commit:     a34c877eb465561774c2bcd8536e7b9c2d987c54
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 30 16:48:49 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep 30 16:48:53 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a34c877e

Remove obsolete _eintr_func_wrapper

This wrapper is obsolete since python 3.5 implemented EINTR
retry in the standard library.

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/__init__.py | 25 +------------------------
 lib/portage/locks.py    |  2 +-
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
index 635eea31e2..05c81be538 100644
--- a/lib/portage/__init__.py
+++ b/lib/portage/__init__.py
@@ -345,29 +345,6 @@ class _unicode_module_wrapper:
         return result
 
 
-class _eintr_func_wrapper:
-    """
-    Wraps a function and handles EINTR by calling the function as
-    many times as necessary (until it returns without raising EINTR).
-    """
-
-    __slots__ = ("_func",)
-
-    def __init__(self, func):
-        self._func = func
-
-    def __call__(self, *args, **kwargs):
-        while True:
-            try:
-                rval = self._func(*args, **kwargs)
-                break
-            except OSError as e:
-                if e.errno != errno.EINTR:
-                    raise
-
-        return rval
-
-
 import os as _os
 
 _os_overrides = {
@@ -375,7 +352,7 @@ _os_overrides = {
     id(_os.popen): _os.popen,
     id(_os.read): _os.read,
     id(_os.system): _os.system,
-    id(_os.waitpid): _eintr_func_wrapper(_os.waitpid),
+    id(_os.waitpid): _os.waitpid,
 }
 
 

diff --git a/lib/portage/locks.py b/lib/portage/locks.py
index 9c77398bb1..1c3e13ce4f 100644
--- a/lib/portage/locks.py
+++ b/lib/portage/locks.py
@@ -297,7 +297,7 @@ def _lockfile_iteration(
 
     # try for a non-blocking lock, if it's held, throw a message
     # we're waiting on lockfile and use a blocking attempt.
-    locking_method = portage._eintr_func_wrapper(_get_lock_fn())
+    locking_method = _get_lock_fn()
     try:
         if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ:
             raise OSError(errno.ENOSYS, "Function not implemented")

Reply via email to