Commit Graph
15792 Commits
Author SHA1 Message Date
Jeong, YunWon 5c341efdf0 Implement generator/coroutine lifecycle, tracing, and error handling
- Add interactive REPL mode: auto-print expression results in single mode
- Implement Destructor for PyGenerator and PyCoroutine
- Add locals_dirty tracking and locals_to_fast() for frame sync
- Add per-line tracing with prev_line tracking in execution loop
- Fix gen_throw to close sub-iterator on GeneratorExit (gen_close_iter)
- Pass callable object as arg in c_call/c_return/c_exception trace events
- Distinguish [Errno] vs [WinError] for CRT vs Win32 API errors
- Fix tee thread safety with AtomicBool running flag
- Fix division error messages to match expected format
2026-02-11 16:46:36 +09:00
Jeong, YunWon ccd3d4f964 Replace std::sync::LazyLock with common::lock::LazyLock (#7079) 2026-02-11 16:09:42 +09:00
Jeong, YunWonandgithub-actions[bot] c06cf56c60 Replace once_cell with std::sync::OnceLock/core::cell::OnceCell (#7077)
* Replace `once_cell` with `std::sync::OnceLock`/`core::cell::OnceCell`

- Replace `once_cell::sync::{Lazy, OnceCell}` with
  `std::sync::{LazyLock, OnceLock}`
- Replace `once_cell::unsync::{Lazy, OnceCell}` with
  `core::cell::{LazyCell, OnceCell}`
- Inline `get_or_try_init` at call sites (unstable in std as of 1.93)
- Replace `OnceCell::with_value()` with `OnceCell::from()` in codecs.rs
- Remove `once_cell` direct dependency from common and vm crates

* Auto-format: cargo fmt --all

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-11 11:08:16 +09:00
Jeong, YunWon 36ff461d65 Add import_ensure_initialized to import_module_level (#7076)
Wait for module initialization to complete when a module is
already in sys.modules but still being initialized by another
thread. Check __spec__._initializing and call
_lock_unlock_module to block until the import finishes.
2026-02-11 10:57:10 +09:00
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
Shahar Naveh 2edab987fd Auto update lib status (#7074) 2026-02-11 01:48:50 +09:00
Jeong, YunWon f594b0a400 Replace unsafe pointer cast with AtomicPtr in PyCode (#7063)
Add `source_path: AtomicPtr<PyStrInterned>` field to `PyCode`
for interior mutability, replacing the UB-inducing
`#[allow(invalid_reference_casting)]` + `write_volatile` pattern
in `update_code_filenames`. Use atomic load/store instead of a
mutex since the operation is a simple pointer swap on a 'static
reference. Update all read sites to use `source_path()` accessor.
2026-02-11 01:28:17 +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
Jeong, YunWon b521f76ca4 impl more memory 2026-02-10 22:27:46 +09:00
CPython Developers 91b128a466 Update test_memoryview from v3.14.3 2026-02-10 22:27:46 +09:00
dependabot[bot] 23cf16a283 Bump psm from 0.1.29 to 0.1.30
Bumps [psm](https://github.com/rust-lang/stacker) from 0.1.29 to 0.1.30.
- [Commits](https://github.com/rust-lang/stacker/commits)

---
updated-dependencies:
- dependency-name: psm
  dependency-version: 0.1.30
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-10 22:25:09 +09:00
dependabot[bot] ac5f77a9a8 Bump memchr from 2.7.6 to 2.8.0
Bumps [memchr](https://github.com/BurntSushi/memchr) from 2.7.6 to 2.8.0.
- [Commits](https://github.com/BurntSushi/memchr/compare/2.7.6...2.8.0)

---
updated-dependencies:
- dependency-name: memchr
  dependency-version: 2.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-10 22:23:59 +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
Jeong, YunWon 3bd061ef5a Merge pull request #7068 from ShaharNaveh/update-support-init
Update `support.__init__.py` from 3.14.3
2026-02-10 20:59:55 +09:00
ShaharNaveh 28ed23f7ca Update test_array.py from 3.14.3 2026-02-10 13:16:46 +02:00
ShaharNaveh b6ebbfd365 impl array.clear 2026-02-10 12:58:29 +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 1a54267aa7 Merge pull request #7060 from youknowone/test_iter
Update test_errno,test_iter from v3.14.3
2026-02-10 00:50:54 +09: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
Jeong, YunWon 570d50c67f no_std for common, pylib, codegen (#7056)
* `std` feature for common

- Gate OS-dependent modules behind `#[cfg(feature = "std")]`
- Replace `std::f64` with `core::f64` in float_ops
- Replace `std::process::abort` with panic in refcount
- Remove `thread_local` from levenshtein (stack buffer)
- Split static_cell into threading/non_threading/no_std

* `std` for codegen

* `no_std` for pylib
2026-02-09 23:28:20 +09:00
Jeong, YunWon c974b77127 [update_lib] fix hard_deps resolution and fix commit not to miss test data (#7058)
* [update_lib] fix hard_dep not to unclude other tests

* [update_lib] commit test data
2026-02-09 14:41:15 +09:00
Jeong, YunWon dc2d235e59 Replace unsafe pointer cast with PyMutex in PyCode (#7055)
Add `source_path: PyMutex<&'static PyStrInterned>` field to
`PyCode` for interior mutability, replacing the UB-inducing
`#[allow(invalid_reference_casting)]` + `write_volatile` pattern
in `update_code_filenames`. Update all read sites across the
codebase to use the new `source_path()` accessor method.
2026-02-09 14:01:39 +09:00
CPython Developers d1c19bef38 Update linecache from v3.14.3 2026-02-09 12:56:53 +09:00
Jeong, YunWon d2a9937ad6 [update_lib] todo shows last updated date (#7053) 2026-02-09 09:39:01 +09:00
Jeong, YunWon 4daac232a4 no_std for doc, replace HashSet in codegen (#7054) 2026-02-09 08:14: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
Jeong, YunWon cf83008d33 no_std for wtf8, sre_engine, compiler-core, literal (#7051)
* `no_std` for wtf8

* `no_std` for sre_engine, compiler-core, literal
2026-02-09 01:04:54 +09:00
Shahar Naveh ea352ccdae Make inner oparg values private (#7050) 2026-02-08 14:56:56 +00:00
Jeong, YunWonandgithub-actions[bot] f777416870 initial sandbox (#7035)
* Add host_env feature for sandbox isolation

Introduce a `host_env` feature flag that gates all host environment
access (filesystem, network, signals, processes). When disabled,
the VM operates in sandbox mode:

- _io module always available; FileIO gated by host_env
- SandboxStdio provides lightweight stdin/stdout/stderr via Rust std::io
- BytesIO/StringIO/BufferedIO/TextIOWrapper work without host_env
- open() returns UnsupportedOperation in sandbox
- stdlib modules (os, socket, signal, etc.) gated by host_env
- CI checks both host_env ON and OFF builds

* Auto-format: ruff check --select I --fix

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-08 13:58:30 +00:00
Jeong, YunWon 5dabad6702 reason inside #[allow] (#7049) 2026-02-08 13:11:50 +00:00
Shahar Naveh 23a89663e0 Update tomllib from 3.14.3 (#7048) 2026-02-08 12:51:38 +00:00
Shahar Naveh c8b4d6308f Newtype for LoadAttr oparg (#7047) 2026-02-08 11:47:14 +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
Jeong, YunWon 07fc6ee3c7 no_std clippy (#7043) 2026-02-08 16:49:18 +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
dependabot[bot] ae260c13fa Bump webpack from 5.94.0 to 5.104.1 in /wasm/example (#7036)
Bumps [webpack](https://github.com/webpack/webpack) from 5.94.0 to 5.104.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Changelog](https://github.com/webpack/webpack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack/compare/v5.94.0...v5.104.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.104.1
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-08 00:10:53 +09:00