[C++-sig] Re: Re: Retiring "ref", etc.
daveh at cadlink.com
Wed Jun 12 03:21:43 CEST 2002
"David Abrahams" <david.abrahams at rcn.com> wrote in message
news:006f01c2119f$4c95c070$6501a8c0 at boostconsulting.com...
> From: "Dave Hawkes" <daveh at cadlink.com>
> > Another awkward twist is that some of the python API functions accept a
> > PyObject* as a valid parameter.
> Not according to Guido:
But from the python 2.2 manual, PyObject_Dir, for example, can take a NULL
pointer as a valid argument. Also note that this function can in some
circumstance return a NULL result without setting PyErr_Occured. This is not
a unique function as I have spotted one or two others with similar
> > Which implies a 'NULL' reference should be
> > allowed which is not symantically an error condition. However I don't
> > there any functions that can return a valid NULL apart from some of the
> > MACRO versions with no error checking.
> > I don't think it is unreasonable to construct a new smart pointer that
> > a NULL pointer as it currently does.
> > However for return values may be we should have a different smart
> > called something like result_reference. We can then allow conversions
> > between the two that would check if result_reference was valid, before
> > converting to a regular reference.
> I'm thinking that return values of Python API wrappers should always
> "object", which has a builtin check for null that throws.
Then how are functions like PyObject_Dir handled if you can't have a valid
More information about the Cplusplus-sig