René's URL Explorer Experiment


Title: Align numeric conversion and rounding boundaries by youknowdot · Pull Request #9697 · RustPython/RustPython · GitHub

Open Graph Title: Align numeric conversion and rounding boundaries by youknowdot · Pull Request #9697 · RustPython/RustPython

X Title: Align numeric conversion and rounding boundaries by youknowdot · Pull Request #9697 · RustPython/RustPython

Description: Summary Group CPython 3.15 numeric conversion boundaries in 433 changed production lines (+219/-214): Reuse ArgIntoFloat and ArgIntoComplex to distinguish native scalar conversion from constructor dispatch. Native conversion reads stored float/complex subclass values while constructor-specific special methods retain their required precedence. Normalize float.real/conjugate results and preserve exact complex.complex identity through existing number helpers. Match complex special-method error/warning diagnostics with the shared qualified-type formatter. Normalize Unicode literals before underscore validation, preserve invalid-scalar prefixes, and match embedded-NUL/underscore diagnostics without trimming away information needed by the existing transformer. Replace float subclass's manual positional parser with the existing FuncArgs binder, retaining original positional and keyword owners through conversion/allocation. Release bytearray and generic buffer data guards before invalid float literal repr callbacks, while keeping generic buffer exports alive through error construction. This permits callback mutation without deadlocking and preserves export-related resize rejection. The shared C-API float parser benefits from the same fix. Seven Rust files only. No Python, Lib, tests, expected-failure markers, or workflows changed. Use exact ties-even float rounding, match decimal-round overflow text, and accept arbitrary nonnegative nextafter step indices through the existing saturated native helper. Reuse native conversion for log/log2/log10, preserving huge-integer retry behavior. Share ceil/floor conversion and descriptor-miss handling with trunc through existing special-method lookup. Stream fsum conversions through the existing numerical algorithm, stop before later callbacks after intermediate overflow, and allocate the result before releasing the iterator. Keep numeric diagnostics/warnings compatible with the shared WTF-8 formatter without duplicating type-name logic. Reference and validation Compared with CPython commit d220409a13b77de7a6c30abe16ea90db01528edc: complex conversion, float conversion, and numeric underscore parsing. 13,787 bounded CPython/source-model assertions passed across scalar callbacks, warnings, errors, identities, owner cleanup, Unicode strings and all four shared normalizer consumers. Independent review added 112 CPython observations and 78 NUL boundary assertions, and found a Unicode/NUL diagnostic regression in the initial candidate that is corrected in this final composition. These are reference/model checks, not execution of the Rust implementation. The rounding companion passed 53,508 further CPython/source-model checks and 116,945 independent assertions using separate integer-round, rational decimal-round and signed-rank nextafter models. These cover signed zero, NaN payloads, infinity, adjacent-to-half floats, bounded huge indices, and error/callback ordering. Independent composition review verified the original conversion group is unchanged outside the narrow companion hunks. The native math companion passed 4,195 additional bounded CPython/source-model comparisons and 39 independent checks against mathmodule.c. Exact review verified original conversion/rounding content outside intended hunks and compatibility with #9666. Independent exact-source review passed. Final focused host-env/VM/stdlib threading cargo check, normal all-targets Clippy and ordinary commit hooks passed. Clippy emitted exactly four unchanged main-baseline diagnostics: one POSIX needless-collect and three ElementTree lints. Strict -D warnings remains blocked by that baseline; no warnings were suppressed. No native RustPython execution was attempted. Full workspace/C-API suites and cross-platform runtime checks remain unrun; hosted CI is required. The buffer-callback follow-up passed 35 bounded pinned-CPython assertions covering bytearray mutation/reentry, generic export retention, Python buffer release order, repr exceptions and success/failure cleanup. Exact-source independent review confirmed that all data guards end before callbacks while export ownership survives error creation. Final follow-up threaded cargo check passed in 1m05s and all-targets Clippy in 2m14s, with exactly the same four baseline diagnostics. Normal commit hooks and diff checks passed. Native RustPython and C-API runtime execution remain unrun; hosted validation is pending. Remaining limits The existing ordinary float constructor's keyword-versus-arity diagnostic precedence remains outside this conversion group. Formatting consumers now preserve WTF-8; the shared helper migration itself is tracked in #9700. Native float conversion still has its existing missing-type-name precision difference for unusually long names. Other numeric arithmetic and extreme allocating integer-round behavior remain outside scope. No runtime expected failure is claimed resolved without execution. AI-assisted contribution by OpenAI Codex, disclosed in the commit trailer. Summary by CodeRabbit Bug Fixes Improved numeric conversions for floats and complex numbers, including handling of special conversion methods and complex subclasses. Updated rounding and truncation behavior for exact values, custom numeric types, and values too large to represent. Improved error reporting for invalid numeric conversions and overflow in summation. Corrected handling of large step counts in nextafter and underscores in numeric strings containing a null character.

Open Graph Description: Summary Group CPython 3.15 numeric conversion boundaries in 433 changed production lines (+219/-214): Reuse ArgIntoFloat and ArgIntoComplex to distinguish native scalar conversion from constructo...

X Description: Summary Group CPython 3.15 numeric conversion boundaries in 433 changed production lines (+219/-214): Reuse ArgIntoFloat and ArgIntoComplex to distinguish native scalar conversion from constructo...

Opengraph URL: https://github.com/RustPython/RustPython/pull/9697

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:6b03a88f-2fd9-3e9b-3b20-fad5bf421445
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBDEE:1CCECA:12796C8:189D358:6B01F932
html-safe-nonce7cb654be9e4eaa650fd0336745a02e1648f06f5f040ade4103e6562e068b6b94
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREVFOjFDQ0VDQToxMjc5NkM4OjE4OUQzNTg6NkIwMUY5MzIiLCJ2aXNpdG9yX2lkIjoiODY4NTIwMTI2MzM4Nzg2NzQ0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf6dfa3fad47a2dab5c08a87373c9366b38723282f64282a957081ba964a0a2a8
hovercard-subject-tagpull_request:5152940212
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9697/files
twitter:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/336763669?s=400&v=4
og:image:altSummary Group CPython 3.15 numeric conversion boundaries in 433 changed production lines (+219/-214): Reuse ArgIntoFloat and ArgIntoComplex to distinguish native scalar conversion from constructo...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/9697/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9697%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9697%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/9697/files
Reloadhttps://github.com/RustPython/RustPython/pull/9697/files
Reloadhttps://github.com/RustPython/RustPython/pull/9697/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
youknowdot:fix/numeric-conversion-controls-20261104https://github.com/youknowdot/RustPython/tree/fix/numeric-conversion-controls-20261104
Conversation 6 https://github.com/RustPython/RustPython/pull/9697
Commits 5 https://github.com/RustPython/RustPython/pull/9697/commits
Checks 27 https://github.com/RustPython/RustPython/pull/9697/checks
Files changed https://github.com/RustPython/RustPython/pull/9697/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9697/files
Align numeric conversion and rounding boundaries https://github.com/RustPython/RustPython/pull/9697/files#top
Show all changes 5 commits https://github.com/RustPython/RustPython/pull/9697/files
e4eda87 Align numeric scalar conversion boundaries with CPython youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9697/commits/e4eda87989ec8c971a9ec9a119729139187ada56
6541993 Align float rounding and nextafter boundaries youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9697/commits/65419939ebee7a5a0b73b2875f0cb886d9f3d077
3bc76fd Align native math conversion and streaming controls youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9697/commits/3bc76fd9c107013e41299529430cb3b6b43ca56f
a97dc96 Bind streaming sum callback lifetime explicitly youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9697/commits/a97dc9662dc65bda00ea74f00847ea18d641e9b1
a350311 Release float parsing guards before error callbacks youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9697/commits/a3503116e424367f2c0e84d486d4b08a592bbdb8
Clear filters https://github.com/RustPython/RustPython/pull/9697/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9697/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9697/files
math.rs https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
complex.rs https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
float.rs https://github.com/RustPython/RustPython/pull/9697/files#diff-4deb5676286995e76a9c87099407a5d64a7a57a6ee9ca97a059e79e649bc0dca
number.rs https://github.com/RustPython/RustPython/pull/9697/files#diff-4b6c8f777cc85a356e8cfd03078d3119eeecaa76f326aac365e67c91c724a8ae
number.rs https://github.com/RustPython/RustPython/pull/9697/files#diff-66b4fff210b902daa0770fd938ce60eac9501e55c8d8a525cf8f3afad454af0e
vm_object.rs https://github.com/RustPython/RustPython/pull/9697/files#diff-8d455749c67df5f6030ce84784d39256f31f0bec713e953d171a27fd300d1d27
crates/stdlib/src/math.rshttps://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
View file https://github.com/youknowdot/RustPython/blob/a3503116e424367f2c0e84d486d4b08a592bbdb8/crates/stdlib/src/math.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9697/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
https://github.com/RustPython/RustPython/pull/9697/files#diff-89a82797903807f93fd800a07d85c4fc0040354febe4b3544e5f9ed8e9fec640
crates/vm/src/builtins/complex.rshttps://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
View file https://github.com/youknowdot/RustPython/blob/a3503116e424367f2c0e84d486d4b08a592bbdb8/crates/vm/src/builtins/complex.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9697/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
https://github.com/RustPython/RustPython/pull/9697/files#diff-b0ba58a1a769c49088c60a0a76a7a99bc1e710180d4373aaf2d287a004a362f5
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9697/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9697/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.