Martin v. Löwis wrote:
Paul Watson wrote:
It appears that _ALL_SOURCE gets defined in the
/usr/include/standards.h file. If we could #define _ANSI_C_SOURCE or
_POSIX_SOURCE, it appears that it would eleminate _ALL_SOURCE.
Ah, ok - this should be easy enough. Python would normally define
_POSIX_SOURCE (through _XOPEN_SOURCE), but configure(.in) has this
block:
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE ==
500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not
defined
# or has another value. By not (re)defining it, the defaults come in
place.
AIX/4)
define_xopen_so urce=no;;
AIX/5)
if test `uname -r` -eq 1; then
define_xopen_so urce=no
fi
;;
which causes _XOPEN_SOURCE (and subsequently probably _POSIX_SOURCE) not
to be defined. What AIX version are you using? Can you try removing
the fragment from configure(.in), rerun configure, verify that
_XOPEN_SOURCE is defined in pyconfig.h, and then try building again?
If this works, this might be a solution. Otherwise, we need to put
something like this into _codecs_cn.c:
#ifdef hz
/* On AIX version such-and-such, hz is defined because _ALL_SOURCE is
defined, this in turn is defined because _XOPEN_SOURCE is not.
As _XOPEN_SOURCE cannot be enabled (see configure.in), we just
work around by removing the hz definition again. */
#undef hz
#endif
Regards,
Martin
Commenting out the section in configure(.in) did not cause it to work.
It still ended up with '100_encode' complaint.
Using '#undef hz' in ./Modules/cjkcodecs/_codecs_cn.c does cause it to
compile. However, it will not pass ./Lib/test/test_codecsenco ding_cn.py
or ./Lib/test/test_codecmaps_ cn.py. The others (_hk, _jp, _kr, and _tw)
do pass the test.
I also note that compiles occurring after the complaint about not
finding Tcl/Tk do not appear to get the OPT= setting I specified on the
'make' command line. It starts with compilation of structmodule.c and
includes the _codecs_??.c files. Does this have any significance? Is
it possible that there are other settings not being used?
$ python test_codecencod ings_cn.py
test_chunkcodin g (__main__.Test_ GB2312) ... ERROR
test_customrepl ace (__main__.Test_ GB2312) ... ERROR
test_errorhandl e (__main__.Test_ GB2312) ... ERROR
test_streamread er (__main__.Test_ GB2312) ... ERROR
test_streamwrit er (__main__.Test_ GB2312) ... ERROR
test_xmlcharref replace (__main__.Test_ GB2312) ... ERROR
test_chunkcodin g (__main__.Test_ GBK) ... ERROR
test_customrepl ace (__main__.Test_ GBK) ... ERROR
test_errorhandl e (__main__.Test_ GBK) ... ERROR
test_streamread er (__main__.Test_ GBK) ... ERROR
test_streamwrit er (__main__.Test_ GBK) ... ERROR
test_xmlcharref replace (__main__.Test_ GBK) ... ERROR
test_chunkcodin g (__main__.Test_ GB18030) ... ERROR
test_customrepl ace (__main__.Test_ GB18030) ... ERROR
test_errorhandl e (__main__.Test_ GB18030) ... ERROR
test_streamread er (__main__.Test_ GB18030) ... ERROR
test_streamwrit er (__main__.Test_ GB18030) ... ERROR
test_xmlcharref replace (__main__.Test_ GB18030) ... ERROR
=============== =============== =============== =============== ==========
ERROR: test_chunkcodin g (__main__.Test_ GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb2312
=============== =============== =============== =============== ==========
ERROR: test_customrepl ace (__main__.Test_ GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb2312
=============== =============== =============== =============== ==========
ERROR: test_errorhandl e (__main__.Test_ GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb2312
=============== =============== =============== =============== ==========
ERROR: test_streamread er (__main__.Test_ GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb2312
=============== =============== =============== =============== ==========
ERROR: test_streamwrit er (__main__.Test_ GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb2312
=============== =============== =============== =============== ==========
ERROR: test_xmlcharref replace (__main__.Test_ GB2312)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb2312
=============== =============== =============== =============== ==========
ERROR: test_chunkcodin g (__main__.Test_ GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gbk
=============== =============== =============== =============== ==========
ERROR: test_customrepl ace (__main__.Test_ GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gbk
=============== =============== =============== =============== ==========
ERROR: test_errorhandl e (__main__.Test_ GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gbk
=============== =============== =============== =============== ==========
ERROR: test_streamread er (__main__.Test_ GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gbk
=============== =============== =============== =============== ==========
ERROR: test_streamwrit er (__main__.Test_ GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gbk
=============== =============== =============== =============== ==========
ERROR: test_xmlcharref replace (__main__.Test_ GBK)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gbk
=============== =============== =============== =============== ==========
ERROR: test_chunkcodin g (__main__.Test_ GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb18030
=============== =============== =============== =============== ==========
ERROR: test_customrepl ace (__main__.Test_ GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb18030
=============== =============== =============== =============== ==========
ERROR: test_errorhandl e (__main__.Test_ GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb18030
=============== =============== =============== =============== ==========
ERROR: test_streamread er (__main__.Test_ GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb18030
=============== =============== =============== =============== ==========
ERROR: test_streamwrit er (__main__.Test_ GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb18030
=============== =============== =============== =============== ==========
ERROR: test_xmlcharref replace (__main__.Test_ GB18030)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/pwatson/usr/lib/python2.4/test/test_multibytec odec_support.py ",
line 27, in setUp
self.codec = codecs.lookup(s elf.encoding)
LookupError: unknown encoding: gb18030
----------------------------------------------------------------------
Ran 18 tests in 0.015s
FAILED (errors=18)
Traceback (most recent call last):
File "test_codecenco dings_cn.py", line 60, in ?
test_main()
File "test_codecenco dings_cn.py", line 57, in test_main
test_support.ru n_suite(suite)
File "/home/pwatson/usr/lib/python2.4/test/test_support.py ", line
274, in run_suite
raise TestFailed(msg)
test.test_suppo rt.TestFailed: errors occurred; run in verbose mode for
details
10:38 pwatson [ kbs80:/home/pwatson/src/python/Python-2.4.2/Lib/test ] 672
$ python test_codecencod ings_hk.py
test_chunkcodin g (__main__.Test_ Big5HKSCS) ... ok
test_customrepl ace (__main__.Test_ Big5HKSCS) ... ok
test_errorhandl e (__main__.Test_ Big5HKSCS) ... ok
test_streamread er (__main__.Test_ Big5HKSCS) ... ok
test_streamwrit er (__main__.Test_ Big5HKSCS) ... ok
test_xmlcharref replace (__main__.Test_ Big5HKSCS) ... ok
----------------------------------------------------------------------
Ran 6 tests in 0.063s
OK