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

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


The following commit(s) were added to refs/heads/main by this push:
     new 4f7b5bf  DISPATCH-2316 Py_INCREF usage of Py_True/Py_False to prevent 
crashes during GC (#1496)
4f7b5bf is described below

commit 4f7b5bf27e012289a096dd5b8ef808a988dfc19a
Author: Jiri DanÄ›k <[email protected]>
AuthorDate: Sat Jan 22 19:33:29 2022 +0100

    DISPATCH-2316 Py_INCREF usage of Py_True/Py_False to prevent crashes during 
GC (#1496)
---
 src/python_embedded.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/python_embedded.c b/src/python_embedded.c
index 8468406..833df4a 100644
--- a/src/python_embedded.c
+++ b/src/python_embedded.c
@@ -412,14 +412,15 @@ PyObject *qd_field_to_py(qd_parsed_field_t *field)
     uint8_t   tag    = qd_parse_tag(field);
     switch (tag) {
       case QD_AMQP_NULL:
-        Py_INCREF(Py_None);
         result = Py_None;
+        Py_INCREF(result);
         break;
 
       case QD_AMQP_BOOLEAN:
       case QD_AMQP_TRUE:
       case QD_AMQP_FALSE:
         result = qd_parse_as_uint(field) ? Py_True : Py_False;
+        Py_INCREF(result);
         break;
 
       case QD_AMQP_UBYTE:

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

Reply via email to