File: | build/temp.linux-x86_64-3.8/../../dbus_bindings/message-append.c |
Warning: | line 722, column 24 PyObject ownership leak with reference count of 1 |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* D-Bus Message serialization. This contains all the logic to map from | |||
2 | * Python objects to D-Bus types. | |||
3 | * | |||
4 | * Copyright (C) 2006 Collabora Ltd. <http://www.collabora.co.uk/> | |||
5 | * | |||
6 | * SPDX-License-Identifier: MIT | |||
7 | * | |||
8 | * Permission is hereby granted, free of charge, to any person | |||
9 | * obtaining a copy of this software and associated documentation | |||
10 | * files (the "Software"), to deal in the Software without | |||
11 | * restriction, including without limitation the rights to use, copy, | |||
12 | * modify, merge, publish, distribute, sublicense, and/or sell copies | |||
13 | * of the Software, and to permit persons to whom the Software is | |||
14 | * furnished to do so, subject to the following conditions: | |||
15 | * | |||
16 | * The above copyright notice and this permission notice shall be | |||
17 | * included in all copies or substantial portions of the Software. | |||
18 | * | |||
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |||
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |||
23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |||
24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
26 | * DEALINGS IN THE SOFTWARE. | |||
27 | */ | |||
28 | ||||
29 | #include "dbus_bindings-internal.h" | |||
30 | ||||
31 | #include <assert.h> | |||
32 | ||||
33 | #define DBG_IS_TOO_VERBOSE | |||
34 | #include "compat-internal.h" | |||
35 | #include "types-internal.h" | |||
36 | #include "message-internal.h" | |||
37 | ||||
38 | /* Return the number of variants wrapping the given object. Return 0 | |||
39 | * if the object is not a D-Bus type. | |||
40 | */ | |||
41 | static long | |||
42 | get_variant_level(PyObject *obj) | |||
43 | { | |||
44 | if (DBusPyString_Check(obj)) { | |||
45 | return ((DBusPyString *)obj)->variant_level; | |||
46 | } | |||
47 | else if (DBusPyFloatBase_Check(obj)) { | |||
48 | return ((DBusPyFloatBase *)obj)->variant_level; | |||
49 | } | |||
50 | else if (DBusPyArray_Check(obj)) { | |||
51 | return ((DBusPyArray *)obj)->variant_level; | |||
52 | } | |||
53 | else if (DBusPyDict_Check(obj)) { | |||
54 | return ((DBusPyDict *)obj)->variant_level; | |||
55 | } | |||
56 | else if (DBusPyLongBase_Check(obj) || | |||
57 | DBusPyBytesBase_Check(obj) || | |||
58 | DBusPyStrBase_Check(obj) || | |||
59 | DBusPyStruct_Check(obj)) { | |||
60 | return dbus_py_variant_level_get(obj); | |||
61 | } | |||
62 | else { | |||
63 | return 0; | |||
64 | } | |||
65 | } | |||
66 | ||||
67 | char dbus_py_Message_append__doc__[] = ( | |||
68 | "message.append(*args, **kwargs)\n" | |||
69 | "\n" | |||
70 | "Set the message's arguments from the positional parameter, according to\n" | |||
71 | "the signature given by the ``signature`` keyword parameter.\n" | |||
72 | "\n" | |||
73 | "The following type conversions are supported:\n\n" | |||
74 | "=============================== ===========================\n" | |||
75 | "D-Bus (in signature) Python\n" | |||
76 | "=============================== ===========================\n" | |||
77 | "boolean (b) any object (via bool())\n" | |||
78 | "byte (y) string of length 1\n" | |||
79 | " any integer\n" | |||
80 | "any integer type any integer\n" | |||
81 | "double (d) any float\n" | |||
82 | "object path anything with a __dbus_object_path__ attribute\n" | |||
83 | "string, signature, object path str (must be UTF-8) or unicode\n" | |||
84 | "dict (a{...}) any mapping\n" | |||
85 | "array (a...) any iterable over appropriate objects\n" | |||
86 | "struct ((...)) any iterable over appropriate objects\n" | |||
87 | "variant any object above (guess type as below)\n" | |||
88 | "=============================== ===========================\n" | |||
89 | "\n" | |||
90 | "Here 'any integer' means anything on which int() or long()\n" | |||
91 | "(as appropriate) will work, except for basestring subclasses.\n" | |||
92 | "'Any float' means anything on which float() will work, except\n" | |||
93 | "for basestring subclasses.\n" | |||
94 | "\n" | |||
95 | "If there is no signature, guess from the arguments using\n" | |||
96 | "the static method `Message.guess_signature`.\n" | |||
97 | ); | |||
98 | ||||
99 | char dbus_py_Message_guess_signature__doc__[] = ( | |||
100 | "guess_signature(*args) -> Signature [static method]\n\n" | |||
101 | "Guess a D-Bus signature which should be used to encode the given\n" | |||
102 | "Python objects.\n" | |||
103 | "\n" | |||
104 | "The signature is constructed as follows:\n\n" | |||
105 | "+-------------------------------+---------------------------+\n" | |||
106 | "|Python |D-Bus |\n" | |||
107 | "+===============================+===========================+\n" | |||
108 | "|D-Bus type, variant_level > 0 |variant (v) |\n" | |||
109 | "+-------------------------------+---------------------------+\n" | |||
110 | "|D-Bus type, variant_level == 0 |the corresponding type |\n" | |||
111 | "+-------------------------------+---------------------------+\n" | |||
112 | "|anything with a |object path |\n" | |||
113 | "|__dbus_object_path__ attribute | |\n" | |||
114 | "+-------------------------------+---------------------------+\n" | |||
115 | "|bool |boolean (y) |\n" | |||
116 | "+-------------------------------+---------------------------+\n" | |||
117 | "|any other int subclass |int32 (i) |\n" | |||
118 | "+-------------------------------+---------------------------+\n" | |||
119 | "|any other long subclass |int64 (x) |\n" | |||
120 | "+-------------------------------+---------------------------+\n" | |||
121 | "|any other float subclass |double (d) |\n" | |||
122 | "+-------------------------------+---------------------------+\n" | |||
123 | "|any other str subclass |string (s) |\n" | |||
124 | "+-------------------------------+---------------------------+\n" | |||
125 | "|any other unicode subclass |string (s) |\n" | |||
126 | "+-------------------------------+---------------------------+\n" | |||
127 | "|any other tuple subclass |struct ((...)) |\n" | |||
128 | "+-------------------------------+---------------------------+\n" | |||
129 | "|any other list subclass |array (a...), guess |\n" | |||
130 | "| |contents' type according to|\n" | |||
131 | "| |type of first item |\n" | |||
132 | "+-------------------------------+---------------------------+\n" | |||
133 | "|any other dict subclass |dict (a{...}), guess key, |\n" | |||
134 | "| |value type according to |\n" | |||
135 | "| |types for an arbitrary item|\n" | |||
136 | "+-------------------------------+---------------------------+\n" | |||
137 | "|anything else |raise TypeError |\n" | |||
138 | "+-------------------------------+---------------------------+\n" | |||
139 | ); | |||
140 | ||||
141 | /* return a new reference, possibly to None */ | |||
142 | static PyObject * | |||
143 | get_object_path(PyObject *obj) | |||
144 | { | |||
145 | PyObject *magic_attr = PyObject_GetAttr(obj, dbus_py__dbus_object_path__const); | |||
146 | ||||
147 | if (magic_attr) { | |||
148 | if (PyUnicode_Check(magic_attr)((((((PyObject*)(magic_attr))->ob_type))->tp_flags & ((1UL << 28))) != 0) || PyBytes_Check(magic_attr)((((((PyObject*)(magic_attr))->ob_type))->tp_flags & ((1UL << 27))) != 0)) { | |||
149 | return magic_attr; | |||
150 | } | |||
151 | else { | |||
152 | Py_CLEAR(magic_attr)do { PyObject *_py_tmp = ((PyObject*)(magic_attr)); if (_py_tmp != ((void*)0)) { (magic_attr) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
153 | PyErr_SetString(PyExc_TypeError, "__dbus_object_path__ must be " | |||
154 | "a string"); | |||
155 | return NULL((void*)0); | |||
156 | } | |||
157 | } | |||
158 | else { | |||
159 | /* Ignore exceptions, except for SystemExit and KeyboardInterrupt */ | |||
160 | if (PyErr_ExceptionMatches(PyExc_SystemExit) || | |||
161 | PyErr_ExceptionMatches(PyExc_KeyboardInterrupt)) | |||
162 | return NULL((void*)0); | |||
163 | PyErr_Clear(); | |||
164 | Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (& _Py_NoneStruct); | |||
165 | } | |||
166 | } | |||
167 | ||||
168 | /* Return a new reference. If the object is a variant and variant_level_ptr | |||
169 | * is not NULL, put the variant level in the variable pointed to, and | |||
170 | * return the contained type instead of "v". */ | |||
171 | static PyObject * | |||
172 | _signature_string_from_pyobject(PyObject *obj, long *variant_level_ptr) | |||
173 | { | |||
174 | PyObject *magic_attr; | |||
175 | long variant_level = get_variant_level(obj); | |||
176 | ||||
177 | if (variant_level < 0) | |||
178 | return NULL((void*)0); | |||
179 | ||||
180 | if (variant_level_ptr) { | |||
181 | *variant_level_ptr = variant_level; | |||
182 | } | |||
183 | else if (variant_level > 0) { | |||
184 | return PyUnicode_FromString(DBUS_TYPE_VARIANT_AS_STRING"v"); | |||
185 | } | |||
186 | ||||
187 | if (obj == Py_True((PyObject *) &_Py_TrueStruct) || obj == Py_False((PyObject *) &_Py_FalseStruct)) { | |||
188 | return PyUnicode_FromString(DBUS_TYPE_BOOLEAN_AS_STRING"b"); | |||
189 | } | |||
190 | ||||
191 | magic_attr = get_object_path(obj); | |||
192 | if (!magic_attr) | |||
193 | return NULL((void*)0); | |||
194 | if (magic_attr != Py_None(&_Py_NoneStruct)) { | |||
195 | Py_CLEAR(magic_attr)do { PyObject *_py_tmp = ((PyObject*)(magic_attr)); if (_py_tmp != ((void*)0)) { (magic_attr) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
196 | return PyUnicode_FromString(DBUS_TYPE_OBJECT_PATH_AS_STRING"o"); | |||
197 | } | |||
198 | Py_CLEAR(magic_attr)do { PyObject *_py_tmp = ((PyObject*)(magic_attr)); if (_py_tmp != ((void*)0)) { (magic_attr) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
199 | ||||
200 | /* Ordering is important: some of these are subclasses of each other. */ | |||
201 | if (PyLong_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 24))) != 0)) { | |||
202 | if (DBusPyUInt64_Check(obj)) | |||
203 | return PyUnicode_FromString(DBUS_TYPE_UINT64_AS_STRING"t"); | |||
204 | else if (DBusPyInt64_Check(obj)) | |||
205 | return PyUnicode_FromString(DBUS_TYPE_INT64_AS_STRING"x"); | |||
206 | else if (DBusPyUInt32_Check(obj)) | |||
207 | return PyUnicode_FromString(DBUS_TYPE_UINT32_AS_STRING"u"); | |||
208 | else if (DBusPyInt32_Check(obj)) | |||
209 | return PyUnicode_FromString(DBUS_TYPE_INT32_AS_STRING"i"); | |||
210 | else if (DBusPyUInt16_Check(obj)) | |||
211 | return PyUnicode_FromString(DBUS_TYPE_UINT16_AS_STRING"q"); | |||
212 | else if (DBusPyInt16_Check(obj)) | |||
213 | return PyUnicode_FromString(DBUS_TYPE_INT16_AS_STRING"n"); | |||
214 | else if (DBusPyByte_Check(obj)) | |||
215 | return PyUnicode_FromString(DBUS_TYPE_BYTE_AS_STRING"y"); | |||
216 | else if (DBusPyBoolean_Check(obj)) | |||
217 | return PyUnicode_FromString(DBUS_TYPE_BOOLEAN_AS_STRING"b"); | |||
218 | else | |||
219 | return PyUnicode_FromString(DBUS_TYPE_INT32_AS_STRING"i"); | |||
220 | } | |||
221 | else if (PyUnicode_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 28))) != 0)) { | |||
222 | /* Object paths and signatures are unicode subtypes in Python 3 | |||
223 | * (the first two cases will never be true in Python 2) */ | |||
224 | if (DBusPyObjectPath_Check(obj)) | |||
225 | return PyUnicode_FromString(DBUS_TYPE_OBJECT_PATH_AS_STRING"o"); | |||
226 | else if (DBusPySignature_Check(obj)) | |||
227 | return PyUnicode_FromString(DBUS_TYPE_SIGNATURE_AS_STRING"g"); | |||
228 | else | |||
229 | return PyUnicode_FromString(DBUS_TYPE_STRING_AS_STRING"s"); | |||
230 | } | |||
231 | #if defined(DBUS_TYPE_UNIX_FD((int) 'h')) | |||
232 | else if (DBusPyUnixFd_Check(obj)) | |||
233 | return PyUnicode_FromString(DBUS_TYPE_UNIX_FD_AS_STRING"h"); | |||
234 | #endif | |||
235 | else if (PyFloat_Check(obj)((((PyObject*)(obj))->ob_type) == (&PyFloat_Type) || PyType_IsSubtype ((((PyObject*)(obj))->ob_type), (&PyFloat_Type)))) { | |||
236 | #ifdef WITH_DBUS_FLOAT32 | |||
237 | if (DBusPyDouble_Check(obj)) | |||
238 | return PyUnicode_FromString(DBUS_TYPE_DOUBLE_AS_STRING"d"); | |||
239 | else if (DBusPyFloat_Check(obj)) | |||
240 | return PyUnicode_FromString(DBUS_TYPE_FLOAT_AS_STRING); | |||
241 | else | |||
242 | #endif | |||
243 | return PyUnicode_FromString(DBUS_TYPE_DOUBLE_AS_STRING"d"); | |||
244 | } | |||
245 | else if (PyBytes_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 27))) != 0)) { | |||
246 | /* Object paths and signatures are bytes subtypes in Python 2 | |||
247 | * (the first two cases will never be true in Python 3) */ | |||
248 | if (DBusPyObjectPath_Check(obj)) | |||
249 | return PyUnicode_FromString(DBUS_TYPE_OBJECT_PATH_AS_STRING"o"); | |||
250 | else if (DBusPySignature_Check(obj)) | |||
251 | return PyUnicode_FromString(DBUS_TYPE_SIGNATURE_AS_STRING"g"); | |||
252 | else if (DBusPyByteArray_Check(obj)) | |||
253 | return PyUnicode_FromString(DBUS_TYPE_ARRAY_AS_STRING"a" | |||
254 | DBUS_TYPE_BYTE_AS_STRING"y"); | |||
255 | else | |||
256 | return PyUnicode_FromString(DBUS_TYPE_STRING_AS_STRING"s"); | |||
257 | } | |||
258 | else if (PyTuple_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 26))) != 0)) { | |||
259 | Py_ssize_t len = PyTuple_GET_SIZE(obj)(((PyVarObject*)(((PyTupleObject *)(obj))))->ob_size); | |||
260 | PyObject *list = PyList_New(len + 2); /* new ref */ | |||
261 | PyObject *item; /* temporary new ref */ | |||
262 | PyObject *empty_str; /* temporary new ref */ | |||
263 | PyObject *ret; | |||
264 | Py_ssize_t i; | |||
265 | ||||
266 | if (!list) return NULL((void*)0); | |||
267 | if (len == 0) { | |||
268 | PyErr_SetString(PyExc_ValueError, "D-Bus structs cannot be empty"); | |||
269 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
270 | return NULL((void*)0); | |||
271 | } | |||
272 | /* Set the first and last elements of list to be the parentheses */ | |||
273 | item = PyUnicode_FromString(DBUS_STRUCT_BEGIN_CHAR_AS_STRING"("); | |||
274 | if (PyList_SetItem(list, 0, item) < 0) { | |||
275 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
276 | return NULL((void*)0); | |||
277 | } | |||
278 | item = PyUnicode_FromString(DBUS_STRUCT_END_CHAR_AS_STRING")"); | |||
279 | if (PyList_SetItem(list, len + 1, item) < 0) { | |||
280 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
281 | return NULL((void*)0); | |||
282 | } | |||
283 | if (!item || !PyList_GET_ITEM(list, 0)(((PyListObject *)(list))->ob_item[0])) { | |||
284 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
285 | return NULL((void*)0); | |||
286 | } | |||
287 | item = NULL((void*)0); | |||
288 | ||||
289 | for (i = 0; i < len; i++) { | |||
290 | item = PyTuple_GetItem(obj, i); | |||
291 | if (!item) { | |||
292 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
293 | return NULL((void*)0); | |||
294 | } | |||
295 | item = _signature_string_from_pyobject(item, NULL((void*)0)); | |||
296 | if (!item) { | |||
297 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
298 | return NULL((void*)0); | |||
299 | } | |||
300 | if (PyList_SetItem(list, i + 1, item) < 0) { | |||
301 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
302 | return NULL((void*)0); | |||
303 | } | |||
304 | item = NULL((void*)0); | |||
305 | } | |||
306 | empty_str = PyUnicode_FromString(""); | |||
307 | if (!empty_str) { | |||
308 | /* really shouldn't happen */ | |||
309 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
310 | return NULL((void*)0); | |||
311 | } | |||
312 | ret = PyObject_CallMethod_PyObject_CallMethod_SizeT(empty_str, "join", "(O)", list); /* new ref */ | |||
313 | /* whether ret is NULL or not, */ | |||
314 | Py_CLEAR(empty_str)do { PyObject *_py_tmp = ((PyObject*)(empty_str)); if (_py_tmp != ((void*)0)) { (empty_str) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
315 | Py_CLEAR(list)do { PyObject *_py_tmp = ((PyObject*)(list)); if (_py_tmp != ( (void*)0)) { (list) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
316 | return ret; | |||
317 | } | |||
318 | else if (PyList_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 25))) != 0)) { | |||
319 | PyObject *tmp; | |||
320 | PyObject *ret = PyUnicode_FromString(DBUS_TYPE_ARRAY_AS_STRING"a"); | |||
321 | if (!ret) return NULL((void*)0); | |||
322 | if (DBusPyArray_Check(obj) && | |||
323 | PyUnicode_Check(((DBusPyArray *)obj)->signature)((((((PyObject*)(((DBusPyArray *)obj)->signature))->ob_type ))->tp_flags & ((1UL << 28))) != 0)) | |||
324 | { | |||
325 | PyObject *concat = PyUnicode_Concat( | |||
326 | ret, ((DBusPyArray *)obj)->signature); | |||
327 | Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != ( (void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
328 | return concat; | |||
329 | } | |||
330 | if (PyList_GET_SIZE(obj)((((PyVarObject*)(obj))->ob_size)) == 0) { | |||
331 | /* No items, so fail. Or should we guess "av"? */ | |||
332 | PyErr_SetString(PyExc_ValueError, "Unable to guess signature " | |||
333 | "from an empty list"); | |||
334 | return NULL((void*)0); | |||
335 | } | |||
336 | tmp = PyList_GetItem(obj, 0); | |||
337 | tmp = _signature_string_from_pyobject(tmp, NULL((void*)0)); | |||
338 | if (!tmp) return NULL((void*)0); | |||
339 | { | |||
340 | PyObject *concat = PyUnicode_Concat(ret, tmp); | |||
341 | Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != ( (void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
342 | Py_CLEAR(tmp)do { PyObject *_py_tmp = ((PyObject*)(tmp)); if (_py_tmp != ( (void*)0)) { (tmp) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
343 | return concat; | |||
344 | } | |||
345 | } | |||
346 | else if (PyDict_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 29))) != 0)) { | |||
347 | PyObject *key, *value, *keysig, *valuesig; | |||
348 | Py_ssize_t pos = 0; | |||
349 | PyObject *ret = NULL((void*)0); | |||
350 | ||||
351 | if (DBusPyDict_Check(obj) && | |||
352 | PyUnicode_Check(((DBusPyDict *)obj)->signature)((((((PyObject*)(((DBusPyDict *)obj)->signature))->ob_type ))->tp_flags & ((1UL << 28))) != 0)) | |||
353 | { | |||
354 | return PyUnicode_FromFormat((DBUS_TYPE_ARRAY_AS_STRING"a" | |||
355 | DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING"{" | |||
356 | "%U" | |||
357 | DBUS_DICT_ENTRY_END_CHAR_AS_STRING"}"), | |||
358 | ((DBusPyDict *)obj)->signature); | |||
359 | } | |||
360 | if (!PyDict_Next(obj, &pos, &key, &value)) { | |||
361 | /* No items, so fail. Or should we guess "a{vv}"? */ | |||
362 | PyErr_SetString(PyExc_ValueError, "Unable to guess signature " | |||
363 | "from an empty dict"); | |||
364 | return NULL((void*)0); | |||
365 | } | |||
366 | keysig = _signature_string_from_pyobject(key, NULL((void*)0)); | |||
367 | valuesig = _signature_string_from_pyobject(value, NULL((void*)0)); | |||
368 | if (keysig && valuesig) { | |||
369 | ret = PyUnicode_FromFormat((DBUS_TYPE_ARRAY_AS_STRING"a" | |||
370 | DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING"{" | |||
371 | "%U%U" | |||
372 | DBUS_DICT_ENTRY_END_CHAR_AS_STRING"}"), | |||
373 | keysig, valuesig); | |||
374 | } | |||
375 | Py_CLEAR(keysig)do { PyObject *_py_tmp = ((PyObject*)(keysig)); if (_py_tmp != ((void*)0)) { (keysig) = ((void*)0); _Py_DECREF(((PyObject*) (_py_tmp))); } } while (0); | |||
376 | Py_CLEAR(valuesig)do { PyObject *_py_tmp = ((PyObject*)(valuesig)); if (_py_tmp != ((void*)0)) { (valuesig) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
377 | return ret; | |||
378 | } | |||
379 | else { | |||
380 | PyErr_Format(PyExc_TypeError, "Don't know which D-Bus type " | |||
381 | "to use to encode type \"%s\"", | |||
382 | Py_TYPE(obj)(((PyObject*)(obj))->ob_type)->tp_name); | |||
383 | return NULL((void*)0); | |||
384 | } | |||
385 | } | |||
386 | ||||
387 | PyObject * | |||
388 | dbus_py_Message_guess_signature(PyObject *unused UNUSED__attribute__((__unused__)), PyObject *args) | |||
389 | { | |||
390 | PyObject *tmp, *ret = NULL((void*)0); | |||
391 | ||||
392 | if (!args) { | |||
393 | if (!PyErr_Occurred()) { | |||
394 | PyErr_BadInternalCall()_PyErr_BadInternalCall("../../dbus_bindings/message-append.c" , 394); | |||
395 | } | |||
396 | return NULL((void*)0); | |||
397 | } | |||
398 | ||||
399 | #ifdef USING_DBG | |||
400 | fprintf(stderrstderr, "DBG/%ld: called Message_guess_signature", (long)getpid()); | |||
401 | PyObject_Print(args, stderrstderr, 0); | |||
402 | fprintf(stderrstderr, "\n"); | |||
403 | #endif | |||
404 | ||||
405 | if (!PyTuple_Check(args)((((((PyObject*)(args))->ob_type))->tp_flags & ((1UL << 26))) != 0)) { | |||
406 | DBG("%s", "Message_guess_signature: args not a tuple")do {} while (0); | |||
407 | PyErr_BadInternalCall()_PyErr_BadInternalCall("../../dbus_bindings/message-append.c" , 407); | |||
408 | return NULL((void*)0); | |||
409 | } | |||
410 | ||||
411 | /* if there were no args, easy */ | |||
412 | if (PyTuple_GET_SIZE(args)(((PyVarObject*)(((PyTupleObject *)(args))))->ob_size) == 0) { | |||
413 | DBG("%s", "Message_guess_signature: no args, so return Signature('')")do {} while (0); | |||
414 | return PyObject_CallFunction_PyObject_CallFunction_SizeT((PyObject *)&DBusPySignature_Type, "(s)", ""); | |||
415 | } | |||
416 | ||||
417 | /* if there were args, the signature we want is, by construction, | |||
418 | * exactly the signature we get for the tuple args, except that we don't | |||
419 | * want the parentheses. */ | |||
420 | tmp = _signature_string_from_pyobject(args, NULL((void*)0)); | |||
421 | if (!tmp) { | |||
422 | DBG("%s", "Message_guess_signature: failed")do {} while (0); | |||
423 | return NULL((void*)0); | |||
424 | } | |||
425 | if (PyUnicode_Check(tmp)((((((PyObject*)(tmp))->ob_type))->tp_flags & ((1UL << 28))) != 0)) { | |||
426 | PyObject *as_bytes = PyUnicode_AsUTF8String(tmp); | |||
427 | Py_CLEAR(tmp)do { PyObject *_py_tmp = ((PyObject*)(tmp)); if (_py_tmp != ( (void*)0)) { (tmp) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
428 | if (!as_bytes) | |||
429 | return NULL((void*)0); | |||
430 | if (PyBytes_GET_SIZE(as_bytes)((((PyVarObject*)(as_bytes))->ob_size)) < 2) { | |||
431 | PyErr_SetString(PyExc_RuntimeError, "Internal error: " | |||
432 | "_signature_string_from_pyobject returned " | |||
433 | "a bad result"); | |||
434 | Py_CLEAR(as_bytes)do { PyObject *_py_tmp = ((PyObject*)(as_bytes)); if (_py_tmp != ((void*)0)) { (as_bytes) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
435 | return NULL((void*)0); | |||
436 | } | |||
437 | tmp = as_bytes; | |||
438 | } | |||
439 | if (!PyBytes_Check(tmp)((((((PyObject*)(tmp))->ob_type))->tp_flags & ((1UL << 27))) != 0) || PyBytes_GET_SIZE(tmp)((((PyVarObject*)(tmp))->ob_size)) < 2) { | |||
440 | PyErr_SetString(PyExc_RuntimeError, "Internal error: " | |||
441 | "_signature_string_from_pyobject returned " | |||
442 | "a bad result"); | |||
443 | Py_CLEAR(tmp)do { PyObject *_py_tmp = ((PyObject*)(tmp)); if (_py_tmp != ( (void*)0)) { (tmp) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
444 | return NULL((void*)0); | |||
445 | } | |||
446 | ret = PyObject_CallFunction_PyObject_CallFunction_SizeT((PyObject *)&DBusPySignature_Type, "(s#)", | |||
447 | PyBytes_AS_STRING(tmp)((((PyBytesObject *)(tmp))->ob_sval)) + 1, | |||
448 | PyBytes_GET_SIZE(tmp)((((PyVarObject*)(tmp))->ob_size)) - 2); | |||
449 | Py_CLEAR(tmp)do { PyObject *_py_tmp = ((PyObject*)(tmp)); if (_py_tmp != ( (void*)0)) { (tmp) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
450 | return ret; | |||
451 | } | |||
452 | ||||
453 | static int _message_iter_append_pyobject(DBusMessageIter *appender, | |||
454 | DBusSignatureIter *sig_iter, | |||
455 | PyObject *obj, | |||
456 | dbus_bool_t *more); | |||
457 | static int _message_iter_append_variant(DBusMessageIter *appender, | |||
458 | PyObject *obj); | |||
459 | ||||
460 | static int | |||
461 | _message_iter_append_string(DBusMessageIter *appender, | |||
462 | int sig_type, PyObject *obj, | |||
463 | dbus_bool_t allow_object_path_attr) | |||
464 | { | |||
465 | char *s; | |||
466 | PyObject *utf8; | |||
467 | ||||
468 | if (sig_type == DBUS_TYPE_OBJECT_PATH((int) 'o') && allow_object_path_attr) { | |||
469 | PyObject *object_path = get_object_path (obj); | |||
470 | ||||
471 | if (object_path == Py_None(&_Py_NoneStruct)) { | |||
472 | Py_CLEAR(object_path)do { PyObject *_py_tmp = ((PyObject*)(object_path)); if (_py_tmp != ((void*)0)) { (object_path) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
473 | } | |||
474 | else if (!object_path) { | |||
475 | return -1; | |||
476 | } | |||
477 | else { | |||
478 | int ret = _message_iter_append_string(appender, sig_type, | |||
479 | object_path, FALSE0); | |||
480 | Py_CLEAR(object_path)do { PyObject *_py_tmp = ((PyObject*)(object_path)); if (_py_tmp != ((void*)0)) { (object_path) = ((void*)0); _Py_DECREF(((PyObject *)(_py_tmp))); } } while (0); | |||
481 | return ret; | |||
482 | } | |||
483 | } | |||
484 | ||||
485 | if (PyBytes_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 27))) != 0)) { | |||
486 | utf8 = obj; | |||
487 | Py_INCREF(obj)_Py_INCREF(((PyObject*)(obj))); | |||
488 | } | |||
489 | else if (PyUnicode_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 28))) != 0)) { | |||
490 | utf8 = PyUnicode_AsUTF8String(obj); | |||
491 | if (!utf8) return -1; | |||
492 | } | |||
493 | else { | |||
494 | PyErr_SetString(PyExc_TypeError, | |||
495 | "Expected a string or unicode object"); | |||
496 | return -1; | |||
497 | } | |||
498 | ||||
499 | /* Raise TypeError if the string has embedded NULs */ | |||
500 | if (PyBytes_AsStringAndSize(utf8, &s, NULL((void*)0)) < 0) | |||
501 | return -1; | |||
502 | ||||
503 | /* Validate UTF-8, strictly */ | |||
504 | if (!dbus_validate_utf8(s, NULL((void*)0))) { | |||
505 | PyErr_SetString(PyExc_UnicodeError, "String parameters " | |||
506 | "to be sent over D-Bus must be valid UTF-8 " | |||
507 | "with no noncharacter code points"); | |||
508 | return -1; | |||
509 | } | |||
510 | ||||
511 | DBG("Performing actual append: string (from unicode) %s", s)do {} while (0); | |||
512 | if (!dbus_message_iter_append_basic(appender, sig_type, &s)) { | |||
513 | Py_CLEAR(utf8)do { PyObject *_py_tmp = ((PyObject*)(utf8)); if (_py_tmp != ( (void*)0)) { (utf8) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
514 | PyErr_NoMemory(); | |||
515 | return -1; | |||
516 | } | |||
517 | ||||
518 | Py_CLEAR(utf8)do { PyObject *_py_tmp = ((PyObject*)(utf8)); if (_py_tmp != ( (void*)0)) { (utf8) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp ))); } } while (0); | |||
519 | return 0; | |||
520 | } | |||
521 | ||||
522 | static int | |||
523 | _message_iter_append_byte(DBusMessageIter *appender, PyObject *obj) | |||
524 | { | |||
525 | unsigned char y; | |||
526 | ||||
527 | if (PyBytes_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 27))) != 0)) { | |||
528 | if (PyBytes_GET_SIZE(obj)((((PyVarObject*)(obj))->ob_size)) != 1) { | |||
529 | PyErr_Format(PyExc_ValueError, | |||
530 | "Expected a length-1 bytes but found %d bytes", | |||
531 | (int)PyBytes_GET_SIZE(obj)((((PyVarObject*)(obj))->ob_size))); | |||
532 | return -1; | |||
533 | } | |||
534 | y = *(unsigned char *)PyBytes_AS_STRING(obj)((((PyBytesObject *)(obj))->ob_sval)); | |||
535 | } | |||
536 | else { | |||
537 | /* on Python 2 this accepts either int or long */ | |||
538 | long i = PyLong_AsLong(obj); | |||
539 | ||||
540 | if (i == -1 && PyErr_Occurred()) return -1; | |||
541 | if (i < 0 || i > 0xff) { | |||
542 | PyErr_Format(PyExc_ValueError, | |||
543 | "%d outside range for a byte value", | |||
544 | (int)i); | |||
545 | return -1; | |||
546 | } | |||
547 | y = i; | |||
548 | } | |||
549 | DBG("Performing actual append: byte \\x%02x", (unsigned)y)do {} while (0); | |||
550 | if (!dbus_message_iter_append_basic(appender, DBUS_TYPE_BYTE((int) 'y'), &y)) { | |||
551 | PyErr_NoMemory(); | |||
552 | return -1; | |||
553 | } | |||
554 | return 0; | |||
555 | } | |||
556 | ||||
557 | static dbus_bool_t | |||
558 | dbuspy_message_iter_close_container(DBusMessageIter *iter, | |||
559 | DBusMessageIter *sub, | |||
560 | dbus_bool_t is_ok) | |||
561 | { | |||
562 | if (!is_ok) { | |||
563 | dbus_message_iter_abandon_container(iter, sub); | |||
564 | return TRUE1; | |||
565 | } | |||
566 | return dbus_message_iter_close_container(iter, sub); | |||
567 | } | |||
568 | ||||
569 | #if defined(DBUS_TYPE_UNIX_FD((int) 'h')) | |||
570 | static int | |||
571 | _message_iter_append_unixfd(DBusMessageIter *appender, PyObject *obj) | |||
572 | { | |||
573 | int fd; | |||
574 | long original_fd; | |||
575 | ||||
576 | if (PyLong_Check(obj)((((((PyObject*)(obj))->ob_type))->tp_flags & ((1UL << 24))) != 0)) | |||
577 | { | |||
578 | /* on Python 2 this accepts either int or long */ | |||
579 | original_fd = PyLong_AsLong(obj); | |||
580 | if (original_fd == -1 && PyErr_Occurred()) | |||
581 | return -1; | |||
582 | if (original_fd < INT_MIN(-2147483647 -1) || original_fd > INT_MAX2147483647) { | |||
583 | PyErr_Format(PyExc_ValueError, "out of int range: %ld", | |||
584 | original_fd); | |||
585 | return -1; | |||
586 | } | |||
587 | fd = (int)original_fd; | |||
588 | } | |||
589 | else if (PyObject_IsInstance(obj, (PyObject*) &DBusPyUnixFd_Type)) { | |||
590 | fd = dbus_py_unix_fd_get_fd(obj); | |||
591 | } | |||
592 | else { | |||
593 | return -1; | |||
594 | } | |||
595 | ||||
596 | DBG("Performing actual append: fd %d", fd)do {} while (0); | |||
597 | if (!dbus_message_iter_append_basic(appender, DBUS_TYPE_UNIX_FD((int) 'h'), &fd)) { | |||
598 | PyErr_NoMemory(); | |||
599 | return -1; | |||
600 | } | |||
601 | return 0; | |||
602 | } | |||
603 | #endif | |||
604 | ||||
605 | static int | |||
606 | _message_iter_append_dictentry(DBusMessageIter *appender, | |||
607 | DBusSignatureIter *sig_iter, | |||
608 | PyObject *dict, PyObject *key) | |||
609 | { | |||
610 | DBusSignatureIter sub_sig_iter; | |||
611 | DBusMessageIter sub; | |||
612 | int ret = -1; | |||
613 | PyObject *value = PyObject_GetItem(dict, key); | |||
614 | dbus_bool_t more; | |||
615 | ||||
616 | if (!value) return -1; | |||
617 | ||||
618 | #ifdef USING_DBG | |||
619 | fprintf(stderrstderr, "Append dictentry: "); | |||
620 | PyObject_Print(key, stderrstderr, 0); | |||
621 | fprintf(stderrstderr, " => "); | |||
622 | PyObject_Print(value, stderrstderr, 0); | |||
623 | fprintf(stderrstderr, "\n"); | |||
624 | #endif | |||
625 | ||||
626 | DBG("Recursing signature iterator %p -> %p", sig_iter, &sub_sig_iter)do {} while (0); | |||
627 | dbus_signature_iter_recurse(sig_iter, &sub_sig_iter); | |||
628 | #ifdef USING_DBG | |||
629 | { | |||
630 | char *s; | |||
631 | s = dbus_signature_iter_get_signature(sig_iter); | |||
632 | DBG("Signature of parent iterator %p is %s", sig_iter, s)do {} while (0); | |||
633 | dbus_free(s); | |||
634 | s = dbus_signature_iter_get_signature(&sub_sig_iter); | |||
635 | DBG("Signature of sub-iterator %p is %s", &sub_sig_iter, s)do {} while (0); | |||
636 | dbus_free(s); | |||
637 | } | |||
638 | #endif | |||
639 | ||||
640 | DBG("%s", "Opening DICT_ENTRY container")do {} while (0); | |||
641 | if (!dbus_message_iter_open_container(appender, DBUS_TYPE_DICT_ENTRY((int) 'e'), | |||
642 | NULL((void*)0), &sub)) { | |||
643 | PyErr_NoMemory(); | |||
644 | goto out; | |||
645 | } | |||
646 | ret = _message_iter_append_pyobject(&sub, &sub_sig_iter, key, &more); | |||
647 | if (ret == 0) { | |||
648 | ret = _message_iter_append_pyobject(&sub, &sub_sig_iter, value, &more); | |||
649 | } | |||
650 | DBG("%s", "Closing DICT_ENTRY container")do {} while (0); | |||
651 | if (!dbuspy_message_iter_close_container(appender, &sub, (ret == 0))) { | |||
652 | PyErr_NoMemory(); | |||
653 | ret = -1; | |||
654 | } | |||
655 | out: | |||
656 | Py_CLEAR(value)do { PyObject *_py_tmp = ((PyObject*)(value)); if (_py_tmp != ((void*)0)) { (value) = ((void*)0); _Py_DECREF(((PyObject*)( _py_tmp))); } } while (0); | |||
657 | return ret; | |||
658 | } | |||
659 | ||||
660 | static int | |||
661 | _message_iter_append_multi(DBusMessageIter *appender, | |||
662 | const DBusSignatureIter *sig_iter, | |||
663 | int mode, PyObject *obj) | |||
664 | { | |||
665 | DBusMessageIter sub_appender; | |||
666 | DBusSignatureIter sub_sig_iter; | |||
667 | PyObject *contents; | |||
668 | int ret; | |||
669 | PyObject *iterator = PyObject_GetIter(obj); | |||
670 | char *sig = NULL((void*)0); | |||
671 | int container = mode; | |||
672 | dbus_bool_t is_byte_array = DBusPyByteArray_Check(obj); | |||
673 | int inner_type; | |||
674 | dbus_bool_t more; | |||
675 | ||||
676 | assert(mode == DBUS_TYPE_DICT_ENTRY || mode == DBUS_TYPE_ARRAY ||((void) sizeof ((mode == ((int) 'e') || mode == ((int) 'a') || mode == ((int) 'r')) ? 1 : 0), __extension__ ({ if (mode == ( (int) 'e') || mode == ((int) 'a') || mode == ((int) 'r')) ; else __assert_fail ("mode == DBUS_TYPE_DICT_ENTRY || mode == DBUS_TYPE_ARRAY || mode == DBUS_TYPE_STRUCT" , "../../dbus_bindings/message-append.c", 677, __extension__ __PRETTY_FUNCTION__ ); })) | |||
677 | mode == DBUS_TYPE_STRUCT)((void) sizeof ((mode == ((int) 'e') || mode == ((int) 'a') || mode == ((int) 'r')) ? 1 : 0), __extension__ ({ if (mode == ( (int) 'e') || mode == ((int) 'a') || mode == ((int) 'r')) ; else __assert_fail ("mode == DBUS_TYPE_DICT_ENTRY || mode == DBUS_TYPE_ARRAY || mode == DBUS_TYPE_STRUCT" , "../../dbus_bindings/message-append.c", 677, __extension__ __PRETTY_FUNCTION__ ); })); | |||
678 | ||||
679 | #ifdef USING_DBG | |||
680 | fprintf(stderrstderr, "Appending multiple: "); | |||
681 | PyObject_Print(obj, stderrstderr, 0); | |||
682 | fprintf(stderrstderr, "\n"); | |||
683 | #endif | |||
684 | ||||
685 | if (!iterator) return -1; | |||
686 | if (mode == DBUS_TYPE_DICT_ENTRY((int) 'e')) container = DBUS_TYPE_ARRAY((int) 'a'); | |||
687 | ||||
688 | DBG("Recursing signature iterator %p -> %p", sig_iter, &sub_sig_iter)do {} while (0); | |||
689 | dbus_signature_iter_recurse(sig_iter, &sub_sig_iter); | |||
690 | #ifdef USING_DBG | |||
691 | { | |||
692 | char *s; | |||
693 | s = dbus_signature_iter_get_signature(sig_iter); | |||
694 | DBG("Signature of parent iterator %p is %s", sig_iter, s)do {} while (0); | |||
695 | dbus_free(s); | |||
696 | s = dbus_signature_iter_get_signature(&sub_sig_iter); | |||
697 | DBG("Signature of sub-iterator %p is %s", &sub_sig_iter, s)do {} while (0); | |||
698 | dbus_free(s); | |||
699 | } | |||
700 | #endif | |||
701 | inner_type = dbus_signature_iter_get_current_type(&sub_sig_iter); | |||
702 | ||||
703 | if (mode == DBUS_TYPE_ARRAY((int) 'a') || mode == DBUS_TYPE_DICT_ENTRY((int) 'e')) { | |||
704 | sig = dbus_signature_iter_get_signature(&sub_sig_iter); | |||
705 | if (!sig) { | |||
706 | PyErr_NoMemory(); | |||
707 | ret = -1; | |||
708 | goto out; | |||
709 | } | |||
710 | } | |||
711 | /* else leave sig set to NULL. */ | |||
712 | ||||
713 | DBG("Opening '%c' container", container)do {} while (0); | |||
714 | if (!dbus_message_iter_open_container(appender, container, | |||
715 | sig, &sub_appender)) { | |||
716 | PyErr_NoMemory(); | |||
717 | ret = -1; | |||
718 | goto out; | |||
719 | } | |||
720 | ret = 0; | |||
721 | more = TRUE1; | |||
722 | while ((contents = PyIter_Next(iterator))) { | |||
| ||||
723 | ||||
724 | if (mode == DBUS_TYPE_ARRAY((int) 'a') || mode == DBUS_TYPE_DICT_ENTRY((int) 'e')) { | |||
725 | DBG("Recursing signature iterator %p -> %p", sig_iter, &sub_sig_iter)do {} while (0); | |||
726 | dbus_signature_iter_recurse(sig_iter, &sub_sig_iter); | |||
727 | #ifdef USING_DBG | |||
728 | { | |||
729 | char *s; | |||
730 | s = dbus_signature_iter_get_signature(sig_iter); | |||
731 | DBG("Signature of parent iterator %p is %s", sig_iter, s)do {} while (0); | |||
732 | dbus_free(s); | |||
733 | s = dbus_signature_iter_get_signature(&sub_sig_iter); | |||
734 | DBG("Signature of sub-iterator %p is %s", &sub_sig_iter, s)do {} while (0); | |||
735 | dbus_free(s); | |||
736 | } | |||
737 | #endif | |||
738 | } | |||
739 | else /* struct */ { | |||
740 | if (!more) { | |||
741 | PyErr_Format(PyExc_TypeError, "Fewer items found in struct's " | |||
742 | "D-Bus signature than in Python arguments "); | |||
743 | ret = -1; | |||
744 | break; | |||
745 | } | |||
746 | } | |||
747 | ||||
748 | if (mode == DBUS_TYPE_DICT_ENTRY((int) 'e')) { | |||
749 | ret = _message_iter_append_dictentry(&sub_appender, &sub_sig_iter, | |||
750 | obj, contents); | |||
751 | } | |||
752 | else if (mode == DBUS_TYPE_ARRAY((int) 'a') && is_byte_array
|
34.1 | 'is_byte_array' is 1 |
1 | Assuming field 'msg' is non-null |
1 | #ifndef PyIter_Next |
2 | struct _object; |
3 | typedef struct _object PyObject; |
4 | PyObject* clang_analyzer_PyObject_New_Reference(); |
5 | PyObject* PyIter_Next(PyObject *o) { |
6 | return clang_analyzer_PyObject_New_Reference(); |
7 | } |
8 | #else |
9 | #warning "API PyIter_Next is defined as a macro." |
10 | #endif |