You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.4 KiB

  1. From 36bcb170ba9097885902513640075eac2e6ce384 Mon Sep 17 00:00:00 2001
  2. From: Calin Culianu <calin.culianu@gmail.com>
  3. Date: Mon, 8 Nov 2021 18:15:59 -0600
  4. Subject: [PATCH] Fixup for Python 3.10
  5. Closes issue #109. Long story short: a few names from collection are
  6. now moved to collection.abc exclusively starting in Python 3.10. The
  7. only name this app uses from there that was moved is
  8. `collections.Iterable`. Python versions starting from 3.3 support both
  9. `collections.Iterable` and `collections.abc.Iterable` as the way to refer to
  10. this class, which Python 3.10 being the first one to drop
  11. `collections.Iterable`. So.. we just work around this API quirk
  12. and always refer ot it as `collections.abc.Iterable`.
  13. ---
  14. stem/control.py | 3 ++-
  15. 1 file changed, 2 insertions(+), 1 deletion(-)
  16. --- a/stem/control.py
  17. +++ b/stem/control.py
  18. @@ -249,6 +249,7 @@ If you're fine with allowing your script
  19. import calendar
  20. import collections
  21. +import collections.abc
  22. import functools
  23. import inspect
  24. import io
  25. @@ -2532,7 +2533,7 @@ class Controller(BaseController):
  26. for param, value in params:
  27. if isinstance(value, str):
  28. query_comp.append('%s="%s"' % (param, value.strip()))
  29. - elif isinstance(value, collections.Iterable):
  30. + elif isinstance(value, collections.abc.Iterable):
  31. query_comp.extend(['%s="%s"' % (param, val.strip()) for val in value])
  32. elif not value:
  33. query_comp.append(param)