[New-bugs-announce] [issue19393] symtable.symtable can return the wrong "top" SymbolTable

Steven Winfield report at bugs.python.org
Fri Oct 25 19:49:56 CEST 2013


New submission from Steven Winfield:

The attached script creates calls symtable.symtable many times on a code snippet that contains a single class with a method called "top", and some other important (to trigger the behaviour) properties:
  * a class variable
  * at least three other methods

The symtable module is reloaded each time, which seems to exacerbate the problem, but it not necessary.

The return value of symtable.symtable is sometimes a SymbolTable object, as expected, and sometimes a symtable.Function object.

Here is some example output from the script:

c:\Python27>python.exe C:\Temp\symtable_weirdness.py
Counter({'SymbolTable': 59, 'Function': 41})

c:\Python33>python.exe C:\Temp\symtable_weirdness.py
Counter({'SymbolTable': 89, 'Function': 11})

The values are consistent between runs, but can be changed by altering PYTHONHASHSEED between runs.

----------
components: Library (Lib)
files: symtable_weirdness.py
messages: 201265
nosy: Steven.Winfield
priority: normal
severity: normal
status: open
title: symtable.symtable can return the wrong "top" SymbolTable
type: behavior
versions: Python 2.7, Python 3.3
Added file: http://bugs.python.org/file32359/symtable_weirdness.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19393>
_______________________________________


More information about the New-bugs-announce mailing list