New submission from Jan Schlüter <python-b...@jan-schlueter.de>: 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. ---------- components: Build messages: 91427 nosy: f0k severity: normal status: open title: Add Mingw recognition to pyport.h to allow building extensions versions: Python 2.5, Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6672> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com