Skip to content
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

Closed
ccomb mannequin opened this issue May 17, 2010 · 7 comments
Closed

infinite recursion with setfilesystemencoding and pdb #52986

ccomb mannequin opened this issue May 17, 2010 · 7 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@ccomb
Copy link
Mannequin

ccomb mannequin commented May 17, 2010

BPO 8740
Nosy @vstinner, @florentx
Superseder
  • bpo-8226: sys.setfilesystemencoding("xxx"); open("a") => stack overflow
  • 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:

    assignee = None
    closed_at = <Date 2010-05-17.15:05:04.849>
    created_at = <Date 2010-05-17.13:45:49.452>
    labels = ['type-bug']
    title = 'infinite recursion with setfilesystemencoding and pdb'
    updated_at = <Date 2010-05-19.12:03:22.807>
    user = 'https://bugs.python.org/ccomb'

    bugs.python.org fields:

    activity = <Date 2010-05-19.12:03:22.807>
    actor = 'ccomb'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-05-17.15:05:04.849>
    closer = 'flox'
    components = ['None']
    creation = <Date 2010-05-17.13:45:49.452>
    creator = 'ccomb'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 8740
    keywords = []
    message_count = 7.0
    messages = ['105904', '105906', '105910', '105911', '105912', '105913', '106050']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'flox', 'ccomb']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '8226'
    type = 'behavior'
    url = 'https://bugs.python.org/issue8740'
    versions = ['Python 3.1']

    @ccomb
    Copy link
    Mannequin Author

    ccomb mannequin commented May 17, 2010

    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

    @ccomb ccomb mannequin added the type-bug An unexpected behavior, bug, or error label May 17, 2010
    @florentx
    Copy link
    Mannequin

    florentx mannequin commented May 17, 2010

    Next release should fix it: 3.1.3
    (Tested on 3.1 branch)

    @florentx florentx mannequin closed this as completed May 17, 2010
    @vstinner
    Copy link
    Member

    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?

    @vstinner
    Copy link
    Member

    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.

    @ccomb
    Copy link
    Mannequin Author

    ccomb mannequin commented May 17, 2010

    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

    @vstinner
    Copy link
    Member

    Oh, flox closed the issue: it's a duplicate of bpo-8226. The bug was fixed in Python 3.1.2 by myself (r79394).

    @ccomb
    Copy link
    Mannequin Author

    ccomb mannequin commented May 19, 2010

    (I forgot to mention that the bug occured on python 3.1.2.)

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant