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

SourceForge.net noreply at sourceforge.net
Tue Apr 4 17:13:38 CEST 2006


Patches item #1448488, was opened at 2006-03-13 08:53
Message generated for change (Comment added) made by anthonybaxter
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: Closed
>Resolution: Fixed
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: Anthony Baxter (anthonybaxter)
Date: 2006-04-05 01:13

Message:
Logged In: YES 
user_id=29957

Applied the changes as per xxsubtypemodule.c in revision
43634. Cygwin builds now (and is in buildbot). 


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

Comment By: Zooko O'Whielacronx (zooko)
Date: 2006-03-13 22:29

Message:
Logged In: YES 
user_id=52562

Here is the result of make test after setting the tp_base
slot to 0.

266 tests OK.
3 tests failed:
    test_mmap test_platform test_time
40 tests skipped:
    test_aepack test_al test_applesingle test_bsddb
test_bsddb185
    test_bsddb3 test_cd test_cl test_codecmaps_cn
test_codecmaps_hk
    test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw
test_ctypes
    test_curses test_dbm test_gl test_hashlib_speed test_imgfile
    test_ioctl test_linuxaudiodev test_locale test_macfs
    test_macostools test_nis test_normalization test_ossaudiodev
    test_pep277 test_plistlib test_scriptpackages
test_socket_ssl
    test_socketserver test_sunaudiodev test_tcl test_timeout
    test_unicode_file test_urllib2net test_urllibnet test_winreg
    test_winsound
3 skips unexpected on cygwin:
    test_tcl test_ctypes test_bsddb


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

Comment By: Zooko O'Whielacronx (zooko)
Date: 2006-03-13 11: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-13 10: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-13 09: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