fix: replace assert with proper exception in python_build_standalone (#2859)
Assert statements are skipped under python -O, making them unsuitable for runtime validation. Replace assert with an explicit check that raises PythonBuildStandaloneError if the target directory already exists. Assisted-by: OpenCode:glm-5
This commit is contained in:
@@ -175,7 +175,9 @@ def create_python_build_standalone_environment(
|
||||
)
|
||||
|
||||
python_base_dir = temp_dir / "pbs"
|
||||
assert not python_base_dir.exists()
|
||||
if python_base_dir.exists():
|
||||
msg = f"python-build-standalone directory already exists: {python_base_dir}"
|
||||
raise PythonBuildStandaloneError(msg)
|
||||
extract_tar(archive_path, python_base_dir)
|
||||
|
||||
return _find_python_executable(python_base_dir)
|
||||
|
||||
Reference in New Issue
Block a user