Commit e6997dba authored by Jan Reimes's avatar Jan Reimes
Browse files

fix(factory): handle multiple exceptions when importing InterpreterPoolExecutor

* Update exception handling to catch both ImportError and AttributeError
* Ensure compatibility with older Python versions in factory and test files
parent 52282dff
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -9,12 +9,11 @@ from typing import Any
from pool_executors.pool_executors.serial import SerialPoolExecutor
from pool_executors.pool_executors.types import ExecutorType

# Import InterpreterPoolExecutor for Python 3.14+, handle gracefully for older versions
try:
    from concurrent.futures import InterpreterPoolExecutor

    HAS_INTERPRETER_POOL_EXECUTOR = True
except ImportError, AttributeError:
except (ImportError, AttributeError):
    InterpreterPoolExecutor = None  # type: ignore[assignment, misc]
    HAS_INTERPRETER_POOL_EXECUTOR = False

+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ from functools import partial

try:
    from concurrent.futures import InterpreterPoolExecutor
except ImportError:
except (ImportError, AttributeError):
    InterpreterPoolExecutor = None  # type: ignore[misc]

import pytest