Message80514
The peephole optimizer can optimize indexed access to an unicode
constant which does not give the same result in UCS-2 and UCS-4 builds.
As a result, the pyc file is not portable across those builds.
This is something I witnessed when recompiling in UCS-2 rather than
UCS-4 mode, and having a strange failure in test_multibytecodec. Erasing
test_multibytecodec.pyc suppressed the failure.
Here is a small demonstration of the problem:
>>> def f():
... return '\U00012345'[0]
...
>>> import dis
>>> dis.dis(f)
2 0 LOAD_CONST 3 ('\ud808')
3 RETURN_VALUE
For reference, here is the error I had in test_multibytecodec:
======================================================================
FAIL: test_gb18030 (test.test_multibytecodec.Test_StreamWriter)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/antoine/py3k/__svn__/Lib/test/test_multibytecodec.py",
line 185, in test_gb18030
self.assertEqual(s.getvalue(), b'123\x907\x959')
AssertionError: b'123\x907\x959\x907\x959' != b'123\x907\x959'
---------------------------------------------------------------------- |
|
Date |
User |
Action |
Args |
2009-01-25 16:16:12 | pitrou | set | recipients:
+ pitrou, rhettinger |
2009-01-25 16:16:12 | pitrou | set | messageid: <1232900172.29.0.659028766072.issue5057@psf.upfronthosting.co.za> |
2009-01-25 16:16:11 | pitrou | link | issue5057 messages |
2009-01-25 16:16:10 | pitrou | create | |
|