kpvdr commented on a change in pull request #256:
URL: https://github.com/apache/qpid-proton/pull/256#discussion_r469565080



##########
File path: python/proton/_message.py
##########
@@ -90,13 +90,18 @@ def _check(self, err):
 
     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 types. (py2: unicode, py3: str via type hack 
above)
+            # or string subclasses. Exclude string subclasses symbol and char.
+            if isinstance(k, unicode) and not (type(k) is symbol or type(k) is 
char):
+                # Convert string subclasses to string
+                if not type(k) is unicode:
+                    self.properties[unicode(k)] = self.properties.pop(k)
                 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)
+            # If key is binary then change to string. Exclude bytes subclass 
decimal128.
+            # Mostly for py2 users who encode strings without using the u'' 
prefix
+            # but py3 bytes() type will be converted also
+            elif isinstance(k, bytes) and not (type(k) is decimal128):

Review comment:
       Good point. Agreed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to