[Python-Dev] r59042 - python/branches/py3k/Modules/xxmodule.c

Christian Heimes lists at cheimes.de
Mon Nov 19 00:16:25 CET 2007


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-types

"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


More information about the Python-Dev mailing list