Robin Schreiber added the comment:

Regarding the macro definition, I would be fine with changing it to 
_hashlib_state.

The dance you have found inside the Init, makes shure that the very same module 
is returned if Init is called twice or multiple times, before the Module is 
unloaded. A month back, when I created this patch, I had statements such as 
test.import.import_fresh_module(...) call the Init-method multiple times, 
before a module was unloaded. This was apparently a bug, as I can no longer 
reproduce this behavior, but at that time I thought it was the expected 
behavior :-)

The last code snipped verifies, that we only dereference the type if the 
dealloc function is not being called from inside the subtype_dealloc function. 
This is necessary because the subtype_dealloc function itself contains a decref 
of the respective type object. Without this check, we would then end up 
decrefing the type too many times.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15653>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to