portalocker icon indicating copy to clipboard operation
portalocker copied to clipboard

Feature request: remove pywin32 dependency so that this project can be free-threading compatible

Open electroglyph opened this issue 6 months ago • 2 comments

free-threading compatibility for pywin32 is looking pretty grim:

https://github.com/mhammond/pywin32/issues/2303

portalocker is the only thing left blocking free-threading compatibility for a project i use.

i haven't looked at your implementation yet, but would you be open to accepting a PR that gets rid of pywin32?

electroglyph avatar Jun 26 '25 06:06 electroglyph

The pywin32 support was actually re-added in the most recent release of the library since the msvcrt locking has a few limitations: https://github.com/wolph/portalocker/issues/98

The code is completely contained within the Win32Locker however (including the imports) so the library will work safely without having pywin32 installed: https://github.com/wolph/portalocker/blob/7c764c933cda2fdb4471b1b427595fe9cf061e5c/portalocker/portalocker.py#L101-L156

Where I seem to have gone wrong... I've made pywin32 a fixed instead of an optional requirement for the library so I need to fix that :)

wolph avatar Jun 26 '25 11:06 wolph

excellent, that's great news!

electroglyph avatar Jun 27 '25 00:06 electroglyph