Bug 1860077 - Convert process `handle` to `int` in ProcessHandlerMixin::Process::__del__ to resolve an issue on Windows r=ahal

I started going down the path I initially proposed in bug 1753797, but
that was more effort than it was worth. Converting the handle as
necessary seems good enough.

Differential Revision: https://phabricator.services.mozilla.com/D192122
This commit is contained in:
ahochheiden 2023-11-02 01:42:17 +00:00
Родитель 77924520f0
Коммит e31ee71874
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -181,7 +181,12 @@ class ProcessHandlerMixin(object):
_maxint = sys.maxsize
handle = getattr(self, "_handle", None)
if handle:
# _internal_poll is a Python3 built-in call and requires _handle to be an int on Windows
# It's only an AutoHANDLE for legacy Python2 reasons that are non-trivial to remove
self._handle = int(self._handle)
self._internal_poll(_deadstate=_maxint)
# Revert it back to the saved 'handle' (AutoHANDLE) for self._cleanup()
self._handle = handle
if handle or self._job or self._io_port:
self._cleanup()
else: