[pypy-commit] pypy py3k: fix certain bootstrap issues w/ fsdecoding (refs #2300): bootstrap check for
pjenvey
pypy.commits at gmail.com
Sun May 29 12:39:01 EDT 2016
Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r84817:a74ce6610195
Date: 2016-05-29 09:38 -0700
http://bitbucket.org/pypy/pypy/changeset/a74ce6610195/
Log: fix certain bootstrap issues w/ fsdecoding (refs #2300): bootstrap
check for delayed filesystemencoding initialization after
eb02742ce71d
diff --git a/pypy/interpreter/unicodehelper.py b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -67,10 +67,11 @@
uni = runicode.str_decode_utf_8(
bytes, len(bytes), 'surrogateescape',
errorhandler=state.decode_error_handler)[0]
- elif state.codec_need_encodings:
- # bootstrap check: if the filesystem codec is implemented in
- # Python we cannot use it before the codecs are ready. use the
- # locale codec instead
+ elif space.sys.filesystemencoding is None or state.codec_need_encodings:
+ # bootstrap check: if the filesystemencoding isn't initialized
+ # or the filesystem codec is implemented in Python we cannot
+ # use it before the codecs are ready. use the locale codec
+ # instead
from pypy.module._codecs.locale import (
str_decode_locale_surrogateescape)
bytes = space.bytes_w(w_string)
@@ -95,10 +96,11 @@
bytes = runicode.unicode_encode_utf_8(
uni, len(uni), 'surrogateescape',
errorhandler=state.encode_error_handler)
- elif state.codec_need_encodings:
- # bootstrap check: if the filesystem codec is implemented in
- # Python we cannot use it before the codecs are ready. use the
- # locale codec instead
+ elif space.sys.filesystemencoding is None or state.codec_need_encodings:
+ # bootstrap check: if the filesystemencoding isn't initialized
+ # or the filesystem codec is implemented in Python we cannot
+ # use it before the codecs are ready. use the locale codec
+ # instead
from pypy.module._codecs.locale import (
unicode_encode_locale_surrogateescape)
uni = space.unicode_w(w_uni)
More information about the pypy-commit
mailing list