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.

classification
Title: compileall doesn't support PEP 383 (undecodable paths/filenames)
Type: behavior Stage: patch review
Components: Library (Lib), Unicode Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, python-dev, r.david.murray, vstinner
Priority: normal Keywords: patch

Created on 2011-02-10 12:38 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
compileall_surrogates.patch vstinner, 2011-02-10 12:38
Messages (4)
msg128288 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-02-10 12:38
The compileall uses print("bla", filename, "bla") to write messages to the console. But the print fails if the filename cannot be encoded to the console encoding. It occurs if the filename is an undecodable filename encoded by the PEP 383 using surrogates. For example, UTF-8 cannot encode surrogates.

Attached patch uses repr() to escape surrogates: it adds also quotes to the filename. I don't know if it is a problem to add quotes. I prefer quotes, but it is more readable if the path or the filename contain spaces.
msg128421 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-02-11 18:51
I agree that quotes help debugging, so +1 for repr (or !r, not sure which ones reads better).  Not sure this can make it into stable branches.
msg128994 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-02-21 20:58
Fixed by r88478.

> Not sure this can make it into stable branches.

I agree, I prefer to not touch stable releases.
msg135753 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-05-10 22:38
New changeset 85cfbbc7da60 by Victor Stinner in branch '3.2':
Issue #11169: compileall module uses repr() to format filenames and paths to
http://hg.python.org/cpython/rev/85cfbbc7da60
History
Date User Action Args
2022-04-11 14:57:12adminsetgithub: 55378
2011-05-10 22:38:44python-devsetnosy: + python-dev
messages: + msg135753
2011-02-21 20:58:50vstinnersetstatus: open -> closed

messages: + msg128994
resolution: fixed
nosy: vstinner, eric.araujo, r.david.murray
2011-02-11 18:51:10eric.araujosetnosy: + eric.araujo

messages: + msg128421
title: compileall doesn't support the PEP 383 (undecodable paths/filenames) -> compileall doesn't support PEP 383 (undecodable paths/filenames)
2011-02-10 21:51:11pitrousetnosy: + r.david.murray

type: behavior
components: + Library (Lib)
stage: patch review
2011-02-10 12:38:42vstinnercreate