[issue1272] Decode __file__ and co_filename to unicode using fs default

Alexandre Vassalotti report at bugs.python.org
Sun Oct 14 03:32:10 CEST 2007

Alexandre Vassalotti added the comment:

Guido wrote:
> I figured out the problem -- it came from marshalled old code objects. 
> If you throw away all .pyc files the problem goes away.  You can also
> get rid of the similar checks for the 'name' argument -- this should
> just be a PyUnicode too.  A systematic approach to invalidating all the
> .pyc files is updating the magic number in import.c.


I had to remove a few another PyString instances in pyexpat.c and
_ctypes.c. So, here (hopefully) the final version of the patch. 

The changes from the last version are:

   - Correct a typo in of the comments in PyUnicode_DecodeFSDefault
   - Specified in the API doc of PyUnicode_DecodeFSDefault that the
     function take a null-terminated string.
   - Bumped the magic number in import.c
   - Fix PyCode_New calls in _ctypes and pyexpat module.
   - Remove the PyString type check on 'filename' and 'name' in PyCode_New.
   - Remove the unneeded string coercion code from PyCode_New.

Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: updated_file_fsenc-2.patch
Type: text/x-patch
Size: 11018 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-bugs-list/attachments/20071014/b9acf7f1/attachment.bin 

More information about the Python-bugs-list mailing list