Ronald Oussoren <ronaldousso...@mac.com> added the comment:

Eddie,

I have read the thread and still don't see why breaking existing code is a good 
thing to do.

As I wrote earlier there are two issues you're trying to address with one patch:

1) Not all types in the CPython tree are initialised using PyType_Ready

Fixing that is ok and the patch for that looks ok. But: I haven't checked if 
PyType_Ready is called before types are used, if the call to PyType_Ready is 
done after the type is already implicitly readied the call to PyType_Ready is 
purely cosmetic.

2) Using PyVarObject_HEAD_INIT(&some_type, ...) causes problems on Windows

I don't agree with the current patch for that because that *silently* changes 
the semantics of existing code, and hence can break existing C extensions. 

I haven't tested the patch yet, but I do have C extensions that use this 
pattern and where "&some_type" is not equivalent to NULL.

The correct change for the CPython tree is to change all instances of 
PyVarObject_HEAD_INIT(&some_type, ...) to PyVarObject_HEAD_INIT(NULL, ...), and 
then add explicit code to set the type of the type instance where "some_type" 
is not PyType_Type (AFAIK there aren't any of those in the CPython tree, but 
there are outside of CPython).


Another reason why changing PyVarObject_HEAD_INIT is not correct is that this 
can be used to initialize more than just PyTypeObject structs, as the name 
suggests it is used to initialize PyVarObject values and not just PyTypeObject 
values. Changing the macro also breaks those.

----------

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

Reply via email to