A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-April/088036.html below:

[Python-Dev] Let's update CObject API so it is safe and regular!

[Python-Dev] Let's update CObject API so it is safe and regular!Larry Hastings larry at hastings.org
Wed Apr 1 20:58:00 CEST 2009
Kristján Valur Jónsson wrote:
> What are the semantics of the "type" argument for PyCObject_FromVoidPtr()?
>   

 From the patch, from the documentation comment above the prototype for 
PyCObject_FromVoidPtr() in Include/cobject.h:

    The "type" string must point to a legal C string of non-zero length,


> -Does it do a strdup, or is the type required to be valid while the object exists (e.g. a static string)?
>   

 From the patch, continuing on from where we just left off:

    and this string must outlive the CObject.


> -How is the type match determined, strcmp, or pointer comparison?

 From the patch, observing the code in the static function 
_is_legal_cobject_and_type() in Objects/cobject.c:

        if (!type || !*type) {
            PyErr_SetString(PyExc_TypeError, invalidType);
            return 0;
        }
        if (strcmp(type, self->type)) {
            PyErr_SetString(PyExc_TypeError, incorrectType);
            return 0;
        }


A method for answering further such questions suggests itself,


/larry//
/
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4