[Distutils] string types for paths in PEP 517
Nathaniel Smith
njs at pobox.com
Tue Sep 5 02:33:01 EDT 2017
Hi all,
Quick question about an arcane topic: currently, PEP 517 says that
paths are always represented as unicode strings. For example, when the
frontend calls build_wheel, it has to create a temporary dir to hold
the output wheel, and it passes this in as an absolute path
represented as a unicode string.
In Python 3 I think this is totally fine, because the surrogate-escape
system means that all paths can be represented as unicode strings,
even on systems like Linux where you can have paths that are invalid
according to Python's idea of the filesystem encoding.
In Python 2, if I understand correctly (and I'm not super confident
that I do), then there is no surrogate-escape, and it's possible to
have paths that can't be represented as a unicode object. For example,
if someone's home directory is /home/stéfan in UTF-8 but Python thinks
that the locale is C, and a frontend tries to make a tmpdir in
$HOME/.local/tmp/ and pass it to a backend then... everything blows
up, I guess?
So I guess this is a question for those unfortunate souls who
understand these details better than me (hi Nick!): is this actually a
problem, and is there anything we can/should do differently?
-n
--
Nathaniel J. Smith -- https://vorpus.org
More information about the Distutils-SIG
mailing list