Message90815
| 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:21 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, r_mosaic |
| 2009年07月22日 15:04:20 | amaury.forgeotdarc | set | messageid: <1248275060.78.0.416323595668.issue6543@psf.upfronthosting.co.za> |
| 2009年07月22日 15:04:19 | amaury.forgeotdarc | link | issue6543 messages |
| 2009年07月22日 15:04:19 | amaury.forgeotdarc | create |
|