Author: Manuel Jacob <m...@manueljacob.de> Branch: py3.3 Changeset: r79130:25989b3230e5 Date: 2015-08-22 03:06 +0200 http://bitbucket.org/pypy/pypy/changeset/25989b3230e5/
Log: Avoid import in app_main.py before stdio is initialized. If the interpreter is run with the '-v' option specified, the import machinery prints messages to sys.stderr. This commit removes two imports before stdio initialization, which resulted in an AttributeError because of this. The imports were there to avoid issues during bootstrapping, which I did not yet run into after removing the imports. diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -266,16 +266,7 @@ if hasattr(sys, 'stdin'): return # already initialized - # Hack to avoid recursion issues during bootstrapping: pre-import - # the utf-8 and latin-1 codecs - encerr = None - try: - import encodings.utf_8 - import encodings.latin_1 - except ImportError as e: - encerr = e - - try: + if 1: # keep indentation if encoding and ':' in encoding: encoding, errors = encoding.split(':', 1) else: @@ -294,10 +285,6 @@ print("Python error: <stdin> is a directory, cannot continue", file=sys.stderr) os._exit(1) - finally: - if encerr: - display_exception(encerr) - del encerr def create_stdio(fd, writing, name, encoding, errors, unbuffered): import io _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit