Do not crash on unicode filenames

Review Request #1193 - Created Oct. 22, 2014 and submitted

Information
David Turner
pants
d4ef453...
Reviewers
pants-reviews
benjyw, ity, jinfeng, jsirois, peiyu, stuhood

Introduce a new function, safe_walk, which wraps os.path.walk, but
ensures that the returned values are unicode objects. This isn't
strictly safe, in that it is possible that some paths will not be
decodeable, but that case is rare, and the only alternative is to
somehow avoid all interaction between paths and unicode objects, which
seems especially tough in the presence of unicode_literals. See e.g.
https://mail.python.org/pipermail/python-dev/2008-December/083856.html

Note that rbcommons has mangled the filename of the newly added file -- it is in fact testprojects/tests/java/com/pants/testproject/unicode/中文/.gitsave (if you download the diff and apply it, all will be well).

Ran new test.

Issues

  • 0
  • 3
  • 1
  • 4
Description From Last Updated
Jin Feng
Benjy Weinberger
Eric Ayers
David Turner
Benjy Weinberger
Benjy Weinberger
Ity Kaul
David Turner
David Turner
David Turner
Review request changed

Status: Closed (submitted)

Change Summary:

In master at eaa2fc58b2fe66f6635b847f74f16ed5fecc8eec
Loading...