Repository navigation
Sync ten foundational Python libraries with Python 3.15 - #9140
Conversation
Migrate _py_abc, stat, genericpath, ntpath, posixpath, functools, gettext, string, optparse, and mimetypes with related canonical tests using scripts/update_lib from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Preserve the existing pure LRU hash-count expected failure. Assisted-by: OpenAI Codex:model version unavailable
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters: 18
📒 Files selected for processing: 1
✨ Finishing Touches
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. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: :4: SyntaxWarning: invalid decimal literal dependencies:
dependent tests: (3 tests)
[ ] lib: cpython/Lib/pprint.py dependencies:
dependent tests: (98 tests)
[x] lib: cpython/Lib/ntpath.py dependencies:
dependent tests: (55 tests)
[x] lib: cpython/Lib/genericpath.py dependencies:
dependent tests: (40 tests)
[x] lib: cpython/Lib/stat.py dependencies:
dependent tests: (125 tests)
[x] lib: cpython/Lib/abc.py dependencies:
dependent tests: (11 tests)
[x] lib: cpython/Lib/string dependencies:
dependent tests: (77 tests)
[x] lib: cpython/Lib/posixpath.py dependencies:
dependent tests: (75 tests)
[x] lib: cpython/Lib/mimetypes.py dependencies:
dependent tests: (44 tests)
[x] lib: cpython/Lib/gettext.py dependencies:
dependent tests: (209 tests)
[x] lib: cpython/Lib/functools.py dependencies:
dependent tests: (51 tests)
Legend:
|
Emit positional-only annotations before regular positional annotations, matching declaration order and the canonical functools regression coverage. Assisted-by: OpenAI Codex:model version unavailable
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea77258db0
ℹ️ 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".
| mime_dict = mimetypes.read_mime_types(filename) | ||
| mock_open.assert_called_with(filename, encoding='utf-8', | ||
| errors='surrogateescape') | ||
| mock_open.assert_called_with(filename, encoding='utf-8') |
There was a problem hiding this comment.
Restore the deleted malformed-MIME regression tests
When a MIME type file contains malformed UTF-8, this assertion change is accompanied by deletion of test_read_mime_types_invalid_utf8_comment and test_read_mime_types_invalid_utf8_type, eliminating the only regression coverage for the prior surrogate-escape behavior. The repository's critical test rules forbid both changing assertions and deleting test logic; retain these cases (marking them expected-failure if the strict behavior is currently required) instead of removing them.
AGENTS.md reference: AGENTS.md:L273-L275
Useful? React with 👍 / 👎.
| raise TypeError(f'{funcname} requires at least ' | ||
| '1 positional argument') | ||
| return self._dispatch(args[0].__class__).__get__(self._obj, self._cls)(*args, **kwargs) | ||
| method = self._dispatch(args[self._dispatch_arg_index].__class__) |
There was a problem hiding this comment.
Guard the second singledispatch argument before indexing
When a plain-function singledispatchmethod is accessed on the class and called with only its explicit instance, such as C.m(C()) for def m(self, value), _dispatch_arg_index is 1 while the existing guard only rejects an empty tuple. This line consequently raises IndexError: tuple index out of range instead of the expected missing-argument TypeError; check that the selected dispatch index exists before indexing.
Useful? React with 👍 / 👎.
Summary
Split ten dependency-first Python libraries from #8954, with the minimal native annotation-order prerequisite exposed by their canonical functools coverage.
The ten modules, ordered with shared dependencies before their consumers:
_py_abcstatgenericpathntpathposixpathfunctoolsgettextstring(one package)optparsemimetypesRun actual
scripts/update_lib migrateindividually for 25 implementation/test/support paths from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Seven paths remain unchanged; the resulting diff is 18 files, +707/-194. The only departure from canonical source is the existingTestLRUPy.test_lru_hash_only_onceexpected-failure override, with its original reason and body preserved.Includes ABC
__class__fallback parity, stat constants, pathALL_BUT_LAST/positional-only APIs, functools dispatch/cache updates, immutable gettext/optparse tables, string cleanup and MIME mapping/UTF-8 changes. Native ABC/functools prerequisites are on main except for the focused annotation-order correction included below. Deferred lazy-import/GC/native-dependent families are outside this batch.Validation
threading,stdlib,stdio,importlib,host_env;--no-default-features --bin rustpython -j1 --offline --locked.This is bounded selected-body coverage, not full test_stat/test_ntpath or full module-suite coverage, and does not claim Windows, GC/UAF, thread-stress or general subprocess coverage.
AI assistance is disclosed in the commit trailer.
CI repair: positional-only annotation ordering
The new canonical
TestSingleDispatch.test_positional_only_argumentexposed a native prerequisite in Ubuntu CI: compiler annotation emission placed regular positional parameters before positional-only parameters, so annotation-inferred singledispatch registered the wrong type. Follow-upea77258db0f8c442c2be478e67c237983fdeee0aadds the exact +4/-4 compiler fix from the remaining mega changes. It emits positional-only annotations first, matching CPython. No Lib assertion, fixture, marker or expected-failure change was made.The repaired head passed normal hooks, a fresh matching narrow release build, and strict scoped all-target
rustpython-codegenClippy. The original 23 bounded selections and natural startup probe passed again, as did the unchanged failing canonical method and a tiny six-entry annotation-order oracle. The same oracle passed on pinned exact-final CPython. All runs used fresh bounded processes with -S/-B, optimize0, C locale/private temporary directories and verified source/binary receipts; all original library hashes are unchanged. These are selected-case results, not full-suite coverage. Existing CI failures remain visible pending the new-head runs.