René's URL Explorer Experiment


Title: Replace runtime type-name checks with type identity by youknowdot · Pull Request #9723 · RustPython/RustPython · GitHub

Open Graph Title: Replace runtime type-name checks with type identity by youknowdot · Pull Request #9723 · RustPython/RustPython

X Title: Replace runtime type-name checks with type identity by youknowdot · Pull Request #9723 · RustPython/RustPython

Description: Summary Follow up on #9679 by replacing the remaining native type-name identity decisions: Restrict OSError errno dispatch and builtin set repr selection to the actual builtin types. Compare ctypes simple bases by identity, so a subclass named _SimpleCData cannot change repr or OUT conversion. Replace the HRESULT name heuristic with cached _check_retval_ semantics and the HRESULT calling-convention flag. Preserve checker snapshot/fallback rules and allocate simple-subclass results without invoking Python constructors. Check actual inheritance in the initializer debug diagnostic instead of counting names in exception text. Register COMError's native initializer so Python subclasses and explicit super().__init__ calls retain its argument and attribute-assignment behavior. Python regressions cover spoofed names, renaming, checker mutation, callable lookup errors, native result construction, and Windows HRESULT cases. No Lib synchronization files or existing test assertions are changed; no Python behavior tests are added in Rust. The audit retained textual names used for diagnostics, serialization, capsule/JavaScript protocols, and existing test labels. Mirrored upstream Lib conventions are outside these native runtime fixes. Validation Rebased on main 0abb21ac2b, including #9728. All six original commits were unchanged by range-diff. The COMError constructor passed metadata compilation and a release-mode RustPython probe in an isolated Linux checkout with only its platform gate temporarily opened. Verified subclass assignment events, direct and super() initialization, receiver checks, arity, heap/immutable flags, name and docstring. The published source remains Windows-only; actual Windows CI for the updated head is pending. Final VM and test-target compilation passed. Six RustPython snippet tests passed through pytest: builtin exceptions/set and ctypes, calls, by-value and from-buffer cases. Canonical test_exception_hierarchy, test_set, and test_ctypes.test_repr passed (662 tests run; one case skipped). test_ctypes.test_checkretval and test_ctypes.test_functions were skipped because _ctypes_test is unavailable locally. New focused cases also passed CPython. Normal commit hooks, formatting, and whitespace checks passed. C-API tests passed: 129 passed, 4 ignored; doc tests passed. Full-workspace validation remains incomplete: after resolving the missing-libffi link locally, optimized VM unit-test compilation received SIGKILL. Strict Clippy is blocked by existing unrelated lints (including posix.rs needless collection); no new lint remains in the changed code. Windows execution is not available locally. AI assistance: OpenAI Codex performed the audit, implementation, reference probes, tests, and independent source review; model version was not exposed. Summary by CodeRabbit Bug Fixes Set subclasses now display their class name in representations, even when it matches the built-in set name or changes at runtime. Built-in sets retain their usual representation. OSError subclasses with names matching OSError now preserve their own type when constructed. Improved ctypes callback metadata handling, restype validation and updates, and return-value conversion for custom types. Windows ctypes calls now handle COM interface identifiers and provide improved error formatting and COM error details. Tests Added coverage for set and OSError subclass behavior, ctypes callbacks and return values, and Windows error handling.

Open Graph Description: Summary Follow up on #9679 by replacing the remaining native type-name identity decisions: Restrict OSError errno dispatch and builtin set repr selection to the actual builtin types. Compare ctype...

X Description: Summary Follow up on #9679 by replacing the remaining native type-name identity decisions: Restrict OSError errno dispatch and builtin set repr selection to the actual builtin types. Compare ctype...

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

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:8546ea44-7a7a-f7c6-5c9d-a25cd21551a4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCE9E:215B92:2F29DBA:3ED4A44:6B01DE4E
html-safe-nonce216f723c238a0a59c07bb32453166b763eb8d76b23bbefe9b366e3d8855919b3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTlFOjIxNUI5MjoyRjI5REJBOjNFRDRBNDQ6NkIwMURFNEUiLCJ2aXNpdG9yX2lkIjoiMjkwODc3NzU0NjU4Nzk1NDc2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1865a8eff395a995b9ca8758f43f86abda3c8466103a6003c86f9a1f46f4efe9
hovercard-subject-tagpull_request:5165295886
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/9723/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 Follow up on #9679 by replacing the remaining native type-name identity decisions: Restrict OSError errno dispatch and builtin set repr selection to the actual builtin types. Compare ctype...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/9723/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9723%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%2F9723%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/9723/files
Reloadhttps://github.com/RustPython/RustPython/pull/9723/files
Reloadhttps://github.com/RustPython/RustPython/pull/9723/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:actual-type-identity-20261105https://github.com/youknowdot/RustPython/tree/actual-type-identity-20261105
Conversation 13 https://github.com/RustPython/RustPython/pull/9723
Commits 7 https://github.com/RustPython/RustPython/pull/9723/commits
Checks 28 https://github.com/RustPython/RustPython/pull/9723/checks
Files changed https://github.com/RustPython/RustPython/pull/9723/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9723/files
Replace runtime type-name checks with type identity https://github.com/RustPython/RustPython/pull/9723/files#top
Show all changes 7 commits https://github.com/RustPython/RustPython/pull/9723/files
7c9de68 Replace runtime type-name checks with type identity youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/7c9de6819fbd80a9430419aad016fea70b783c82
2ece3ac Match CPython ctypes metadata and finalizer semantics youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/2ece3ac4825c3547c664c0f52aee72e2d86edb7d
a68fe9c Complete ctypes restype deletion and Windows error handling youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/a68fe9c7becea46a68b6f4d2095d84a5f07b33b8
9000469 Use class-local cached ctypes callback metadata youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/90004698b40e041fd52734b05ed9dcd64d46aa48
e5dea97 Use cached ctypes argtypes for ordinary function calls youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/e5dea97229b92b33a3ef91a4359ba96079f21cf3
5f5835b Use public BaseException export in Windows COM initialization youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/5f5835b730552f804fe34db9a0f3c2bba1c2b524
803a9cb Preserve COMError initialization in Python subclasses codex Nov 6, 2026 https://github.com/RustPython/RustPython/pull/9723/commits/803a9cbbdf715b0e0c86c08264587286fd7514cf
Clear filters https://github.com/RustPython/RustPython/pull/9723/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9723/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9723/files
test_win32_com_foreign_func.py https://github.com/RustPython/RustPython/pull/9723/files#diff-5c53d6053c592de0f9c19599c30996c8641235e1b106a29bf20be7b02e512277
ctypes.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-0c472fcbece94f09d8398d170b05bde9f0b147557347c454000d0a7252190fc8
set.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-ca3250b43726cb4327f8b4f6d413151036abc2f00f7c3197f55432013ca2c07f
exceptions.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
_ctypes.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
base.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-16c64cd355bd8034d61677ad8e407239d548e0e35c48ee05e951e03e93aa1781
function.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-d4cf72f95963a6d3e08f9e7e53594d6b5e2cc7711afbc0b490894d97dc8d8648
simple.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-640c11bed665f401309f30eaa8f59ef7ca4c930c57bc97dbf036e19030e1e64a
slot.rs https://github.com/RustPython/RustPython/pull/9723/files#diff-1b5587c15bdfe9ff552fbc35e014eef20d6b7934fbb31b922cf35d87e8837b7b
builtin_exceptions.py https://github.com/RustPython/RustPython/pull/9723/files#diff-9948afa9cc8e4a175f769771bdb1930355f76b99f3dface36d968c35561b7d1d
builtin_set.py https://github.com/RustPython/RustPython/pull/9723/files#diff-49fd7f7d95c68ebdcf476b292e14e8698f1b0bf06c065fee93f13440128597b3
stdlib_ctypes.py https://github.com/RustPython/RustPython/pull/9723/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
Lib/test/test_ctypes/test_win32_com_foreign_func.pyhttps://github.com/RustPython/RustPython/pull/9723/files#diff-5c53d6053c592de0f9c19599c30996c8641235e1b106a29bf20be7b02e512277
View file https://github.com/youknowdot/RustPython/blob/803a9cbbdf715b0e0c86c08264587286fd7514cf/Lib/test/test_ctypes/test_win32_com_foreign_func.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9723/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9723/files#diff-5c53d6053c592de0f9c19599c30996c8641235e1b106a29bf20be7b02e512277
https://github.com/RustPython/RustPython/pull/9723/files#diff-5c53d6053c592de0f9c19599c30996c8641235e1b106a29bf20be7b02e512277
crates/host_env/src/ctypes.rshttps://github.com/RustPython/RustPython/pull/9723/files#diff-0c472fcbece94f09d8398d170b05bde9f0b147557347c454000d0a7252190fc8
View file https://github.com/youknowdot/RustPython/blob/803a9cbbdf715b0e0c86c08264587286fd7514cf/crates/host_env/src/ctypes.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9723/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9723/files#diff-0c472fcbece94f09d8398d170b05bde9f0b147557347c454000d0a7252190fc8
https://github.com/RustPython/RustPython/pull/9723/files#diff-0c472fcbece94f09d8398d170b05bde9f0b147557347c454000d0a7252190fc8
https://github.com/RustPython/RustPython/pull/9723/files#diff-0c472fcbece94f09d8398d170b05bde9f0b147557347c454000d0a7252190fc8
crates/vm/src/builtins/set.rshttps://github.com/RustPython/RustPython/pull/9723/files#diff-ca3250b43726cb4327f8b4f6d413151036abc2f00f7c3197f55432013ca2c07f
View file https://github.com/youknowdot/RustPython/blob/803a9cbbdf715b0e0c86c08264587286fd7514cf/crates/vm/src/builtins/set.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9723/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9723/files#diff-ca3250b43726cb4327f8b4f6d413151036abc2f00f7c3197f55432013ca2c07f
https://github.com/RustPython/RustPython/pull/9723/files#diff-ca3250b43726cb4327f8b4f6d413151036abc2f00f7c3197f55432013ca2c07f
crates/vm/src/exceptions.rshttps://github.com/RustPython/RustPython/pull/9723/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
View file https://github.com/youknowdot/RustPython/blob/803a9cbbdf715b0e0c86c08264587286fd7514cf/crates/vm/src/exceptions.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9723/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9723/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
https://github.com/RustPython/RustPython/pull/9723/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
crates/vm/src/stdlib/_ctypes.rshttps://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
View file https://github.com/youknowdot/RustPython/blob/803a9cbbdf715b0e0c86c08264587286fd7514cf/crates/vm/src/stdlib/_ctypes.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9723/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
https://github.com/RustPython/RustPython/pull/9723/files#diff-d2bf8c03d89a90728436dbecb8b7f929c67d08ff5d6e18b2a0fc279e8fe77a8d
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9723/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9723/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.