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: const PyDict_Type ?
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jackjansen Nosy List: anthonybaxter, jackjansen, rhettinger, zooko
Priority: normal Keywords: patch

Created on 2006-03-12 21:53 by zooko, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg49726 - (view) Author: Zooko O'Whielacronx (zooko) Date: 2006-03-12 21:53
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.
msg49727 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2006-03-12 22:50
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 
msg49728 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2006-03-12 23:21
Logged In: YES 
user_id=80475

Zooko, does the code work for you if the tp_base slot is 
set to zero?
msg49729 - (view) Author: Zooko O'Whielacronx (zooko) Date: 2006-03-13 00:50
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.
msg49730 - (view) Author: Zooko O'Whielacronx (zooko) Date: 2006-03-13 11:29
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
msg49731 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2006-04-04 15:13
Logged In: YES 
user_id=29957

Applied the changes as per xxsubtypemodule.c in revision
43634. Cygwin builds now (and is in buildbot). 
History
Date User Action Args
2022-04-11 14:56:15adminsetgithub: 43024
2006-03-12 21:53:23zookocreate