ytrstu / winpdb

Automatically exported from code.google.com/p/winpdb
0 stars 0 forks source link

Spurious members are injected inside internal classes defined in function #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the following script in python then with winpdb:

"""
inject.py
"""

def inject():
    injected = 1
    class wrapper:
        class nested:
            member = injected
    return dir(wrapper)

if __name__ == "__main__":
    print(inject())

What is the expected output? What do you see instead?
Expected:
$> python inject.py
['__doc__', '__module__', 'nested']

Winpdb (adds 'injected' in wrapper):
$> winpdb.bat inject.py
['__doc__', '__module__', 'injected', 'nested']

What version of the product are you using? On what operating system?
Winpdb 1.4.6 - Tychod
Python 2.5.2
Windows Vista

Please provide any additional information below.

I. This works as expected when 'wrapper' class is defined 
in the "__main__" condition and not in a function.

II. Notice that 'value' is also injected to 'nested' class.

Original issue reported on code.google.com by ouime...@gmail.com on 27 Nov 2009 at 6:02