[jira] [Commented] (PROTON-2712) [Python] Inconsistencies in binding type mappings

2023-04-18 Thread Andrew Stitcher (Jira)


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

Andrew Stitcher commented on PROTON-2712:
-

Ah, thanks - I can confirm that the fixed version produces a better result for 
user_id using the cli-proton-python sender

> [Python] Inconsistencies in binding type mappings
> -
>
> Key: PROTON-2712
> URL: https://issues.apache.org/jira/browse/PROTON-2712
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Affects Versions: proton-c-0.39.0
>Reporter: Andrew Stitcher
>Assignee: Andrew Stitcher
>Priority: Major
> Fix For: proton-c-0.39.0
>
>
> There were some inconsistencies and infelicities in the new cffi API bindings 
> type mappings between python and C types



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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



[jira] [Commented] (PROTON-2712) [Python] Inconsistencies in binding type mappings

2023-04-17 Thread Jira


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

Jiri Daněk commented on PROTON-2712:


I'm using unfixed version. I meant the comment to post reproduction steps, 
since I had them written and did not want to throw the writeup away 

Sorry for the confusion.

> [Python] Inconsistencies in binding type mappings
> -
>
> Key: PROTON-2712
> URL: https://issues.apache.org/jira/browse/PROTON-2712
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Affects Versions: proton-c-0.39.0
>Reporter: Andrew Stitcher
>Assignee: Andrew Stitcher
>Priority: Major
> Fix For: proton-c-0.39.0
>
>
> There were some inconsistencies and infelicities in the new cffi API bindings 
> type mappings between python and C types



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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



[jira] [Commented] (PROTON-2712) [Python] Inconsistencies in binding type mappings

2023-04-17 Thread Andrew Stitcher (Jira)


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

Andrew Stitcher commented on PROTON-2712:
-

[~jdanek] I'm confused: my change precisely changes the user_id property to 
return a python bytes opbject not a memoryview object. Are you sure you are 
using the fixed version of the code?

> [Python] Inconsistencies in binding type mappings
> -
>
> Key: PROTON-2712
> URL: https://issues.apache.org/jira/browse/PROTON-2712
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Affects Versions: proton-c-0.39.0
>Reporter: Andrew Stitcher
>Assignee: Andrew Stitcher
>Priority: Major
> Fix For: proton-c-0.39.0
>
>
> There were some inconsistencies and infelicities in the new cffi API bindings 
> type mappings between python and C types



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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



[jira] [Commented] (PROTON-2712) [Python] Inconsistencies in binding type mappings

2023-04-17 Thread Jira


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

Jiri Daněk commented on PROTON-2712:


Using https://github.com/rh-messaging/cli-proton-python to print {{user_id}} on 
a Message

{noformat}
% .venv/bin/python -c 'import proton; print(proton.VERSION)'
(0, 36, 0)

% .venv/bin/python -m cli_proton_python.sender --log-msgs=dict 
{'address': None, 'annotations': {}, 'content': None, 'content_encoding': 
'None', 'content_type': 'text/plain', 'correlation_id': None, 'creation_time': 
0.00, 'delivery_count': 0, 'durable': False, 'expiration': 0, 
'first_acquirer': False, 'group_id': None, 'group_sequence': 0, 'id': None, 
'inferred': False, 'instructions': None, 'priority': 4, 'properties': {}, 
'reply_to': None, 'reply_to_group_id': None, 'subject': None, 'ttl': 0, 
'user_id': ''}
{noformat}

{noformat}
% python3 -c 'import proton; print(proton.VERSION)'
(0, 39, 0)

% python3 -m cli_proton_python.sender --log-msgs=dict
:128: RuntimeWarning: 'cli_proton_python.sender' found in 
sys.modules after import of package 'cli_proton_python', but prior to execution 
of 'cli_proton_python.sender'; this may result in unpredictable behaviour
Traceback (most recent call last):
  File "", line 198, in _run_module_as_main
  File "", line 88, in _run_code
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/sender.py", 
line 614, in 
main()
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/sender.py", 
line 607, in main
container.run()
  File "/home/jdanek/.local/lib/python3.11/site-packages/proton/_reactor.py", 
line 196, in run
while self.process():
  ^^
  File "/home/jdanek/.local/lib/python3.11/site-packages/proton/_reactor.py", 
line 259, in process
event.dispatch(handler)
  File "/home/jdanek/.local/lib/python3.11/site-packages/proton/_events.py", 
line 159, in dispatch
_dispatch(handler, type.method, self)
  File "/home/jdanek/.local/lib/python3.11/site-packages/proton/_events.py", 
line 130, in _dispatch
m(*args)
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/sender.py", 
line 393, in on_timer_task
self.send_message()
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/sender.py", 
line 263, in send_message
self.print_message(self.msg)
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/coreclient.py",
 line 200, in print_message
utils.print_message(message, self.opts.log_msgs)
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/utils.py", 
line 110, in print_message
print(formatter.Formatter(msg).print_message_as_dict())
  
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/formatter.py",
 line 203, in print_message_as_dict
int_result += "'%s': %s, " % (k, Formatter.format_object(int_value))
 ^^
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/formatter.py",
 line 169, in format_object
return Formatter.format_string(in_data)
   
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/formatter.py",
 line 144, in format_string
int_res = "'%s'" % (Formatter.quote_string_escape(in_data))
^^
  File 
"/home/jdanek/repos/testing/cli/cli-proton-python/cli_proton_python/formatter.py",
 line 299, in quote_string_escape
return in_data.replace("'", "\\'")
   ^^^
AttributeError: 'memoryview' object has no attribute 'replace'
{noformat}

When I inspect the {{message}} by running

{code}
print([f"{k}: {getattr(message,k)}" for k in dir(message)])
{code}

I get

{noformat}
[...]
'address: None',
'annotation_dict: AnnotationDict({})',
'annotations: AnnotationDict({})',
'body: None',
'clear: ',
'content_encoding: None',
'content_type: text/plain',
'correlation_id: None',
'creation_time: 0.0',
'decode: ',
'delivery_count: 0',
'durable: False',
'encode: ',
'expiry_time: 0.0',
'first_acquirer: False', 'group_id: None', 'group_sequence: 0',
'id: None',
'inferred: False',
'instruction_dict: None',
'instructions: None',
'priority: 4',
'properties: {}',
'recv: ',
'reply_to: None',
'reply_to_group_id: None',
'send: ',
'subject: None',
'ttl: 0.0',
'user_id: ']
{noformat}

whereas with prior versions of python-qpid-proton, I'd get

{noformat}
"user_id: b''"]
{noformat}

> [Python] Inconsistencies in binding type mappings
> -
>
> Key: PROTON-2712
> URL: https://issues.apache.org/jira/browse/PROTON-2712
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: 

[jira] [Commented] (PROTON-2712) [Python] Inconsistencies in binding type mappings

2023-04-17 Thread ASF subversion and git services (Jira)


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

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

Commit 23c45e12f5547297a6391c8a82318f50c50beb0c in qpid-proton's branch 
refs/heads/main from Andrew Stitcher
[ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=23c45e12f ]

PROTON-2712: Fix some issues in the python binding type mapping


> [Python] Inconsistencies in binding type mappings
> -
>
> Key: PROTON-2712
> URL: https://issues.apache.org/jira/browse/PROTON-2712
> Project: Qpid Proton
>  Issue Type: Bug
>  Components: python-binding
>Affects Versions: proton-c-0.39.0
>Reporter: Andrew Stitcher
>Assignee: Andrew Stitcher
>Priority: Major
> Fix For: proton-c-0.39.0
>
>
> There were some inconsistencies and infelicities in the new cffi API bindings 
> type mappings between python and C types



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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