[ 
https://issues.apache.org/jira/browse/PROTON-2237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17245405#comment-17245405
 ] 

ASF subversion and git services commented on PROTON-2237:
---------------------------------------------------------

Commit 66f8696721fab2cc982c05eb7d94572bb2956841 in qpid-proton's branch 
refs/heads/python-check-property-keys from Kim van der Riet
[ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=66f8696 ]

PROTON-2237: Correct checking of Proton message property keys

PROTON-2237: Alternative approach which converts all child classes of 
string/unicode to the base class, including proton symbol and char types.

PROTON-2237: Changed logic of key check so that subclasses of string *except* 
proton.symbol and proton.char will be encoded as strings

PROTON-2237: Added unit tests to check illegal key types are detected and 
handled, also subclasses of string type keys are converted to type string

PROTON-2237: Finalized handling property keys, added tests for these cases.

PROTON-2237: Fix for dictionary keys changed during iteration error, deeper 
test for key conversions

PROTON-2237: Final tidy-up of logic and structure, added function doc to 
explain what is happening.

NO-JIRA: Minor code format fix: added space into if stmt.

PROTON-2237: Rearrange logic so as to avoid python version check. Minor 
re-arrange of tests.


> [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
>            Assignee: 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to