2 /* Frame object implementation */
7 #include "frameobject.h"
9 #include "structmember.h"
13 #define MIN(a, b) ((a) < (b) ? (a) : (b))
14 #define MAX(a, b) ((a) > (b) ? (a) : (b))
16 #define OFF(x) offsetof(PyFrameObject, x)
18 static PyMemberDef frame_memberlist
[] = {
19 {"f_back", T_OBJECT
, OFF(f_back
), RO
},
20 {"f_code", T_OBJECT
, OFF(f_code
), RO
},
21 {"f_builtins", T_OBJECT
, OFF(f_builtins
),RO
},
22 {"f_globals", T_OBJECT
, OFF(f_globals
), RO
},
23 {"f_lasti", T_INT
, OFF(f_lasti
), RO
},
24 {"f_restricted",T_INT
, OFF(f_restricted
),RO
},
25 {"f_exc_type", T_OBJECT
, OFF(f_exc_type
)},
26 {"f_exc_value", T_OBJECT
, OFF(f_exc_value
)},
27 {"f_exc_traceback", T_OBJECT
, OFF(f_exc_traceback
)},
32 frame_getlocals(PyFrameObject
*f
, void *closure
)
34 PyFrame_FastToLocals(f
);
35 Py_INCREF(f
->f_locals
);
40 frame_getlineno(PyFrameObject
*f
, void *closure
)
47 lineno
= PyCode_Addr2Line(f
->f_code
, f
->f_lasti
);
49 return PyInt_FromLong(lineno
);
52 /* Setter for f_lineno - you can set f_lineno from within a trace function in
53 * order to jump to a given line of code, subject to some restrictions. Most
54 * lines are OK to jump to because they don't make any assumptions about the
55 * state of the stack (obvious because you could remove the line and the code
56 * would still work without any stack errors), but there are some constructs
59 * o Lines with an 'except' statement on them can't be jumped to, because
60 * they expect an exception to be on the top of the stack.
61 * o Lines that live in a 'finally' block can't be jumped from or to, since
62 * the END_FINALLY expects to clean up the stack after the 'try' block.
63 * o 'try'/'for'/'while' blocks can't be jumped into because the blockstack
64 * needs to be set up before their code runs, and for 'for' loops the
65 * iterator needs to be on the stack.
68 frame_setlineno(PyFrameObject
*f
, PyObject
* p_new_lineno
)
70 int new_lineno
= 0; /* The new value of f_lineno */
71 int new_lasti
= 0; /* The new value of f_lasti */
72 int new_iblock
= 0; /* The new value of f_iblock */
73 char *code
= NULL
; /* The bytecode for the frame... */
74 Py_ssize_t code_len
= 0; /* ...and its length */
75 char *lnotab
= NULL
; /* Iterating over co_lnotab */
76 Py_ssize_t lnotab_len
= 0; /* (ditto) */
77 int offset
= 0; /* (ditto) */
78 int line
= 0; /* (ditto) */
79 int addr
= 0; /* (ditto) */
80 int min_addr
= 0; /* Scanning the SETUPs and POPs */
81 int max_addr
= 0; /* (ditto) */
82 int delta_iblock
= 0; /* (ditto) */
83 int min_delta_iblock
= 0; /* (ditto) */
84 int min_iblock
= 0; /* (ditto) */
85 int f_lasti_setup_addr
= 0; /* Policing no-jump-into-finally */
86 int new_lasti_setup_addr
= 0; /* (ditto) */
87 int blockstack
[CO_MAXBLOCKS
]; /* Walking the 'finally' blocks */
88 int in_finally
[CO_MAXBLOCKS
]; /* (ditto) */
89 int blockstack_top
= 0; /* (ditto) */
90 int setup_op
= 0; /* (ditto) */
92 /* f_lineno must be an integer. */
93 if (!PyInt_Check(p_new_lineno
)) {
94 PyErr_SetString(PyExc_ValueError
,
95 "lineno must be an integer");
99 /* You can only do this from within a trace function, not via
100 * _getframe or similar hackery. */
103 PyErr_Format(PyExc_ValueError
,
104 "f_lineno can only be set by a trace function");
108 /* Fail if the line comes before the start of the code block. */
109 new_lineno
= (int) PyInt_AsLong(p_new_lineno
);
110 if (new_lineno
< f
->f_code
->co_firstlineno
) {
111 PyErr_Format(PyExc_ValueError
,
112 "line %d comes before the current code block",
117 /* Find the bytecode offset for the start of the given line, or the
118 * first code-owning line after it. */
119 PyString_AsStringAndSize(f
->f_code
->co_lnotab
, &lnotab
, &lnotab_len
);
121 line
= f
->f_code
->co_firstlineno
;
123 for (offset
= 0; offset
< lnotab_len
; offset
+= 2) {
124 addr
+= lnotab
[offset
];
125 line
+= lnotab
[offset
+1];
126 if (line
>= new_lineno
) {
133 /* If we didn't reach the requested line, return an error. */
134 if (new_lasti
== -1) {
135 PyErr_Format(PyExc_ValueError
,
136 "line %d comes after the current code block",
141 /* We're now ready to look at the bytecode. */
142 PyString_AsStringAndSize(f
->f_code
->co_code
, &code
, &code_len
);
143 min_addr
= MIN(new_lasti
, f
->f_lasti
);
144 max_addr
= MAX(new_lasti
, f
->f_lasti
);
146 /* You can't jump onto a line with an 'except' statement on it -
147 * they expect to have an exception on the top of the stack, which
148 * won't be true if you jump to them. They always start with code
149 * that either pops the exception using POP_TOP (plain 'except:'
150 * lines do this) or duplicates the exception on the stack using
151 * DUP_TOP (if there's an exception type specified). See compile.c,
152 * 'com_try_except' for the full details. There aren't any other
153 * cases (AFAIK) where a line's code can start with DUP_TOP or
154 * POP_TOP, but if any ever appear, they'll be subject to the same
155 * restriction (but with a different error message). */
156 if (code
[new_lasti
] == DUP_TOP
|| code
[new_lasti
] == POP_TOP
) {
157 PyErr_SetString(PyExc_ValueError
,
158 "can't jump to 'except' line as there's no exception");
162 /* You can't jump into or out of a 'finally' block because the 'try'
163 * block leaves something on the stack for the END_FINALLY to clean
164 * up. So we walk the bytecode, maintaining a simulated blockstack.
165 * When we reach the old or new address and it's in a 'finally' block
166 * we note the address of the corresponding SETUP_FINALLY. The jump
167 * is only legal if neither address is in a 'finally' block or
168 * they're both in the same one. 'blockstack' is a stack of the
169 * bytecode addresses of the SETUP_X opcodes, and 'in_finally' tracks
170 * whether we're in a 'finally' block at each blockstack level. */
171 f_lasti_setup_addr
= -1;
172 new_lasti_setup_addr
= -1;
173 memset(blockstack
, '\0', sizeof(blockstack
));
174 memset(in_finally
, '\0', sizeof(in_finally
));
176 for (addr
= 0; addr
< code_len
; addr
++) {
177 unsigned char op
= code
[addr
];
182 blockstack
[blockstack_top
++] = addr
;
183 in_finally
[blockstack_top
-1] = 0;
187 assert(blockstack_top
> 0);
188 setup_op
= code
[blockstack
[blockstack_top
-1]];
189 if (setup_op
== SETUP_FINALLY
) {
190 in_finally
[blockstack_top
-1] = 1;
198 /* Ignore END_FINALLYs for SETUP_EXCEPTs - they exist
199 * in the bytecode but don't correspond to an actual
200 * 'finally' block. (If blockstack_top is 0, we must
201 * be seeing such an END_FINALLY.) */
202 if (blockstack_top
> 0) {
203 setup_op
= code
[blockstack
[blockstack_top
-1]];
204 if (setup_op
== SETUP_FINALLY
) {
211 /* For the addresses we're interested in, see whether they're
212 * within a 'finally' block and if so, remember the address
213 * of the SETUP_FINALLY. */
214 if (addr
== new_lasti
|| addr
== f
->f_lasti
) {
217 for (i
= blockstack_top
-1; i
>= 0; i
--) {
219 setup_addr
= blockstack
[i
];
224 if (setup_addr
!= -1) {
225 if (addr
== new_lasti
) {
226 new_lasti_setup_addr
= setup_addr
;
229 if (addr
== f
->f_lasti
) {
230 f_lasti_setup_addr
= setup_addr
;
235 if (op
>= HAVE_ARGUMENT
) {
240 /* Verify that the blockstack tracking code didn't get lost. */
241 assert(blockstack_top
== 0);
243 /* After all that, are we jumping into / out of a 'finally' block? */
244 if (new_lasti_setup_addr
!= f_lasti_setup_addr
) {
245 PyErr_SetString(PyExc_ValueError
,
246 "can't jump into or out of a 'finally' block");
251 /* Police block-jumping (you can't jump into the middle of a block)
252 * and ensure that the blockstack finishes up in a sensible state (by
253 * popping any blocks we're jumping out of). We look at all the
254 * blockstack operations between the current position and the new
255 * one, and keep track of how many blocks we drop out of on the way.
256 * By also keeping track of the lowest blockstack position we see, we
257 * can tell whether the jump goes into any blocks without coming out
258 * again - in that case we raise an exception below. */
260 for (addr
= min_addr
; addr
< max_addr
; addr
++) {
261 unsigned char op
= code
[addr
];
274 min_delta_iblock
= MIN(min_delta_iblock
, delta_iblock
);
276 if (op
>= HAVE_ARGUMENT
) {
281 /* Derive the absolute iblock values from the deltas. */
282 min_iblock
= f
->f_iblock
+ min_delta_iblock
;
283 if (new_lasti
> f
->f_lasti
) {
285 new_iblock
= f
->f_iblock
+ delta_iblock
;
288 /* Backwards jump. */
289 new_iblock
= f
->f_iblock
- delta_iblock
;
292 /* Are we jumping into a block? */
293 if (new_iblock
> min_iblock
) {
294 PyErr_SetString(PyExc_ValueError
,
295 "can't jump into the middle of a block");
299 /* Pop any blocks that we're jumping out of. */
300 while (f
->f_iblock
> new_iblock
) {
301 PyTryBlock
*b
= &f
->f_blockstack
[--f
->f_iblock
];
302 while ((f
->f_stacktop
- f
->f_valuestack
) > b
->b_level
) {
303 PyObject
*v
= (*--f
->f_stacktop
);
308 /* Finally set the new f_lineno and f_lasti and return OK. */
309 f
->f_lineno
= new_lineno
;
310 f
->f_lasti
= new_lasti
;
315 frame_gettrace(PyFrameObject
*f
, void *closure
)
317 PyObject
* trace
= f
->f_trace
;
328 frame_settrace(PyFrameObject
*f
, PyObject
* v
, void *closure
)
330 /* We rely on f_lineno being accurate when f_trace is set. */
332 PyObject
* old_value
= f
->f_trace
;
338 f
->f_lineno
= PyCode_Addr2Line(f
->f_code
, f
->f_lasti
);
340 Py_XDECREF(old_value
);
345 static PyGetSetDef frame_getsetlist
[] = {
346 {"f_locals", (getter
)frame_getlocals
, NULL
, NULL
},
347 {"f_lineno", (getter
)frame_getlineno
,
348 (setter
)frame_setlineno
, NULL
},
349 {"f_trace", (getter
)frame_gettrace
, (setter
)frame_settrace
, NULL
},
353 /* Stack frames are allocated and deallocated at a considerable rate.
354 In an attempt to improve the speed of function calls, we maintain a
355 separate free list of stack frames (just like integers are
356 allocated in a special way -- see intobject.c). When a stack frame
357 is on the free list, only the following members have a meaning:
358 ob_type == &Frametype
359 f_back next item on free list, or NULL
360 f_nlocals number of locals
361 f_stacksize size of value stack
362 ob_size size of localsplus
363 Note that the value and block stacks are preserved -- this can save
364 another malloc() call or two (and two free() calls as well!).
365 Also note that, unlike for integers, each frame object is a
366 malloc'ed object in its own right -- it is only the actual calls to
367 malloc() that we are trying to save here, not the administration.
368 After all, while a typical program may make millions of calls, a
369 call depth of more than 20 or 30 is probably already exceptional
370 unless the program contains run-away recursion. I hope.
372 Later, MAXFREELIST was added to bound the # of frames saved on
373 free_list. Else programs creating lots of cyclic trash involving
374 frames could provoke free_list into growing without bound.
377 static PyFrameObject
*free_list
= NULL
;
378 static int numfree
= 0; /* number of frames currently in free_list */
379 #define MAXFREELIST 200 /* max value for numfree */
382 frame_dealloc(PyFrameObject
*f
)
385 PyObject
**fastlocals
;
388 PyObject_GC_UnTrack(f
);
389 Py_TRASHCAN_SAFE_BEGIN(f
)
390 /* Kill all local variables */
391 slots
= f
->f_nlocals
+ f
->f_ncells
+ f
->f_nfreevars
;
392 fastlocals
= f
->f_localsplus
;
393 for (i
= slots
; --i
>= 0; ++fastlocals
) {
394 Py_XDECREF(*fastlocals
);
398 if (f
->f_stacktop
!= NULL
) {
399 for (p
= f
->f_valuestack
; p
< f
->f_stacktop
; p
++)
403 Py_XDECREF(f
->f_back
);
404 Py_DECREF(f
->f_code
);
405 Py_DECREF(f
->f_builtins
);
406 Py_DECREF(f
->f_globals
);
407 Py_XDECREF(f
->f_locals
);
408 Py_XDECREF(f
->f_trace
);
409 Py_XDECREF(f
->f_exc_type
);
410 Py_XDECREF(f
->f_exc_value
);
411 Py_XDECREF(f
->f_exc_traceback
);
412 if (numfree
< MAXFREELIST
) {
414 f
->f_back
= free_list
;
419 Py_TRASHCAN_SAFE_END(f
)
423 frame_traverse(PyFrameObject
*f
, visitproc visit
, void *arg
)
425 PyObject
**fastlocals
, **p
;
427 #define VISIT(o) if (o) {if ((err = visit((PyObject *)(o), arg))) return err;}
431 VISIT(f
->f_builtins
);
435 VISIT(f
->f_exc_type
);
436 VISIT(f
->f_exc_value
);
437 VISIT(f
->f_exc_traceback
);
440 slots
= f
->f_nlocals
+ f
->f_ncells
+ f
->f_nfreevars
;
441 fastlocals
= f
->f_localsplus
;
442 for (i
= slots
; --i
>= 0; ++fastlocals
) {
447 if (f
->f_stacktop
!= NULL
) {
448 for (p
= f
->f_valuestack
; p
< f
->f_stacktop
; p
++)
455 frame_clear(PyFrameObject
*f
)
457 PyObject
**fastlocals
, **p
;
460 Py_XDECREF(f
->f_exc_type
);
461 f
->f_exc_type
= NULL
;
463 Py_XDECREF(f
->f_exc_value
);
464 f
->f_exc_value
= NULL
;
466 Py_XDECREF(f
->f_exc_traceback
);
467 f
->f_exc_traceback
= NULL
;
469 Py_XDECREF(f
->f_trace
);
473 slots
= f
->f_nlocals
+ f
->f_ncells
+ f
->f_nfreevars
;
474 fastlocals
= f
->f_localsplus
;
475 for (i
= slots
; --i
>= 0; ++fastlocals
) {
476 if (*fastlocals
!= NULL
) {
477 Py_XDECREF(*fastlocals
);
483 if (f
->f_stacktop
!= NULL
) {
484 for (p
= f
->f_valuestack
; p
< f
->f_stacktop
; p
++) {
492 PyTypeObject PyFrame_Type
= {
493 PyObject_HEAD_INIT(&PyType_Type
)
496 sizeof(PyFrameObject
),
498 (destructor
)frame_dealloc
, /* tp_dealloc */
504 0, /* tp_as_number */
505 0, /* tp_as_sequence */
506 0, /* tp_as_mapping */
510 PyObject_GenericGetAttr
, /* tp_getattro */
511 PyObject_GenericSetAttr
, /* tp_setattro */
512 0, /* tp_as_buffer */
513 Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_HAVE_GC
,/* tp_flags */
515 (traverseproc
)frame_traverse
, /* tp_traverse */
516 (inquiry
)frame_clear
, /* tp_clear */
517 0, /* tp_richcompare */
518 0, /* tp_weaklistoffset */
522 frame_memberlist
, /* tp_members */
523 frame_getsetlist
, /* tp_getset */
528 static PyObject
*builtin_object
;
532 builtin_object
= PyString_InternFromString("__builtins__");
533 return (builtin_object
!= NULL
);
537 PyFrame_New(PyThreadState
*tstate
, PyCodeObject
*code
, PyObject
*globals
,
540 PyFrameObject
*back
= tstate
->frame
;
543 Py_ssize_t extras
, ncells
, nfrees
, i
;
546 if (code
== NULL
|| globals
== NULL
|| !PyDict_Check(globals
) ||
547 (locals
!= NULL
&& !PyMapping_Check(locals
))) {
548 PyErr_BadInternalCall();
552 ncells
= PyTuple_GET_SIZE(code
->co_cellvars
);
553 nfrees
= PyTuple_GET_SIZE(code
->co_freevars
);
554 extras
= code
->co_stacksize
+ code
->co_nlocals
+ ncells
+ nfrees
;
555 if (back
== NULL
|| back
->f_globals
!= globals
) {
556 builtins
= PyDict_GetItem(globals
, builtin_object
);
558 if (PyModule_Check(builtins
)) {
559 builtins
= PyModule_GetDict(builtins
);
560 assert(!builtins
|| PyDict_Check(builtins
));
562 else if (!PyDict_Check(builtins
))
565 if (builtins
== NULL
) {
566 /* No builtins! Make up a minimal one
567 Give them 'None', at least. */
568 builtins
= PyDict_New();
569 if (builtins
== NULL
||
570 PyDict_SetItemString(
571 builtins
, "None", Py_None
) < 0)
579 /* If we share the globals, we share the builtins.
580 Save a lookup and a call. */
581 builtins
= back
->f_builtins
;
582 assert(builtins
!= NULL
&& PyDict_Check(builtins
));
585 if (free_list
== NULL
) {
586 f
= PyObject_GC_NewVar(PyFrameObject
, &PyFrame_Type
, extras
);
596 free_list
= free_list
->f_back
;
597 if (f
->ob_size
< extras
) {
598 f
= PyObject_GC_Resize(PyFrameObject
, f
, extras
);
604 _Py_NewReference((PyObject
*)f
);
606 f
->f_builtins
= builtins
;
612 f
->f_globals
= globals
;
613 /* Most functions have CO_NEWLOCALS and CO_OPTIMIZED set. */
614 if ((code
->co_flags
& (CO_NEWLOCALS
| CO_OPTIMIZED
)) ==
615 (CO_NEWLOCALS
| CO_OPTIMIZED
))
616 locals
= NULL
; /* PyFrame_FastToLocals() will set. */
617 else if (code
->co_flags
& CO_NEWLOCALS
) {
618 locals
= PyDict_New();
619 if (locals
== NULL
) {
629 f
->f_locals
= locals
;
631 f
->f_exc_type
= f
->f_exc_value
= f
->f_exc_traceback
= NULL
;
632 f
->f_tstate
= tstate
;
635 f
->f_lineno
= code
->co_firstlineno
;
636 f
->f_restricted
= (builtins
!= tstate
->interp
->builtins
);
638 f
->f_nlocals
= code
->co_nlocals
;
639 f
->f_stacksize
= code
->co_stacksize
;
640 f
->f_ncells
= ncells
;
641 f
->f_nfreevars
= nfrees
;
643 extras
= f
->f_nlocals
+ ncells
+ nfrees
;
644 /* Tim said it's ok to replace memset */
645 for (i
=0; i
<extras
; i
++)
646 f
->f_localsplus
[i
] = NULL
;
648 f
->f_valuestack
= f
->f_localsplus
+ extras
;
649 f
->f_stacktop
= f
->f_valuestack
;
650 _PyObject_GC_TRACK(f
);
654 /* Block management */
657 PyFrame_BlockSetup(PyFrameObject
*f
, int type
, int handler
, int level
)
660 if (f
->f_iblock
>= CO_MAXBLOCKS
)
661 Py_FatalError("XXX block stack overflow");
662 b
= &f
->f_blockstack
[f
->f_iblock
++];
665 b
->b_handler
= handler
;
669 PyFrame_BlockPop(PyFrameObject
*f
)
672 if (f
->f_iblock
<= 0)
673 Py_FatalError("XXX block stack underflow");
674 b
= &f
->f_blockstack
[--f
->f_iblock
];
678 /* Convert between "fast" version of locals and dictionary version */
681 map_to_dict(PyObject
*map
, Py_ssize_t nmap
, PyObject
*dict
, PyObject
**values
,
685 for (j
= nmap
; --j
>= 0; ) {
686 PyObject
*key
= PyTuple_GET_ITEM(map
, j
);
687 PyObject
*value
= values
[j
];
689 value
= PyCell_GET(value
);
691 if (PyObject_DelItem(dict
, key
) != 0)
695 if (PyObject_SetItem(dict
, key
, value
) != 0)
702 dict_to_map(PyObject
*map
, Py_ssize_t nmap
, PyObject
*dict
, PyObject
**values
,
703 Py_ssize_t deref
, int clear
)
706 for (j
= nmap
; --j
>= 0; ) {
707 PyObject
*key
= PyTuple_GET_ITEM(map
, j
);
708 PyObject
*value
= PyObject_GetItem(dict
, key
);
712 if (value
|| clear
) {
713 if (PyCell_GET(values
[j
]) != value
) {
714 if (PyCell_Set(values
[j
], value
) < 0)
718 } else if (value
!= NULL
|| clear
) {
719 if (values
[j
] != value
) {
721 Py_XDECREF(values
[j
]);
730 PyFrame_FastToLocals(PyFrameObject
*f
)
732 /* Merge fast locals into f->f_locals */
733 PyObject
*locals
, *map
;
735 PyObject
*error_type
, *error_value
, *error_traceback
;
739 locals
= f
->f_locals
;
740 if (locals
== NULL
) {
741 locals
= f
->f_locals
= PyDict_New();
742 if (locals
== NULL
) {
743 PyErr_Clear(); /* Can't report it :-( */
747 map
= f
->f_code
->co_varnames
;
748 if (!PyTuple_Check(map
))
750 PyErr_Fetch(&error_type
, &error_value
, &error_traceback
);
751 fast
= f
->f_localsplus
;
752 j
= PyTuple_GET_SIZE(map
);
753 if (j
> f
->f_nlocals
)
756 map_to_dict(map
, j
, locals
, fast
, 0);
757 if (f
->f_ncells
|| f
->f_nfreevars
) {
758 if (!(PyTuple_Check(f
->f_code
->co_cellvars
)
759 && PyTuple_Check(f
->f_code
->co_freevars
))) {
762 map_to_dict(f
->f_code
->co_cellvars
,
763 PyTuple_GET_SIZE(f
->f_code
->co_cellvars
),
764 locals
, fast
+ f
->f_nlocals
, 1);
765 map_to_dict(f
->f_code
->co_freevars
,
766 PyTuple_GET_SIZE(f
->f_code
->co_freevars
),
767 locals
, fast
+ f
->f_nlocals
+ f
->f_ncells
, 1);
769 PyErr_Restore(error_type
, error_value
, error_traceback
);
773 PyFrame_LocalsToFast(PyFrameObject
*f
, int clear
)
775 /* Merge f->f_locals into fast locals */
776 PyObject
*locals
, *map
;
778 PyObject
*error_type
, *error_value
, *error_traceback
;
782 locals
= f
->f_locals
;
783 map
= f
->f_code
->co_varnames
;
786 if (!PyTuple_Check(map
))
788 PyErr_Fetch(&error_type
, &error_value
, &error_traceback
);
789 fast
= f
->f_localsplus
;
790 j
= PyTuple_GET_SIZE(map
);
791 if (j
> f
->f_nlocals
)
794 dict_to_map(f
->f_code
->co_varnames
, j
, locals
, fast
, 0, clear
);
795 if (f
->f_ncells
|| f
->f_nfreevars
) {
796 if (!(PyTuple_Check(f
->f_code
->co_cellvars
)
797 && PyTuple_Check(f
->f_code
->co_freevars
)))
799 dict_to_map(f
->f_code
->co_cellvars
,
800 PyTuple_GET_SIZE(f
->f_code
->co_cellvars
),
801 locals
, fast
+ f
->f_nlocals
, 1, clear
);
802 dict_to_map(f
->f_code
->co_freevars
,
803 PyTuple_GET_SIZE(f
->f_code
->co_freevars
),
804 locals
, fast
+ f
->f_nlocals
+ f
->f_ncells
, 1,
807 PyErr_Restore(error_type
, error_value
, error_traceback
);
810 /* Clear out the free list */
815 while (free_list
!= NULL
) {
816 PyFrameObject
*f
= free_list
;
817 free_list
= free_list
->f_back
;
821 assert(numfree
== 0);
822 Py_XDECREF(builtin_object
);
823 builtin_object
= NULL
;