Skip to content

Commit 4e93e5b

Browse files
committed
eliminated __OPT_toplevel__ hack
1 parent e807a33 commit 4e93e5b

5 files changed

Lines changed: 40 additions & 43 deletions

File tree

v3/example-code/closures/closure1.golden

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@
250250
}
251251
],
252252
"globals": {
253-
"b": [
254-
"REF",
255-
2
256-
],
257253
"foo": [
258254
"REF",
259255
1
256+
],
257+
"b": [
258+
"REF",
259+
2
260260
]
261261
},
262262
"heap": {
@@ -326,13 +326,13 @@
326326
}
327327
],
328328
"globals": {
329-
"b": [
330-
"REF",
331-
2
332-
],
333329
"foo": [
334330
"REF",
335331
1
332+
],
333+
"b": [
334+
"REF",
335+
2
336336
]
337337
},
338338
"heap": {
@@ -402,13 +402,13 @@
402402
}
403403
],
404404
"globals": {
405-
"b": [
406-
"REF",
407-
2
408-
],
409405
"foo": [
410406
"REF",
411407
1
408+
],
409+
"b": [
410+
"REF",
411+
2
412412
]
413413
},
414414
"heap": {
@@ -480,13 +480,13 @@
480480
}
481481
],
482482
"globals": {
483-
"b": [
484-
"REF",
485-
2
486-
],
487483
"foo": [
488484
"REF",
489485
1
486+
],
487+
"b": [
488+
"REF",
489+
2
490490
]
491491
},
492492
"heap": {

v3/example-code/closures/closure1.golden_py3

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@
250250
}
251251
],
252252
"globals": {
253-
"b": [
254-
"REF",
255-
2
256-
],
257253
"foo": [
258254
"REF",
259255
1
256+
],
257+
"b": [
258+
"REF",
259+
2
260260
]
261261
},
262262
"heap": {
@@ -326,13 +326,13 @@
326326
}
327327
],
328328
"globals": {
329-
"b": [
330-
"REF",
331-
2
332-
],
333329
"foo": [
334330
"REF",
335331
1
332+
],
333+
"b": [
334+
"REF",
335+
2
336336
]
337337
},
338338
"heap": {
@@ -402,13 +402,13 @@
402402
}
403403
],
404404
"globals": {
405-
"b": [
406-
"REF",
407-
2
408-
],
409405
"foo": [
410406
"REF",
411407
1
408+
],
409+
"b": [
410+
"REF",
411+
2
412412
]
413413
},
414414
"heap": {
@@ -480,13 +480,13 @@
480480
}
481481
],
482482
"globals": {
483-
"b": [
484-
"REF",
485-
2
486-
],
487483
"foo": [
488484
"REF",
489485
1
486+
],
487+
"b": [
488+
"REF",
489+
2
490490
]
491491
},
492492
"heap": {

v3/example-code/py_tutorial.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4661,7 +4661,7 @@
46614661
4
46624662
],
46634663
"middleName": "Birchard",
4664-
"lastName": "Hayes",
4664+
"s2": "Rutherford Birchard Hayes",
46654665
"age": 26,
46664666
"orderedUniqueAges": [
46674667
"REF",
@@ -4678,7 +4678,7 @@
46784678
"person": "Tom Cruise",
46794679
"s": "Rutherford Birchard Hayes",
46804680
"b": "Ringo",
4681-
"s2": "Rutherford Birchard Hayes",
4681+
"lastName": "Hayes",
46824682
"thisAge": 28,
46834683
"pi": 3.142,
46844684
"worth": 40000000

v3/example-code/py_tutorial.golden_py3

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4661,7 +4661,7 @@
46614661
4
46624662
],
46634663
"middleName": "Birchard",
4664-
"lastName": "Hayes",
4664+
"s2": "Rutherford Birchard Hayes",
46654665
"age": 26,
46664666
"orderedUniqueAges": [
46674667
"REF",
@@ -4678,7 +4678,7 @@
46784678
"person": "Tom Cruise",
46794679
"s": "Rutherford Birchard Hayes",
46804680
"b": "Ringo",
4681-
"s2": "Rutherford Birchard Hayes",
4681+
"lastName": "Hayes",
46824682
"thisAge": 28,
46834683
"pi": 3.142,
46844684
"worth": 40000000

v5-unity/pg_logger.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

265265
def 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

Comments
 (0)