summaryrefslogtreecommitdiff
path: root/tests/run/methodmangling_unknown_names.py
blob: dae1f5c22b209657d4b23a9821c5ea083970c171 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# mode: run
# tag: allow_unknown_names, pure2.0, pure3.0

class Test(object):
    def run(self):
        """
        >>> Test().run()
        NameError1
        NameError2
        found mangled
        """
        try:
            print(__something)
        except NameError:
            print("NameError1")  # correct - shouldn't exist
        globals()['__something'] = 'found unmangled'
        try:
            print(__something)
        except NameError:
            print("NameError2")  # correct - shouldn't exist
        globals()['_Test__something'] = 'found mangled'
        try:
            print(__something)  # should print this
        except NameError:
            print("NameError3")