Commit Graph
4280 Commits
Author SHA1 Message Date
Jeong, YunWonandCPython Developers 6bfdfb1bea Upgrade typing from 3.14.2 and more impl (#7057)
* Implement TypeAliasType, type annotations, and genericalias fixes

- TypeAliasType: lazy value evaluation via closures, __module__,
  __parameters__, __iter__, evaluate_value, check_type_params,
  IMMUTABLETYPE flag, Hashable/AsMapping/Iterable traits
- TypeAliasType constructor: positional-or-keyword arg validation,
  duplicate/unexpected kwarg rejection
- type.__annotations__ setter: distinguish None assignment from deletion
- Annotation scope: name as __annotate__, format as positional-only,
  __conditional_annotations__ uses Cell for both load and store
- Compiler: proper TypeParams/TypeAlias scope with closures,
  find_ann covers match/try-except handlers
- symboltable: deduplicate TypeAlias value scope code
- GenericAlias repr: handle list args, avoid deadlock in repr_arg
  by cloning items before calling repr
- AST types: remove IMMUTABLETYPE (heap types, mutable)
- pymodule macro: preserve existing __module__ getset descriptors

* Update typing from v3.14.3

* Implement TypeAliasType, type annotations, and genericalias fixes

- TypeAliasType: lazy value evaluation via closures, __module__,
  __parameters__, __iter__, evaluate_value, check_type_params,
  IMMUTABLETYPE flag, Hashable/AsMapping/Iterable traits
- TypeAliasType constructor: positional-or-keyword arg validation,
  duplicate/unexpected kwarg rejection
- type.__annotations__ setter: distinguish None assignment from deletion
- Annotation scope: name as __annotate__, format as positional-only,
  __conditional_annotations__ uses Cell for both load and store
- Compiler: proper TypeParams/TypeAlias scope with closures,
  find_ann covers match/try-except handlers
- symboltable: deduplicate TypeAlias value scope code
- GenericAlias: implement gaiterobject (generic_alias_iterator),
  starred equality comparison, starred pickle via iterator reduce,
  split attr_exceptions/attr_blocked for correct __dir__,
  make_parameters/subs_parameters handle list/tuple args recursively,
  repr_arg indexed access for mutation safety
- AST types: remove IMMUTABLETYPE (heap types, mutable)
- pymodule macro: preserve existing __module__ getset descriptors

---------

Co-authored-by: CPython Developers <>
2026-02-11 09:39:04 +09:00
Jeong, YunWon 65d54e8d51 Merge pull request #7071 from youknowone/memoryview
Update test_memoryview from v3.14.3 and impl count/index
2026-02-11 00:13:48 +09:00
Elmir fde808e663 handle type annotations in nested functions correctly (#7072)
For example in the following code:

    def foo(x: int, y: float):
        def bar(q: int):
            return q
        pass

Make sure that `foo` type annotations are correctly propogated to
it's `__annotate__` and `__annotations__` attributes.

With this chage, we'll get:

    >>>>> foo.__annotations__
    {'x': <class 'int'>, 'y': <class 'float'>}

Previously annotations where 'lost', and we would get:

    >>>>> foo.__annotations__
    {}
2026-02-11 00:08:57 +09:00
CPython Developers 91b128a466 Update test_memoryview from v3.14.3 2026-02-10 22:27:46 +09:00
Jeong, YunWon d79b41ba28 Merge pull request #7070 from ShaharNaveh/update-array
Update `test_array.py` from 3.14.3
2026-02-10 21:08:55 +09:00
ShaharNaveh f73df6a102 Update test_json from 3.14.3 2026-02-10 21:00:40 +09:00
ShaharNaveh 28ed23f7ca Update test_array.py from 3.14.3 2026-02-10 13:16:46 +02:00
ShaharNaveh 4babbf3f97 Update test_support.py from 3.14.3 2026-02-10 11:45:49 +02:00
ShaharNaveh c4e3a804cc Update test_descr.py from 3.14.3 2026-02-10 11:44:47 +02:00
ShaharNaveh bb39d2e1ce Update support.__init__.py from 3.14.3 2026-02-10 11:40:38 +02:00
Jeong, YunWon 6f1edf3b26 Remove static cache for builtins iter/reversed reduce
- Replace static_cell! cached builtins_iter/builtins_reversed with
  per-call vm.builtins.get_attr lookups to support runtime builtins
  mutation (CPython issue #101765)
- Refactor PositionIterInternal::reduce to take func, active, and
  empty callbacks; resolve builtins outside the lock to prevent
  deadlock from reentrant iterator access
- Add __reduce__ and fix reentrant next() in PyCallableIterator
- Remove expectedFailure from test_reverse_iterator_picking and
  test_reduce_mutating_builtins_iter
2026-02-10 00:49:12 +09:00
CPython Developers 177837de6b Update test_iter from v3.14.3 2026-02-10 00:48:22 +09:00
CPython Developers 48d63a6dae Update test_errno from v3.14.3 2026-02-10 00:48:22 +09:00
Jeong, YunWon c16f6f8b68 Fix signal handler after fork (#7012)
* temp regrtest save_env patch

* Refactor signal_handlers from Option to OnceCell

- Change `signal_handlers` type from `Option<Box<...>>` to
  `OnceCell<Box<...>>` so fork children can lazily initialize it
- Add `VirtualMachine::is_main_thread()` using runtime thread ID
  comparison instead of structural `signal_handlers.is_none()` check
- Initialize signal handlers in `py_os_after_fork_child()` via
  `get_or_init()` for workers that fork
- Use `get_or_init()` in `signal()` and `getsignal()` functions
- Remove `set_wakeup_fd(-1)` special-case workaround (d6d0303)
- Extract `signal::new_signal_handlers()` to deduplicate init expr
- Allow `getsignal()` from any thread (matches CPython behavior)
- Fix `set_wakeup_fd` error message to name the correct function
2026-02-10 00:38:46 +09:00
Copilot 20ad988585 Update copy module and test_copy from CPython v3.14.3 (#7062) 2026-02-10 00:05:15 +09:00
CPython Developers d1c19bef38 Update linecache from v3.14.3 2026-02-09 12:56:53 +09:00
Jeong, YunWon 470bd5990b Fix test_import: import machinery, circular imports, and script shadowing (#7034)
* Fix test_import: import machinery and errors

- Emit IMPORT_FROM instead of LOAD_ATTR for `import a.b.c as m`
- Add "partially initialized module" error for circular imports
- Add "cannot access submodule" error for initializing submodules
- Implement script shadowing detection with "consider renaming" hint
  - Detect user scripts shadowing stdlib/third-party modules
  - Compute original sys.path[0] from sys.argv[0]
  - Check sys.stdlib_module_names for stdlib detection
  - Respect safe_path setting
- Implement _imp._fix_co_filename for code source_path rewriting
- Add data parameter to _imp.get_frozen_object with marshal deser
- Fix import_from: check __spec__.has_location before using origin
- Set ImportError.path attribute on import failures
- Fix import_star error messages for non-str __all__/__dict__ items
- Always call builtins.__import__ in import_inner

* Propagate __bool__ errors from fromlist in import

Previously, try_to_bool errors were silently swallowed via .ok(),
causing fromlist with broken __bool__ to default to false.
2026-02-09 01:40:26 +09:00
Shahar Naveh 23a89663e0 Update tomllib from 3.14.3 (#7048) 2026-02-08 12:51:38 +00:00
ShaharNaveh d54cf8f12e Update difflib.py from 3.14.3 2026-02-08 20:36:35 +09:00
ShaharNaveh 32b57785c3 Update dataclasses.py from 3.14.3 2026-02-08 19:38:26 +09:00
Jeong, YunWon d2d8eeea2f Add _types module (#6807)
* _types

* builtin_function_or_method

* PyCapsule

* function_or_method

* Remove expectedFailure for test_builtin_function and test_join_nondaemon_on_shutdown
2026-02-08 19:17:03 +09:00
ShaharNaveh c29d2d9a1c Update get{opt,pass}.py from 3.14.3 2026-02-08 16:35:56 +09:00
Shahar Naveh bbe5412aea Update test_{binop,contains}.py from 3.14.3 (#7038) 2026-02-08 10:00:50 +09:00
Shahar Naveh 87289fd904 Update tests with deprecated get_c_recursion_limit (#7039) 2026-02-08 09:59:14 +09:00
ShaharNaveh bff70f957f Remove redundunt test_pickle tests 2026-02-08 08:54:38 +09:00
ShaharNaveh c00ccf7a6c Update test_sort.py from 3.14.3 2026-02-08 08:33:45 +09:00
Shahar Naveh 47f54f19c5 test__all__.py (#7037) 2026-02-07 22:42:10 +09:00
Shahar Naveh 3d283bb91f Update some libs&tests to 3.14.3 (#7006)
* Update some libs&tests to 3.14.3

* Update argparse from 3.14.3

* Update inspect

* Update `configparser.py` from 3.14.3
2026-02-07 19:09:42 +09:00
CPython Developers 75137f7cdd Update test_import from v3.14.3 2026-02-07 15:13:43 +09:00
Jeong, YunWonandCPython Developers 6b870d62ad Fix traceback, syntax errors, and exception handling (#7015)
* Update codeop from v3.14.3

* Fix traceback, syntax errors, and exception handling

- Improve unclosed bracket detection with "'(' was never closed" message
- Fix IndentationError location to point to end of line
- Implement frame.clear() with proper checks for executing/suspended frames
- Fix exception context chaining for propagated exceptions
- Add traceback.__dir__() and prevent tb_next deletion
- Fix subscript operation source range restoration in compiler
- Change "duplicate parameter" to "duplicate argument" error message
- Refactor duplicate code in asyncgenerator.rs and frame.rs

---------

Co-authored-by: CPython Developers <>
2026-02-07 13:41:45 +09:00
Jeong, YunWon 234bdda40d Refactor warn.rs and _warnings module (#7023)
- Add already_warned() with filter version tracking
- Add type validation for _defaultaction and _onceregistry
- Use direct function names for _warnings pyattr/pyfunction
- Route stdlib::warnings::warn through warn::warn
- Remove spurious EncodingWarning from TextIOWrapper
- Clean up comments and simplify check_matched error handling
- Remove expectedFailure from 3 passing test_warnings tests
2026-02-06 20:46:51 +09:00
Jeong, YunWon 8127000080 Impl more codecs and _codecs._unregister_error (#7025)
- Rewrite _pycodecs.py: escape_decode, charmap_decode,
  unicode_escape_decode/encode, raw_unicode_escape_decode/encode
- Add _codecs._unregister_error with built-in handler protection
  and null byte/surrogate validation
- Normalize encoding name in register_manual
- Add codec error notes via add_note
- Fix cp65001 encoding constant in StandardEncoding::parse
- Remove 35 expectedFailure markers from test_codecs,
  test_pickle, test_datetime, pickletools
2026-02-06 20:37:18 +09:00
CPython Developers 951a97e32d Update encodings from v3.14.3 2026-02-06 12:05:17 +09:00
Jeong, YunWon 1e1b423fc0 Merge pull request #6997 from youknowone/test_io
Better codecs and fix lots of test_io and other expectedFailures
2026-02-06 09:04:47 +09:00
Jeong, YunWon 19db8d0b9f Merge pull request #7008 from youknowone/warnings 2026-02-06 07:45:48 +09:00
CPython Developers 7ccab4a4c8 Update traceback from v3.14.3 2026-02-06 07:45:17 +09:00
ShaharNaveh c3212e7cd0 Update pprint.py from 3.14.3 2026-02-06 01:14:55 +09:00
CPython Developers cc23a67493 Update test_dict from v3.14.3 2026-02-06 00:35:00 +09:00
Jeong, YunWon b880c33a8b Move pickletester.py to the correct place (#7003)
* Move `pickletester.py` to the correct place

* Mark failing tests

* Update `test_pickle.py` from 3.14.3
2026-02-06 00:21:15 +09:00
Jeong, YunWon 6e09d1b123 win codecs 2026-02-06 00:15:18 +09:00
Jeong, YunWon 258ac74384 fix io 2026-02-06 00:15:18 +09:00
CPython Developers e948314a3e Update test_io from v3.14.3 2026-02-06 00:15:18 +09:00
Jeong, YunWon afea16569b Fix test_io expectedFailures 2026-02-06 00:15:18 +09:00
Jeong, YunWon 2e62cac72b Implement more warnings 2026-02-05 23:50:08 +09:00
Jeong, YunWon c0af6eb5c0 skip flaky test_threaded_weak_key_dict_copy (#7010) 2026-02-05 23:47:09 +09:00
Jeong, YunWon 6de6a92717 Merge pull request #7001 from youknowone/annotationlib
Add test_annotationlib to v3.14.2 and fix related bugs
2026-02-05 23:39:47 +09:00
ShaharNaveh 906113f499 Merge remote-tracking branch 'upstream/main' into move-pickletester 2026-02-05 15:52:30 +02:00
ShaharNaveh d4c268c834 Update test_pickle.py from 3.14.3 2026-02-05 15:52:00 +02:00
CPython Developers 2fac506b35 Update warnings from v3.14.2 2026-02-05 21:54:56 +09:00
ShaharNaveh 00ea4636a1 Mark failing tests 2026-02-05 14:19:41 +02:00