-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
profiling.sampling is not working for replay mode #148225
Copy link
Copy link
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-profilingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
I ran next command with a.py code, and it made the error.
python3.15 -m profiling.sampling run -o output.prof a.py
python3.15 -m profiling.sampling replay output.prof
# a.py
for i in range(10000):
a = [*p for p in [[1, 2], [2], [3, 4, 4]]]This is the error message:
Traceback (most recent call last):
File "<frozen runpy>", line 196, in _run_module_as_main
File "<frozen runpy>", line 87, in _run_code
File "C:\Users\XXX\AppData\Local\Python\pythoncore-3.15-64\Lib\profiling\sampling\__main__.py", line 65, in <module>
main()
~~~~^^
File "C:\Users\XXX\AppData\Local\Python\pythoncore-3.15-64\Lib\profiling\sampling\cli.py", line 788, in main
_main()
~~~~~^^
File "C:\Users\XXX\AppData\Local\Python\pythoncore-3.15-64\Lib\profiling\sampling\cli.py", line 922, in _main
handler(args)
~~~~~~~^^^^^^
File "C:\Users\XXX\AppData\Local\Python\pythoncore-3.15-64\Lib\profiling\sampling\cli.py", line 1175, in _handle_replay
with BinaryReader(args.input_file) as reader:
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Users\XXX\AppData\Local\Python\pythoncore-3.15-64\Lib\profiling\sampling\binary_reader.py", line 32, in __enter__
self._reader = _remote_debugging.BinaryReader(self.filename)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
ValueError: Invalid magic number: 0xfa03a97b
The reported magic number 0xfa03a97b corresponds to Python 3.13/3.14. It seems that profiling.sampling might be inadvertently picking up components or generating data using the 3.14 environment available on the PATH, even when explicitly invoked with python3.15.
I used python 3.15.0a7, and I also downloaded python 3.14.3, and only 3.14.3 is on PATH.
Environments - Window 11 64bit, Using VSCode powershell terminal, pwsh 7.5.5
Also, I tried to do this in venv but python -m profiling.sampling run -o output.prof a.py made another error.
Failed to find the PyRuntime section in process 15236 on Windows platform
CPython versions tested on:
3.15
Operating systems tested on:
Windows
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-profilingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error