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
%autocall: Python 3.9 and PEP 585 #13006
Comments
Are you sure yo don't have a config option that set autocall to 2 ? By default IPython behaves properly:
What does You can try With autocall set to 2 even other stuff get improperly called:
which is why it's not the default. |
My autocall is set to 1 (default), I have not changed it. Maybe it's fixed on 7.25 dev already?
|
My bad, the default auf autocall is 0, not 1, with 1 I can indeed reproduce. |
narrowed it down to
Which get called and decide that |
Awesome, thank you for looking into it. Note that this is only an issue with classes that have |
Autocall is decided purely on the syntax, it does not use reflexion or inspection. So that might be hard. |
Hmm, if it's working purely on the syntax tree, how does any getattr work? How can it tell that this is safe?
|
Reading the conversation it seems to me like this issue is specific to |
It is. With autocall = 1, When doing a |
PEP 585 in Python 3.9 introduces
__class_getitem__
, which allows for some types such asconcurrent.futures.Future
to have a type alias, such as:The above works as expected in ipython 7.24.0, but if you don't assign it to a name, it throws an exception:
This seems to be a bug with ipython, as it works fine in normal python terminal.
From my understanding, this is due to a feature in ipython that lets you just write
len array
without parenthesis, and it'll automatically add parentheses for you. In this case, it tries to call Future([int]) as if it was an array.EDIT: I believe the feature is called "autocall"
The text was updated successfully, but these errors were encountered: