[pypy-svn] pypy default: make sure not to run _setup twice, else we might get infinite recursion between raw_input and _old_raw_input

antocuni commits-noreply at bitbucket.org
Wed Mar 30 15:26:12 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r43016:71e57acf2ca9
Date: 2011-03-30 15:24 +0200
http://bitbucket.org/pypy/pypy/changeset/71e57acf2ca9/

Log:	make sure not to run _setup twice, else we might get infinite
	recursion between raw_input and _old_raw_input

diff --git a/lib_pypy/pyrepl/readline.py b/lib_pypy/pyrepl/readline.py
--- a/lib_pypy/pyrepl/readline.py
+++ b/lib_pypy/pyrepl/readline.py
@@ -381,6 +381,9 @@
 
 def _setup():
     global _old_raw_input
+    if _old_raw_input is not None:
+        return # don't run _setup twice
+    
     try:
         f_in = sys.stdin.fileno()
         f_out = sys.stdout.fileno()
@@ -401,4 +404,5 @@
         _old_raw_input = __builtin__.raw_input
         __builtin__.raw_input = _wrapper.raw_input
 
+_old_raw_input = None
 _setup()


More information about the Pypy-commit mailing list