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

'inspect.getmembers()' delivers attribute '__annotations__' for class 'module' that does not exist #123506

Closed
siegbert7 opened this issue Aug 30, 2024 · 1 comment
Labels
type-bug An unexpected behavior, bug, or error

Comments

@siegbert7
Copy link

siegbert7 commented Aug 30, 2024

Bug report

Bug description:

# Add a code block here, if required

# Demonstrate AttributeError: type object 'module' has no attribute '__annotations__'
# Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32

import sys, inspect

pObj = type(sys)
print(pObj)             # <class 'module'>

for name, value in iter(inspect.getmembers(pObj)):                                # Delivers member '__annotations__'
    print(name)
    try                     :   obj = eval('pObj.'+name)                                      # Works fine, except for '__annotations__'
    except AttributeError   :   print('***********************************')    # AttributeError: type object 'module' has no attribute '__annotations__'

CPython versions tested on:

3.12

Operating systems tested on:

Windows

@siegbert7 siegbert7 added the type-bug An unexpected behavior, bug, or error label Aug 30, 2024
@Eclips4
Copy link
Member

Eclips4 commented Aug 30, 2024

Duplicate of #123242

@Eclips4 Eclips4 marked this as a duplicate of #123242 Aug 30, 2024
@Eclips4 Eclips4 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2024
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

2 participants