0001-fix-publish-for-python-3-10.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From e1c45570f61f9d6b28f8604c8a8cd6dd94f959ed Mon Sep 17 00:00:00 2001
  2. From: Brishen Hawkins <brishen.hawkins@gmail.com>
  3. Date: Tue, 9 Jun 2020 00:18:39 -0600
  4. Subject: [PATCH] Fix for Python 3.9 moving Iterable to collections.abc
  5. Signed-off-by: Brishen Hawkins <brishen.hawkins@gmail.com>
  6. Backported from: e1c45570f61f9d6b28f8604c8a8cd6dd94f959ed
  7. Signed-off-by: Marcus Hoffmann <marcus.hoffmann@othermo.de>
  8. ---
  9. src/paho/mqtt/publish.py | 6 +++++-
  10. 1 file changed, 5 insertions(+), 1 deletion(-)
  11. diff --git a/src/paho/mqtt/publish.py b/src/paho/mqtt/publish.py
  12. index f9f1986e..dcb34ff1 100644
  13. --- a/src/paho/mqtt/publish.py
  14. +++ b/src/paho/mqtt/publish.py
  15. @@ -21,6 +21,10 @@
  16. from __future__ import absolute_import
  17. import collections
  18. +try:
  19. + from collections.abc import Iterable
  20. +except ImportError:
  21. + from collections import Iterable
  22. from . import client as paho
  23. from .. import mqtt
  24. @@ -124,7 +128,7 @@ def multiple(msgs, hostname="localhost", port=1883, client_id="", keepalive=60,
  25. proxy_args: a dictionary that will be given to the client.
  26. """
  27. - if not isinstance(msgs, collections.Iterable):
  28. + if not isinstance(msgs, Iterable):
  29. raise TypeError('msgs must be an iterable')
  30. client = paho.Client(client_id=client_id, userdata=collections.deque(msgs),