Skip to content

Use add_dll_directory as a context manager #708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

maresb
Copy link
Contributor

@maresb maresb commented Apr 12, 2024

Description

I am perhaps still a bit stuck on the partially refuted idea that the error in #678 is caused by adding a path repeatedly instead of by an actual long path. (It didn't seem to solve the problem.)

This tweak to my previous approach calls add_dll_directory as a context manager so that the path is added just temporarily. My long-shot hope is that the @cache decorator was insufficient protection due to multithreading/multiprocessing when running pytest.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@maresb maresb force-pushed the add_dll_directory-context branch from 8bdf838 to a9ff5cf Compare April 12, 2024 14:54
@maresb maresb force-pushed the add_dll_directory-context branch from a9ff5cf to 1ffbae3 Compare April 12, 2024 15:09
@ricardoV94 ricardoV94 requested a review from lucianopaz April 15, 2024 09:29
Copy link
Member

@lucianopaz lucianopaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ricardoV94 ricardoV94 merged commit 4e5570d into pymc-devs:main Apr 15, 2024
@maresb maresb deleted the add_dll_directory-context branch April 16, 2024 08:28
@Dhruvanshu-Joshi
Copy link
Member

I think the mypy checks still fail on windows. Here's the new error log that I get:

[pytensor\link\c\cmodule.py]
pytensor\link\c\cmodule.py:291: error: Incompatible types in assignment (expression has type "_AddedDllDirectory", variable has type "AbstractContextManager[None]")
pytensor\link\c\cmodule.py:291: note: Error code "assignment" not covered by "type: ignore" comment
pytensor\link\c\cmodule.py:291: note: Following member(s) of "_AddedDllDirectory" have conflicts:
pytensor\link\c\cmodule.py:291: note:     Expected:
pytensor\link\c\cmodule.py:291: note:         def __enter__(self) -> None
pytensor\link\c\cmodule.py:291: note:     Got:
pytensor\link\c\cmodule.py:291: note:         def __enter__(self) -> _AddedDllDirectory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants