Title: frame.setlineno has serious flaws. · Issue #94438 · python/cpython · GitHub
Open Graph Title: frame.setlineno has serious flaws. · Issue #94438 · python/cpython
X Title: frame.setlineno has serious flaws. · Issue #94438 · python/cpython
Description: The frame_setlineno function works in in stages: Determine a set of possible bytecode offsets as targets from the line number. Compute the stack state for these targets and the current position Determine a best target. That is, the first...
Open Graph Description: The frame_setlineno function works in in stages: Determine a set of possible bytecode offsets as targets from the line number. Compute the stack state for these targets and the current position Det...
X Description: The frame_setlineno function works in in stages: Determine a set of possible bytecode offsets as targets from the line number. Compute the stack state for these targets and the current position Det...
Opengraph URL: https://github.com/python/cpython/issues/94438
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"frame.setlineno has serious flaws.","articleBody":"The `frame_setlineno` function works in in stages:\r\n* Determine a set of possible bytecode offsets as targets from the line number. \r\n* Compute the stack state for these targets and the current position\r\n* Determine a best target. That is, the first one that has a compatible stack.\r\n* Pop values form the stack and jump.\r\n\r\nThe first steps is faulty (I think, I haven't demonstrated this) as it might be possible to jump to an instruction involved in frame creation. This should be easy to fix using the new `_co_firsttraceable` field.\r\n\r\nThe second step has (at least) three flaws:\r\n\r\n- [x] It does not account for `NULL`s on the stack, making it possible to jump from a stack with `NULL`s to one that cannot handle `NULL`s.\r\n- [x] It does not skip over caches, so could produce incorrect stacks by misinterpreting cache entries as normal instructions.\r\n- [x] It is out of date. For example it thinks that `PUSH_EXC_INFO` pushes three values. It only pushes one.\r\n\r\nSetting the line number of a frame is only possible in the debugger, so this isn't as terrible as might appear, but it definitely needs fixing.\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-111237\n* gh-111243\n* gh-111338\n* gh-111341\n* gh-111369\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/markshannon","@type":"Person","name":"markshannon"},"datePublished":"2022-06-30T11:30:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/94438/cpython/issues/94438"}
| 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:13c343f9-39f2-da91-6b13-ab50df164493 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8492:16B518:E25B07:1346F4C:69693CAD |
| html-safe-nonce | f3520494d563f973891420d5aabbc1c3edd05903407469141f1c3460679091db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDkyOjE2QjUxODpFMjVCMDc6MTM0NkY0Qzo2OTY5M0NBRCIsInZpc2l0b3JfaWQiOiI0Njg5NDUzNTQ5OTE1NTUyOTQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9599757eddd0e0084e70127fdb076b8c45669f305526cc5742ce3ed2e36aec99 |
| hovercard-subject-tag | issue:1289995827 |
| 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/94438/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bac57c172c85cb720bfb3e7fd0393eb8372bbaa5f9a265733cbd16781aa4d0f7/python/cpython/issues/94438 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bac57c172c85cb720bfb3e7fd0393eb8372bbaa5f9a265733cbd16781aa4d0f7/python/cpython/issues/94438 |
| og:image:alt | The frame_setlineno function works in in stages: Determine a set of possible bytecode offsets as targets from the line number. Compute the stack state for these targets and the current position Det... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | markshannon |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| 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 | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width