mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Backport METH_FASTCALL from Python 3.7 (#328)
This commit is contained in:
parent
70c97f598b
commit
cf73bbd678
102 changed files with 2896 additions and 3301 deletions
26
third_party/python/Objects/frameobject.c
vendored
26
third_party/python/Objects/frameobject.c
vendored
|
@ -461,13 +461,15 @@ static int numfree;
|
|||
static PyFrameObject *free_list;
|
||||
#define PyFrame_MAXFREELIST 200
|
||||
|
||||
static void
|
||||
static void _Py_HOT_FUNCTION
|
||||
frame_dealloc(PyFrameObject *restrict f)
|
||||
{
|
||||
PyObject **p, **valuestack;
|
||||
PyCodeObject *co;
|
||||
|
||||
PyObject_GC_UnTrack(f);
|
||||
if (_PyObject_GC_IS_TRACKED(f))
|
||||
_PyObject_GC_UNTRACK(f);
|
||||
|
||||
Py_TRASHCAN_SAFE_BEGIN(f)
|
||||
/* Kill all local variables */
|
||||
valuestack = f->f_valuestack;
|
||||
|
@ -658,9 +660,9 @@ int _PyFrame_Init()
|
|||
return 1;
|
||||
}
|
||||
|
||||
PyFrameObject *
|
||||
PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
|
||||
PyObject *locals)
|
||||
PyFrameObject* _Py_HOT_FUNCTION
|
||||
_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code,
|
||||
PyObject *globals, PyObject *locals)
|
||||
{
|
||||
PyFrameObject *back = tstate->frame;
|
||||
PyFrameObject *f;
|
||||
|
@ -715,7 +717,8 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
|
|||
extras = code->co_stacksize + code->co_nlocals + ncells +
|
||||
nfrees;
|
||||
if (free_list == NULL) {
|
||||
f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, extras);
|
||||
f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type,
|
||||
extras);
|
||||
if (f == NULL) {
|
||||
Py_DECREF(builtins);
|
||||
return NULL;
|
||||
|
@ -779,7 +782,16 @@ PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals,
|
|||
f->f_executing = 0;
|
||||
f->f_gen = NULL;
|
||||
|
||||
_PyObject_GC_TRACK(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
PyFrameObject*
|
||||
PyFrame_New(PyThreadState *tstate, PyCodeObject *code,
|
||||
PyObject *globals, PyObject *locals)
|
||||
{
|
||||
PyFrameObject *f = _PyFrame_New_NoTrack(tstate, code, globals, locals);
|
||||
if (f)
|
||||
_PyObject_GC_TRACK(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue