On Wed, Nov 25, 2015 at 1:06 PM, Stefan Behnel <
stef...@behnel.de> wrote:
> Robert Bradshaw schrieb am 25.11.2015 um 20:47:
>> On Wed, Nov 25, 2015 at 9:44 AM, Yury Selivanov wrote:
>>> I'm working on an alternative implementation of asyncio event loop on Cython
>>> and libuv:
https://github.com/1st1/uvloop
>>>
>>> The results so far are extremely promising, I see 2-3.5x performance
>>> improvements in benchmarks:
>>>
https://github.com/python/asyncio/issues/282#issuecomment-155957235
>>>
>>> In uvloop I have to carefully track resources of libuv. It would be nice if
>>> I had a way to define __del__ on a cdef class, so that I can resurrect it in
>>> some occasions -- I need it to follow PEP 442 semantics. This way I can
>>> implement uvloop to behave closer to asyncio.
>>>
>>> Is it possible to add __del__ methods for cdef classes? Perhaps enabled
>>> only with special cython class decorator? Only for Python > 3.4?
>>
>> You should look at __dealloc__.
>
> I don't think __dealloc__ is a good place to try to resurrect an object. It
> might already be unusable at that point (GC cycle breaking, subclass
> cleanups, ...).