Re: [Python-Dev] r59042 - python/branches/py3k/Modules/xxmodule.c
Brett Cannon wrote:
Can't you do this testing in your own checkout without committing the change until you have talked to python-dev about the idea of changing how all types are initialized?
CC to Python Dev The discussion is about http://svn.python.org/view?rev=59042&view=rev I've carefully studied the docs before I've committed the change. The problem is a well documented compiler issue on Windows. The tp_base slot can't be filled with a type on Windows when the module is compiled with distutils. On Unix the gcc can handle tp_base fine. Since most Python developers are using Linux or Mac OS X and the file isn't covered by a unit test nobody has noticed the problem http://docs.python.org/dev/3.0/extending/newtypes.html#subclassing-other-typ... "When filling out the PyTypeObject() for the Shoddy type, you see a slot for tp_base(). Due to cross platform compiler issues, you can’t fill that field directly with the PyList_Type(); it can be done later in the module’s init() function." I've changed it for two reasons: * The xxmodule.c file is an example and template for developers. It's giving a bad example and it leads to code that doesn't compile on Windows. * I'm working on a very basic unit test to test distutils.core.Extension. I've chosen xxmodule and xxsubtype for the tests. I hope I didn't step over a line with the change. I didn't change the files w/o consulting the documentation first. Christian
On Nov 18, 2007 3:16 PM, Christian Heimes
Brett Cannon wrote:
Can't you do this testing in your own checkout without committing the change until you have talked to python-dev about the idea of changing how all types are initialized?
CC to Python Dev The discussion is about http://svn.python.org/view?rev=59042&view=rev
I've carefully studied the docs before I've committed the change. The problem is a well documented compiler issue on Windows. The tp_base slot can't be filled with a type on Windows when the module is compiled with distutils.
On Unix the gcc can handle tp_base fine. Since most Python developers are using Linux or Mac OS X and the file isn't covered by a unit test nobody has noticed the problem
http://docs.python.org/dev/3.0/extending/newtypes.html#subclassing-other-typ...
"When filling out the PyTypeObject() for the Shoddy type, you see a slot for tp_base(). Due to cross platform compiler issues, you can't fill that field directly with the PyList_Type(); it can be done later in the module's init() function."
If the docs point that fact out then it is fine. I didn't even know about it!
I've changed it for two reasons:
* The xxmodule.c file is an example and template for developers. It's giving a bad example and it leads to code that doesn't compile on Windows.
* I'm working on a very basic unit test to test distutils.core.Extension. I've chosen xxmodule and xxsubtype for the tests.
I hope I didn't step over a line with the change. I didn't change the files w/o consulting the documentation first.
Nope. With the docs specifying that then it makes sense to change the example code. -Brett
Brett Cannon wrote:
If the docs point that fact out then it is fine. I didn't even know about it!
I didn't know it until today, too. I took me some reading why the h... the same code compiles fine on Linux but fails on Windows. :) Christian
participants (2)
-
Brett Cannon
-
Christian Heimes