mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-87092: do not allocate PyFutureFeatures dynamically (GH-98913)
This commit is contained in:
parent
c76db37c0d
commit
6d683d8525
4 changed files with 22 additions and 32 deletions
|
@ -96,22 +96,14 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, PyObject *filename)
|
|||
}
|
||||
|
||||
|
||||
PyFutureFeatures *
|
||||
_PyFuture_FromAST(mod_ty mod, PyObject *filename)
|
||||
int
|
||||
_PyFuture_FromAST(mod_ty mod, PyObject *filename, PyFutureFeatures *ff)
|
||||
{
|
||||
PyFutureFeatures *ff;
|
||||
|
||||
ff = (PyFutureFeatures *)PyObject_Malloc(sizeof(PyFutureFeatures));
|
||||
if (ff == NULL) {
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
ff->ff_features = 0;
|
||||
ff->ff_location = (_PyCompilerSrcLocation){-1, -1, -1, -1};
|
||||
|
||||
if (!future_parse(ff, mod, filename)) {
|
||||
PyObject_Free(ff);
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
return ff;
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue