[Patches] [ python-Patches-1448488 ] const PyDict_Type ?

SourceForge.net noreply at sourceforge.net
Mon Mar 13 01:50:59 CET 2006


Patches item #1448488, was opened at 2006-03-12 21:53
Message generated for change (Comment added) made by zooko
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1448488&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Zooko O'Whielacronx (zooko)
Assigned to: Jack Jansen (jackjansen)
Summary: const PyDict_Type ?

Initial Comment:
When I try to compile SVN trunk, plus my recent
declspecs-for-ssize_t patch, I get this error from
Cygwin gcc 3.4.4:

building 'collections' extension
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -I.
-I/cygdrive/c/playground/python/trunk/./Include
-I./Include -I.
-I/cygdrive/c/playground/python/trunk/Include
 -I/cygdrive/c/playground/python/trunk -c
/cygdrive/c/playground/python/trunk/Modules/collectionsmodule.c
-o build/temp.cygwin-1.5.19-i686-2.5/collectionsmodule.o
/cygdrive/c/playground/python/trunk/Modules/collectionsmodule.c:1314:
error: initializer element is not constant
/cygdrive/c/playground/python/trunk/Modules/collectionsmodule.c:1314:
error: (near initialization for `defdict_type.tp_base')


This is with this version of gcc:

$ gcc --version
gcc (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd
0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.


So, with much uncertainty, I applied the attached patch
that makes PyDict_Type be const.  The whole thing then
compiles fine (if you disregard one million warnings
about discarding qualifiers from pointer target type),
but the resulting python.exe segfaults on startup.


----------------------------------------------------------------------

>Comment By: Zooko O'Whielacronx (zooko)
Date: 2006-03-13 00:50

Message:
Logged In: YES 
user_id=52562

The tp_base slot is zero then compilation finishes normally,
and the resulting python.exe starts normally instead of
segfaulting.  Now running make test and I will report back
if it fails.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2006-03-12 23:21

Message:
Logged In: YES 
user_id=80475

Zooko, does the code work for you if the tp_base slot is 
set to zero?

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2006-03-12 22:50

Message:
Logged In: YES 
user_id=80475

Cygwin seems to be somewhat sensitive to how subtypes are 
initialized in extensions.  

The collections.defaultdict PyTypeObject structure may 
need to be modified to comform to the example in lines 106 
and 137 in xxsubtypes.c 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1448488&group_id=5470


More information about the Patches mailing list