[PKG-Openstack-devel] Bug#903030: python-dogpile.cache: Misc fixes for Py 3.7 compatibility

James Page james.page at ubuntu.com
Thu Jul 5 11:54:56 BST 2018


Package: python-dogpile.cache
Version: 0.6.2-5
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu cosmic ubuntu-patch

Dear Maintainer,


In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/py37-compat.patch: Compat fixes for Python 3.7.

The patch was picked from the upstream VCS.

Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers cosmic
  APT policy: (500, 'cosmic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.15.0-23-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru python-dogpile.cache-0.6.2/debian/patches/py37-compat.patch python-dogpile.cache-0.6.2/debian/patches/py37-compat.patch
--- python-dogpile.cache-0.6.2/debian/patches/py37-compat.patch	1969-12-31 18:00:00.000000000 -0600
+++ python-dogpile.cache-0.6.2/debian/patches/py37-compat.patch	2018-07-05 05:30:20.000000000 -0500
@@ -0,0 +1,118 @@
+commit 3c4351c11f79e0c458dc281ee9745e29feee993b
+Author: Brian Sheldon <trash.block at gmail.com>
+Date:   Mon Mar 5 09:18:16 2018 -0500
+
+    Rename "async" variable for python 3.7
+    
+    Fixed import issue for Python 3.7 where a variable named "async" was
+    used, leading to syntax errors.  Pull request courtesy Brian Sheldon.
+    
+    Fixes: #119
+    Change-Id: I5189eaaca07e4eb369daa655a54791dfa915c034
+    Pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/64
+
+--- /dev/null
++++ b/docs/build/unreleased/119.rst
+@@ -0,0 +1,8 @@
++.. change::
++	:tags: bug
++	:tickets: 119
++
++	Fixed import issue for Python 3.7 where several variables named "async"
++	were, leading to syntax errors.  Pull request courtesy Brian Sheldon.
++
++
+--- a/dogpile/lock.py
++++ b/dogpile/lock.py
+@@ -112,7 +112,7 @@ class Lock(object):
+         if not self._is_expired(createdtime):
+             return NOT_REGENERATED
+ 
+-        async = False
++        _async = False
+ 
+         if self._has_value(createdtime):
+             if not self.mutex.acquire(False):
+@@ -138,14 +138,14 @@ class Lock(object):
+                 elif self.async_creator:
+                     log.debug("Passing creation lock to async runner")
+                     self.async_creator(self.mutex)
+-                    async = True
++                    _async = True
+                     return value, createdtime
+ 
+             log.debug("Calling creation function")
+             created = self.creator()
+             return created
+         finally:
+-            if not async:
++            if not _async:
+                 self.mutex.release()
+                 log.debug("Released creation lock")
+ 
+--- a/dogpile/util/readwrite_lock.py
++++ b/dogpile/util/readwrite_lock.py
+@@ -23,7 +23,7 @@ class ReadWriteMutex(object):
+ 
+     def __init__(self):
+         # counts how many asynchronous methods are executing
+-        self.async = 0
++        self.async_ = 0
+ 
+         # pointer to thread that is the current sync operation
+         self.current_sync_operation = None
+@@ -31,7 +31,7 @@ class ReadWriteMutex(object):
+         # condition object to lock on
+         self.condition = threading.Condition(threading.Lock())
+ 
+-    def acquire_read_lock(self, wait = True):
++    def acquire_read_lock(self, wait=True):
+         """Acquire the 'read' lock."""
+         self.condition.acquire()
+         try:
+@@ -45,7 +45,7 @@ class ReadWriteMutex(object):
+                 if self.current_sync_operation is not None:
+                     return False
+ 
+-            self.async += 1
++            self.async_ += 1
+             log.debug("%s acquired read lock", self)
+         finally:
+             self.condition.release()
+@@ -57,23 +57,23 @@ class ReadWriteMutex(object):
+         """Release the 'read' lock."""
+         self.condition.acquire()
+         try:
+-            self.async -= 1
++            self.async_ -= 1
+ 
+             # check if we are the last asynchronous reader thread
+             # out the door.
+-            if self.async == 0:
++            if self.async_ == 0:
+                 # yes. so if a sync operation is waiting, notifyAll to wake
+                 # it up
+                 if self.current_sync_operation is not None:
+                     self.condition.notifyAll()
+-            elif self.async < 0:
++            elif self.async_ < 0:
+                 raise LockError("Synchronizer error - too many "
+                                 "release_read_locks called")
+             log.debug("%s released read lock", self)
+         finally:
+             self.condition.release()
+ 
+-    def acquire_write_lock(self, wait = True):
++    def acquire_write_lock(self, wait=True):
+         """Acquire the 'write' lock."""
+         self.condition.acquire()
+         try:
+@@ -96,7 +96,7 @@ class ReadWriteMutex(object):
+             self.current_sync_operation = threading.currentThread()
+ 
+             # now wait again for asyncs to finish
+-            if self.async > 0:
++            if self.async_ > 0:
+                 if wait:
+                     # wait
+                     self.condition.wait()
diff -Nru python-dogpile.cache-0.6.2/debian/patches/series python-dogpile.cache-0.6.2/debian/patches/series
--- python-dogpile.cache-0.6.2/debian/patches/series	2017-04-25 09:27:04.000000000 -0500
+++ python-dogpile.cache-0.6.2/debian/patches/series	2018-07-05 05:09:54.000000000 -0500
@@ -1,2 +1,3 @@
 no-intersphinx.patch
 remove-non-deterministic-tests.patch
+py37-compat.patch


More information about the Openstack-devel mailing list