This is an automated email from the ASF dual-hosted git repository. astitcher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit b8b6e05678d8280a4d09b786b6e99196ddb148af Author: Andrew Stitcher <[email protected]> AuthorDate: Tue Mar 7 18:07:45 2023 +0000 PROTON-2095: Add debug API to print proton object --- python/cproton.h | 3 +++ python/cproton.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/python/cproton.h b/python/cproton.h index 3f6b7ad39..29dc30ba4 100644 --- a/python/cproton.h +++ b/python/cproton.h @@ -372,6 +372,7 @@ pn_type_t pn_data_type(pn_data_t *data); void pn_data_widen(pn_data_t *data); int pn_decref(void *object); +char *pn_tostring(void *object); pn_delivery_t *pn_delivery(pn_link_t *link, pn_delivery_tag_t tag); void pn_delivery_abort(pn_delivery_t *delivery); @@ -680,3 +681,5 @@ void pn_record_def_py(pn_record_t *record); void *pn_record_get_py(pn_record_t *record); void pn_record_set_py(pn_record_t *record, void *value); int pn_ssl_get_peer_hostname_py(pn_ssl_t *ssl, char *hostname, size_t size); + +void free(void*); diff --git a/python/cproton.py b/python/cproton.py index 4d5e1558a..5d5a0b54e 100644 --- a/python/cproton.py +++ b/python/cproton.py @@ -318,6 +318,13 @@ def pn_pyref_decref(obj): retained_objects.discard(obj) +def pn_tostring(obj): + cs = lib.pn_tostring(obj) + s = ffi.string(cs).decode('utf8') + lib.free(cs) + return s + + def pn_collector_put_pyref(collector, obj, etype): d = ffi.new_handle(obj) retained_objects.add(d) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
