Message115437
I just noticed that the previous "new" patch I uploaded was actually my original patch. Oops. Anyway...
In a discussion on the capi list, a few people objected to compiling in Unicode-agnostic mode by default (e.g., it would be annoying for Cython). Attached is a new patch that compiles in Unicode-agnostic mode only when Py_UNICODE_AGNOSTIC is defined (and brings the patch up to date with other changes to the py3k branch).
It includes automated tests, and I have tested UCS2 Linux, UCS4 Linux, and Windows builds.
After the patch, trying to import a module with a mismatched Unicode setting looks like this:
>>> import _testunicodemismatched
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: module's Unicode representation does not match the interpreter's
Here's a birds-eye view of the patch:
moduleobject.h: Add a flags field to PyModuleDef_Base
moduleobject.c: Detect import with mismatched Unicode setting
pyunicode.h: New file; non-agnostic code from unicodeobject.h moved here
unicodeobject.h: Deleted ~150 lines of #defines (yay!)
Everything else: tests
I'm pretty happy with the patch. In the earlier discussion here, there was generally positive feedback for the overall idea. Someone want to do a patch review? |
|
Date |
User |
Action |
Args |
2010-09-03 11:05:25 | stutzbach | set | recipients:
+ stutzbach, lemburg, gvanrossum, loewis, zooko, scoder, vstinner, Arfrever, r.david.murray |
2010-09-03 11:05:25 | stutzbach | set | messageid: <1283511925.66.0.0891042754262.issue8654@psf.upfronthosting.co.za> |
2010-09-03 11:05:24 | stutzbach | link | issue8654 messages |
2010-09-03 11:05:23 | stutzbach | create | |
|