Skip to content

Commit 53a906c

Browse files
authored
Match settrace events, f_lineno jumps, and type dict lookup (#8758)
* Keep type dict keys and report current f_lasti Snapshot the MRO during lookup so non-string keys can run __eq__, skip subclass updates when set_bases is reentered, make module __dict__ a readonly member, and forbid deleting exception __dict__. f_lasti is the current opcode; line events skip NO_LOCATION units. Assisted-by: Grok:grok-4.6 * Fire settrace call events from RESUME PY_START/PY_RESUME become a 'call' event only at the first RESUME of a frame activation, so lasti is the resume unit and f_trace_lines is honored. Unskip passing TraceTestCase methods. Assisted-by: Grok:grok-4.6 * Record what_event so f_lineno jumps match line traces Store the current monitoring event while a trace callback runs, reject jumps from call/return/exception, unwind tracer errors in the traced frame, and fire call on PY_THROW. Unskip JumpTestCase except the infinite-loop and five remaining xfails. Assisted-by: Grok:grok-4.6 * Fire remaining settrace events from opcodes and jumps Keep GET_ANEXT's iterator in mark_stacks, dispatch non-call events through f_trace, fire PY_YIELD/PY_RETURN from the opcodes, emit same-line LINE on backward jumps, and raise at flattened call sites. Unskip the rest of test_sys_settrace. Assisted-by: Grok:grok-4.6 * Fix trampoline raise panic and unxfail passing traces Do not decode inline-cache units as opcodes when a flattened call raises. Remove expectedFailure from test_trace and test_regrtest coverage tests that now pass. Assisted-by: Grok:grok-4.6 * Fire profile returns without a per-frame f_trace setprofile must see PY_RETURN/PY_YIELD even when f_trace is unset. Drop EXPECTED_FAILURE from the pdb doctest and unxfail test_unfinished_generator. Assisted-by: Grok:grok-4.6
1 parent 617c4be commit 53a906c

16 files changed

Lines changed: 477 additions & 308 deletions

File tree

‎Lib/test/test_descr.py‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3432,7 +3432,6 @@ def __del__(self):
34323432
l = [A() for x in range(100)]
34333433
del l
34343434

3435-
@unittest.expectedFailure # TODO: RUSTPYTHON
34363435
def test_set_dict(self):
34373436
# Testing __dict__ assignment...
34383437
class C(object): pass
@@ -5288,7 +5287,6 @@ def __pow__(self, *args):
52885287

52895288

52905289
class MiscTests(unittest.TestCase):
5291-
@unittest.expectedFailure # TODO: RUSTPYTHON; a class namespace drops keys that are not strings, so MyKey.__eq__ is never reached and __bases__ stays put
52925290
def test_type_lookup_mro_reference(self):
52935291
# Issue #14199: _PyType_Lookup() has to keep a strong reference to
52945292
# the type MRO because it may be modified during the lookup, if
@@ -5924,7 +5922,6 @@ class B2(A):
59245922
with self.assertRaises(TypeError):
59255923
B1.__bases__ += ()
59265924

5927-
@unittest.expectedFailure # TODO: RUSTPYTHON
59285925
def test_tp_subclasses_cycle_in_update_slots(self):
59295926
"""
59305927
type_set_bases must check for reentrancy upon finishing its job
@@ -5961,7 +5958,6 @@ class C(A):
59615958
self.assertEqual(B1.__bases__, (C,))
59625959
self.assertEqual(C.__subclasses__(), [B1])
59635960

5964-
@unittest.expectedFailure # TODO: RUSTPYTHON
59655961
def test_tp_subclasses_cycle_error_return_path(self):
59665962
"""
59675963
The same as test_tp_subclasses_cycle_in_update_slots, but tests

‎Lib/test/test_doctest/test_doctest.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,7 +2129,7 @@ def test_pdb_set_trace():
21292129
... 'list', # list source from example 3
21302130
... 'continue', # stop debugging
21312131
... ''])
2132-
>>> try: runner.run(test) # TODO: RUSTPYTHON # doctest: +EXPECTED_FAILURE
2132+
>>> try: runner.run(test)
21332133
... finally: sys.stdin = real_stdin
21342134
... # doctest: +NORMALIZE_WHITESPACE
21352135
> <doctest foo-bar@baz[1]>(3)g()

‎Lib/test/test_regrtest.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,6 @@ def test_slowest_interrupted(self):
12261226
regex = ('10 slowest tests:\n')
12271227
self.check_line(output, regex)
12281228

1229-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: Regex didn't match: '^lines +cov% +module +\\(path\\)\\n(?: *[0-9]+ *[0-9]{1,2}\\.[0-9]% *[^ ]+ +\\([^)]+\\)+)+' not found in 'Warning: collecting coverage without -j is imprecise. Configure --with-pydebug and run -m test -T -j for best results.\nUsing random seed: 2780369491\n0:00:00 Run 1 test sequentially in a single process\n0:00:00 [1/1] test_regrtest_coverage\n0:00:00 [1/1] test_regrtest_coverage passed\n\n== Tests result: SUCCESS ==\n\n1 test OK.\n\nTotal duration: 102 ms\nTotal tests: run=1\nTotal test files: run=1/1\nResult: SUCCESS\n'
12301229
def test_coverage(self):
12311230
# test --coverage
12321231
test = self.create_test('coverage')

‎Lib/test/test_sys_setprofile.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ def g(p):
260260
(1, 'return', g_ident),
261261
])
262262

263-
@unittest.expectedFailure # TODO: RUSTPYTHON
264263
def test_unfinished_generator(self):
265264
def f():
266265
for i in range(2):

0 commit comments

Comments
 (0)