This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: compile error in _fileio.c (cygwin)
Type: Stage:
Components: Build Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, ocean-city
Priority: normal Keywords: easy, patch

Created on 2008-09-23 13:41 by ocean-city, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
_fileio.patch ocean-city, 2008-09-23 13:41
_fileio.patch ocean-city, 2008-09-23 15:26 version2
Messages (5)
msg73639 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-23 13:41
Currently, fails to build trunk on cygwin.

gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -I. -
I/home/WhiteRabbit/python-dev/trunk/./Include -I. -IInclude -I./Include
-I/home/
WhiteRabbit/python-dev/trunk/Include
-I/home/WhiteRabbit/python-dev/trunk -c /ho
me/WhiteRabbit/python-dev/trunk/Modules/_fileio.c -o
build/temp.cygwin-1.5.25-i6
86-2.6/home/WhiteRabbit/python-dev/trunk/Modules/_fileio.o
/home/WhiteRabbit/python-dev/trunk/Modules/_fileio.c:834: error:
initializer ele
ment is not constant
/home/WhiteRabbit/python-dev/trunk/Modules/_fileio.c:834: error: (near
initializ
ation for `PyFileIO_Type.ob_type')


To fix this, attached patch is needed. Or, like py3k, using following
Py_???_HEAD_INIT (surrounded with bracket) might fix this issue in trunk.

#define PyObject_HEAD_INIT(type)	\
	{ _PyObject_EXTRA_INIT		\
	1, type },

#define PyVarObject_HEAD_INIT(type, size)	\
	{ PyObject_HEAD_INIT(type) size },
msg73643 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-09-23 15:10
The patch is OK, even if the second half is not necessary:
PyType_Ready() takes care of the ob_type field.

Adding brackets in the macro would be wrong: the object layout is
different between 2.6 and 3.0.
3.0 does not have this problem because _fileio.c is built-in and linked
with the core interpreter (2.6 leaves it in an extension module).
msg73645 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-23 15:26
>The patch is OK, even if the second half is not necessary:
>PyType_Ready() takes care of the ob_type field.

Oh, OK.

>Adding brackets in the macro would be wrong: the object layout is
>different between 2.6 and 3.0.

I Undarstand.

How about the attached patch?
msg73646 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-09-23 15:30
OK, please apply!
msg73647 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-09-23 16:12
Thanks, fixed in r66566(trunk).
History
Date User Action Args
2022-04-11 14:56:39adminsetgithub: 48195
2008-09-23 16:12:07ocean-citysetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg73647
2008-09-23 15:30:03amaury.forgeotdarcsetkeywords: - needs review
resolution: accepted
messages: + msg73646
2008-09-23 15:26:42ocean-citysetfiles: + _fileio.patch
messages: + msg73645
2008-09-23 15:10:14amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg73643
2008-09-23 13:41:36ocean-citycreate