-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
When I launch a subprocess from other implementations, such as PyPy, or other Python versions including 3.8, the sys.path
in those interpreters unexpectedly inherits from the 3.13 parent process, which is incorrect and leads to import errors.
import sys,multiprocessing
def f(n):
return sum(range(n))
def worker(n,result):
result.value=f(n)
print(f"Done from {sys.executable}")
if __name__=="__main__":
n = 100000000 # Attempt to calculate it from PyPy
multiprocessing.set_executable(r"D:\Python\pypy3.10-v7.3.17-win64\python.exe")
result = multiprocessing.Value('i', 0)
process = multiprocessing.Process(target=worker, args=(n, result))
process.start()
process.join()
assert result.value != 0, "An error may have occurred in the subprocess"
print(f"Result from f({n}): {result.value}")
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-multiprocessingtype-featureA feature request or enhancementA feature request or enhancement