mhammond / pywin32

Python for Windows (pywin32) Extensions
5.01k stars 793 forks source link

Release GIL when creating or starting a service #2062

Closed adamkbmc closed 1 year ago

adamkbmc commented 1 year ago

Some service take a while to start so this change releases the GIL so that the python process isn't blocked. It only applies to CreateService and StartService. I guess it could also be applied to ControlService and DeleteService but these are simple calls into the Win32 API (and we've not had a problem with services taking a long time to stop or when being deleted)

It also has a small build change: on some machines (generally developer systems) the default action for a .py file isn't to run it, but to edit it. If the default action has been changed then the build breaks so my change just runs the h2py.py script using python.exe explicitly. This seems to be the only place where .py files are run without specifying the interpreter

mhammond commented 1 year ago

Maybe add a note to the changelog too?

adamkbmc commented 1 year ago

I've added a note to CHANGES.txt and backed out the makefile_pythonwin change. I didn't plan to submit that at the same time I just needed it to make the code build on my machine.