Closed
Description
Bug report
While debugging, cProfile fails to work, while profile does work, see session below:
Python 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pdb
>>> db = pdb.Pdb()
>>> db.run("aaa")
> <string>(1)<module>()
(Pdb) import profile, cProfile
(Pdb) cProfile.run("print(0)")
0
*** TypeError: Cannot create or construct a <class 'pstats.Stats'> object from <cProfile.Profile object at 0x1028d5660>
(Pdb) profile.run("print(0)")
0
1 function calls in 0.000 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 profile:0(print(0))
0 0.000 0.000 profile:0(profiler)
(Pdb) q
>>> cProfile.run("print(0)")
0
4 function calls in 0.000 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {built-in method builtins.print}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> profile.run("print(0)")
0
5 function calls in 0.000 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 :0(exec)
1 0.000 0.000 0.000 0.000 :0(print)
1 0.000 0.000 0.000 0.000 :0(setprofile)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 profile:0(print(0))
0 0.000 0.000 profile:0(profiler)
>>>
Your environment
- CPython versions tested on: Python 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)] on darwin
- Operating system and architecture: Apple M1 Max - 13.1 (22C65)