Title: Fix numeric warning error start offsets by youknowdot · Pull Request #9305 · RustPython/RustPython · GitHub
Open Graph Title: Fix numeric warning error start offsets by youknowdot · Pull Request #9305 · RustPython/RustPython
X Title: Fix numeric warning error start offsets by youknowdot · Pull Request #9305 · RustPython/RustPython
Description: Follow-up to #9296, based independently on tested main 0b0a360. Use the existing numeric literal's last-character position when a parser-collected numeric SyntaxWarning becomes SyntaxError in noninteractive compilation. Interactive compilation already uses that position. For example, the offset for compile('0b1and 2', ..., 'exec') with SyntaxWarning configured as an error changes from 1 to 3, matching CPython 3.15.0. The same applies to AST compilation and Unicode character columns. This changes only the collector's offset argument. It does not change warning order or callback arguments, exception conversion/stringification, original-filename handling, or interactive behavior. It is not the broader numeric metadata patch prepared on #9282: end positions, error text/newline policy, lone-CR normalization and SyntaxError args remain outside this PR. The separate #9282 work is not included or superseded. Validation: Built default+capi with locked/offline dependencies and incremental compilation disabled; source-bound independent binary. Compared 18 fixed, compile-only cases with final CPython 3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc) and a historical #9296 binary whose compile.rs is byte-identical to the main base. That historical binary is not represented as a fresh main build. Cases cover ordinary/AST exec, eval and single modes, Unicode before the numeric literal, and LF/CRLF/lone-CR sources. Start positions now agree in 16/18 cases. Two lone-CR cases retain the pre-existing normalization gap. Every recorded baseline-to-candidate field was compared: only SyntaxError.offset changed in all 18 cases. Full metadata equality with CPython is not claimed; end/text/args differences remain. VM parser-disabled, nonthreading/threading and test-target checks passed; strict all-target threading Clippy passed. The first Clippy attempt was stopped by the disk-reserve guard; after reclaiming disposable build outputs, the unchanged candidate passed the same guarded command. Existing canonical test.test_grammar.TokenTests.test_end_of_numerical_literals passed: 1 test, no skips, expected failures or unexpected successes. This is regression coverage; it does not assert offsets. No Lib changes, expectedFailure removal or bespoke behavior tests. The canonical numeric warning method does not currently assert this offset; the finite observation matrix checks it directly without executing generated code. Full workspace/CAPI test suites were not run. AI assistance was used for implementation and validation.
Open Graph Description: Follow-up to #9296, based independently on tested main 0b0a360. Use the existing numeric literal's last-character position when a parser-collected numeric SyntaxWarning becomes SyntaxError in n...
X Description: Follow-up to #9296, based independently on tested main 0b0a360. Use the existing numeric literal's last-character position when a parser-collected numeric SyntaxWarning becomes SyntaxError ...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9305
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:aba2eb58-e9dc-f030-b1ad-233e4dc6668e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 851A:1AE20C:3CBE9F0:4CE746A:6B01FF21 |
| html-safe-nonce | 74c30508c56ba09d2b9cc50169affa60a07b82d95a30112383c77c6291f5c5c1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTFBOjFBRTIwQzozQ0JFOUYwOjRDRTc0NkE6NkIwMUZGMjEiLCJ2aXNpdG9yX2lkIjoiNTk0OTI2OTE3MTI3NDY0NTI4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 014ef6328bf318d6ccda1a6cd804e463088f5780641acbd70defa496fb0c4c31 |
| hovercard-subject-tag | pull_request:4967936891 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/RustPython/RustPython/pull/9305/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Follow-up to #9296, based independently on tested main 0b0a360. Use the existing numeric literal's last-character position when a parser-collected numeric SyntaxWarning becomes SyntaxError in n... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width