diff options
author | shadchin <[email protected]> | 2023-10-03 23:32:21 +0300 |
---|---|---|
committer | shadchin <[email protected]> | 2023-10-03 23:48:51 +0300 |
commit | 01ffd024041ac933854c367fb8d1b5682d19883f (patch) | |
tree | b70aa497ba132a133ccece49f7763427dcd0743f /contrib/tools/python3/src/Lib/multiprocessing/synchronize.py | |
parent | a33fdb9a34581fd124e92535153b1f1fdeca6aaf (diff) |
Update Python 3 to 3.11.6
Diffstat (limited to 'contrib/tools/python3/src/Lib/multiprocessing/synchronize.py')
-rw-r--r-- | contrib/tools/python3/src/Lib/multiprocessing/synchronize.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py b/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py index 2328d332123..3ccbfe311c7 100644 --- a/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py +++ b/contrib/tools/python3/src/Lib/multiprocessing/synchronize.py @@ -50,8 +50,8 @@ class SemLock(object): def __init__(self, kind, value, maxvalue, *, ctx): if ctx is None: ctx = context._default_context.get_context() - self.is_fork_ctx = ctx.get_start_method() == 'fork' - unlink_now = sys.platform == 'win32' or self.is_fork_ctx + self._is_fork_ctx = ctx.get_start_method() == 'fork' + unlink_now = sys.platform == 'win32' or self._is_fork_ctx for i in range(100): try: sl = self._semlock = _multiprocessing.SemLock( @@ -103,7 +103,7 @@ class SemLock(object): if sys.platform == 'win32': h = context.get_spawning_popen().duplicate_for_child(sl.handle) else: - if self.is_fork_ctx: + if self._is_fork_ctx: raise RuntimeError('A SemLock created in a fork context is being ' 'shared with a process in a spawn context. This is ' 'not supported. Please use the same context to create ' @@ -115,6 +115,8 @@ class SemLock(object): self._semlock = _multiprocessing.SemLock._rebuild(*state) util.debug('recreated blocker with handle %r' % state[0]) self._make_methods() + # Ensure that deserialized SemLock can be serialized again (gh-108520). + self._is_fork_ctx = False @staticmethod def _make_name(): |