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 amaury.forgeotdarc
Recipients amaury.forgeotdarc, r_mosaic
Date 2009-07-22.15:04:17
SpamBayes Score 2.3076765e-09
Marked as misclassified No
Message-id <1248275060.78.0.416323595668.issue6543@psf.upfronthosting.co.za>
In-reply-to
Content
This also happens on a Western Windows (cp437, mbcs==cp1252) with a
filename like "café.py".

The attached patch corrects three problems:

- in compile.c, the c_filename member has utf8 encoding, and must not be
decoded with PyUnicode_DecodeFSDefault. This is the reported issue.

- Same thing in pythonrun.c, if you want "print(__file__)" to work.

- in traceback.c, the content of the file is not shown.


Tested with this script:
=====================================================
print("file name:", __file__)
import traceback
try:
    aaa
except:
    traceback.print_exc()
    raise
=====================================================

The output should be:
=====================================================
file name: c:\temp\café.py
Traceback (most recent call last):
  File "c:\temp\café.py", line 4, in <module>
    aaa
NameError: name 'aaa' is not defined
Traceback (most recent call last):
  File "c:\temp\café.py", line 4, in <module>
    aaa
NameError: name 'aaa' is not defined
=====================================================
History
Date User Action Args
2009-07-22 15:04:21amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, r_mosaic
2009-07-22 15:04:20amaury.forgeotdarcsetmessageid: <1248275060.78.0.416323595668.issue6543@psf.upfronthosting.co.za>
2009-07-22 15:04:19amaury.forgeotdarclinkissue6543 messages
2009-07-22 15:04:19amaury.forgeotdarccreate