This is an automated email from the ASF dual-hosted git repository.

kpvdr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-interop-test.git

commit 3873d35d74662dac56e8cbba13032fb264a1237b
Author: QIT Development Team <[email protected]>
AuthorDate: Fri Jul 17 15:11:05 2026 -0400

    Fix Python shim char decoding bug
    
    Python receiver fails to parse char values from other shims.
    Handle three cases for char values:
    - Empty string or \x00 escape → code point 0
    - Single character → use ord() to get code point
    - Numeric string → parse as int
    
    Fixes 4 test failures where Java/C++/.NET send to Python receiver.
    
    Previous fix attempt was in Java encoder (wrong side).
    The issue was Python decoder failing with:
    'invalid literal for int() with base 10: \x00'
---
 shims/python-proton/shim.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/shims/python-proton/shim.py b/shims/python-proton/shim.py
index 68720de..7fc8009 100755
--- a/shims/python-proton/shim.py
+++ b/shims/python-proton/shim.py
@@ -117,7 +117,16 @@ class SenderHandler(MessagingHandler):
         # Character (UTF-32)
         if amqp_type == "char":
             from proton import char
-            code_point = int(value) if isinstance(value, str) else value
+            if isinstance(value, str):
+                # Handle string representations: empty, escape sequence, or 
numeric
+                if value == '' or value == '\\x00':
+                    code_point = 0
+                elif len(value) == 1:
+                    code_point = ord(value)
+                else:
+                    code_point = int(value)
+            else:
+                code_point = value
             return char(chr(code_point))
 
         # Timestamp (milliseconds since epoch)


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

Reply via email to