New submission from Ned Batchelder <n...@nedbatchelder.com>:
Here is a trace involving generator expressions. Using 3.10.0b3 on Mac, there are "line" events within the expression. Those events are missing on Windows. --- 8< ------------------------------- import linecache, sys def trace(frame, event, arg): # The weird globals here is to avoid a NameError on shutdown... if frame.f_code.co_filename == globals().get("__file__"): lineno = frame.f_lineno print("{} {}: {}".format(event[:4], lineno, linecache.getline(__file__, lineno).rstrip())) return trace def doit(): o = ((1,2), (3,4)) o = (a for a in o) for tup in o: x = tup[0] y = tup[1] print(sys.version) sys.settrace(trace) doit() --------------------------------------- When run on Mac, it produces this output: 3.10.0b3 (default, Jun 18 2021, 06:43:38) [Clang 12.0.0 (clang-1200.0.32.29)] call 10: def doit(): line 11: o = ((1,2), (3,4)) line 12: o = (a for a in o) line 13: for tup in o: call 12: o = (a for a in o) line 12: o = (a for a in o) retu 12: o = (a for a in o) line 14: x = tup[0] line 15: y = tup[1] line 13: for tup in o: call 12: o = (a for a in o) line 12: o = (a for a in o) retu 12: o = (a for a in o) line 14: x = tup[0] line 15: y = tup[1] line 13: for tup in o: call 12: o = (a for a in o) retu 12: o = (a for a in o) retu 13: for tup in o: When run on Windows, it produces this output: 3.10.0b3 (tags/v3.10.0b3:865714a, Jun 17 2021, 20:39:25) [MSC v.1929 64 bit (AMD64)] call 10: def doit(): line 11: o = ((1,2), (3,4)) line 12: o = (a for a in o) line 13: for tup in o: call 12: o = (a for a in o) retu 12: o = (a for a in o) line 14: x = tup[0] line 15: y = tup[1] line 13: for tup in o: call 12: o = (a for a in o) retu 12: o = (a for a in o) line 14: x = tup[0] line 15: y = tup[1] line 13: for tup in o: call 12: o = (a for a in o) retu 12: o = (a for a in o) retu 13: for tup in o: On Windows, the "line 12" events are missing. ---------- components: Interpreter Core keywords: 3.10regression messages: 396050 nosy: Mark.Shannon, nedbat priority: normal severity: normal status: open title: Generator expressions trace differently on Windows than on Mac versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44450> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com