pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

async and await are reserved keywords in python 3.7 #188

Closed bsipocz closed 4 years ago

bsipocz commented 5 years ago

Thus https://github.com/pymc-devs/pymc/blob/master/pymc/threadpool.py#L346 causes a SyntaxError at the time of importing pymc.

I suppose there is no plans to do another release here, but if it's a possibility I'm happy to open a PR to rename the method.

boegel commented 4 years ago

I ran into a SyntaxError as well when trying to install pymc with Python 3.7 (as a dependency for HDDM), fixed with the following patch:

await is a keyword in Python 3.7+, so rename 'await' method to avoid SyntaxError

--- pymc-2.3.7/pymc/threadpool.py.orig  2020-03-19 17:48:14.572211381 +0100
+++ pymc-2.3.7/pymc/threadpool.py   2020-03-19 17:49:39.573111182 +0100
@@ -343,7 +343,7 @@
             self.main_lock.release()
         self.counter_lock.release()

-    def await(self):
+    def waitforit(self):
         self.main_lock.acquire()
         self.main_lock.release()

@@ -384,7 +384,7 @@
                         exc_callback=eb,
                         args=args,
                         requestID=id(args)))
-    done_lock.await()
+    done_lock.waitforit()

     if exceptions:
         six.reraise(*exceptions[0])
twiecki commented 4 years ago

@boegel want to do a PR?

boegel commented 4 years ago

@twiecki I started looking into a PR, and noticed you've already fixed this in #193.

There's no release yet with this fix included though...