1# mode: run 2# tag: allow_unknown_names, pure2.0, pure3.0 3 4class Test(object): 5 def run(self): 6 """ 7 >>> Test().run() 8 NameError1 9 NameError2 10 found mangled 11 """ 12 try: 13 print(__something) 14 except NameError: 15 print("NameError1") # correct - shouldn't exist 16 globals()['__something'] = 'found unmangled' 17 try: 18 print(__something) 19 except NameError: 20 print("NameError2") # correct - shouldn't exist 21 globals()['_Test__something'] = 'found mangled' 22 try: 23 print(__something) # should print this 24 except NameError: 25 print("NameError3") 26