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

Making instance of TypeVar fails because of missing __name__ #84123

Closed
jack1142 mannequin opened this issue Mar 12, 2020 · 4 comments
Closed

Making instance of TypeVar fails because of missing __name__ #84123

jack1142 mannequin opened this issue Mar 12, 2020 · 4 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@jack1142
Copy link
Mannequin

jack1142 mannequin commented Mar 12, 2020

BPO 39942
Nosy @ilevkivskyi, @hongweipeng, @miss-islington, @jack1142
PRs
  • bpo-39942:Fix TypeVar fails when missing __name__ #19616
  • [3.7] bpo-39942:Fix failure in TypeVar when missing __name__ (GH-19616) #19626
  • [3.8] bpo-39942:Fix failure in TypeVar when missing __name__ (GH-19616) #19627
  • 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 2020-04-20.20:28:52.865>
    created_at = <Date 2020-03-12.00:11:51.865>
    labels = ['3.7', '3.8', 'type-bug', 'library', '3.9']
    title = 'Making instance of `TypeVar` fails because of missing `__name__`'
    updated_at = <Date 2020-04-20.20:28:52.865>
    user = 'https://github.com/jack1142'

    bugs.python.org fields:

    activity = <Date 2020-04-20.20:28:52.865>
    actor = 'levkivskyi'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-04-20.20:28:52.865>
    closer = 'levkivskyi'
    components = ['Library (Lib)']
    creation = <Date 2020-03-12.00:11:51.865>
    creator = 'jack1142'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39942
    keywords = ['patch']
    message_count = 4.0
    messages = ['363990', '366872', '366874', '366876']
    nosy_count = 4.0
    nosy_names = ['levkivskyi', 'hongweipeng', 'miss-islington', 'jack1142']
    pr_nums = ['19616', '19626', '19627']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue39942'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @jack1142
    Copy link
    Mannequin Author

    jack1142 mannequin commented Mar 12, 2020

    Example code:

    code = """
    import typing
    T = typing.TypeVar("T")
    """
    exec(code, {})
    

    Traceback:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<string>", line 3, in <module>
      File "C:\Python38\lib\typing.py", line 603, in __init__
        def_mod = sys._getframe(1).f_globals['__name__']  # for pickling
    KeyError: '__name__'
    

    If this problem with __name__ is not something that needs to be fixed, then I also noticed that the same line in typing.py will also raise when platform doesn't have sys._getframe()

    @jack1142 jack1142 mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 12, 2020
    @ilevkivskyi
    Copy link
    Member

    New changeset a25a04f by HongWeipeng in branch 'master':
    bpo-39942:Fix failure in TypeVar when missing __name__ (GH-19616)
    a25a04f

    @miss-islington
    Copy link
    Contributor

    New changeset 694a95f by Miss Islington (bot) in branch '3.7':
    bpo-39942:Fix failure in TypeVar when missing __name__ (GH-19616)
    694a95f

    @miss-islington
    Copy link
    Contributor

    New changeset 41660ca by Miss Islington (bot) in branch '3.8':
    bpo-39942:Fix failure in TypeVar when missing __name__ (GH-19616)
    41660ca

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants