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

traceback of exception with non-unicode __module__ #89777

Closed
iritkatriel opened this issue Oct 26, 2021 · 5 comments
Closed

traceback of exception with non-unicode __module__ #89777

iritkatriel opened this issue Oct 26, 2021 · 5 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir

Comments

@iritkatriel
Copy link
Member

BPO 45614
Nosy @gvanrossum, @erlend-aasland, @iritkatriel
PRs
  • bpo-45614: Fix traceback display for exceptions with invalid module name #29726
  • [3.10] bpo-45614: Fix traceback display for exceptions with invalid module n… #29826
  • [3.9] bpo-45614: Fix traceback display for exceptions with invalid module n… #29827
  • 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 2021-11-29.10:12:03.135>
    created_at = <Date 2021-10-26.12:05:47.066>
    labels = ['interpreter-core', 'library', '3.9', '3.10', '3.11']
    title = 'traceback of exception with non-unicode __module__'
    updated_at = <Date 2021-11-29.10:12:03.134>
    user = 'https://github.com/iritkatriel'

    bugs.python.org fields:

    activity = <Date 2021-11-29.10:12:03.134>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-11-29.10:12:03.135>
    closer = 'iritkatriel'
    components = ['Interpreter Core', 'Library (Lib)']
    creation = <Date 2021-10-26.12:05:47.066>
    creator = 'iritkatriel'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45614
    keywords = ['patch']
    message_count = 5.0
    messages = ['405037', '405038', '407173', '407256', '407257']
    nosy_count = 3.0
    nosy_names = ['gvanrossum', 'erlendaasland', 'iritkatriel']
    pr_nums = ['29726', '29826', '29827']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue45614'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @iritkatriel
    Copy link
    Member Author

    This test currently fails for both C and python tracebacks:

        def test_exception_modulename_not_unicode(self):
            class X(Exception):
                def __str__(self):
                    return "I am X"
    
            X.__module__ = 42
    
            err = self.get_report(X())
            exp = f'<unknown>.{X.__qualname__}: I am X'
            self.assertEqual(exp, err)

    @iritkatriel iritkatriel added 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir labels Oct 26, 2021
    @iritkatriel
    Copy link
    Member Author

    In C it is missing the '.' between <unknown> and the qualname. In python it raises an exception when trying to + the module field with a string.

    @iritkatriel
    Copy link
    Member Author

    New changeset 4dfae6f by Irit Katriel in branch 'main':
    bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726)
    4dfae6f

    @iritkatriel iritkatriel added 3.9 only security fixes 3.10 only security fixes labels Nov 27, 2021
    @iritkatriel
    Copy link
    Member Author

    New changeset 4d2cc3e by Irit Katriel in branch '3.10':
    bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726) (GH-29826)
    4d2cc3e

    @iritkatriel
    Copy link
    Member Author

    New changeset 5b6aa6c by Irit Katriel in branch '3.9':
    bpo-45614: Fix traceback display for exceptions with invalid module name (GH-29726) (GH-29827)
    5b6aa6c

    @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
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant