[issue38006] Crash in remove() weak reference callback of weakref.WeakValueDictionary at Python exit

Petr Viktorin report at bugs.python.org
Mon Sep 2 08:55:34 EDT 2019


Petr Viktorin <encukou at gmail.com> added the comment:

I'm not sure adding a check would solve this. What should be done when a function with func_code=NULL is called? "Silently do nothing" is not really an option; raising an exception wouldn't help much in this case.

I wonder if a function's tp_clear we should clear the mutable parts (like func_closure) before the immutable ones (func_code).
Any access to the immutable ones should have checks (and probably raise exceptions if those are NULL).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38006>
_______________________________________


More information about the Python-bugs-list mailing list