|
| 1 | +From 6a074bff2c2a1d531f7d379095c924d81abd2cdf Mon Sep 17 00:00:00 2001 |
| 2 | +From: akhila-guruju <v-guakhila@microsoft.com> |
| 3 | +Date: Wed, 12 Nov 2025 07:22:20 +0000 |
| 4 | +Subject: [PATCH] fix cython-0.29 compatibility error |
| 5 | + |
| 6 | +Patch Reference: https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#exception-values-and-noexcept |
| 7 | +--- |
| 8 | + src/amqp_management.pyx | 6 +++--- |
| 9 | + src/connection.pyx | 6 +++--- |
| 10 | + src/message_receiver.pyx | 2 +- |
| 11 | + src/message_sender.pyx | 4 ++-- |
| 12 | + 4 files changed, 9 insertions(+), 9 deletions(-) |
| 13 | + |
| 14 | +diff --git a/src/amqp_management.pyx b/src/amqp_management.pyx |
| 15 | +index a055ccf..fbbdfb9 100644 |
| 16 | +--- a/src/amqp_management.pyx |
| 17 | ++++ b/src/amqp_management.pyx |
| 18 | +@@ -95,19 +95,19 @@ cdef class cManagementOperation(StructBase): |
| 19 | + |
| 20 | + #### Management Link Callbacks |
| 21 | + |
| 22 | +-cdef void on_amqp_management_open_complete(void* context, c_amqp_management.AMQP_MANAGEMENT_OPEN_RESULT_TAG open_result): |
| 23 | ++cdef void on_amqp_management_open_complete(void* context, c_amqp_management.AMQP_MANAGEMENT_OPEN_RESULT_TAG open_result) noexcept: |
| 24 | + _logger.debug("Management link open: %r", open_result) |
| 25 | + if context != NULL: |
| 26 | + context_obj = <object>context |
| 27 | + context_obj._management_open_complete(open_result) |
| 28 | + |
| 29 | +-cdef void on_amqp_management_error(void* context): |
| 30 | ++cdef void on_amqp_management_error(void* context) noexcept: |
| 31 | + _logger.debug("Management link error") |
| 32 | + if context != NULL: |
| 33 | + context_obj = <object>context |
| 34 | + context_obj._management_operation_error() |
| 35 | + |
| 36 | +-cdef void on_execute_operation_complete(void* context, c_amqp_management.AMQP_MANAGEMENT_EXECUTE_OPERATION_RESULT_TAG execute_operation_result, unsigned int status_code, const char* status_description, c_message.MESSAGE_HANDLE message): |
| 37 | ++cdef void on_execute_operation_complete(void* context, c_amqp_management.AMQP_MANAGEMENT_EXECUTE_OPERATION_RESULT_TAG execute_operation_result, unsigned int status_code, const char* status_description, c_message.MESSAGE_HANDLE message) noexcept: |
| 38 | + cdef c_message.MESSAGE_HANDLE cloned |
| 39 | + description = "None" if <void*>status_description == NULL else status_description |
| 40 | + _logger.debug("Management op complete: %r, status code: %r, description: %r", execute_operation_result, status_code, description) |
| 41 | +diff --git a/src/connection.pyx b/src/connection.pyx |
| 42 | +index 2b13401..d36126a 100644 |
| 43 | +--- a/src/connection.pyx |
| 44 | ++++ b/src/connection.pyx |
| 45 | +@@ -79,7 +79,7 @@ cdef class Connection(StructBase): |
| 46 | + self._c_value = value._c_value |
| 47 | + self._create() |
| 48 | + |
| 49 | +- cdef create(self, XIO sasl_client, const char* hostname, const char* container_id, c_connection.ON_CONNECTION_STATE_CHANGED on_connection_state_changed, c_xio.ON_IO_ERROR on_io_error, void* callback_context): |
| 50 | ++ cdef create(self, XIO sasl_client, const char* hostname, const char* container_id, c_connection.ON_CONNECTION_STATE_CHANGED on_connection_state_changed, c_xio.ON_IO_ERROR on_io_error, void* callback_context) noexcept: |
| 51 | + self.destroy() |
| 52 | + self._sasl_client = sasl_client |
| 53 | + self._c_value = c_connection.connection_create2(sasl_client._c_value, hostname, container_id, NULL, NULL, on_connection_state_changed, callback_context, on_io_error, callback_context) |
| 54 | +@@ -183,7 +183,7 @@ cdef class Connection(StructBase): |
| 55 | + |
| 56 | + #### Callback |
| 57 | + |
| 58 | +-cdef void on_connection_state_changed(void* context, c_connection.CONNECTION_STATE_TAG new_connection_state, c_connection.CONNECTION_STATE_TAG previous_connection_state): |
| 59 | ++cdef void on_connection_state_changed(void* context, c_connection.CONNECTION_STATE_TAG new_connection_state, c_connection.CONNECTION_STATE_TAG previous_connection_state) noexcept: |
| 60 | + if <void*>context != NULL: |
| 61 | + context_pyobj = <PyObject*>context |
| 62 | + if context_pyobj.ob_refcnt == 0: # context is being garbage collected, skip the callback |
| 63 | +@@ -196,7 +196,7 @@ cdef void on_connection_state_changed(void* context, c_connection.CONNECTION_STA |
| 64 | + _logger.info("Unknown connection state changed: %r to %r", previous_connection_state, new_connection_state) |
| 65 | + |
| 66 | + |
| 67 | +-cdef void on_io_error(void* context): |
| 68 | ++cdef void on_io_error(void* context) noexcept: |
| 69 | + if <void*>context != NULL: |
| 70 | + context_obj = <object>context |
| 71 | + if hasattr(context_obj, '_io_error'): |
| 72 | +diff --git a/src/message_receiver.pyx b/src/message_receiver.pyx |
| 73 | +index b99647c..2cc020e 100644 |
| 74 | +--- a/src/message_receiver.pyx |
| 75 | ++++ b/src/message_receiver.pyx |
| 76 | +@@ -120,7 +120,7 @@ cdef class cMessageReceiver(StructBase): |
| 77 | + |
| 78 | + #### Callbacks (context is a MessageReceiver instance) |
| 79 | + |
| 80 | +-cdef void on_message_receiver_state_changed(void* context, c_message_receiver.MESSAGE_RECEIVER_STATE_TAG new_state, c_message_receiver.MESSAGE_RECEIVER_STATE_TAG previous_state): |
| 81 | ++cdef void on_message_receiver_state_changed(void* context, c_message_receiver.MESSAGE_RECEIVER_STATE_TAG new_state, c_message_receiver.MESSAGE_RECEIVER_STATE_TAG previous_state) noexcept: |
| 82 | + if context != NULL: |
| 83 | + context_pyobj = <PyObject*>context |
| 84 | + if context_pyobj.ob_refcnt == 0: # context is being garbage collected, skip the callback |
| 85 | +diff --git a/src/message_sender.pyx b/src/message_sender.pyx |
| 86 | +index 738207a..2922ec9 100644 |
| 87 | +--- a/src/message_sender.pyx |
| 88 | ++++ b/src/message_sender.pyx |
| 89 | +@@ -97,7 +97,7 @@ cdef class cMessageSender(StructBase): |
| 90 | + #### Callbacks (context is a MessageSender instance) |
| 91 | + |
| 92 | + |
| 93 | +-cdef void on_message_send_complete(void* context, c_message_sender.MESSAGE_SEND_RESULT_TAG send_result, c_amqpvalue.AMQP_VALUE delivery_state): |
| 94 | ++cdef void on_message_send_complete(void* context, c_message_sender.MESSAGE_SEND_RESULT_TAG send_result, c_amqpvalue.AMQP_VALUE delivery_state) noexcept: |
| 95 | + cdef c_amqpvalue.AMQP_VALUE send_data |
| 96 | + if <void*>delivery_state == NULL: |
| 97 | + wrapped = None |
| 98 | +@@ -114,7 +114,7 @@ cdef void on_message_send_complete(void* context, c_message_sender.MESSAGE_SEND_ |
| 99 | + context_obj._on_message_sent(context_obj, send_result, delivery_state=wrapped) |
| 100 | + |
| 101 | + |
| 102 | +-cdef void on_message_sender_state_changed(void* context, c_message_sender.MESSAGE_SENDER_STATE_TAG new_state, c_message_sender.MESSAGE_SENDER_STATE_TAG previous_state): |
| 103 | ++cdef void on_message_sender_state_changed(void* context, c_message_sender.MESSAGE_SENDER_STATE_TAG new_state, c_message_sender.MESSAGE_SENDER_STATE_TAG previous_state) noexcept: |
| 104 | + if context != NULL: |
| 105 | + context_pyobj = <PyObject*>context |
| 106 | + if context_pyobj.ob_refcnt == 0: # context is being garbage collected, skip the callback |
| 107 | +-- |
| 108 | +2.43.0 |
| 109 | + |
0 commit comments