Update test_sys.py from 3.13.11 (#6428)

* mark RustPython as  free-threaded

* Py_GIL_DISABLED

* Update `test_sys.py` from 3.13.11

* mark tests

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
This commit is contained in:
Shahar Naveh
2026-01-01 11:35:55 +02:00
committed by GitHub
parent b446dac359
commit 3e2ada0586
3 changed files with 489 additions and 218 deletions

698
Lib/test/test_sys.py vendored

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@ mod sys {
const RUSTPYTHON_DEBUGBUILD: bool = cfg!(debug_assertions);
#[pyattr(name = "abiflags")]
pub(crate) const ABIFLAGS: &str = "";
pub(crate) const ABIFLAGS: &str = "t"; // 't' for free-threaded (no GIL)
#[pyattr(name = "api_version")]
const API_VERSION: u32 = 0x0; // what C api?
#[pyattr(name = "copyright")]
@@ -599,6 +599,11 @@ mod sys {
// TODO: sys.audit implementation
}
#[pyfunction]
const fn _is_gil_enabled() -> bool {
false // RustPython has no GIL (like free-threaded Python)
}
#[pyfunction]
fn exit(code: OptionalArg<PyObjectRef>, vm: &VirtualMachine) -> PyResult {
let code = code.unwrap_or_none(vm);

View File

@@ -23,6 +23,8 @@ pub(crate) mod _sysconfigdata {
"RUST_MULTIARCH" => RUST_MULTIARCH,
// enough for tests to stop expecting urandom() to fail after restricting file resources
"HAVE_GETRANDOM" => 1,
// RustPython has no GIL (like free-threaded Python)
"Py_GIL_DISABLED" => 1,
// Compiler configuration for native extension builds
"CC" => "cc",
"CXX" => "c++",