[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem] 02/06: Fixup for Python 3.10



This is an automated email from the git hooks/post-receive script.

atagar pushed a commit to branch maint
in repository stem.

commit af71483f50bcfb0fc1eeff1f1686b9a13c91d749
Author: Calin Culianu <calin.culianu@xxxxxxxxx>
AuthorDate: Mon Nov 8 18:15:59 2021 -0600

    Fixup for Python 3.10
    
    Closes issue #109.  Long story short: a few names from collection are
    now moved to collection.abc exclusively starting in Python 3.10. The
    only name this app uses from there that was moved is
    `collections.Iterable`.  Python versions starting from 3.3 support both
    `collections.Iterable` and `collections.abc.Iterable` as the way to refer to
    this class, which Python 3.10 being the first one to drop
    `collections.Iterable`.  So.. we just work around this API quirk
    and always refer ot it as `collections.abc.Iterable`.
---
 stem/control.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index e93bf58b..e192e295 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -248,7 +248,7 @@ If you're fine with allowing your script to raise exceptions then this can be mo
 """
 
 import calendar
-import collections
+import collections.abc
 import functools
 import inspect
 import io
@@ -2532,7 +2532,7 @@ class Controller(BaseController):
     for param, value in params:
       if isinstance(value, str):
         query_comp.append('%s="%s"' % (param, value.strip()))
-      elif isinstance(value, collections.Iterable):
+      elif isinstance(value, collections.abc.Iterable):
         query_comp.extend(['%s="%s"' % (param, val.strip()) for val in value])
       elif not value:
         query_comp.append(param)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits