You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2020/06/02 17:18:20 UTC
[qpid-proton] branch python-check-property-keys created (now
ccbfcf6)
This is an automated email from the ASF dual-hosted git repository.
kpvdr pushed a change to branch python-check-property-keys
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git.
at ccbfcf6 PROTON-2237: Correct checking of Proton message property keys
This branch includes the following new commits:
new ccbfcf6 PROTON-2237: Correct checking of Proton message property keys
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-proton] 01/01: PROTON-2237: Correct checking of Proton
message property keys
Posted by kp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kpvdr pushed a commit to branch python-check-property-keys
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit ccbfcf659d19c0b7917beed823432ba102743386
Author: Kim van der Riet <kp...@apache.org>
AuthorDate: Tue Jun 2 13:16:49 2020 -0400
PROTON-2237: Correct checking of Proton message property keys
---
python/proton/_message.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/python/proton/_message.py b/python/proton/_message.py
index 6563935..5ed94ae 100644
--- a/python/proton/_message.py
+++ b/python/proton/_message.py
@@ -90,13 +90,16 @@ class Message(object):
def _check_property_keys(self):
for k in self.properties.keys():
- if isinstance(k, unicode):
- # py2 unicode, py3 str (via hack definition)
+ # Check for string type. (py2: unicode, py3: str via type hack above)
+ # String subclasses symbol and char are excluded
+ # (But so are other string subclasses that would be encoded as type string!)
+ if type(k) == unicode:
continue
# If key is binary then change to string
- elif isinstance(k, str):
- # py2 str
- self.properties[k.encode('utf-8')] = self.properties.pop(k)
+ # Mostly for py2 users who encode strings without using the u'' prefix
+ # but py3 bytes() type will be converted also
+ elif isinstance(k, bytes):
+ self.properties[k.decode('utf-8')] = self.properties.pop(k)
else:
raise MessageException('Application property key is not string type: key=%s %s' % (str(k), type(k)))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org