-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Incorrect typing for error_before_exec
#14907
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
Comments
Hi @krassowski I would like to work on this issue |
Please do! |
Hi @krassowski , The errors seems to be because of the [[tool.mypy.overrides]] section for Interactiveshell in the pyproject.toml file; See Line 176 Lines 171 to 181 in b854379
|
Great find! Can you try to find a way to flip it to |
Sure, let me explore and will raise a PR :) |
Just one doubt I had, do you want me to tweak the pyproject.toml configuration only so that we see less errors, or you want me to try modifying some of the existing function in Ineteractiveshell.py to resolve it? |
Hi @krassowski , I think its a good starting point , gradually we can start flipping the necessary parameters along with fixing the issues. So, if you are satisfied with this much change only. Then I will create the PR. |
If a rule can be enabled (or not get disabled) by making small tweaks to typing in |
Sure, but let's also try to find what would have caught the |
All the existing parameter in the toml for interactiveshell are fine, and if we just flip the ignore_errors we can see the BaseException for But the main paramater which helps in finding this error is |
Hi @krassowski , |
This PR fixes issue #14907 Changes made: 1. `pyproject.toml` => changed ignore_error = false, so that we can catch BaseException like errors. Drawback => Testing with mypy we see 54 errors for `ipython/IPython/core/interactiveshell.py` Resolution => To flip certain parameter in pyproject.toml so that we get less errors and try to resolve each of them in segments to minimize review efforts. 2. `ipython/IPython/core/interactiveshell.py` => Upon making the best changes to `pyproject.toml` we reduce the errors to 3(we will cover the rest of them gradually, this is for starters). Which were:  I had resolved 2 of them : https://github.com/ipython/ipython/blob/b854379e3b801ce812c648e95f8846a1334e3195/IPython/core/interactiveshell.py#L334 and https://github.com/ipython/ipython/blob/b854379e3b801ce812c648e95f8846a1334e3195/IPython/core/interactiveshell.py#L3602 Which eventually results in only 1 error, with current settings: 
error_before_exec
is typed asbool
here:ipython/IPython/core/interactiveshell.py
Lines 286 to 294 in b854379
but later it is raised:
ipython/IPython/core/interactiveshell.py
Lines 305 to 310 in b854379
The tests suggest that both are
BaseException
descendants:ipython/tests/test_interactiveshell.py
Lines 112 to 118 in b854379
A PR fixing the issue should start investigating why mypy was not complaining and make CI fail.
The text was updated successfully, but these errors were encountered: