Commit 371d50b5 authored by Kirill Smelkov's avatar Kirill Smelkov

context: Fix thinko/typo in PyContext.__dealloc__

Instead of `pyctx.ctx = nil` it was just `ctx = nil` - i.e. assign nil
to local variable instead of changing pyctx instance data. We were not
observing this bug because Cython, for C++ fields of cdef classes,
automatically emits in-place destructor calls in generated __dealloc__

    https://github.com/cython/cython/blob/0.29.14-11-g8c620c388/Cython/Compiler/ModuleNode.py#L1477-L1478

and so this way there was no leak. However we want to be explicit and the
code was not correct. Fix it.

The bug was there from 2a359791 (context: Move/Port context package to
C++/Pyx nogil).
parent 01ade7ac
......@@ -58,7 +58,7 @@ cdef class PyContext:
raise AssertionError("Context must not be instantiated by user")
def __dealloc__(PyContext pyctx):
ctx = nil
pyctx.ctx = nil
# deadline() returns context deadline or None, if there is no deadline.
def deadline(PyContext pyctx): # -> time | None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment