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

get_parameters failed for Tuple #98

Open
joshmalina opened this issue Feb 7, 2023 · 6 comments · May be fixed by #99
Open

get_parameters failed for Tuple #98

joshmalina opened this issue Feb 7, 2023 · 6 comments · May be fixed by #99

Comments

@joshmalina
Copy link

joshmalina commented Feb 7, 2023

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

@joshmalina joshmalina linked a pull request Feb 7, 2023 that will close this issue
@joshmalina
Copy link
Author

PR here: #99

@gandersen101
Copy link

I'm actually seeing this in Python 3.9 as well, so I don't think this is exclusive to 3.11.

@gandersen101
Copy link

A little more context, looks like this was fixed in #94 and it was not just an issue about the Tuple type but any non-indexed Generic. However, there does not seem to be a release with the changes from #94 yet. Would it be possible to get one? Thanks!

@ilevkivskyi
Copy link
Owner

Hm, it looks like we didn't have a release for a while indeed. I will take a look into making a release soon.

@gandersen101
Copy link

That would be great, thank you! @joshmalina, I think this issue and the associated PR can be closed because this is working correctly on master.

@ilevkivskyi
Copy link
Owner

FYI I just released https://pypi.org/project/typing-inspect/0.9.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants