mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
gh-114569: Use PyMem_* APIs for non-PyObjects in compiler (#114587)
This commit is contained in:
parent
3996cbdd33
commit
8612230c1c
2 changed files with 15 additions and 16 deletions
|
@ -162,7 +162,7 @@ basicblock_last_instr(const basicblock *b) {
|
|||
static basicblock *
|
||||
cfg_builder_new_block(cfg_builder *g)
|
||||
{
|
||||
basicblock *b = (basicblock *)PyObject_Calloc(1, sizeof(basicblock));
|
||||
basicblock *b = (basicblock *)PyMem_Calloc(1, sizeof(basicblock));
|
||||
if (b == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
|
@ -437,10 +437,10 @@ _PyCfgBuilder_Free(cfg_builder *g)
|
|||
basicblock *b = g->g_block_list;
|
||||
while (b != NULL) {
|
||||
if (b->b_instr) {
|
||||
PyObject_Free((void *)b->b_instr);
|
||||
PyMem_Free((void *)b->b_instr);
|
||||
}
|
||||
basicblock *next = b->b_list;
|
||||
PyObject_Free((void *)b);
|
||||
PyMem_Free((void *)b);
|
||||
b = next;
|
||||
}
|
||||
PyMem_Free(g);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue