-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
I ran into the following problematic case with gh-133221 (which had to be reverted):
import sys
import _testinternalcapi
def foo():
pass
def trace_temporarily():
sys._getframe().f_trace_opcodes = True
sys.settrace(print)
sys.settrace(None)
sys._getframe().f_trace_opcodes = False
trace_temporarily()
_testinternalcapi.verify_stateless_code(foo.__code__)
foo()
_testinternalcapi.verify_stateless_code(foo.__code__) # fails
(See #133221 (comment).)
I would expect co_instrumentation
and co_monitoring
to have remained NULL.
CC @markshannon
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error