Files
RustPython/crates/stdlib
Jeong, YunWon fafd9c75df more hostenv isolation (#7932)
* Move which crate dependency from vm to host_env

Add host_env::fs::which wrapper and update getpath.rs call site.

* Move readline module from vm to host_env

Move crates/vm/src/readline.rs to crates/host_env/src/readline.rs and
re-export it from rustpython_vm::readline. Move rustyline dependency
from vm to host_env. Drop the host_env feature gates on history I/O
inside the moved module.

* Move gethostname and mac_address dependencies from stdlib to host_env

Add host_env::socket::hostname and host_env::socket::mac_address
wrappers. Update _socket.gethostname and _uuid.get_node_id call sites.

* Re-export libc constants and types through host_env

Move direct libc constant and type references in stdlib (faulthandler,
fcntl, multiprocessing, posixshmem, select, syslog) to use host_env
re-exports. Replace libc::c_int and libc::c_uint in stdlib with
core::ffi equivalents.

* Re-export mmap libc constants through host_env

Move direct libc MADV_*, MAP_*, PROT_*, EOVERFLOW references in
stdlib::mmap to host_env::mmap re-exports. Replace libc::c_int with
core::ffi::c_int.

* Re-export locale and termios libc constants through host_env

Move direct libc LC_*, ABDAY_*, ABMON_*, TIOC*, FIO* and related
constants in stdlib::locale and stdlib::termios to host_env
re-exports. Replace libc::c_char in stdlib::locale and
stdlib::openssl::cert with core::ffi::c_char.

* Replace libc c-types and FILE wrappers in openssl with host_env

Replace libc::c_int, c_long, c_uchar, c_uint, c_ulong, c_void,
c_char in stdlib::openssl with core::ffi equivalents. Replace
libc::ENOENT with host_env::errno::errors::ENOENT. Add
host_env::fileutils::{CFile, fclose} and route the load_dh_params
fclose call and PEM_read_DHparams FILE pointer type through them.

* Fix Windows build: expose EOVERFLOW, SIGSEGV, SIGFPE on Windows

host_mmap::EOVERFLOW and host_faulthandler::{SIGSEGV, SIGFPE}
re-exports were gated to cfg(unix) but stdlib uses them from Windows
and platform-agnostic code paths.

* Re-export remaining libc types and constants through host_env

Move direct libc references in stdlib (resource, posixsubprocess,
grp, socket) to host_env re-exports. Replace libc::c_long,
libc::c_longlong, libc::c_char in stdlib::socket with core::ffi
equivalents. Add resource::{RLIMIT_*, RUSAGE_*, c_long, rlim_t,
rlimit, timeval}, posix::{c_char, pid_t}, grp::gid_t, and
socket::{AF_*, SOCK_STREAM, sa_family_t, socklen_t, sockaddr_*}
re-exports.

* Move socket2 and dns-lookup dependencies from stdlib to host_env

Re-export socket2 as host_env::socket::raw and dns-lookup as
host_env::socket::dns. Update _socket call sites to route through
host_env aliases.

* Move system-configuration dependency from stdlib to host_env

Re-export the macOS system-configuration crate as
host_env::system_configuration and update _scproxy call sites.

* Restrict CAN/ALG sockaddr structs to target_os linux

libc on Android (bionic) does not define sockaddr_can, so importing it
for target_os = "android" fails to compile. Keep AF_ALG/AF_CAN for both
linux and android, and gate sockaddr_alg/sockaddr_can to linux only.

Assisted-by: Claude
2026-07-07 18:14:45 +09:00
..
2026-07-07 18:14:45 +09:00
2026-07-07 09:19:25 +09:00
2026-07-07 18:14:45 +09:00
2026-04-21 00:13:25 +09:00