Commit Graph

368 Commits

Author SHA1 Message Date
Lee Dogeon
0cd6eb7b13 Write profile even if failed (#6685) 2026-01-10 15:26:49 +09:00
Jeong, YunWon
e1b22f19e6 vm.run_pyc_bytes (#6645)
* rustpython_vm::import::check_pyc_magic_number_bytes

* vm.new_scope_with_main

* PyCode::from_pyc

* vm.run_pyc_bytes

* add boundary check
2026-01-04 22:58:16 +09:00
Jeong, YunWon
bdd036ea6b pythonrun (#6643) 2026-01-04 20:52:35 +09:00
Jeong, YunWon
e10dc94992 Fix stdio_encoding, stdio_errors (#6617)
* stdio_errors, stdio_encodings

* add ascii

* unmark tests
2026-01-01 14:48:27 +09:00
Jeong, YunWon
1e706d911e Interpreter (#6614)
* Refine documentation in interpreter.rs

Improve InterpreterConfig with convenience methods (with_debug, add_path, add_paths), better documentation with working examples, refactored stdlib setup into focused functions, and comprehensive unit tests while maintaining 100% backward compatibility.

* Improve error message for non-Unicode paths

* Use consistent make_module naming in all doc examples

* cut useful changes

---------

Co-authored-by: Mohamed Gharbi <galaxysea777@gmail.com>
2025-12-31 22:14:28 +09:00
Jeong, YunWon
e79a1a1a66 Fix traceback (#6569)
* Fix traceback

* Update traceback from CPython 3.13.11

* unmark test_traceback

* fix code

* fix debug range

* fix tests
2025-12-30 16:58:53 +09:00
Terry Tianlin Luan
1464d5ca43 Adding + Fixing Clippy rules to better align with #[no_std] (#6570)
* * Added alloc_instead_of_core, std_instead_of_alloc, and std_instead_of_core clippy rules
* Manually changed part of the code to use core/alloc

* use clippy --fix to fix issues in stdlib

* * Used clippy --fix to fix issues in vm
* Imported Range in vm/src/anystr.rs

* * Used clippy --fix to fix issues in common
2025-12-30 13:10:14 +09:00
Jeong, YunWon
57b4b4ae45 fix sys path (#6537) 2025-12-26 21:43:00 +09:00
Jeong, YunWon
8b3bf558fc Introduce PyConfig to implement Paths correctly (#6461)
* getpath

* introduce PyConfig

* landmark in getpath
2025-12-21 08:25:17 +09:00
Jeong, YunWon
4bec0ad1c6 Fix test_runpy (#6409) 2025-12-12 15:26:00 +09:00
Jeong, YunWon
2ff1fba6ed Faulthandler (#6406) 2025-12-12 09:23:59 +09:00
Jeong, YunWon
04d55fa5c6 Faulthandler (#6400) 2025-12-12 00:08:55 +09:00
Jeong, YunWon
1a783fc9ec Replace SSL backend to rustls (#6244) 2025-11-16 22:17:35 +09:00
Jeong YunWon
4f8ef16937 Re-organize vm.run_script inner functions 2025-11-15 23:09:31 +09:00
Shahar Naveh
fcf196935e Update ruff 0.14.1 (#6195)
* Update ruff to 0.14.1

* Fix test regression in `test_compile`

* Unmark passing test

* Update `test_syntax` from 3.13.9

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-10-20 22:46:46 +09:00
Anton
b56e469a5f Handle OsError in REPL (#6187) 2025-10-13 10:18:51 +09:00
Noa
85ca28094e Apply clippy suggestions to switch to let chains (#6126) 2025-09-04 15:34:10 +09:00
Jack O'Connor
109e64c2ba Allow multiple indented blocks in REPL (#6097)
There aren't any tests but being able to do nested for loops seems like
a pretty big win to me so I'm going to put up for review.

The original returned boolean clearly had **false positives** for
detecting bad errors for things like nested `if` and `for` statements.
What is less clear is if there are any **true positives** which I am no
longer catching with the updated return value.

Co-authored-by: Jack O'Connor <jack@jackoconnor.dev>
2025-08-21 13:15:02 +09:00
Shahar Naveh
4bf32a04f4 Apply some clipy lints (#6045) 2025-07-30 12:16:02 +09:00
Jeong, YunWon
d40cbbb451 Fix cspell warning (#5890)
* Fix cspell warning

* cspell: -> spell-checker:
2025-07-03 12:04:43 +09:00
Jeong YunWon
3673372d3d Fix cspell warnings 2025-06-27 12:32:59 +09:00
Jeong YunWon
2c61a12bed Apply coderabbit reviews 2025-06-15 16:03:46 +09:00
Jeong YunWon
f560b4cbfb Fix nightly clippy warnings 2025-06-15 16:03:46 +09:00
Aneesh Durg
323ea3b96b Support incomplete parsing (#5764)
* continue accepting REPL input for multiline strings

* Match cpython behavior for all multi-line statements (execute when complete)

* Emit _IncompleteInputError when compiling with incomplete flag

* Refine when _IncompleteInputError is emitted

* Support multiline strings emitting _IncompleteInputError

* lint

* Undo accidental change to PyTabError

* match -> if let

* Fix test_baseexception and test_codeop

* fix spelling

* fix exception name

* Skip pickle test of _IncompleteInputError

* Use py3.15's codeop implementation

* Update Lib/test/test_baseexception.py

---------

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-06-05 14:41:56 +09:00
Aneesh Durg
e49e743669 Support multiline function/class definitions in REPL and InteractiveConsole (#5743)
* Support multiline function/class definitions in REPL and InteractiveConsole
2025-04-30 14:53:37 +09:00
Jeong YunWon
e434ff5f6e basic wasip2 support 2025-04-20 19:47:35 +09:00
Jeong, YunWon
4ae2936a45 fix more cspell warnings (#5689) 2025-04-11 12:08:07 +09:00
Jeong YunWon
36cce6b174 run fmt 2025-04-05 00:14:03 +09:00
Ashwin Naren
5c854fc690 clear out warnings 2025-04-04 21:46:28 +09:00
Jeong YunWon
d7113e11db Fix more cspell warnings 2025-04-04 21:45:03 +09:00
Jeong YunWon
7ac61f3840 fix cspell warnings 2025-04-04 16:15:54 +09:00
Jeong, YunWon
c7ca173c90 Merge pull request #5254 from youknowone/exception-group
ExceptionGroup
2025-03-27 14:51:12 +09:00
Jeong YunWon
e7fdfca5f5 Add python-implemented ExceptionGroup 2025-03-27 01:28:36 +09:00
Jeong YunWon
bc38e9dedd Apply nightly clippy suggestions 2025-03-26 14:52:23 +09:00
Noa
950a8d5694 Update to ruff_python_parser 0.11 2025-03-19 22:45:57 -05:00
Stefan Lukas
a6b4ef7f5d Replace Python parser with ruff parser (#5494)
* stage1

* compiler pass build

* introduce rustpython-compiler-source

* stage2

* fixup

* pass compile

* Fix hello world compiler test

* Fix code generation for if-elif-else statement

* Fix code generation for lambda expression

* Fix code generation for integers

* Fix code generation for fstrings

* Fix code generation for if statement

* Fix code generation for if statement

* Fix code generation for if statement

* Fix code generation for fstring

* Fix code generation for class definition

* Replace feature flags

* Initialize frozen core modules

* Allow __future__ import after module doc comment

* Disable ast module

* Commit remaining fixes for compile errors in examples

* Fix some warnings

* Update ast stdlib module

* Update ast stdlib module

* Update ast stdlib module

* Update ast stdlib module

* Update ast stdlib module

* Split ast stdlib module into files

* Fix codegen for positional arguments with defaults

* Update ast stdlib module

* Update ast stdlib module

* Extract string and constant handling from expression.rs

* Always add required fields to AST nodes

* Compile doc strings correctly again

* Enable "ast" Cargo feature by default

* Refactor compilation of big integer literal

* Update ast stdlib module

* Update ast stdlib module

* Update ast stdlib module

* Reset barebones example

* Fix some left-over warnings

* Undo accidential change

* Adapt shell to ruff parser

* Pin parser to v0.4.10

* fix clippy

* Add TODO about interactive mode

* Fix compilation of complex number expression

* Remove moved code

* Update test case to ruff v0.4.10

* Apply suggestion

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

* Apply suggestion

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

* Fix compilation of fstring expression

* Fix compilation of fstring expression

* Fix wasm compile errors

* Attach correct source locations to ast objects

* Fix some more wasm compile errors

* Consider compile mode and enable AST stdlib module again

* Fix incorrect AST source location end column

* Fix compile error if "compiler" feature is not enabled

* Fix regrtests

* Fix some test_ast tests

* Add source range to type ignore

* Fix incompatibility with Rust 2024 edition

* Fix todos by implementing missing ast conversions and deleting unused code

* Appease clippy

* Fix remaining ast tests

* Fix remaining ast tests

* Mark/fix remaining tests

* Fix more

* Hacky windows fix

---------

Co-authored-by: Kangzhi Shi <shikangzhi@gmail.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
Co-authored-by: Noa <coolreader18@gmail.com>
2025-03-19 21:06:03 -05:00
Noa
a596568151 Use lexopt for argument parsing (#5602) 2025-03-19 12:28:58 -05:00
Ashwin Naren
b870b0e1b5 2024 edition formatting
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-02-26 11:48:22 -08:00
Noa
0a8b0406f5 Enable missing_unsafe_on_extern lint 2025-02-24 21:25:23 -06:00
Noa
a9331bb34d Fix warnings for rust 1.85 2025-02-20 14:58:59 -06:00
Noa
b7db23bbae Fix warnings for Rust 1.84 2025-01-11 18:48:27 +09:00
carsonzhu
01f7536b36 expose run_shell 2024-12-11 17:33:36 +09:00
Noa
e4be882994 Miscellaneous cli-related parity fixes 2024-12-03 16:28:32 -06:00
Jeong, YunWon
b1a38c2d50 Fix rust 1.80 warnings (#5363)
* Fix rust 1.80 warnings

* Fix nightly clippy warnings
2024-07-28 10:43:40 +09:00
Jeong YunWon
87849cda4f fix grammar 2024-04-30 23:18:14 +09:00
Jeong YunWon
24f57dde2f Align Settings to PyConfig 2024-04-30 23:18:14 +09:00
Jeong YunWon
6b7b080827 Add sys._stdlib_dir when freeze-stdlib 2024-04-30 22:21:56 +09:00
Jeong YunWon
f0f4633346 Fix nightly clippy 2024-04-18 03:37:29 +09:00
Jeong, YunWon
6eed8f42c7 split vm.import and vm.import_from (#5212) 2024-04-08 00:07:38 +09:00
Jeong, YunWon
3737f2a091 make adding a single module simpler for interpreter users (#4792) 2024-03-21 21:48:29 +09:00