More FAQs.

This commit is contained in:
Guido van Rossum 2002-02-11 15:00:03 +00:00
parent 0c994bd700
commit 9c4c598a79
1 changed files with 27 additions and 0 deletions

View File

@ -414,6 +414,33 @@ FAQs
A. It is intended to support that fully.
Q. What happens when a global is deleted?
A. The module's celldict would have a cell with a NULL objptr for
that key.
Q. What would the C code for LOAD_GLOBAL_CELL look like?
A. case LOAD_GLOBAL_CELL:
cell = func_cells[oparg];
x = cell->objptr;
if (x == NULL) {
x = cell->cellptr->objptr;
if (x == NULL) {
... error recovery ...
break;
}
}
Py_INCREF(x);
continue;
Q. What happens in the module's top-level code where there is
presumably no func_cells array?
A. We could do some code analysis and create a func_cells array,
or we could use LOAD_NAME which should use PyMapping_GetItem on
the globals dict.
Graphics