◐ Shell
clean mode source ↗

Add minimal capi lifecycle support by bschoenmaeckers · Pull Request #7648 · RustPython/RustPython

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Inspect import-lock after-fork helper call sites and nearby cfg guards.
rg -n -C4 'acquire_imp_lock_for_fork|release_imp_lock_after_fork_parent|reinit_imp_lock_after_fork|after_fork_child_imp_lock_release' --type rust

Repository: RustPython/RustPython

Length of output: 4130


🏁 Script executed:

#!/bin/bash
# Check the full context around line 851 in posix.rs to see the cfg guard
sed -n '840,860p' crates/vm/src/stdlib/posix.rs | cat -n

Repository: RustPython/RustPython

Length of output: 909


🏁 Script executed:

#!/bin/bash
# Check if _imp.rs has conditional no-op exports for when host_env is unavailable
sed -n '79,110p' crates/vm/src/stdlib/_imp.rs | cat -n

Repository: RustPython/RustPython

Length of output: 1301


🏁 Script executed:

#!/bin/bash
# Find the function containing line 851 in posix.rs to check parent cfg guard
sed -n '830,855p' crates/vm/src/stdlib/posix.rs | cat -n

Repository: RustPython/RustPython

Length of output: 1315


🏁 Script executed:

#!/bin/bash
# Also check if there are any conditional stubs or no-op exports for when host_env is not available
rg -A5 'cfg.*host_env' crates/vm/src/stdlib/_imp.rs

Repository: RustPython/RustPython

Length of output: 1583


🏁 Script executed:

#!/bin/bash
# Find the function definition that contains line 851
sed -n '800,860p' crates/vm/src/stdlib/posix.rs | grep -n "fn " | head -5

Repository: RustPython/RustPython

Length of output: 178


🏁 Script executed:

#!/bin/bash
# Get full function signature and cfg around line 851
sed -n '795,860p' crates/vm/src/stdlib/posix.rs | cat -n

Repository: RustPython/RustPython

Length of output: 3390


🏁 Script executed:

#!/bin/bash
# Check if host_env is a conditional feature that can be disabled
rg -n "feature.*host_env|host_env.*feature" crates/vm/Cargo.toml crates/Cargo.toml

Repository: RustPython/RustPython

Length of output: 122


🏁 Script executed:

#!/bin/bash
# Check the full context of call sites to see exact cfg guards
sed -n '760,770p' crates/vm/src/stdlib/posix.rs | cat -n
sed -n '800,810p' crates/vm/src/stdlib/posix.rs | cat -n  
sed -n '855,865p' crates/vm/src/stdlib/posix.rs | cat -n

Repository: RustPython/RustPython

Length of output: 1543


🏁 Script executed:

#!/bin/bash
# Check for host_env feature definition in the workspace
find . -name "Cargo.toml" -type f | xargs grep -l "host_env" | head -5

Repository: RustPython/RustPython

Length of output: 156


🏁 Script executed:

#!/bin/bash
# Check the root Cargo.toml for feature definitions
sed -n '/\[features\]/,/^\[/p' Cargo.toml | head -30

Repository: RustPython/RustPython

Length of output: 963


🏁 Script executed:

#!/bin/bash
# Check if there are any conditional no-op stubs for the fork helpers when host_env is unavailable
rg -B5 -A5 'cfg.*not.*host_env' crates/vm/src/stdlib/_imp.rs

Repository: RustPython/RustPython

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Confirm the exact cfg guard on the reinit_locks_after_fork function
sed -n '818,835p' crates/vm/src/stdlib/posix.rs | cat -n

Repository: RustPython/RustPython

Length of output: 1086


🏁 Script executed:

#!/bin/bash
# Check if there are any conditional stubs anywhere for these functions when host_env is unavailable
rg 'acquire_imp_lock_for_fork|release_imp_lock_after_fork_parent|reinit_imp_lock_after_fork|after_fork_child_imp_lock_release' crates/vm/src/stdlib/_imp.rs

Repository: RustPython/RustPython

Length of output: 272


🏁 Script executed:

#!/bin/bash
# Verify: when host_env feature is off, are these symbols completely unavailable?
# Check what happens after line 97 in _imp.rs (after the host_env gated functions)
sed -n '97,120p' crates/vm/src/stdlib/_imp.rs | cat -n

Repository: RustPython/RustPython

Length of output: 1005


Align call sites with the new export cfg gates to prevent linker errors.

The four fork helpers in _imp.rs (lines 79–96) are now gated with all(unix, feature = "threading", feature = "host_env"), but their call sites in posix.rs only check feature = "threading" or all(unix, feature = "threading"). When host_env is disabled, these functions will not be exported, causing linker failures.

Update the four call sites in posix.rs to require all(unix, feature = "threading", feature = "host_env"):