Skip to content

Commit dd8c743

Browse files
fix pylibftdi for Python3.12
1 parent 260bf6a commit dd8c743

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

.github/workflows/python-lint-and-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
# Note we don't test version 3.7 as many dev deps require >= 3.8
12-
python-version: ["3.8", "3.9", "3.10", "3.11"]
12+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1313

1414
steps:
1515
- uses: actions/checkout@v3

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ classifiers = [
2929
"Programming Language :: Python :: 3.9",
3030
"Programming Language :: Python :: 3.10",
3131
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
3233
"Topic :: Scientific/Engineering",
3334
"Topic :: Software Development :: Embedded Systems",
3435
"Topic :: System :: Hardware",

src/pylibftdi/driver.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ def _load_library(self, name: str, search_list: list[str] | None = None) -> Any:
143143
# cdll access.
144144
lib = getattr(cdll, dll)
145145
break
146-
except OSError:
146+
# On DLL load fail, Python <3.12 raises OSError, 3.12+ AttributeError.
147+
except (OSError, AttributeError):
147148
lib_path = find_library(dll)
148149
if lib_path is not None:
149150
lib = getattr(cdll, lib_path)

0 commit comments

Comments
 (0)