You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Kim van der Riet (Jira)" <ji...@apache.org> on 2020/06/02 17:31:00 UTC

[jira] [Updated] (PROTON-2237) [python] Non-string message property keys not handled correctly

     [ https://issues.apache.org/jira/browse/PROTON-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kim van der Riet updated PROTON-2237:
-------------------------------------
    Description: 
The AMQP 1.0 spec allows only string keys for message properties.

Proton's Python binding has a method (_message.py:91 _check_property_keys()) for checking message property keys, but it does not handle all cases correctly:
 # Proton types Symbol and Char are derived from string, and are allowed in the test. This results in an illegal encoding.
 # Because in Python 2, many coders carelessly use string literals without the required u'' prefix (and thus results in a bytes type), bytes types are converted to unicode string types. However, the encode() function is being used, which simply returns a binary type in Python 2 and raises an error in Python 3. This should probably be the decode() method, which returns a string and works for both Python 2 and 3.

  was:
The AMQP 1.0 spec allows only string keys for message properties.



Proton's Python binding has a method (_message.py:91 _check_property_keys()) for checking message property keys, but it does not handle all cases correctly:
 # Proton types Symbol and Char are derived from string, and are allowed in the test. This results in an illegal encoding.
 # Because in Python 2, many coders carelessly use string literals without the required u'' prefix (and thus results in a bytes type), bytes types are converted to unicode string types. However, the encode() function is being used, which simply returns a binary type in Python 2 and raises an error in Python 3. This should probably be the decode() method, which works for both Python 2 and 3.


> [python] Non-string message property keys not handled correctly
> ---------------------------------------------------------------
>
>                 Key: PROTON-2237
>                 URL: https://issues.apache.org/jira/browse/PROTON-2237
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>            Reporter: Kim van der Riet
>            Priority: Major
>
> The AMQP 1.0 spec allows only string keys for message properties.
> Proton's Python binding has a method (_message.py:91 _check_property_keys()) for checking message property keys, but it does not handle all cases correctly:
>  # Proton types Symbol and Char are derived from string, and are allowed in the test. This results in an illegal encoding.
>  # Because in Python 2, many coders carelessly use string literals without the required u'' prefix (and thus results in a bytes type), bytes types are converted to unicode string types. However, the encode() function is being used, which simply returns a binary type in Python 2 and raises an error in Python 3. This should probably be the decode() method, which returns a string and works for both Python 2 and 3.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org