New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
infinite recursion with setfilesystemencoding and pdb #52986
Comments
This leads to a maximum recursion depth error: $ python3.1
>>> import sys, pdb
>>> sys.setfilesystemencoding('iso8859-7')
>>> pdb.set_trace() I'm on ubuntu 10.04 x86_64, with LANG=fr_FR.utf8 |
Next release should fix it: 3.1.3 |
What is the problem? $ python3.1
Python 3.1.2 (r312:79147, Apr 21 2010, 23:52:07)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, pdb; sys.setfilesystemencoding('iso8859-7'); pdb.set_trace()
--Return--
> <stdin>(1)<module>()->None
(Pdb) Where is the infinite loop? |
The file system encoding should not be modifiable. Call sys.setfilesystemencoding() breaks Python, eg. module filenames are not reencoded. See also bpo-8611. sys.setfilesystemencoding() is as danregeous as sys.setdefaultencoding() because it changes too much things in Python. If you would like to decode a filename with an encoding different than sys.setfilesystemencoding(): use the bytes type. Eg. os.listdir(b'.') gives you bytes filenames. |
Traceback (most recent call last):
File "/usr/lib/python3.1/encodings/__init__.py", line 98, in search_function
level=0)
File "/usr/lib/python3.1/encodings/__init__.py", line 98, in search_function
level=0)
(...)
File "/usr/lib/python3.1/encodings/__init__.py", line 98, in search_function
level=0)
File "/usr/lib/python3.1/encodings/__init__.py", line 98, in search_function
level=0)
File "/usr/lib/python3.1/encodings/__init__.py", line 83, in search_function
norm_encoding = normalize_encoding(encoding)
File "/usr/lib/python3.1/encodings/__init__.py", line 55, in normalize_encoding
if isinstance(encoding, bytes):
RuntimeError: maximum recursion depth exceeded while calling a Python object |
Oh, flox closed the issue: it's a duplicate of bpo-8226. The bug was fixed in Python 3.1.2 by myself (r79394). |
(I forgot to mention that the bug occured on python 3.1.2.) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: