9 Commits
Author SHA1 Message Date
Bas Schoenmaeckers 5a051f9442 Implement basic PyUnicodeWriter (#9216)
* Implement basic `PyUnicodeWriter`

* Add tests

* Review

* Allow surrogate codepoints in PyUnicodeWriter_WriteChar

* use try_reserve
2026-10-20 09:25:46 +09:00
Bas SchoenmaeckersandJeong, YunWon a1971c1d9d Unify PyObject dereferencing in c-api (#8292)
* Add `FfiPtrExt` for uniform pointer dereferences

* Panic on NULL ptrs

* capi: import type_name from core, not std

Assisted-by: Grok:4.6

* Use `assume_owned_or_err` in PyGetSetDef

* Update latest code

---------

Co-authored-by: Jeong, YunWon <jeong@youknowone.org>
2026-09-25 00:48:15 +09:00
Bas Schoenmaeckers 455d22b353 Add more unicode functions to the c-api (#8272)
* Add more unicode functions

Review

Add unicode decode functions

Add more functions

* Remove

* Add helper
2026-07-22 20:28:51 +09:00
Bas Schoenmaeckers c5efd71f2a Add codecs support to c-api (#8267)
* Add codecs support to c-apo

* Reduce code duplication
2026-07-17 00:19:31 +09:00
Bas Schoenmaeckers 4caf959e58 Use PyO3 main & enable c-api tests (#8000)
Enable `abi3t` support in PyO3
Add left over c-api functions

Fix PyLong_AsUnsignedLongLongMask

Update pyo3 to `0.29`
Add `PyInt::as_u64_mask`

Fix `PyInt::as_u32_mask`
2026-07-05 01:13:45 +09:00
Jeong, YunWon a1ba6a662c Align compiler and AST behavior with CPython (#8138)
* Align compiler and AST behavior with CPython

Update the compiler pipeline, AST module support, and related VM compile/eval paths toward CPython 3.14 behavior.

Use upstream Ruff parser crates directly and keep RustPython-specific syntax preflight handling in the compile path.

Refresh opcode metadata, snapshots, and targeted tests for the aligned bytecode and AST behavior.

* fix

* Fix PR 8138 CI failures

* Fix match mapping wildcard scan complexity

* fixes

* Use Ruff runtime AST fields

* Minimize residual patch diff

* refactor error handling

* Remove _ast conversion context wrappers

* Clean up _ast conversion glue and compiler warning escalation

Rename the Node conversion parameter `ctx` to `vm` throughout the _ast
module.

Remove the unused compile_program, compile_program_single,
compile_block_expression, and compile_expression forwarders; compile_top
stays as the entry point.

Stash an escalated compiler SyntaxWarning so a non-SyntaxWarning category
propagates unchanged instead of being rewritten to SyntaxError, matching
PyErr_ExceptionMatches(SyntaxWarning) in compiler_warn. Drop the now-unused
CompileWarningError::into_codegen_error.

Replace the PositionalArguments two-variant enum with a struct holding a
shared range and a PositionalArgumentsKind enum.

Assisted-by: Claude

* Represent compiler flags as a CompilerFlags bitflags

Replace the loose PY_CF_*/CO_* i32 constants in compile_mode with a
CompilerFlags bitflags covering the PyCF_* flags and __future__
CO_FUTURE_* bits. The Python-visible ast.PyCF_* attribute values are
derived from it via bits(); parser input modes stay plain consts.

builtins::compile and the compile_string flag handling test flags
through CompilerFlags::contains instead of raw bit math.

Assisted-by: Claude

* Fix PR 8138 test regressions

* Fix PR 8138 CI failures

* Avoid shell interpolation in Linux deps action

* Fix review findings in compiler/AST changes

- frame.rs: compute the MATCH_CLASS class name lazily so a successful
  match no longer takes the type name lock or allocates; the
  __match_args__-not-a-tuple branch reuses it instead of recomputing.
- _ast/constant.rs: add the missing leading space to the with_recursion
  label ("maximum recursion depth exceeded during compilation").
- sys.set_int_max_str_digits: restore the "maxdigits must be 0 or larger
  than {n}" error text.
- codegen: set CO_MAXBLOCKS to 20 in both ir.rs and compile.rs.
- _ast/exception.rs: extract the duplicated excepthandler node guard
  into ensure_excepthandler_node.
- codegen: correct the validate_keywords doc comment.
- Drop redundant "CPython" qualifiers from comments added in this branch.

Assisted-by: Claude
2026-06-26 18:22:08 +09:00
Shahar Naveh f89f415061 Remove redundant to_owned() calls (#8077) 2026-06-12 11:09:22 +09:00
Bas Schoenmaeckers 1782dd25ae Add more unicode functions to c-api (#8044)
* Add more unicode functions to c-api

* Update crates/capi/src/unicodeobject.rs
2026-06-10 11:04:40 +09:00
Bas Schoenmaeckers 1bea4a5185 Add unicode & bytes c-api support (#7904)
* Add unicode & bytes c-api support

* Check for negative size
2026-05-19 13:20:19 +09:00