Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

co_instrumentation and co_monitoring Unexpectedly Set #133524

Copy link
Copy link
Open
@ericsnowcurrently

Description

@ericsnowcurrently
Issue body actions

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

No one assigned

    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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.