-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Possible bug: pdb causes exception #90693
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
Consider a script called snippet.py, containing the lines ------------------------------------------ import numpy as np
import pandas as pd
np.finfo(float)
idx = pd.MultiIndex.from_tuples([(1, 2)])
np.finfo(float)
print("Done") When running via 'python snippet.py' no errors occur. However when running via 'python -m pdb snippet.py' the following happens:
> snippet.py(1)<module>()
-> import numpy as np
(Pdb) r
--Return--
> snippet.py(6)<module>()->None
-> np.finfo(float)
(Pdb) c
Traceback (most recent call last):
File "VENV/lib/python3.10/site-packages/numpy/core/getlimits.py", line 459, in __new__
dtype = numeric.dtype(dtype)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/pdb.py", line 1723, in main
pdb._runscript(mainpyfile)
File "/usr/lib/python3.10/pdb.py", line 1583, in _runscript
self.run(statement)
File "/usr/lib/python3.10/bdb.py", line 597, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "snippet.py", line 6, in <module>
np.finfo(float)
File "VENV/lib/python3.10/site-packages/numpy/core/getlimits.py", line 462, in __new__
dtype = numeric.dtype(type(dtype))
TypeError: 'NoneType' object is not callable
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program Commenting the MultiIndex line will will get rid of the problem but I am not quite sure why. Please note that this error only occurs if the script is run via 'r' in pdb. Running via 'c' does not cause any problems. My setup: |
Hi, (besides commenting out the try-except in numpy/core/getlimits.py:: |
Are you still seeing this problem? I'm unable to reproduce it with Python 3.10.4. (numpy-1.23.0, pandas-1.4.3).
|
@iritkatriel sorry for the delay I just reran the snippet with the following configuration:
and still get the following output:
|
Have you reported this on the numpy bug tracker? |
Negative. I also did not open an issue in the pandas repo. However, if you think that this help I'll gladly do so. |
The exception is coming from numpy code, so I would start there. If it's a cpython bug they will know how to narrow it down to a small reproducer that doesn't involve so many dependencies. |
I just had a look at the numpy bugtracker and it seems like this actually was a cython issue:
My fault was to only update numpy, but pandas was also still using the affected cython version: After updating to v1.4.3 of pandas the code now behaves as expected in the debugger 😄 Thank you very much for looking into this. |
.traceback (most recent call last): |
@Kaliteli can you give some context for your comment? |
Anlayamıyorum |
@Kaliteli can you please check versions of the local libraries you are using (
|
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: