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() breaks sometimes #41688

Closed
quale mannequin opened this issue Mar 12, 2005 · 2 comments
Closed

inspect.getmembers() breaks sometimes #41688

quale mannequin opened this issue Mar 12, 2005 · 2 comments
Labels
stdlib Python modules in the Lib dir

Comments

@quale
Copy link
Mannequin

quale mannequin commented Mar 12, 2005

BPO 1162154
Nosy @amauryfa
Files
  • inspect.getmembers-patch: patch for inspect.getmembers()
  • 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 2009-01-13.23:39:37.499>
    created_at = <Date 2005-03-12.21:18:20.000>
    labels = ['library']
    title = 'inspect.getmembers() breaks sometimes'
    updated_at = <Date 2009-01-13.23:39:37.484>
    user = 'https://bugs.python.org/quale'

    bugs.python.org fields:

    activity = <Date 2009-01-13.23:39:37.484>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-01-13.23:39:37.499>
    closer = 'amaury.forgeotdarc'
    components = ['Library (Lib)']
    creation = <Date 2005-03-12.21:18:20.000>
    creator = 'quale'
    dependencies = []
    files = ['1625']
    hgrepos = []
    issue_num = 1162154
    keywords = []
    message_count = 2.0
    messages = ['24570', '79804']
    nosy_count = 2.0
    nosy_names = ['amaury.forgeotdarc', 'quale']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1162154'
    versions = []

    @quale
    Copy link
    Mannequin Author

    quale mannequin commented Mar 12, 2005

    The inspect library module getmembers() method breaks
    sometimes when it makes a getattr() call that fails. A
    simple example is a slot that doesn't have a value:

     >>> class X(object): __slots__ = 'foo'
     >>> import inspect
     >>> inspect.getmembers(x())
    Traceback (most recent call last):
       File "<pyshell#4>", line 1, in -toplevel-
         inspect.getmembers(X())
       File "C:\PYTHON23\lib\inspect.py", line 171, in
    getmembers
         value = getattr(object, key)
    AttributeError: foo
     >>>

    On the PEAK mailing list Phillip Eby suggested wrapping
    the gettattr() call in try/except. This seems to work fine.

    @quale quale mannequin added stdlib Python modules in the Lib dir labels Mar 12, 2005
    @amauryfa
    Copy link
    Member

    Fixed in r68596.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant