@@ -260,7 +260,7 @@ def mouse_input_wrapper(prompt=''):
260260 'dir' , 'globals' , 'locals' , 'vars' ]
261261# Peter says 'apply' isn't dangerous, so don't ban it
262262
263- IGNORE_VARS = set (('__user_stdout__' , '__OPT_toplevel__' , ' __builtins__' , '__name__' , '__exception__' , '__doc__' , '__package__' ))
263+ IGNORE_VARS = set (('__user_stdout__' , '__builtins__' , '__name__' , '__exception__' , '__doc__' , '__package__' ))
264264
265265def get_user_stdout (frame ):
266266 my_user_stdout = frame .f_globals ['__user_stdout__' ]
@@ -728,10 +728,9 @@ def interaction(self, frame, traceback, event_type):
728728 if top_frame .f_code .co_name == '__repr__' :
729729 return
730730
731- # if top_frame.f_globals doesn't contain the sentinel '__OPT_toplevel__',
732- # then we're in another global scope altogether, so skip it!
731+ # if we're not in a module that we are explicitly tracing, skip:
733732 # (this comes up in tests/backend-tests/namedtuple.txt)
734- if '__OPT_toplevel__' not in top_frame . f_globals :
733+ if top_frame . f_globals [ '__name__' ] != '__main__' :
735734 return
736735
737736
@@ -1285,9 +1284,7 @@ def _runscript(self, script_str, custom_globals=None):
12851284 # update AFTER custom_globals so that custom_globals doesn't clobber us
12861285 user_globals .update ({"__name__" : "__main__" ,
12871286 "__builtins__" : user_builtins ,
1288- "__user_stdout__" : user_stdout ,
1289- # sentinel value for frames deriving from a top-level module
1290- "__OPT_toplevel__" : True })
1287+ "__user_stdout__" : user_stdout })
12911288
12921289 try :
12931290 # enforce resource limits RIGHT BEFORE running script_str
0 commit comments