mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
* Restore consolidated frozendict implementation on current main Preserve reverse dictionary iterator fixes and the 3.15 frame imports. Keep library refreshes separate pending the runtime dependency sequencing decision. Assisted-by: OpenAI Codex:model identifier unavailable * Support scoped canonical test updates in update_lib Index conditional test classes and methods without crossing namespaces, reject ambiguous targets, and preserve inherited override indentation. Add hash-pinned whole-test copying that verifies execution context and exact source bytes, with focused Python fixtures. Assisted-by: OpenAI Codex:model identifier unavailable * Align frozendict copy support and tests with CPython 3.15 Import exact-final copy.py with update_lib; defer Mapping ABC registration to the later library stage. Generate only proven marker corrections, retain observed debug recursion-limit expected failures, and copy the complete canonical builtin-doc discovery test using hash-pinned update_lib copy-test. Assisted-by: OpenAI Codex:model identifier unavailable * Preserve decorator rationale during canonical test copying Reject differing decorator source blocks even when their ASTs match. Cover inline and multiline marker comments, guarded async methods, and CLI no-write behavior. Assisted-by: OpenAI Codex:model identifier unavailable * Finish frozendict with borrowed PyAnyDict views Use the landed PyRef target model for a transparent dict/frozendict header view, retaining objects explicitly with PyRef<PyAnyDict>. Keep targets sealed and preserve mutable-only entry points. Borrow frame globals from the object header rather than movable reference wrappers. Unify exact-TypeError key diagnostics with final CPython semantics, including callback failure propagation and no explicit cause. Keep the Python regressions in builtin_dict and test reference layout/ownership in Rust. Preserve existing canonical library updates. Assisted-by: OpenAI Codex:model identifier unavailable * Align frozendict with CPython and use CPython 3.15 tests - Name the target type in unhashable key errors through PyDict::update_arg (dict_update_arg), replacing the separate PyFrozenDict::merge_into copy of the merge logic. - Split the | operator into dict_or (_PyDict_Or) and frozendict_or. - Return the argument from frozendict(frozendict) only when the called type is frozendict. - Call through the vectorcall slot in PyCallable::invoke when there are no keyword arguments, instead of special-casing frozendict. - Add ensure_builtins (_PyEval_EnsureBuiltins) for eval/exec, and insert __builtins__ for source strings regardless of globals type. - Read __warningregistry__ and __name__ from stored globals entries and accept only None or str for the module name in setup_context. - Remove the unused PyFrozenDict::from_object. - Migrate test_dict.py, mapping_tests.py, test_copy.py and test_builtin.py to v3.15.0 with update_lib, and add test_import/data/syntax_warnings.py. - Drop builtin_dict.py frozendict tests covered by those modules, keeping the descriptor and namespace integration tests. Assisted-by: Claude Code:claude-opus-5-5 * Update crates/vm/src/builtins/dict.rs --------- Co-authored-by: Jeong YunWon <jeong@youknowone.org> Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
116 lines
3.2 KiB
Python
116 lines
3.2 KiB
Python
#!/usr/bin/env python
|
|
"""
|
|
Update library tools for RustPython.
|
|
|
|
Usage:
|
|
python scripts/update_lib quick cpython/Lib/test/test_foo.py
|
|
python scripts/update_lib copy-lib cpython/Lib/dataclasses.py
|
|
python scripts/update_lib migrate cpython/Lib/test/test_foo.py
|
|
python scripts/update_lib patches --from Lib/test/foo.py --to cpython/Lib/test/foo.py
|
|
python scripts/update_lib auto-mark Lib/test/test_foo.py
|
|
python scripts/update_lib copy-test SOURCE DESTINATION --test ClassName.method_name --source-sha256 HASH --destination-sha256 HASH
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
|
|
|
|
def main(argv: list[str] | None = None) -> int:
|
|
parser = argparse.ArgumentParser(
|
|
description="Update library tools for RustPython",
|
|
)
|
|
|
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
|
|
subparsers.add_parser(
|
|
"quick",
|
|
help="Quick update: patch + auto-mark (recommended)",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"migrate",
|
|
help="Migrate test file(s) from CPython, preserving RustPython markers",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"patches",
|
|
help="Patch management (extract/apply patches between files)",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"auto-mark",
|
|
help="Run tests and auto-mark failures with @expectedFailure",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"copy-lib",
|
|
help="Copy library file/directory from CPython (delete existing first)",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"copy-test",
|
|
help="Copy one complete canonical test from hash-pinned inputs",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"deps",
|
|
help="Show dependency information for a module",
|
|
add_help=False,
|
|
)
|
|
subparsers.add_parser(
|
|
"todo",
|
|
help="Show prioritized list of modules to update",
|
|
add_help=False,
|
|
)
|
|
|
|
args, remaining = parser.parse_known_args(argv)
|
|
|
|
if args.command == "quick":
|
|
from update_lib.cmd_quick import main as quick_main
|
|
|
|
return quick_main(remaining)
|
|
|
|
if args.command == "copy-lib":
|
|
from update_lib.cmd_copy_lib import main as copy_lib_main
|
|
|
|
return copy_lib_main(remaining)
|
|
|
|
if args.command == "copy-test":
|
|
from update_lib.cmd_copy_test import main as copy_test_main
|
|
|
|
return copy_test_main(remaining)
|
|
|
|
if args.command == "migrate":
|
|
from update_lib.cmd_migrate import main as migrate_main
|
|
|
|
return migrate_main(remaining)
|
|
|
|
if args.command == "patches":
|
|
from update_lib.cmd_patches import main as patches_main
|
|
|
|
return patches_main(remaining)
|
|
|
|
if args.command == "auto-mark":
|
|
from update_lib.cmd_auto_mark import main as cmd_auto_mark_main
|
|
|
|
return cmd_auto_mark_main(remaining)
|
|
|
|
if args.command == "deps":
|
|
from update_lib.cmd_deps import main as cmd_deps_main
|
|
|
|
return cmd_deps_main(remaining)
|
|
|
|
if args.command == "todo":
|
|
from update_lib.cmd_todo import main as cmd_todo_main
|
|
|
|
return cmd_todo_main(remaining)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|