Skip to content

Commit 0a13fbd

Browse files
maresbricardoV94
authored andcommitted
Fix mypy problem on Windows due to platform differences
As reported in <#678 (comment)>, mypy was failing on Windows due to an unnecessary type: ignore. This fixes it by ignoring the unused-ignore so that Windows is covered.
1 parent bc3dda0 commit 0a13fbd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pytensor/link/c/cmodule.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ def add_gcc_dll_directory() -> None:
284284
if (sys.platform == "win32") & (hasattr(os, "add_dll_directory")):
285285
gcc_path = shutil.which("gcc")
286286
if gcc_path is not None:
287-
os.add_dll_directory(os.path.dirname(gcc_path)) # type: ignore
287+
# Since add_dll_directory is only defined on windows, we need
288+
# the ignore[attr-defined] on non-Windows platforms.
289+
# For Windows we need ignore[unused-ignore] since the ignore
290+
# is unnecessary with that platform.
291+
os.add_dll_directory(os.path.dirname(gcc_path)) # type: ignore[attr-defined,unused-ignore]
288292

289293

290294
def dlimport(fullpath, suffix=None):

0 commit comments

Comments
 (0)