Message91427
This addresses missing statements for recognizing the Mingw compiler in
pyport.h, needed to build several extension modules on Windows using
Mingw. I will first explain the background, then indicate what needs to
be changed and end with some pointers to "related work".
Pyport.h of Python 2.5 and 2.6 (I do not have other versions to check)
addresses an issue with Cygwin's gcc by preventing the declaration of
"__declspec(dllimport)" for function definitions (using the PyAPI_FUNC
(RTYPE) makro), relying on the compiler's auto-import definition
instead, because the compiler would not otherwise throw an "initializer
element is not constant" error when using e.g. PyObject_GenericGetAttr
in a PyTypeObject declaration of a C/C++ extension module (more
generally, whenever an imported Python API function is used as a
constant).
Python 2.6.2 (r262:71605) and Python 2.5.4 (r254:67916) do not check
for the Mingw compiler in pyport.h, although Mingw behaves the same as
the Cygwin version, at least regarding the "__declspec" declaration.
To fix that, each check for __CYGWIN__ in pyport.h should also check
for __MINGW32___ to behave the same way. svn.python.org currently does
not reply, so I can not create a patch against the trunk nor check
whether this issue has already been addressed.
Issue 5046 included a patch to pyport.h fixing this, but it has been
rejected due to other suggested changes that were not mature.
http://recipes.gobolinux.org/r/?list=Python&ver=3.1-
r1&file=arm/20061116160247-
bf48b-7db78fe2f80b3137ce349cf4314364768555ff50.gz.diff suggests the
same change.
http://www.indashpc.org/vbullettin/viewtopic.php?p=5003#5003 gives some
more background information on how I found and fixed the problem.
An internet search for "python initializer element is not constant"
shows that numerous people have been encountering this problem when
trying to build a python extension module. |
|
Date |
User |
Action |
Args |
2009-08-09 12:24:50 | f0k | set | recipients:
+ f0k |
2009-08-09 12:24:50 | f0k | set | messageid: <1249820690.51.0.767085753138.issue6672@psf.upfronthosting.co.za> |
2009-08-09 12:24:49 | f0k | link | issue6672 messages |
2009-08-09 12:24:48 | f0k | create | |
|