-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
mikecore fails to load DFS files with error 2003 (F_ERR_OPEN) when running test suites with Python 3.14 on Windows. Individual tests pass, but full suite execution experiences intermittent failures. Does not occur on Linux or with Python 3.13 on Windows.
Reproduction
Discovered in modelskill test suite:
# Fails: Full suite on Windows + Python 3.14
pytest tests/ -v
# Exception: Could not load file ... (Error code 2003)
# Passes: Same test individually
pytest tests/test_pointcompare.py::test_score -vTest Results
| Platform | Python | Result |
|---|---|---|
| Windows | 3.13 | ✅ Pass |
| Windows | 3.14 | ❌ Intermittent failures |
| Linux | 3.14 | ✅ Pass |
Root Cause
Python 3.14 introduced ctypes thread safety changes for free-threaded builds. mikecore's singleton DLL loading pattern in DfsDLL.py (lines 42-61) lacks thread safety:
class DfsDLL:
Wrapper = None # Global static, no locking
@staticmethod
def Init(libfilepath=None):
if DfsDLL.Wrapper is None: # Race condition
DfsDLL.Wrapper = ctypes.CDLL(...)Suggested Fix
Add thread-safe initialization with proper locking around singleton check and DLL loading.
Workaround
Use Python 3.13 on Windows. See modelskill commit ff699be8.
Environment
- mikecore: 0.2.2
- Python: 3.14.2
- OS: Windows 11
Metadata
Metadata
Assignees
Labels
No labels