[Python-3000] infinite recursion with python -v

Neal Norwitz nnorwitz at gmail.com
Wed Aug 8 07:57:32 CEST 2007


The wiki seems to be done, so sorry for the spam.

python -v crashes due to infinite recursion (well, it tried to be
infinite until it got a stack overflow :-)  The problem seems to be
that Lib/encodings/latin_1.py is loaded, but it tries to be converted
to latin_1, so it tries to load the module, and ...  Or something like
that.  See below for a call stack.

Minimal version:

PyFile_WriteString (s= "# Lib/encodings/latin_1.pyc matches
Lib/encodings/latin_1.py\n", f=) at Objects/fileobject.c:184
mywrite (name= "stderr", fp=, format= "# %s matches %s\n", va=) at
Python/sysmodule.c:1350
PySys_WriteStderr (format= "# %s matches %s\n") at Python/sysmodule.c:1380
check_compiled_module (pathname= "Lib/encodings/latin_1.py", mtime=,
cpathname= "Lib/encodings/latin_1.pyc") at Python/import.c:755
load_source_module (name= "encodings.latin_1", pathname=
"Lib/encodings/latin_1.py", fp=) at Python/import.c:938
load_module (name= "encodings.latin_1", fp=,buf=
"Lib/encodings/latin_1.py", type=1, loader=) at Python/import.c:1733
import_submodule (mod=, subname= "latin_1",fullname=
"encodings.latin_1") at Python/import.c:2418
load_next (mod=,altmod=, p_name=,buf= "encodings.latin_1", p_buflen=)
at Python/import.c:2213
import_module_level (name=, globals=, locals=, fromlist=, level=0) at
Python/import.c:1992
PyImport_ImportModuleLevel (name= "encodings.latin_1", globals=,
locals=, fromlist=, level=0) at Python/import.c:2056
builtin___import__ () at Python/bltinmodule.c:151
[...]
_PyCodec_Lookup (encoding= "latin-1") at Python/codecs.c:147
codec_getitem (encoding= "latin-1",index=0) at Python/codecs.c:211
PyCodec_Encoder (encoding= "latin-1") at Python/codecs.c:275
PyCodec_Encode (object=,encoding= "latin-1", errors=) at Python/codecs.c:322
PyString_AsEncodedObject (str=,encoding= "latin-1", errors=) at
Objects/stringobject.c:459
string_encode () at Objects/stringobject.c:3138
[...]
PyFile_WriteObject (v=, f=, flags=1) at Objects/fileobject.c:159
PyFile_WriteString (s= "# Lib/encodings/latin_1.pyc matches
Lib/encodings/latin_1.py\n",f=) at Objects/fileobject.c:184

== Stack trace for python -v recursion (argument values are mostly trimmed) ==

PyFile_WriteString (s= "# Lib/encodings/latin_1.pyc matches
Lib/encodings/latin_1.py\n", f=) at Objects/fileobject.c:184
mywrite (name= "stderr", fp=, format= "# %s matches %s\n", va=) at
Python/sysmodule.c:1350
PySys_WriteStderr (format= "# %s matches %s\n") at Python/sysmodule.c:1380
check_compiled_module (pathname= "Lib/encodings/latin_1.py", mtime=,
cpathname= "Lib/encodings/latin_1.pyc") at Python/import.c:755
load_source_module (name= "encodings.latin_1", pathname=
"Lib/encodings/latin_1.py", fp=) at Python/import.c:938
load_module (name= "encodings.latin_1", fp=,buf=
"Lib/encodings/latin_1.py", type=1, loader=) at Python/import.c:1733
import_submodule (mod=, subname= "latin_1",fullname=
"encodings.latin_1") at Python/import.c:2418
load_next (mod=,altmod=, p_name=,buf= "encodings.latin_1", p_buflen=)
at Python/import.c:2213
import_module_level (name=, globals=, locals=, fromlist=, level=0) at
Python/import.c:1992
PyImport_ImportModuleLevel (name= "encodings.latin_1", globals=,
locals=, fromlist=, level=0) at Python/import.c:2056
builtin___import__ () at Python/bltinmodule.c:151
PyCFunction_Call () at Objects/methodobject.c:77
PyObject_Call () at Objects/abstract.c:1736
do_call () at Python/ceval.c:3764
call_function (pp_stack=, oparg=513) at Python/ceval.c:3574
PyEval_EvalFrameEx (f=, throwflag=0) at Python/ceval.c:2216
PyEval_EvalCodeEx () at Python/ceval.c:2835
function_call () at Objects/funcobject.c:634
PyObject_Call () at Objects/abstract.c:1736
PyEval_CallObjectWithKeywords () at Python/ceval.c:3431
_PyCodec_Lookup (encoding= "latin-1") at Python/codecs.c:147
codec_getitem (encoding= "latin-1",index=0) at Python/codecs.c:211
PyCodec_Encoder (encoding= "latin-1") at Python/codecs.c:275
PyCodec_Encode (object=,encoding= "latin-1", errors=) at Python/codecs.c:322
PyString_AsEncodedObject (str=,encoding= "latin-1", errors=) at
Objects/stringobject.c:459
string_encode () at Objects/stringobject.c:3138
PyCFunction_Call () at Objects/methodobject.c:73
call_function () at Python/ceval.c:3551
PyEval_EvalFrameEx (f=, throwflag=0) at Python/ceval.c:2216
PyEval_EvalCodeEx () at Python/ceval.c:2835
function_call () at Objects/funcobject.c:634
PyObject_Call () at Objects/abstract.c:1736
method_call () at Objects/classobject.c:397
PyObject_Call () at Objects/abstract.c:1736
PyEval_CallObjectWithKeywords () at Python/ceval.c:3431
PyFile_WriteObject (v=, f=, flags=1) at Objects/fileobject.c:159
PyFile_WriteString (s= "# Lib/encodings/latin_1.pyc matches
Lib/encodings/latin_1.py\n",f=) at Objects/fileobject.c:184


More information about the Python-3000 mailing list