commit:     dcfc92cb1264ed25655a035d5cf4993ee384c1f6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 30 15:09:44 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Mar 30 15:40:57 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dcfc92cb

dev-python/pytz: Fix resource leak in system-tzinfo patch

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch            | 7 ++++---
 dev-python/pytz/{pytz-2023.2-r1.ebuild => pytz-2023.2-r2.ebuild} | 0
 dev-python/pytz/{pytz-2023.3.ebuild => pytz-2023.3-r1.ebuild}    | 0
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch 
b/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch
index 1e64f1bd2fa4..85b639f0e615 100644
--- a/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch
+++ b/dev-python/pytz/files/pytz-2023.2-system-tzinfo.patch
@@ -7,7 +7,7 @@ diff --git a/pytz/__init__.py b/pytz/__init__.py
 index f89d0eb..d00f3bb 100644
 --- a/pytz/__init__.py
 +++ b/pytz/__init__.py
-@@ -75,6 +75,20 @@ else:  # Python 2.x
+@@ -75,6 +75,21 @@ else:  # Python 2.x
          return s.encode('ASCII')
  
  
@@ -15,8 +15,9 @@ index f89d0eb..d00f3bb 100644
 +    for dirpath, dirnames, filenames in os.walk(_PYTZ_TZDATADIR):
 +        for f in filenames:
 +            p = os.path.join(dirpath, f)
-+            if open(p, 'rb').read(4) == b'TZif':
-+                yield os.path.relpath(p, _PYTZ_TZDATADIR)
++            with open(p, 'rb') as tzfile:
++                if tzfile.read(4) == b'TZif':
++                    yield os.path.relpath(p, _PYTZ_TZDATADIR)
 +
 +
 +_PYTZ_TZDATADIR = os.environ.get('PYTZ_TZDATADIR', '/usr/share/zoneinfo')

diff --git a/dev-python/pytz/pytz-2023.2-r1.ebuild 
b/dev-python/pytz/pytz-2023.2-r2.ebuild
similarity index 100%
rename from dev-python/pytz/pytz-2023.2-r1.ebuild
rename to dev-python/pytz/pytz-2023.2-r2.ebuild

diff --git a/dev-python/pytz/pytz-2023.3.ebuild 
b/dev-python/pytz/pytz-2023.3-r1.ebuild
similarity index 100%
rename from dev-python/pytz/pytz-2023.3.ebuild
rename to dev-python/pytz/pytz-2023.3-r1.ebuild

Reply via email to