Commit Graph
345 Commits
Author SHA1 Message Date
Jeong, YunWonandgithub-actions[bot] b877f76141 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 48e4e7c661 Implement more ast features (#6986)
Assisted-by: Codex:gpt-6
2026-02-05 16:20:22 +09:00
Jeong, YunWon 95abec4c21 More Load instructions including LoadLocals, LoadFastBorrow (#6886)
* fix stdlib_io

* more scpell dict

* LoadLocals

* LoadFastBorrow

* more ops
2026-01-29 19:33:46 +09:00
Jeong, YunWon e363b14e81 fix ssl MSG_PEEK (#6892) 2026-01-29 16:48:02 +09:00
Jeong, YunWon d2166dd93a Fix sorted() to use __lt__ instead of __gt__ (#6887)
* test

* Fix sorted() to use __lt__ instead of __gt__

CPython's sort uses __lt__ for comparisons, but RustPython was using
__gt__. This caused issues when only __lt__ was overridden on a
subclass (e.g., NamedTuple with custom __lt__), as it would fall back
to the parent class's comparison instead of using the overridden method.
2026-01-28 16:55:51 +09:00
Jeong, YunWon 6df3753229 Py 3.14 changes fix (#6755)
* marshal v5

* conditional blclk

* fix jit don't use lossy string

* add varname

* symboltable takes responsibility of __debug__
2026-01-18 01:02:40 +09:00
github-actions[bot] 60fb4384e1 Auto-format: ruff check --select I --fix 2026-01-17 10:34:53 +00:00
Jeong, YunWon 566b6f438b PEP 649 annotation phase 4 2026-01-17 19:21:11 +09:00
Jeong, YunWon a78b569d92 PEP 649 annotation phase 3 2026-01-17 19:21:11 +09:00
Jeong, YunWon 0793bd3d08 co_consts 2026-01-17 19:21:11 +09:00
Jeong, YunWon f5b44f505a Fix Exception.__init__ 2026-01-17 19:21:11 +09:00
Jeong, YunWon 24bff8d5bf fix unsigned validation 2026-01-17 19:21:11 +09:00
Jeong, YunWon eafa0c0149 Fix int rounding 2026-01-17 19:21:11 +09:00
Jeong, YunWon db01a1d653 Remove pickle from itertools 2026-01-17 19:21:11 +09:00
Jeong, YunWon 2fe140fdb9 Fix bytes/bytearray fromhex 2026-01-17 19:21:11 +09:00
Jeong, YunWon 8d901a7300 Implement bool(NotImplemented) 2026-01-17 19:21:10 +09:00
Jeong, YunWonandgithub-actions[bot] e9a57d172b correct builtins type under function (#6745)
* correct buitins type

* Auto-format: ruff format

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-01-17 00:00:16 +09:00
6cb763a332 Fix some parts of cron-ci workflow (#6724)
* Use shared PYTHON_VERSION in cron-ci benchmark job

* Correct extra-tests/jsontests.py script

When the `extra_tests/jsontests.py` script was added, it was presumably during
the time when Python versions 3.5 to 3.8 were in use. At that time,
`test.libregrtest.runtest` was a valid path, but from CPython version 3.11
onwards, the path changed to `test.libregrtest.findtests`.

* Use ssl-rustls feature instead of ssl in cron-ci workflow

Replace the ssl feature with ssl-rustls in both the CARGO_ARGS
environment variable and the cargo-llvm-cov test command to fix
the cron-ci workflow.

Since 1a783fc9ec, it is disallowed
to use ssl manually.

* Replace inspect.getargspec with inspect.getfullargspec in custom_text_test_runner

inspect.getargspec() was removed in Python 3.11, causing jsontests.py to
fail with "TypeError: 'NoneType' object is not iterable" when running on
RustPython (which targets Python 3.13).

The get_function_args() function was silently catching the AttributeError
and returning None, which then caused the error in store_class_fields()
when trying to iterate over None.

> https://docs.python.org/3/whatsnew/3.11.html
> The getargspec() function, deprecated since Python 3.0; use
> inspect.signature() or inspect.getfullargspec() instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Exclude rustpython-venvlauncher in cron-ci workflow

Since rustpython-venvlauncher is Windows-only,
it disables the project in the cron-ci workflow.

* Apply suggestion from @fanninpm

Co-authored-by: fanninpm <luxverdans@sbcglobal.net>

* Trigger cron-ci workflow in pull_request

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
Co-authored-by: fanninpm <luxverdans@sbcglobal.net>
2026-01-14 13:28:25 +09:00
HueCodesandHugh 83a0deac25 Fix set in-place operators with self argument (#6661)
Co-authored-by: Hugh <HueCodes@users.noreply.github.com>
2026-01-09 21:31:21 +09:00
Copilotandyouknowone 03380dc4ec Ensure __new__ entries in class __dict__ are staticmethods (#6659)
* Initial plan

* Wrap __new__ methods as staticmethods in type dicts

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* Unmark passing enum test

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
2026-01-06 12:16:51 +09:00
7b36c9e8e0 Handle oversized __hash__ results without panicking (#6561)
* Initial plan

* Fix hash wrapper overflow handling

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* Auto-format: cargo fmt --all

* Adjust __hash__ wrapper conversion

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* Auto-format: cargo fmt --all

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-28 16:27:32 +09:00
Copilotandyouknowone 04a4d1e02f Prevent array.tofile re-entrant deadlock and add regression snippet (#6559)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
2025-12-28 14:48:27 +09:00
27ab62de48 Prevent __class__ reassignment across incompatible layouts (#6521)
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2025-12-27 01:16:09 +09:00
a7d7f81ca7 Handle unions with GenericAlias subclasses without TypeError (#6540)
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2025-12-27 01:13:20 +09:00
Jeong, YunWon 4a6e8fb29e Add except* support (#6530) 2025-12-26 21:54:23 +09:00
61ddd98b89 Handle missing type_params on AST Function/Class/TypeAlias nodes (#6512)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-25 19:08:23 +09:00
a5a1173c3f Disallow rebinding __module__ on immutable builtins and add regression snippet (#6513)
* Initial plan

* Fix __module__ setter on immutable builtin types

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* Remove unused value parameter from immutability helper

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* Auto-format: cargo fmt --all

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-25 18:27:19 +09:00
8443b2c97e Add POSIX shared memory module for multiprocessing on Unix (#6498)
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-25 14:54:44 +09:00
Copilotandyouknowone be9e44aafb Allow SyntaxError.msg to be writable and reflected in string formatting (#6493)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
2025-12-25 09:08:18 +09:00
Jeong, YunWon 014622ac34 Fix os.access not to raise exception when path doesn't exist (#6477)
* Fix os.access not to raise exception when path doesn't exist

* add test
2025-12-24 14:23:33 +09:00
Shahar Naveh 9d2dd17455 Add regression test (#6452) 2025-12-17 19:02:44 +09:00
Jeong, YunWon d36a2cffde New subclass payload layout (#6319)
* PySubclass

* Add base payload to exception

* PyStructSequecne base

* redefine PyOSError and subtypes

* heap exception new

* rework UNSUPPORTED_OPERATION
2025-12-14 19:17:14 +09:00
Shahar Naveh 9ccf4c1872 Ruff auto-format (#6422) 2025-12-12 22:46:39 +09:00
Shahar Naveh a47b32816b Merge pull request #6417 from ShaharNaveh/regr-test-doc-leak
Add regression test for #4505
2025-12-12 21:12:02 +09:00
Jeong, YunWon 98fff96f1c __doc__ handing in the right way (#6390) 2025-12-10 20:04:09 +09:00
Jeong YunWon 8af105fc4f Make mergeable 2025-11-29 00:22:44 +09:00
Ashwin Naren f37ea52565 Ctypes
more pointer implementation

fix import

add more classes

ctypes overhall

updates

fix build

fix warnings, pass test

fix panic on improper library load

test on macos

formatting

tmp

minor updates
2025-11-28 23:27:24 +09:00
Jeong YunWon 6991a80e13 Add __main__.__cached__ 2025-11-15 23:09:31 +09:00
yt2b 1d23f6e8df Panic occurs when formatting with separator and some format specifier (#6213)
* Fix get_separator_interval

* Add extra tests

* Remove FormatType::Number from match arm
2025-10-24 21:41:28 +09:00
Jeong YunWon 50c557419e more match pattern 2025-08-26 21:48:46 +09:00
Lee Dogeon 44a8c9f0b3 Remove completed TODO of extra_tests/fstring.py (#6095) 2025-08-20 14:08:53 +09:00
Jeong, YunWon ddc08498cc Fix match mapping pattern (#6081) 2025-08-20 13:26:18 +09:00
Jack O'Connor 33ea50c2e9 Add return annotation to __annotations__ last (#6071)
Functions like `functools.singledispatch` are sensitive to the order of
items in the `__annotations__` map.

CPython puts returns last.
2025-08-08 23:31:12 +09:00
Jeong, YunWon 8ab7aa2c6b type.__dict__ (#5957) 2025-07-13 13:12:03 +09:00
yt2b f608df4a23 Formatting with width and separator doesn't work correctly (#5927)
* Fix add_magnitude_separators

* Add extra tests
2025-07-10 09:10:52 +09:00
Jeong YunWon 7ebe0182e4 More eval typecheck 2025-07-07 19:02:37 +09:00
yt2b 0a59c1cad3 Implement PyComplex's __format__ function (#5900)
* Add num-complex in rustpython-common

* Implement PyComplex's __format__ function

* Remove @unittest.expectedFailure

* Fix PyComplex's __format__ function

* Remove @unittest.expectedFailure

* Add extra tests

* Rename to ZeroPadding and AlignmentFlag
2025-07-04 22:35:28 +09:00
Jeong, YunWon d5d3507921 Add sys._getframemodulename (#5873) 2025-06-30 22:50:27 +09:00
Ashwin Naren 159769876f add test 2025-06-29 14:42:09 +09:00
Jeong, YunWon 52301ddbe5 Fix PyFunction doc behavior (#5827) 2025-06-23 22:37:51 +09:00