Pdb crashes after jump with Fatal Python error: _PyMem_DebugRawFree: bad trailing pad byte
· Issue #91742 · python/cpython (original) (raw)
Crash report
Access violation occurs when using pdb
in the following procedure:
- step in a function
- step next a few lines inside
print
function - before exiting
print
function, jump to the beginning of the code - continue Code Example [test_pdb.py] (click to expand)
author = "pi" version = "3.14"
def about(): """About""" print(f"Module: {file!r}", f"Author: {author!r}", f"Version: {version!r}", sep='\n')
breakpoint() about()
Error messages
$ python -Wd -Xdev -Xtracemalloc test_pdb.py
> test_pdb.py(12)<module>()
-> about()
(Pdb) s
--Call--
> test_pdb.py(4)about()
-> def about():
(Pdb) n
> test_pdb.py(6)about()
-> print(f"Module: {__file__!r}",
(Pdb) n
> test_pdb.py(7)about()
-> f"Author: {__author__!r}",
(Pdb) j 4
> test_pdb.py(4)about()
-> def about():
(Pdb) c
Module: 'test_pdb.py'
Author: 'pi'
Version: '3.14'
Debug memory block at address p=0000021D17AD8CF0: API 'o'
432 bytes originally requested
The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.
The 8 pad bytes at tail=0000021D17AD8EA0 are not all FORBIDDENBYTE (0xfd):
at tail+0: 0x90 *** OUCH
at tail+1: 0x46 *** OUCH
at tail+2: 0x05 *** OUCH
at tail+3: 0x17 *** OUCH
at tail+4: 0x1d *** OUCH
at tail+5: 0x02 *** OUCH
at tail+6: 0x00 *** OUCH
at tail+7: 0x00 *** OUCH
Data at p: 00 00 00 00 00 00 00 00 ... f0 b4 b5 16 1d 02 00 00
Memory block allocated at (most recent call first):
File "test_pdb.py", line 12
Fatal Python error: _PyMem_DebugRawFree: bad trailing pad byte
Python runtime state: finalizing (tstate=0000021D169BEA10)
Current thread 0x000033f0 (most recent call first):
<no Python frame>
Your environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: Windows10 64bit