Title: Instrumentation assertion failure when calling the registered handler explicitly · Issue #122247 · python/cpython · GitHub
Open Graph Title: Instrumentation assertion failure when calling the registered handler explicitly · Issue #122247 · python/cpython
X Title: Instrumentation assertion failure when calling the registered handler explicitly · Issue #122247 · python/cpython
Description: Bug report Bug description: On my mac M1 Sonoma (14.5), Python 3.13.0b4, I see this crash when registering an opcode monitor, calling the handler explicitly while it's enabled, and then restarting events. To reproduce: import sys def mym...
Open Graph Description: Bug report Bug description: On my mac M1 Sonoma (14.5), Python 3.13.0b4, I see this crash when registering an opcode monitor, calling the handler explicitly while it's enabled, and then restarting ...
X Description: Bug report Bug description: On my mac M1 Sonoma (14.5), Python 3.13.0b4, I see this crash when registering an opcode monitor, calling the handler explicitly while it's enabled, and then restart...
Opengraph URL: https://github.com/python/cpython/issues/122247
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Instrumentation assertion failure when calling the registered handler explicitly","articleBody":"# Bug report\n\n### Bug description:\n\nOn my mac M1 Sonoma (14.5), Python 3.13.0b4, I see this crash when registering an opcode monitor, calling the handler explicitly while it's enabled, and then restarting events. To reproduce:\n\n```python\nimport sys\n\ndef mymonitor(code, instruction_offset):\n pass\n\ntool_id = 4\nsys.monitoring.use_tool_id(tool_id, \"mytool\")\nsys.monitoring.register_callback(\n tool_id,\n sys.monitoring.events.INSTRUCTION,\n mymonitor,\n)\nsys.monitoring.set_events(tool_id, sys.monitoring.events.INSTRUCTION)\nmymonitor(None, 0) # call the *same* handler while it is registered \nsys.monitoring.restart_events()\n```\n\nTriggers an assertion failure (my minimal debugging suggests it's about some inconsistency with the \"instrumentation_version\"):\n```\n$ 3.13.0b4-debug/bin/python -X dev repro.py\nAssertion failed: (debug_check_sanity(tstate-\u003einterp, code)), function _Py_call_instrumentation_instruction, file instrumentation.c, line 1347.\nFatal Python error: Aborted\n\nCurrent thread 0x00000002064b0c00 (most recent call first):\n File \"/Users/phillipschanely/proj/CrossHair/repro.py\", line 4 in mymonitor\n File \"/Users/phillipschanely/proj/CrossHair/repro.py\", line 16 in \u003cmodule\u003e\nzsh: abort /Users/phillipschanely/.pyenv/versions/3.13.0b4-debug/bin/python -X dev \n```\n\nThanks for investigating!\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-122251\n* gh-122812\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/pschanely","@type":"Person","name":"pschanely"},"datePublished":"2024-07-24T21:51:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/122247/cpython/issues/122247"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:34ba66d3-7afd-c472-20e1-96037114063c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B51A:15DFF5:22C4DEC:2F86D3E:696ACCFB |
| html-safe-nonce | 0747a62e9b554642a3ad8f81fea691b295d0f57914fe0f58cb47a3d5d918533f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTFBOjE1REZGNToyMkM0REVDOjJGODZEM0U6Njk2QUNDRkIiLCJ2aXNpdG9yX2lkIjoiNjYyMDA3NDk3OTA2MTU4MzA5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7c30b15947ee387ea2017266a060ccf2db5f516e8f16e10bca852fb71bd9f2a0 |
| hovercard-subject-tag | issue:2428534510 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/122247/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f5197f89ed256bfe3d1993fec83c5580f73d57b9bb2351713250e5c051117f50/python/cpython/issues/122247 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f5197f89ed256bfe3d1993fec83c5580f73d57b9bb2351713250e5c051117f50/python/cpython/issues/122247 |
| og:image:alt | Bug report Bug description: On my mac M1 Sonoma (14.5), Python 3.13.0b4, I see this crash when registering an opcode monitor, calling the handler explicitly while it's enabled, and then restarting ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pschanely |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width