This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Possible bug: pdb causes exception
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: cklb
Priority: normal Keywords:

Created on 2022-01-26 11:20 by cklb, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg411738 - (view) Author: Stefan Ecklebe (cklb) Date: 2022-01-26 11:20
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.
Therefore, I suspect that the problem may be with pdb instead of the external packages.

My setup:
$ python --version
Python 3.10.1
$ pip list | grep numpy
numpy                1.22.1
$ pip list | grep pandas
pandas               1.4.0
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90693
2022-01-27 15:39:46cklbsettype: crash -> behavior
2022-01-26 11:20:07cklbcreate