You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2014/10/15 22:01:17 UTC
svn commit: r1632169 - /qpid/dispatch/trunk/src/python_embedded.c
Author: tross
Date: Wed Oct 15 20:01:16 2014
New Revision: 1632169
URL: http://svn.apache.org/r1632169
Log:
NO-JIRA - Use empty-list encoding for zero-length lists from Python.
Modified:
qpid/dispatch/trunk/src/python_embedded.c
Modified: qpid/dispatch/trunk/src/python_embedded.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/python_embedded.c?rev=1632169&r1=1632168&r2=1632169&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/python_embedded.c (original)
+++ qpid/dispatch/trunk/src/python_embedded.c Wed Oct 15 20:01:16 2014
@@ -150,22 +150,30 @@ qd_error_t qd_py_to_composed(PyObject *v
else if (PyList_Check(value)) {
Py_ssize_t count = PyList_Size(value);
- qd_compose_start_list(field);
- for (Py_ssize_t idx = 0; idx < count; idx++) {
- PyObject *item = PyList_GetItem(value, idx); QD_ERROR_PY_RET();
- qd_py_to_composed(item, field); QD_ERROR_RET();
+ if (count == 0)
+ qd_compose_empty_list(field);
+ else {
+ qd_compose_start_list(field);
+ for (Py_ssize_t idx = 0; idx < count; idx++) {
+ PyObject *item = PyList_GetItem(value, idx); QD_ERROR_PY_RET();
+ qd_py_to_composed(item, field); QD_ERROR_RET();
+ }
+ qd_compose_end_list(field);
}
- qd_compose_end_list(field);
}
else if (PyTuple_Check(value)) {
Py_ssize_t count = PyTuple_Size(value);
- qd_compose_start_list(field);
- for (Py_ssize_t idx = 0; idx < count; idx++) {
- PyObject *item = PyTuple_GetItem(value, idx); QD_ERROR_PY_RET();
- qd_py_to_composed(item, field); QD_ERROR_RET();
+ if (count == 0)
+ qd_compose_empty_list(field);
+ else {
+ qd_compose_start_list(field);
+ for (Py_ssize_t idx = 0; idx < count; idx++) {
+ PyObject *item = PyTuple_GetItem(value, idx); QD_ERROR_PY_RET();
+ qd_py_to_composed(item, field); QD_ERROR_RET();
+ }
+ qd_compose_end_list(field);
}
- qd_compose_end_list(field);
}
else {
PyObject *type=0, *typestr=0, *repr=0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org