bugs.python.org

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.

Read the original on bugs.python.org ↗