Skip to content

get_parameters failed for Tuple #98

Open
@joshmalina

Description

@joshmalina

In Python 3.8, you could:

>>> from typing_inspect import get_parameters
>>> import typing
>>> get_parameters(typing.Tuple)
()

But in Python 3.11, you get:

AttributeError                            Traceback (most recent call last)
File typing_inspect.py:417, in get_parameters(tp)
    416 try:
--> 417     return tp.__parameters__
    418 except Exception as e:

File /usr/local/Cellar/[email protected]/3.11.1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/typing.py:1272, in _BaseGenericAlias.__getattr__(self, attr)
   1271     return getattr(self.__origin__, attr)
-> 1272 raise AttributeError(attr)

AttributeError: __parameters__

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
Cell In[6], line 3
      1 from typing_inspect import get_parameters
      2 import typing
----> 3 get_parameters(typing.Tuple)

File typing_inspect.py:420, in get_parameters(tp)
    418     except Exception as e:
    419         print(tp)
--> 420         raise Exception(e)
    421 else:
    422     return ()

Exception: __parameters__

I'm using version 0.8.0 of the library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions