GeezerVison is showing github.com — Fix native ABC instance checks on Python 3.15 by youknowdot · Pull Request #9067 · RustPython/RustPython
Conversation
youknowdot
commented
Oct 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Current revision
Targets main after #8950, with one logical commit: 082afb3de1722a1ca279ecb8323ec7a7be003849 (parent 4e3b2f40395a4235841aaca811843d97ed68af0d). The unique patch is byte-identical to the prior reviewed head and now includes main's merged #9082 shared CI fix and #9081 REPL fix; original author attribution and assistance trailers are retained. No files under Lib/ are changed.
Normal hooks, whitespace checks, and independent tree/history review passed. The temporary [skip ci] marker is removed and normal CI is enabled for this final head. No new local build or runtime test is claimed. Validation recorded below belongs to earlier revisions unless explicitly stated otherwise.
Rebased once after #9082 and #9081 merged to repair the shared Python 3.15 IO reference failure. Normal commit hooks and exact range-diff/patch-equivalence checks pass. Exact-head hosted CI is running; no additional local runtime validation is claimed.
Summary
Extract the native ABC instance-check fallback from #8954, matching the Python 3.15.0 reference used by #8950.
If reading an instance's __class__ raises AttributeError, use its actual type for ABC checks. Other exceptions still propagate unchanged. This preserves virtual-subclass registration and negative-cache invalidation for such instances.
The unique commit changes native _abc and preserves the original Python regression for missing __class__, registration, and propagation of other exceptions. The pure-Python _py_abc fallback remains outside this PR's unique change.
Reference: CPython 3.15.0 source.
Scope
The unique commit changes no files under Lib/ and inherits .python-version 3.15.0 from #8950. The former shared Python 3.14.8 version pin and TextIOWrapper deletion change have been removed. The Python 3.15.0 TextIOWrapper setter checks attachment before rejecting _CHUNK_SIZE deletion, so the old I/O prerequisite does not belong in this stack.
Validation
- Independent source review against the exact CPython 3.15.0 reference passed.
- The unique native implementation and original Python regression are preserved; the comparison above contains only the two files described here.
- Configured commit hooks passed for
74c9775a5a9ae1f5fbdba476f4fb5a616da5f293.
- No local build or runtime tests were run for this new Python 3.15 stack. Previous local and hosted results belong to the older Python 3.14.8 heads and do not validate this head.
- Normal hosted CI on this exact head is pending.
AI-assisted with OpenAI Codex.
Summary by CodeRabbit
- New Features
- RustPython now targets Python 3.15, with updated runtime version information.
- Improved compatibility for sequence multiplication, logarithms, time conversion, and several standard-library behaviors.
- Bug Fixes
- Fixed ABC instance checks when an object’s
__class__ attribute is unavailable.
- Corrected edge-case handling for memory-mapped searches, struct formats, CSV dialect attributes, and built-in module creation.
- Improved error messages for formatting and invalid AST construction.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
coderabbitai
Bot
commented
Oct 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Note
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Use the following commands to manage reviews:
@coderabbitai resume to resume automatic reviews.
@coderabbitai review to trigger a single review.
Use the checkboxes below for quick actions:
- ▶️ Resume reviews
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
-
-
-
-
-
-
-
-
-
-
-
⚙️ Run configuration
-
-
-
-
-
-
-
-
-
-
-
-
- Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e2d5bbcc-2aa3-40a9-8095-bce962145d73
📥 Commits
-
-
-
-
-
-
-
-
-
-
-
-
Reviewing files that changed from the base of the PR and between 098141b and 695ebec.
⛔ Files ignored due to path filters (10)
-
-
-
-
-
-
-
-
-
-
-
-
Lib/encodings/__init__.py is excluded by !Lib/**
Lib/sysconfig/__init__.py is excluded by !Lib/**
Lib/test/datetimetester.py is excluded by !Lib/**
Lib/test/pickletester.py is excluded by !Lib/**
Lib/test/test_ast/test_ast.py is excluded by !Lib/**
Lib/test/test_cmd_line_script.py is excluded by !Lib/**
Lib/test/test_codecs.py is excluded by !Lib/**
Lib/test/test_peepholer.py is excluded by !Lib/**
Lib/test/test_struct.py is excluded by !Lib/**
Lib/test/test_time.py is excluded by !Lib/**
📒 Files selected for processing (47)
-
-
-
-
-
-
-
-
-
-
-
-
.claude/scripts/setup-env.sh
.github/workflows/ci.yaml
.github/workflows/pyperformance.yaml
.github/workflows/update-doc-db.yml
.github/workflows/upgrade-pylib.lock.yml
.github/workflows/upgrade-pylib.md
.python-version
AGENTS.md
CONTRIBUTING.md
README.md
crates/host_env/src/time.rs
crates/stdlib/src/csv.rs
crates/stdlib/src/math.rs
crates/stdlib/src/mmap.rs
crates/stdlib/src/pystruct.rs
crates/vm/build.rs
crates/vm/src/builtins/mappingproxy.rs
crates/vm/src/builtins/memory.rs
crates/vm/src/cformat.rs
crates/vm/src/codecs.rs
crates/vm/src/exceptions.rs
crates/vm/src/frame.rs
crates/vm/src/stdlib/_ast.rs
crates/vm/src/stdlib/_ast/python.rs
crates/vm/src/stdlib/_imp.rs
crates/vm/src/stdlib/builtins.rs
crates/vm/src/stdlib/sys.rs
crates/vm/src/stdlib/time.rs
crates/vm/src/vm/mod.rs
extra_tests/snippets/builtin___main__.py
extra_tests/snippets/builtin_mappingproxy.py
extra_tests/snippets/builtin_memoryview.py
extra_tests/snippets/builtin_signature.py
extra_tests/snippets/builtin_str.py
extra_tests/snippets/operator_arithmetic.py
extra_tests/snippets/stdlib_ast.py
extra_tests/snippets/stdlib_codecs_wide.py
extra_tests/snippets/stdlib_csv.py
extra_tests/snippets/stdlib_datetime.py
extra_tests/snippets/stdlib_imp.py
extra_tests/snippets/stdlib_math.py
extra_tests/snippets/stdlib_mmap.py
extra_tests/snippets/stdlib_struct.py
extra_tests/snippets/stdlib_sys.py
extra_tests/snippets/stdlib_time.py
scripts/libc_posix.py
scripts/whats_left.py
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
-
📝 Walkthrough
-
📝 Walkthrough
-
-
📝 Walkthrough
-
-
-
📝 Walkthrough
-
-
-
-
📝 Walkthrough
-
-
-
-
-
📝 Walkthrough
-
-
-
-
-
-
📝 Walkthrough
-
-
-
-
-
-
-
📝 Walkthrough
-
-
-
-
-
-
-
-
📝 Walkthrough
-
-
-
-
-
-
-
-
-
📝 Walkthrough
-
-
-
-
-
-
-
-
-
-
📝 Walkthrough
-
-
-
-
-
-
-
-
-
-
-
Walkthrough
The PR advances RustPython’s target to Python 3.15 and updates development and CI setup. It also changes Windows timestamp conversion and several runtime and standard-library behaviors, with corresponding regression tests.
Changes
Python 3.15 target and tooling
| Layer / File(s) |
Summary |
Update Python version metadata .python-version, AGENTS.md, CONTRIBUTING.md, README.md, crates/vm/build.rs, crates/vm/src/stdlib/_ast.rs, crates/vm/src/stdlib/sys.rs, crates/vm/src/vm/mod.rs, scripts/libc_posix.py, scripts/whats_left.py, extra_tests/snippets/stdlib_sys.py |
Version pins, compatibility statements, parser defaults, interpreter metadata, and version checks now identify Python 3.15. |
Update Python setup and workflows .claude/scripts/setup-env.sh, .github/workflows/ci.yaml, .github/workflows/pyperformance.yaml, .github/workflows/update-doc-db.yml, .github/workflows/upgrade-pylib.* |
Development setup and selected workflows now select or validate CPython 3.15. The lint workflow remains pinned to CPython 3.14.7, and one Windows launcher version test is excluded. |
Windows timestamp conversion
| Layer / File(s) |
Summary |
Convert negative Windows timestamps crates/host_env/src/time.rs, crates/vm/src/exceptions.rs, crates/vm/src/stdlib/time.rs, extra_tests/snippets/stdlib_datetime.py, extra_tests/snippets/stdlib_time.py |
Windows UTC and local conversion use FILETIME for negative timestamps. Out-of-range FILETIME values map to OverflowError; OS failures use the existing I/O error conversion. |
Sleep duration conversion
| Layer / File(s) |
Summary |
Convert sleep durations crates/vm/src/stdlib/time.rs, extra_tests/snippets/stdlib_time.py |
time.sleep handles index conversion, integer range errors, and float conversion. Tests cover negative durations, index precedence, and propagated conversion errors. |
ABC instance checks
| Layer / File(s) |
Summary |
Handle missing class attributes crates/vm/src/stdlib/_abc.rs, extra_tests/snippets/stdlib_abc.py |
_abc_instancecheck uses the runtime class when __class__ is unavailable. Tests also check that other exceptions propagate. |
CSV dialect attribute lookup
| Layer / File(s) |
Summary |
Propagate dialect lookup errors crates/stdlib/src/csv.rs, extra_tests/snippets/stdlib_csv.py |
Dialect construction propagates attribute lookup errors other than AttributeError. Tests check defaults for missing attributes and lookup order. |
Math logarithm conversion
| Layer / File(s) |
Summary |
Handle large integer logarithms crates/stdlib/src/math.rs, extra_tests/snippets/stdlib_math.py |
log, log2, and log10 use a shared conversion path that can evaluate indexable integers after float conversion overflows. Tests cover conversion order and errors. |
Memory-mapped search offsets
| Layer / File(s) |
Summary |
Handle search start offsets crates/stdlib/src/mmap.rs, extra_tests/snippets/stdlib_mmap.py |
Nonnegative search offsets are no longer clamped to the mapping size. Tests check searches beyond the mapping end. |
Struct format handling
| Layer / File(s) |
Summary |
Update struct format errors crates/stdlib/src/pystruct.rs, extra_tests/snippets/stdlib_struct.py |
Non-ASCII formats now raise ValueError. Reading format from an uninitialized Struct raises AttributeError. |
Mapping proxy comparisons
| Layer / File(s) |
Summary |
Restrict mapping proxy comparisons crates/vm/src/builtins/mappingproxy.rs, extra_tests/snippets/builtin_mappingproxy.py |
Mapping proxies delegate equality and inequality, and decline other comparisons. Tests check comparison results and ordering errors. |
Percent-format conversion errors
| Layer / File(s) |
Summary |
Include argument context in format errors crates/vm/src/cformat.rs, extra_tests/snippets/builtin_str.py |
Decimal conversion errors identify a scalar, tuple position, or mapping key. Positional argument counts include consumed star arguments. |
Codec registry name normalization
| Layer / File(s) |
Summary |
Normalize codec registry names crates/vm/src/codecs.rs, extra_tests/snippets/stdlib_codecs_wide.py |
Registry operations lowercase ASCII uppercase letters and replace spaces with hyphens while preserving punctuation and underscores. |
Sequence multiplication specialization
| Layer / File(s) |
Summary |
Specialize sequence multiplication crates/vm/src/frame.rs, extra_tests/snippets/operator_arithmetic.py |
Binary operation specialization covers exact strings, bytes, and tuples multiplied by exact integers. Tests cover operand order, counts, overflow, subclasses, and overrides. |
AST node construction
| Layer / File(s) |
Summary |
Validate AST node fields crates/vm/src/stdlib/_ast/python.rs, extra_tests/snippets/stdlib_ast.py |
AST constructors raise TypeError for invalid and missing fields instead of issuing deprecation warnings. Tests cover field errors, defaults, and cyclic fixtures. |
Built-in module creation
| Layer / File(s) |
Summary |
Validate built-in module names crates/vm/src/stdlib/_imp.rs, extra_tests/snippets/stdlib_imp.py |
create_builtin validates module names before checking the module cache and raises ModuleNotFoundError for unregistered built-in names. |
Built-in parameter names
| Layer / File(s) |
Summary |
Update built-in parameter names crates/vm/src/stdlib/builtins.rs, extra_tests/snippets/builtin_signature.py |
abs uses number and bin uses integer as input parameter names. Signature tests expect these names. |
Main module cache metadata
| Layer / File(s) |
Summary |
Leave __cached__ unset crates/vm/src/vm/mod.rs, extra_tests/snippets/builtin___main__.py |
with_simple_run no longer modifies __cached__. The test checks that the attribute is absent. |
Memoryview cast error message
| Layer / File(s) |
Summary |
Update cast error wording crates/vm/src/builtins/memory.rs, extra_tests/snippets/builtin_memoryview.py |
The error now refers to a native format. The accepted cast formats remain unchanged. |
Priority: ➖ Normal
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Feature
Suggested reviewers: youknowone
Merge Risk: ⚪ Minimal · up to 695eb
No actionable issue remains from the supplied evidence; the PR is mergeable after normal checks.
Pre-merge checks | 4 | 1
-
❌ Failed checks (1 inconclusive)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 69 functions across 43 files. (10 skipped… |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
-
| Check name |
Status |
Explanation |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title clearly identifies the native ABC instance-check change, which is the stated objective. The Python 3.15 reference is consistent with the compatibility update context. |
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 30.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 69 functions across 43 files. (10 skipped: 9 unsupported, 1 too large.)
✨ Finishing Touches
-
-
-
-
-
-
-
-
-
-
-
-
🧪 Generate unit tests (beta)
-
-
-
-
-
-
-
-
-
-
-
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-11T14:29:31.143687Z |
082afb3 |
New commits |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c12cc7360b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
|
|
|
instance = NoClassAttribute()
|
|
|
assert not isinstance(instance, CustomInterface)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the newly added test assertions
This assertion is part of a new test scenario added to extra_tests/snippets/stdlib_abc.py, but the repository's critical test-modification policy permits only adding expected-failure decorators or removing those decorators and their TODO comments after a fix. Since this change is neither permitted case, remove the test-file addition before landing the Rust fix.
AGENTS.md reference: AGENTS.md:L277-L279
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
auto-merge was automatically disabled
October 10, 2026 15:39 Head branch was pushed to by a user without write access
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
📦 Library Dependencies
The following Lib/ modules were modified. Here are their dependencies:
[ ] test: cpython/Lib/test/test_mmap.py (TODO: 19)
dependencies:
dependent tests: (2 tests)
- mmap: test_os
- multiprocessing.shared_memory: test_genericalias
Legend:
[+] path exists in CPython
[x] up-to-date, [ ] outdated
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 098141bbbf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+169
to
+173
|
|
for wrapper in (textio, uninitialized_textio, detached_textio):
|
|
|
with assert_raises(AttributeError) as error:
|
|
|
del wrapper._CHUNK_SIZE
|
|
|
assert str(error.exception) == (
|
|
|
"attribute '_CHUNK_SIZE' of '_io.TextIOWrapper' objects cannot be deleted"
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert the I/O snippet test rewrite
The repository's critical test-modification rule permits only adding expected-failure decorators or removing them with their TODO comments, whereas this block replaces the prior deletion expectation and adds new assertion logic and test data. Revert the extra_tests/snippets/stdlib_io.py edits and leave the behavioral correction in Rust.
AGENTS.md reference: AGENTS.md:L273-L279
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+89
to
+92
|
|
# Python 3.14.8 retains ParamSpec bounds without converting or validating them.
|
|
|
assert ParamSpec("Unbounded").__bound__ is None
|
|
|
for bound in (None, "int", "not valid Python!", (int, str), object()):
|
|
|
assert ParamSpec("BoundSpec", bound=bound).__bound__ is bound
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the new ParamSpec test assertions
This loop and its assertions add test logic and test data, but the repository's critical test-file policy allows only adding expected-failure decorators or removing those decorators and their TODO comments. Remove this test-file addition rather than landing it alongside the Rust fix.
AGENTS.md reference: AGENTS.md:L273-L279
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+275
to
+277
|
|
let subclass = vm
|
|
|
.get_attribute_opt(&instance, "__class__")?
|
|
|
.unwrap_or_else(|| instance.class().to_owned().into());
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply the fallback to the pure ABC backend
When callers explicitly use _py_abc.ABCMeta (a backend the standard suite exercises at Lib/test/test_abc.py:687-690), this native-only fallback is bypassed because Lib/_py_abc.py:95 still evaluates instance.__class__ directly. Such objects therefore still raise AttributeError with the pure backend, including after virtual registration, leaving the advertised 3.14.8 ABC fix incomplete; apply the fallback to that backend too.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
youknowdot
changed the title
Fix ABC instance checks when __class__ is missing
Fix native ABC instance checks on Python 3.15
Oct 11, 2026
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Retain the native fallback and Python regression without modifying bundled Lib sources.
Assisted-by: OpenAI Codex:model identifier unavailable
Merging this PR will improve performance by 15.4%
⚡ 1 improved benchmark
✅ 61 untouched benchmarks
⏩ 4 skipped benchmarks1
Performance Changes
Tip Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing youknowdot:fix-abc-missing-class-3148 (082afb3) with main (4e3b2f4)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|