Update threading.Event.isSet() calls to .is_set()

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1959317
epel9
Miro Hrončok 4 years ago
parent a4a36962be
commit b79d6d55b6

@ -0,0 +1,66 @@
From dd2de983417a72efcbe35150a5166de0f4965c65 Mon Sep 17 00:00:00 2001
From: Florian Bruhin <me@the-compiler.org>
Date: Tue, 4 May 2021 16:46:46 +0200
Subject: [PATCH] Update threading.Event.isSet() calls
The new is_set() snake-case spelling has been available since
Python 2.6:
https://docs.python.org/2/library/threading.html#threading.Event.is_set
The old isSet() camel-case spelling raises a deprecation warning with
Python 3.10:
https://docs.python.org/3.10/whatsnew/3.10.html#deprecated
(almost at the end)
---
execnet/gateway_base.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/execnet/gateway_base.py b/execnet/gateway_base.py
index a230683..a75b584 100644
--- a/execnet/gateway_base.py
+++ b/execnet/gateway_base.py
@@ -295,7 +295,7 @@ def _try_send_to_primary_thread(self, reply):
# note that we should be called with _running_lock hold
primary_thread_task_ready = self._primary_thread_task_ready
if primary_thread_task_ready is not None:
- if not primary_thread_task_ready.isSet():
+ if not primary_thread_task_ready.is_set():
self._primary_thread_task = reply
# wake up primary thread
primary_thread_task_ready.set()
@@ -591,7 +591,7 @@ def setcallback(self, callback, endmarker=NO_ENDMARKER_WANTED):
try:
olditem = items.get(block=False)
except self.gateway.execmodel.queue.Empty:
- if not (self._closed or self._receiveclosed.isSet()):
+ if not (self._closed or self._receiveclosed.is_set()):
_callbacks[self.id] = (callback, endmarker, self._strconfig)
break
else:
@@ -616,7 +616,7 @@ def __del__(self):
# state transition "closed" --> "deleted"
for error in self._remoteerrors:
error.warn()
- elif self._receiveclosed.isSet():
+ elif self._receiveclosed.is_set():
# state transition "sendonly" --> "deleted"
# the remote channel is already in "deleted" state, nothing to do
pass
@@ -682,7 +682,7 @@ def close(self, error=None):
# but it's never damaging to send too many CHANNEL_CLOSE messages
# however, if the other side triggered a close already, we
# do not send back a closed message.
- if not self._receiveclosed.isSet():
+ if not self._receiveclosed.is_set():
put = self.gateway._send
if error is not None:
put(Message.CHANNEL_CLOSE_ERROR, self.id, dumps_internal(error))
@@ -711,7 +711,7 @@ def waitclose(self, timeout=None):
"""
# wait for non-"opened" state
self._receiveclosed.wait(timeout=timeout)
- if not self._receiveclosed.isSet():
+ if not self._receiveclosed.is_set():
raise self.TimeoutError("Timeout after %r seconds" % timeout)
error = self._getremoteerror()
if error:

@ -8,6 +8,11 @@ License: MIT
URL: https://github.com/pytest-dev/execnet URL: https://github.com/pytest-dev/execnet
Source0: %pypi_source Source0: %pypi_source
# Update threading.Event.isSet() calls to .is_set()
# This avoids a DeprecationWarning with Python 3.10
# Merged upstream
Patch1: https://github.com/pytest-dev/execnet/pull/127.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: make BuildRequires: make
BuildRequires: %{_bindir}/ps BuildRequires: %{_bindir}/ps
@ -48,7 +53,7 @@ minimal and fast API targetting the following uses:
%prep %prep
%setup -q -n %{srcname}-%{version} %autosetup -p1 -n %{srcname}-%{version}
# remove shebangs and fix permissions # remove shebangs and fix permissions
find . -type f -a \( -name '*.py' -o -name 'py.*' \) \ find . -type f -a \( -name '*.py' -o -name 'py.*' \) \
-exec sed -i '1{/^#!/d}' {} \; \ -exec sed -i '1{/^#!/d}' {} \; \

Loading…
Cancel
Save