[pypy-dev] cpyext performance

Stefan Behnel stefan_ml at behnel.de
Wed Aug 29 22:29:25 CEST 2012

Stefan Behnel, 23.08.2012 11:16:
> Stefan Behnel, 03.07.2012 19:56:
>> Amaury Forgeot d'Arc, 03.07.2012 18:26:
>>> Maybe we should use a weak dictionary to cache the PyObject structure.
>>> This already exists for objects defined and created from C...
>> That would be really helpful. In particular, it would solve one of the most
>> annoying problems that extensions currently have: even if you keep a Python
>> reference to an object, e.g. in a list, its PyObject structure will die
>> once the last C reference to it is gone. That is really hard to work around
>> in some cases. It's very common to keep e.g. a Python list (or set) of byte
>> strings and pass their char* buffer pointers into a C library. That doesn't
>> currently work with cpyext.
> Ok, so where would this have to be done? Is there a way to implement it
> generically in that ubiquitous space.wrap() kind of call (whatever that
> does internally), or would it have to be done explicitly whenever objects
> pass the boundary?

Any comments? I think this would solve a lot of problems.


More information about the pypy-dev mailing list