mirror of
https://github.com/opencv/opencv.git
synced 2026-11-15 05:47:57 -06:00
bootstrap() inserts the package directory into sys.path before importing the native module, but restores sys.path (#18930) and clears sys.OpenCV_LOADER only after that import succeeds. When the native module fails to load (e.g. a missing libGL/libxcb), the cv2/ directory stays on sys.path. Callers that treat cv2 as optional keep running, and multiprocessing "spawn" children inherit that sys.path, where cv2/typing shadows the standard typing module. Restore both before re-raising, and add a test that imports a loader whose native module raises ImportError. Fixes #28766