Author: Philip Jenvey <pjen...@underboss.org> Branch: py3.5 Changeset: r90524:28c92faba249 Date: 2017-03-03 20:26 -0800 http://bitbucket.org/pypy/pypy/changeset/28c92faba249/
Log: handle surrogates in filenames diff --git a/pypy/module/_warnings/interp_warnings.py b/pypy/module/_warnings/interp_warnings.py --- a/pypy/module/_warnings/interp_warnings.py +++ b/pypy/module/_warnings/interp_warnings.py @@ -226,14 +226,16 @@ return False def normalize_module(space, w_filename): - filename = space.text_w(w_filename) + # XXX: could be more efficient (doesn't necessarily need + # fsencoding/redecoding) + filename = space.fsencode_w(w_filename) if len(filename) == 0: return space.newtext("<unknown>") if filename.endswith(".py"): n = len(filename) - 3 assert n >= 0 filename = filename[:n] - return space.newtext(filename) + return space.newfilename(filename) return w_filename def show_warning(space, w_filename, lineno, w_text, w_category, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit