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.

Author alexandre.vassalotti
Recipients alexandre.vassalotti, christian.heimes, gvanrossum
Date 2007-10-14.04:34:59
SpamBayes Score 0.013213555
Marked as misclassified No
Message-id <1192336506.88.0.448378594514.issue1272@psf.upfronthosting.co.za>
In-reply-to
Content
Christian wrote:
> Alexandre's mangle loop doesn't do the same job as mine. Chars like _
> and - aren't removed from the encoding name and the if clauses don't
> catch for example UTF-8 or ISO-8859-1 only UTF8 or ISO8859-1. 

That isn't true. My mangler does exactly the same thing as your
original one.

However, I forgot to add Py_CHARMASK to the calls of tolower() and
isalnum() which would cause problems on platforms with signed char.

> Also he has overseen a PyString_Check in the code repr function.

Fixed.

> We have to get the codecs up and Py_FileSystemEncoding before we can
> decode the filenames. :( I think that the problem needs much more
> attention and a proper fix.

Maybe adding a global variable, let's say _Py_Codecs_Ready, could be
used to notify PyUnicode_DecodeFSDefault that it can use
PyUnicode_Decode, instead of relying only on the built-in codecs. That
would be much simpler than changing boostrapping process.

Here yet another updated patch. The changes are the following:

   - Add Py_CHARMASK to tolower() and isalnum() calls in
     PyUnicode_DecodeFSDefault().
   - Use PyUnicode_Check(), instead of PyString_Check(), in
     code_repr().
   - Update comments for co_filename and co_name in PyCodeObject
     struct definition.
   - Fix a PyString_AS_STRING(co->co_name) instance in compile.c
   - Replace %S for %U in PyErr_Format() calls for substituting co_name.

One more thing, frozen.c needs to be updated. The module data contains
a code object with a PyString co_name. However, there is a bug in the
imp module (it doesn't detect the encoding from modelines, which cause
io.TextIOWrapper to crash) that prevents me from generating the data
for frozen.c.
Files
File name Uploaded
updated_file_fsenc-4.patch alexandre.vassalotti, 2007-10-14.04:35:03
History
Date User Action Args
2007-10-14 04:35:08alexandre.vassalottisetspambayes_score: 0.0132136 -> 0.013213555
recipients: + alexandre.vassalotti, gvanrossum, christian.heimes
2007-10-14 04:35:06alexandre.vassalottisetspambayes_score: 0.0132136 -> 0.0132136
messageid: <1192336506.88.0.448378594514.issue1272@psf.upfronthosting.co.za>
2007-10-14 04:35:06alexandre.vassalottilinkissue1272 messages
2007-10-14 04:35:04alexandre.vassalotticreate