• Victor Stinner's avatar
    Close #16742: Fix misuse of memory allocations in PyOS_Readline() · 2fe9bac4
    Victor Stinner yazdı
    The GIL must be held to call PyMem_Malloc(), whereas PyOS_Readline() releases
    the GIL to read input.
    
    The result of the C callback PyOS_ReadlineFunctionPointer must now be a string
    allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL if an error
    occurred), instead of a string allocated by PyMem_Malloc() or PyMem_Realloc().
    
    Fixing this issue was required to setup a hook on PyMem_Malloc(), for example
    using the tracemalloc module.
    
    PyOS_Readline() copies the result of PyOS_ReadlineFunctionPointer() into a new
    buffer allocated by PyMem_Malloc(). So the public API of PyOS_Readline() does
    not change.
    2fe9bac4
Adı
Son kayıt (commit)
Son güncelleme
..
Python.asdl Loading commit data...
acceler.c Loading commit data...
asdl.py Loading commit data...
asdl_c.py Loading commit data...
bitset.c Loading commit data...
firstsets.c Loading commit data...
grammar.c Loading commit data...
grammar1.c Loading commit data...
listnode.c Loading commit data...
metagrammar.c Loading commit data...
myreadline.c Loading commit data...
node.c Loading commit data...
parser.c Loading commit data...
parser.h Loading commit data...
parsetok.c Loading commit data...
parsetok_pgen.c Loading commit data...
pgen.c Loading commit data...
pgenmain.c Loading commit data...
printgrammar.c Loading commit data...
spark.py Loading commit data...
tokenizer.c Loading commit data...
tokenizer.h Loading commit data...
tokenizer_pgen.c Loading commit data...