Mercurial > cpython-lru_cache-weakref
changeset 86660:bc259b221cb8 3.3
just return toplevel symbol table rather than all blocks (closes #19393)
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Sat, 26 Oct 2013 13:13:51 -0400 |
| parents | 150242784de0 |
| children | f5c729dbe9fb 0bf4cf62f14c |
| files | Lib/symtable.py Misc/NEWS Modules/symtablemodule.c |
| diffstat | 3 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/symtable.py Sat Oct 26 03:16:44 2013 -0700 +++ b/Lib/symtable.py Sat Oct 26 13:13:51 2013 -0400 @@ -10,10 +10,7 @@ __all__ = ["symtable", "SymbolTable", "Class", "Function", "Symbol"] def symtable(code, filename, compile_type): - raw = _symtable.symtable(code, filename, compile_type) - for top in raw.values(): - if top.name == 'top': - break + top = _symtable.symtable(code, filename, compile_type) return _newSymbolTable(top, filename) class SymbolTableFactory:
--- a/Misc/NEWS Sat Oct 26 03:16:44 2013 -0700 +++ b/Misc/NEWS Sat Oct 26 13:13:51 2013 -0400 @@ -81,6 +81,9 @@ Library ------- +- Issue #19393: Fix symtable.symtable function to not be confused when there are + functions or classes named "top". + - Issue #19339: telnetlib module is now using time.monotonic() when available to compute timeout.
--- a/Modules/symtablemodule.c Sat Oct 26 03:16:44 2013 -0700 +++ b/Modules/symtablemodule.c Sat Oct 26 13:13:51 2013 -0400 @@ -32,7 +32,7 @@ st = Py_SymtableString(str, filename, start); if (st == NULL) return NULL; - t = st->st_blocks; + t = (PyObject *)st->st_top; Py_INCREF(t); PyMem_Free((void *)st->st_future); PySymtable_Free(st);
