Bug Summary

File:build/temp.linux-x86_64-3.8/../../dbus_bindings/message.c
Warning:line 544, column 25
PyObject ownership leak with reference count of 1

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name message.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-output=html -analyzer-checker=python -analyzer-disable-checker=deadcode -analyzer-config prune-paths=true,suppress-c++-stdlib=true,suppress-inlined-defensive-checks=false,suppress-null-return-paths=false,crosscheck-with-z3=true,model-path=/opt/pyrefcon/lib/pyrefcon/models/models -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=/tmp/pyrefcon/dbus-python/csa-scan,ctu-index-name=/tmp/pyrefcon/dbus-python/csa-scan/externalDefMap.txt,ctu-invocation-list=/tmp/pyrefcon/dbus-python/csa-scan/invocations.yaml,display-ctu-progress=false -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -relaxed-aliasing -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/tmp/pyrefcon/dbus-python/build/temp.linux-x86_64-3.8 -resource-dir /opt/pyrefcon/lib/clang/13.0.0 -include config.h -isystem /opt/pyrefcon/lib/pyrefcon/models/python3.8 -D HAVE_CONFIG_H -I . -I /tmp/pyrefcon/dbus-python -I /tmp/pyrefcon/dbus-python/include -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -D PIC -internal-isystem /opt/pyrefcon/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wdeprecated-declarations -Wno-declaration-after-statement -Wno-duplicated-branches -Wno-inline -Wno-redundant-decls -Wno-switch-default -Wno-write-strings -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wimplicit-function-declaration -Wold-style-definition -Wjump-misses-init -Wall -Wextra -Wundef -Wpointer-arith -Wmissing-declarations -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wswitch-enum -Wduplicated-cond -Wlogical-op -Wrestrict -Wnull-dereference -Wdouble-promotion -Wno-error=declaration-after-statement -Wno-error=duplicated-branches -Wno-error=inline -Wno-error=redundant-decls -Wno-error=switch-default -Wno-error=write-strings -Wno-error=unused-parameter -Wno-error=missing-field-initializers -fdebug-compilation-dir=/tmp/pyrefcon/dbus-python/build/temp.linux-x86_64-3.8 -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/pyrefcon/dbus-python/csa-scan/reports -x c ../../dbus_bindings/message.c

../../dbus_bindings/message.c

1/* Implementation of D-Bus Message and subclasses (but see message-get-args.h
2 * and message-append.h for unserialization and serialization code).
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#include "message-internal.h"
31
32static PyTypeObject MessageType, SignalMessageType, ErrorMessageType;
33static PyTypeObject MethodReturnMessageType, MethodCallMessageType;
34
35static inline int Message_Check(PyObject *o)
36{
37 return (Py_TYPE(o)(((PyObject*)(o))->ob_type) == &MessageType)
38 || PyObject_IsInstance(o, (PyObject *)&MessageType);
39}
40
41PyObject *
42DBusPy_RaiseUnusableMessage(void)
43{
44 DBusPyException_SetString("Message object is uninitialized, or has become "
45 "unusable due to error while appending "
46 "arguments");
47 return NULL((void*)0);
48}
49
50PyDoc_STRVAR(Message_tp_doc,static const char Message_tp_doc[] = "A message to be sent or received over a D-Bus Connection.\n"
51"A message to be sent or received over a D-Bus Connection.\n")static const char Message_tp_doc[] = "A message to be sent or received over a D-Bus Connection.\n";
52
53static void Message_tp_dealloc(Message *self)
54{
55 if (self->msg) {
56 dbus_message_unref(self->msg);
57 }
58 Py_TYPE(self)(((PyObject*)(self))->ob_type)->tp_free((PyObject *)self);
59}
60
61static PyObject *
62Message_tp_new(PyTypeObject *type,
63 PyObject *args UNUSED__attribute__((__unused__)),
64 PyObject *kwargs UNUSED__attribute__((__unused__)))
65{
66 Message *self;
67
68 self = (Message *)type->tp_alloc(type, 0);
69 if (!self) return NULL((void*)0);
70 self->msg = NULL((void*)0);
71 return (PyObject *)self;
72}
73
74static PyObject *
75MethodCallMessage_tp_repr(PyObject *self)
76{
77 DBusMessage *msg = ((Message *)self)->msg;
78 const char *destination = dbus_message_get_destination(msg);
79 const char *path = dbus_message_get_path(msg);
80 const char *interface = dbus_message_get_interface(msg);
81 const char *member = dbus_message_get_member(msg);
82
83 if (!path)
84 path = "n/a";
85 if (!interface)
86 interface = "n/a";
87 if (!member)
88 member = "n/a";
89 if (!destination)
90 destination = "n/a";
91
92 return PyUnicode_FromFormat(
93 "<%s path: %s, iface: %s, member: %s dest: %s>",
94 Py_TYPE(self)(((PyObject*)(self))->ob_type)->tp_name,
95 path, interface, member, destination);
96}
97
98PyDoc_STRVAR(MethodCallMessage_tp_doc,static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
99"dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
100"interface: str or None, method: str)\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
101"\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
102"A method-call message.\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
103"\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
104"``destination`` is the destination bus name, or None to send the\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
105"message directly to the peer (usually the bus daemon).\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
106"\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
107"``path`` is the object-path of the object whose method is to be called.\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
108"\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
109"``interface`` is the interface qualifying the method name, or None to omit\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
110"the interface from the message header.\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
111"\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
112"``method`` is the method name (member name).\n"static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
113)static const char MethodCallMessage_tp_doc[] = "dbus.lowlevel.MethodCallMessage(destination: str or None, path: str, "
"interface: str or None, method: str)\n""\n""A method-call message.\n"
"\n""``destination`` is the destination bus name, or None to send the\n"
"message directly to the peer (usually the bus daemon).\n""\n"
"``path`` is the object-path of the object whose method is to be called.\n"
"\n""``interface`` is the interface qualifying the method name, or None to omit\n"
"the interface from the message header.\n""\n""``method`` is the method name (member name).\n"
;
114
115static int
116MethodCallMessage_tp_init(Message *self, PyObject *args, PyObject *kwargs)
117{
118 const char *destination, *path, *interface, *method;
119 static char *kwlist[] = {"destination", "path", "interface", "method", NULL((void*)0)};
120
121 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs, "zszs:__init__", kwlist,
122 &destination, &path, &interface,
123 &method)) {
124 return -1;
125 }
126 if (destination && !dbus_py_validate_bus_name(destination, 1, 1)) return -1;
127 if (!dbus_py_validate_object_path(path)) return -1;
128 if (interface && !dbus_py_validate_interface_name(interface)) return -1;
129 if (!dbus_py_validate_member_name(method)) return -1;
130 if (self->msg) {
131 dbus_message_unref(self->msg);
132 self->msg = NULL((void*)0);
133 }
134 self->msg = dbus_message_new_method_call(destination, path, interface,
135 method);
136 if (!self->msg) {
137 PyErr_NoMemory();
138 return -1;
139 }
140 return 0;
141}
142
143PyDoc_STRVAR(MethodReturnMessage_tp_doc,static const char MethodReturnMessage_tp_doc[] = "dbus.lowlevel.MethodReturnMessage(method_call: MethodCallMessage)\n"
"\n""A method-return message."
144"dbus.lowlevel.MethodReturnMessage(method_call: MethodCallMessage)\n"static const char MethodReturnMessage_tp_doc[] = "dbus.lowlevel.MethodReturnMessage(method_call: MethodCallMessage)\n"
"\n""A method-return message."
145"\n"static const char MethodReturnMessage_tp_doc[] = "dbus.lowlevel.MethodReturnMessage(method_call: MethodCallMessage)\n"
"\n""A method-return message."
146"A method-return message.")static const char MethodReturnMessage_tp_doc[] = "dbus.lowlevel.MethodReturnMessage(method_call: MethodCallMessage)\n"
"\n""A method-return message."
;
147
148static int
149MethodReturnMessage_tp_init(Message *self, PyObject *args, PyObject *kwargs)
150{
151 Message *other;
152 static char *kwlist[] = {"method_call", NULL((void*)0)};
153
154 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs, "O!:__init__", kwlist,
155 &MessageType, &other)) {
156 return -1;
157 }
158 if (self->msg) {
159 dbus_message_unref(self->msg);
160 self->msg = NULL((void*)0);
161 }
162 self->msg = dbus_message_new_method_return(other->msg);
163 if (!self->msg) {
164 PyErr_NoMemory();
165 return -1;
166 }
167 return 0;
168}
169
170PyDoc_STRVAR(SignalMessage_tp_doc,static const char SignalMessage_tp_doc[] = "dbus.lowlevel.SignalMessage(path: str, interface: str, method: str)\n"
"\n""A signal message.\n"
171"dbus.lowlevel.SignalMessage(path: str, interface: str, method: str)\n"static const char SignalMessage_tp_doc[] = "dbus.lowlevel.SignalMessage(path: str, interface: str, method: str)\n"
"\n""A signal message.\n"
172"\n"static const char SignalMessage_tp_doc[] = "dbus.lowlevel.SignalMessage(path: str, interface: str, method: str)\n"
"\n""A signal message.\n"
173"A signal message.\n")static const char SignalMessage_tp_doc[] = "dbus.lowlevel.SignalMessage(path: str, interface: str, method: str)\n"
"\n""A signal message.\n"
;
174static int
175SignalMessage_tp_init(Message *self, PyObject *args, PyObject *kwargs)
176{
177 const char *path, *interface, *name;
178 static char *kwlist[] = {"path", "interface", "name", NULL((void*)0)};
179
180 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs, "sss:__init__", kwlist,
181 &path, &interface, &name)) {
182 return -1;
183 }
184 if (!dbus_py_validate_object_path(path)) return -1;
185 if (!dbus_py_validate_interface_name(interface)) return -1;
186 if (!dbus_py_validate_member_name(name)) return -1;
187 if (self->msg) {
188 dbus_message_unref(self->msg);
189 self->msg = NULL((void*)0);
190 }
191 self->msg = dbus_message_new_signal(path, interface, name);
192 if (!self->msg) {
193 PyErr_NoMemory();
194 return -1;
195 }
196 return 0;
197}
198
199static PyObject *
200SignalMessage_tp_repr(PyObject *self)
201{
202 DBusMessage *msg = ((Message *)self)->msg;
203 const char *path = dbus_message_get_path(msg);
204 const char *interface = dbus_message_get_interface(msg);
205 const char *member = dbus_message_get_member(msg);
206 const char *destination = dbus_message_get_destination(msg);
207
208 if (!path)
209 path = "n/a";
210 if (!interface)
211 interface = "n/a";
212 if (!member)
213 member = "n/a";
214 if (!destination)
215 destination = "(broadcast)";
216
217 return PyUnicode_FromFormat("<%s path: %s, iface: %s, member: %s, dest: %s>",
218 Py_TYPE(self)(((PyObject*)(self))->ob_type)->tp_name,
219 path, interface, member, destination);
220}
221
222PyDoc_STRVAR(ErrorMessage_tp_doc,static const char ErrorMessage_tp_doc[] = "dbus.lowlevel.ErrorMessage(reply_to: Message, error_name: str, "
"error_message: str or None)\n""\n""An error message.\n"
223"dbus.lowlevel.ErrorMessage(reply_to: Message, error_name: str, "static const char ErrorMessage_tp_doc[] = "dbus.lowlevel.ErrorMessage(reply_to: Message, error_name: str, "
"error_message: str or None)\n""\n""An error message.\n"
224"error_message: str or None)\n"static const char ErrorMessage_tp_doc[] = "dbus.lowlevel.ErrorMessage(reply_to: Message, error_name: str, "
"error_message: str or None)\n""\n""An error message.\n"
225"\n"static const char ErrorMessage_tp_doc[] = "dbus.lowlevel.ErrorMessage(reply_to: Message, error_name: str, "
"error_message: str or None)\n""\n""An error message.\n"
226"An error message.\n")static const char ErrorMessage_tp_doc[] = "dbus.lowlevel.ErrorMessage(reply_to: Message, error_name: str, "
"error_message: str or None)\n""\n""An error message.\n"
;
227static int
228ErrorMessage_tp_init(Message *self, PyObject *args, PyObject *kwargs)
229{
230 Message *reply_to;
231 const char *error_name, *error_message;
232 static char *kwlist[] = {"reply_to", "error_name", "error_message", NULL((void*)0)};
233
234 if (!PyArg_ParseTupleAndKeywords_PyArg_ParseTupleAndKeywords_SizeT(args, kwargs, "O!sz:__init__", kwlist,
235 &MessageType, &reply_to, &error_name,
236 &error_message)) {
237 return -1;
238 }
239 if (!dbus_py_validate_error_namedbus_py_validate_interface_name(error_name)) return -1;
240 if (self->msg) {
241 dbus_message_unref(self->msg);
242 self->msg = NULL((void*)0);
243 }
244 self->msg = dbus_message_new_error(reply_to->msg, error_name, error_message);
245 if (!self->msg) {
246 PyErr_NoMemory();
247 return -1;
248 }
249 return 0;
250}
251
252DBusMessage *
253DBusPyMessage_BorrowDBusMessage(PyObject *msg)
254{
255 if (!Message_Check(msg)) {
256 PyErr_SetString(PyExc_TypeError,
257 "A dbus.lowlevel.Message instance is required");
258 return NULL((void*)0);
259 }
260 if (!((Message *)msg)->msg) {
261 DBusPy_RaiseUnusableMessage();
262 return NULL((void*)0);
263 }
264 return ((Message *)msg)->msg;
265}
266
267PyObject *
268DBusPyMessage_ConsumeDBusMessage(DBusMessage *msg)
269{
270 PyTypeObject *type;
271 Message *self;
272
273 switch (dbus_message_get_type(msg)) {
274 case DBUS_MESSAGE_TYPE_METHOD_CALL1:
275 type = &MethodCallMessageType;
276 break;
277 case DBUS_MESSAGE_TYPE_METHOD_RETURN2:
278 type = &MethodReturnMessageType;
279 break;
280 case DBUS_MESSAGE_TYPE_ERROR3:
281 type = &ErrorMessageType;
282 break;
283 case DBUS_MESSAGE_TYPE_SIGNAL4:
284 type = &SignalMessageType;
285 break;
286 default:
287 type = &MessageType;
288 }
289
290 self = (Message *)(type->tp_new) (type, dbus_py_empty_tuple, NULL((void*)0));
291 if (!self) {
292 dbus_message_unref(msg);
293 return NULL((void*)0);
294 }
295 self->msg = msg;
296 return (PyObject *)self;
297}
298
299PyDoc_STRVAR(Message_copy__doc__,static const char Message_copy__doc__[] = "message.copy() -> Message (or subclass)\n"
"Deep-copy the message, resetting the serial number to zero.\n"
300"message.copy() -> Message (or subclass)\n"static const char Message_copy__doc__[] = "message.copy() -> Message (or subclass)\n"
"Deep-copy the message, resetting the serial number to zero.\n"
301"Deep-copy the message, resetting the serial number to zero.\n")static const char Message_copy__doc__[] = "message.copy() -> Message (or subclass)\n"
"Deep-copy the message, resetting the serial number to zero.\n"
;
302static PyObject *
303Message_copy(Message *self, PyObject *args UNUSED__attribute__((__unused__)))
304{
305 DBusMessage *msg;
306 if (!self->msg) return DBusPy_RaiseUnusableMessage();
307 msg = dbus_message_copy(self->msg);
308 if (!msg) return PyErr_NoMemory();
309 return DBusPyMessage_ConsumeDBusMessage(msg);
310}
311
312PyDoc_STRVAR(Message_get_auto_start__doc__,static const char Message_get_auto_start__doc__[] = "message.get_auto_start() -> bool\n"
"Return true if this message will cause an owner for the destination name\n"
"to be auto-started.\n"
313"message.get_auto_start() -> bool\n"static const char Message_get_auto_start__doc__[] = "message.get_auto_start() -> bool\n"
"Return true if this message will cause an owner for the destination name\n"
"to be auto-started.\n"
314"Return true if this message will cause an owner for the destination name\n"static const char Message_get_auto_start__doc__[] = "message.get_auto_start() -> bool\n"
"Return true if this message will cause an owner for the destination name\n"
"to be auto-started.\n"
315"to be auto-started.\n")static const char Message_get_auto_start__doc__[] = "message.get_auto_start() -> bool\n"
"Return true if this message will cause an owner for the destination name\n"
"to be auto-started.\n"
;
316static PyObject *
317Message_get_auto_start(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
318{
319 if (!self->msg) return DBusPy_RaiseUnusableMessage();
320 return PyBool_FromLong(dbus_message_get_auto_start(self->msg));
321}
322
323PyDoc_STRVAR(Message_set_auto_start__doc__,static const char Message_set_auto_start__doc__[] = "message.set_auto_start(bool) -> None\n"
"Set whether this message will cause an owner for the destination name\n"
"to be auto-started.\n"
324"message.set_auto_start(bool) -> None\n"static const char Message_set_auto_start__doc__[] = "message.set_auto_start(bool) -> None\n"
"Set whether this message will cause an owner for the destination name\n"
"to be auto-started.\n"
325"Set whether this message will cause an owner for the destination name\n"static const char Message_set_auto_start__doc__[] = "message.set_auto_start(bool) -> None\n"
"Set whether this message will cause an owner for the destination name\n"
"to be auto-started.\n"
326"to be auto-started.\n")static const char Message_set_auto_start__doc__[] = "message.set_auto_start(bool) -> None\n"
"Set whether this message will cause an owner for the destination name\n"
"to be auto-started.\n"
;
327static PyObject *
328Message_set_auto_start(Message *self, PyObject *args)
329{
330 int value;
331 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "i", &value)) return NULL((void*)0);
332 if (!self->msg) return DBusPy_RaiseUnusableMessage();
333 dbus_message_set_auto_start(self->msg, value ? TRUE1 : FALSE0);
334 Py_INCREF(Py_None)_Py_INCREF(((PyObject*)((&_Py_NoneStruct))));
335 return Py_None(&_Py_NoneStruct);
336}
337
338PyDoc_STRVAR(Message_get_no_reply__doc__,static const char Message_get_no_reply__doc__[] = "message.get_no_reply() -> bool\n"
"Return true if this message need not be replied to.\n"
339"message.get_no_reply() -> bool\n"static const char Message_get_no_reply__doc__[] = "message.get_no_reply() -> bool\n"
"Return true if this message need not be replied to.\n"
340"Return true if this message need not be replied to.\n")static const char Message_get_no_reply__doc__[] = "message.get_no_reply() -> bool\n"
"Return true if this message need not be replied to.\n"
;
341static PyObject *
342Message_get_no_reply(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
343{
344 if (!self->msg) return DBusPy_RaiseUnusableMessage();
345 return PyBool_FromLong(dbus_message_get_no_reply(self->msg));
346}
347
348PyDoc_STRVAR(Message_set_no_reply__doc__,static const char Message_set_no_reply__doc__[] = "message.set_no_reply(bool) -> None\n"
"Set whether no reply to this message is required.\n"
349"message.set_no_reply(bool) -> None\n"static const char Message_set_no_reply__doc__[] = "message.set_no_reply(bool) -> None\n"
"Set whether no reply to this message is required.\n"
350"Set whether no reply to this message is required.\n")static const char Message_set_no_reply__doc__[] = "message.set_no_reply(bool) -> None\n"
"Set whether no reply to this message is required.\n"
;
351static PyObject *
352Message_set_no_reply(Message *self, PyObject *args)
353{
354 int value;
355 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "i", &value)) return NULL((void*)0);
356 if (!self->msg) return DBusPy_RaiseUnusableMessage();
357 dbus_message_set_no_reply(self->msg, value ? TRUE1 : FALSE0);
358 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
359}
360
361PyDoc_STRVAR(Message_get_reply_serial__doc__,static const char Message_get_reply_serial__doc__[] = "message.get_reply_serial() -> long\n"
"Returns the serial that the message is a reply to or 0 if none.\n"
362"message.get_reply_serial() -> long\n"static const char Message_get_reply_serial__doc__[] = "message.get_reply_serial() -> long\n"
"Returns the serial that the message is a reply to or 0 if none.\n"
363"Returns the serial that the message is a reply to or 0 if none.\n")static const char Message_get_reply_serial__doc__[] = "message.get_reply_serial() -> long\n"
"Returns the serial that the message is a reply to or 0 if none.\n"
;
364static PyObject *
365Message_get_reply_serial(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
366{
367 if (!self->msg) return DBusPy_RaiseUnusableMessage();
368 return PyLong_FromUnsignedLong(dbus_message_get_reply_serial(self->msg));
369}
370
371PyDoc_STRVAR(Message_set_reply_serial__doc__,static const char Message_set_reply_serial__doc__[] = "message.set_reply_serial(bool) -> None\n"
"Set the serial that this message is a reply to.\n"
372"message.set_reply_serial(bool) -> None\n"static const char Message_set_reply_serial__doc__[] = "message.set_reply_serial(bool) -> None\n"
"Set the serial that this message is a reply to.\n"
373"Set the serial that this message is a reply to.\n")static const char Message_set_reply_serial__doc__[] = "message.set_reply_serial(bool) -> None\n"
"Set the serial that this message is a reply to.\n"
;
374static PyObject *
375Message_set_reply_serial(Message *self, PyObject *args)
376{
377 dbus_uint32_t value;
378
379 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "k", &value)) return NULL((void*)0);
380 if (!self->msg) return DBusPy_RaiseUnusableMessage();
381 if (!dbus_message_set_reply_serial(self->msg, value)) {
382 return PyErr_NoMemory();
383 }
384 Py_INCREF(Py_None)_Py_INCREF(((PyObject*)((&_Py_NoneStruct))));
385 return Py_None(&_Py_NoneStruct);
386}
387
388PyDoc_STRVAR(Message_get_type__doc__,static const char Message_get_type__doc__[] = "message.get_type() -> int\n\n"
"Returns the type of the message.\n"
389"message.get_type() -> int\n\n"static const char Message_get_type__doc__[] = "message.get_type() -> int\n\n"
"Returns the type of the message.\n"
390"Returns the type of the message.\n")static const char Message_get_type__doc__[] = "message.get_type() -> int\n\n"
"Returns the type of the message.\n"
;
391static PyObject *
392Message_get_type(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
393{
394 if (!self->msg) return DBusPy_RaiseUnusableMessage();
395 return PyLong_FromLong(dbus_message_get_type(self->msg));
396}
397
398PyDoc_STRVAR(Message_get_serial__doc__,static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
399"message.get_serial() -> long\n"static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
400"Returns the serial of a message or 0 if none has been specified.\n"static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
401"\n"static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
402"The message's serial number is provided by the application sending the\n"static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
403"message and is used to identify replies to this message. All messages\n"static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
404"received on a connection will have a serial, but messages you haven't\n"static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
405"sent yet may return 0.\n")static const char Message_get_serial__doc__[] = "message.get_serial() -> long\n"
"Returns the serial of a message or 0 if none has been specified.\n"
"\n""The message's serial number is provided by the application sending the\n"
"message and is used to identify replies to this message. All messages\n"
"received on a connection will have a serial, but messages you haven't\n"
"sent yet may return 0.\n"
;
406static PyObject *
407Message_get_serial(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
408{
409 if (!self->msg) return DBusPy_RaiseUnusableMessage();
410 return PyLong_FromUnsignedLong(dbus_message_get_serial(self->msg));
411}
412
413PyDoc_STRVAR(Message_is_method_call__doc__,static const char Message_is_method_call__doc__[] = "is_method_call(interface: str, member: str) -> bool"
414"is_method_call(interface: str, member: str) -> bool")static const char Message_is_method_call__doc__[] = "is_method_call(interface: str, member: str) -> bool";
415static PyObject *
416Message_is_method_call(Message *self, PyObject *args)
417{
418 const char *interface, *method;
419
420 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "ss:is_method_call", &interface, &method)) {
421 return NULL((void*)0);
422 }
423 if (!self->msg) return DBusPy_RaiseUnusableMessage();
424 return PyBool_FromLong(dbus_message_is_method_call(self->msg, interface,
425 method));
426}
427
428PyDoc_STRVAR(Message_is_error__doc__,static const char Message_is_error__doc__[] = "is_error(error: str) -> bool"
429"is_error(error: str) -> bool")static const char Message_is_error__doc__[] = "is_error(error: str) -> bool";
430static PyObject *
431Message_is_error(Message *self, PyObject *args)
432{
433 const char *error_name;
434
435 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "s:is_error", &error_name)) {
436 return NULL((void*)0);
437 }
438 if (!self->msg) return DBusPy_RaiseUnusableMessage();
439 return PyBool_FromLong(dbus_message_is_error(self->msg, error_name));
440}
441
442PyDoc_STRVAR(Message_is_signal__doc__,static const char Message_is_signal__doc__[] = "is_signal(interface: str, member: str) -> bool"
443"is_signal(interface: str, member: str) -> bool")static const char Message_is_signal__doc__[] = "is_signal(interface: str, member: str) -> bool";
444static PyObject *
445Message_is_signal(Message *self, PyObject *args)
446{
447 const char *interface, *signal_name;
448
449 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "ss:is_signal", &interface, &signal_name)) {
450 return NULL((void*)0);
451 }
452 if (!self->msg) return DBusPy_RaiseUnusableMessage();
453 return PyBool_FromLong(dbus_message_is_signal(self->msg, interface,
454 signal_name));
455}
456
457PyDoc_STRVAR(Message_get_member__doc__,static const char Message_get_member__doc__[] = "get_member() -> str or None"
458"get_member() -> str or None")static const char Message_get_member__doc__[] = "get_member() -> str or None";
459static PyObject *
460Message_get_member(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
461{
462 const char *c_str;
463
464 if (!self->msg) return DBusPy_RaiseUnusableMessage();
465 c_str = dbus_message_get_member(self->msg);
466 if (!c_str) {
467 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
468 }
469 return PyUnicode_FromString(c_str);
470}
471
472PyDoc_STRVAR(Message_has_member__doc__,static const char Message_has_member__doc__[] = "has_member(name: str or None) -> bool"
473"has_member(name: str or None) -> bool")static const char Message_has_member__doc__[] = "has_member(name: str or None) -> bool";
474static PyObject *
475Message_has_member(Message *self, PyObject *args)
476{
477 const char *name;
478
479 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:has_member", &name)) {
480 return NULL((void*)0);
481 }
482 if (!self->msg) return DBusPy_RaiseUnusableMessage();
483 return PyBool_FromLong(dbus_message_has_member(self->msg, name));
484}
485
486PyDoc_STRVAR(Message_set_member__doc__,static const char Message_set_member__doc__[] = "set_member(unique_name: str or None)"
487"set_member(unique_name: str or None)")static const char Message_set_member__doc__[] = "set_member(unique_name: str or None)";
488static PyObject *
489Message_set_member(Message *self, PyObject *args)
490{
491 const char *name;
492
493 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:set_member", &name)) {
494 return NULL((void*)0);
495 }
496 if (!self->msg) return DBusPy_RaiseUnusableMessage();
497 if (!dbus_py_validate_member_name(name)) return NULL((void*)0);
498 if (!dbus_message_set_member(self->msg, name)) return PyErr_NoMemory();
499 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
500}
501
502PyDoc_STRVAR(Message_get_path__doc__,static const char Message_get_path__doc__[] = "get_path() -> ObjectPath or None\n\n"
"Return the message's destination object path (if it's a method call) or\n"
"source object path (if it's a method reply or a signal) or None (if it\n"
"has no path).\n"
503"get_path() -> ObjectPath or None\n\n"static const char Message_get_path__doc__[] = "get_path() -> ObjectPath or None\n\n"
"Return the message's destination object path (if it's a method call) or\n"
"source object path (if it's a method reply or a signal) or None (if it\n"
"has no path).\n"
504"Return the message's destination object path (if it's a method call) or\n"static const char Message_get_path__doc__[] = "get_path() -> ObjectPath or None\n\n"
"Return the message's destination object path (if it's a method call) or\n"
"source object path (if it's a method reply or a signal) or None (if it\n"
"has no path).\n"
505"source object path (if it's a method reply or a signal) or None (if it\n"static const char Message_get_path__doc__[] = "get_path() -> ObjectPath or None\n\n"
"Return the message's destination object path (if it's a method call) or\n"
"source object path (if it's a method reply or a signal) or None (if it\n"
"has no path).\n"
506"has no path).\n")static const char Message_get_path__doc__[] = "get_path() -> ObjectPath or None\n\n"
"Return the message's destination object path (if it's a method call) or\n"
"source object path (if it's a method reply or a signal) or None (if it\n"
"has no path).\n"
;
507static PyObject *
508Message_get_path(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
509{
510 const char *c_str;
511
512 if (!self->msg) return DBusPy_RaiseUnusableMessage();
513 c_str = dbus_message_get_path(self->msg);
514 if (!c_str) {
515 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
516 }
517 return PyObject_CallFunction_PyObject_CallFunction_SizeT((PyObject *)&DBusPyObjectPath_Type, "(s)", c_str);
518}
519
520PyDoc_STRVAR(Message_get_path_decomposed__doc__,static const char Message_get_path_decomposed__doc__[] = "get_path_decomposed() -> list of str, or None\n\n"
"Return a list of path components (e.g. /foo/bar -> ['foo','bar'], / -> [])\n"
"or None if the message has no associated path.\n"
521"get_path_decomposed() -> list of str, or None\n\n"static const char Message_get_path_decomposed__doc__[] = "get_path_decomposed() -> list of str, or None\n\n"
"Return a list of path components (e.g. /foo/bar -> ['foo','bar'], / -> [])\n"
"or None if the message has no associated path.\n"
522"Return a list of path components (e.g. /foo/bar -> ['foo','bar'], / -> [])\n"static const char Message_get_path_decomposed__doc__[] = "get_path_decomposed() -> list of str, or None\n\n"
"Return a list of path components (e.g. /foo/bar -> ['foo','bar'], / -> [])\n"
"or None if the message has no associated path.\n"
523"or None if the message has no associated path.\n")static const char Message_get_path_decomposed__doc__[] = "get_path_decomposed() -> list of str, or None\n\n"
"Return a list of path components (e.g. /foo/bar -> ['foo','bar'], / -> [])\n"
"or None if the message has no associated path.\n"
;
524static PyObject *
525Message_get_path_decomposed(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
526{
527 char **paths, **ptr;
528 PyObject *ret = PyList_New(0);
529
530 if (!ret) return NULL((void*)0);
1
Assuming 'ret' is non-null
2
Taking false branch
531 if (!self->msg) {
3
Assuming field 'msg' is non-null
4
Taking false branch
532 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
533 return DBusPy_RaiseUnusableMessage();
534 }
535 if (!dbus_message_get_path_decomposed(self->msg, &paths)) {
5
Assuming the condition is false
6
Taking false branch
536 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
537 return PyErr_NoMemory();
538 }
539 if (!paths) {
7
Assuming 'paths' is non-null
8
Taking false branch
540 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
541 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
542 }
543 for (ptr = paths; *ptr; ptr++) {
9
Loop condition is true. Entering loop body
544 PyObject *str = PyUnicode_FromString(*ptr);
10
Calling 'PyUnicode_FromString'
12
Returning from 'PyUnicode_FromString'
17
PyObject ownership leak with reference count of 1
545
546 if (!str) {
13
Assuming 'str' is non-null
14
Taking false branch
547 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
548 break;
549 }
550 if (PyList_Append(ret, str) < 0) {
15
Assuming the condition is true
16
Taking true branch
551 Py_CLEAR(ret)do { PyObject *_py_tmp = ((PyObject*)(ret)); if (_py_tmp != (
(void*)0)) { (ret) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
552 break;
553 }
554 Py_CLEAR(str)do { PyObject *_py_tmp = ((PyObject*)(str)); if (_py_tmp != (
(void*)0)) { (str) = ((void*)0); _Py_DECREF(((PyObject*)(_py_tmp
))); } } while (0)
;
555 str = NULL((void*)0);
556 }
557 dbus_free_string_array(paths);
558 return ret;
559}
560
561PyDoc_STRVAR(Message_has_path__doc__,static const char Message_has_path__doc__[] = "has_path(name: str or None) -> bool"
562"has_path(name: str or None) -> bool")static const char Message_has_path__doc__[] = "has_path(name: str or None) -> bool";
563static PyObject *
564Message_has_path(Message *self, PyObject *args)
565{
566 const char *name;
567
568 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:has_path", &name)) {
569 return NULL((void*)0);
570 }
571 if (!self->msg) return DBusPy_RaiseUnusableMessage();
572 return PyBool_FromLong(dbus_message_has_path(self->msg, name));
573}
574
575PyDoc_STRVAR(Message_set_path__doc__,static const char Message_set_path__doc__[] = "set_path(name: str or None)"
576"set_path(name: str or None)")static const char Message_set_path__doc__[] = "set_path(name: str or None)";
577static PyObject *
578Message_set_path(Message *self, PyObject *args)
579{
580 const char *name;
581
582 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:set_path", &name)) return NULL((void*)0);
583 if (!self->msg) return DBusPy_RaiseUnusableMessage();
584 if (!dbus_message_has_path(self->msg, name)) return PyErr_NoMemory();
585 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
586}
587
588PyDoc_STRVAR(Message_get_signature__doc__,static const char Message_get_signature__doc__[] = "get_signature() -> Signature or None"
589"get_signature() -> Signature or None")static const char Message_get_signature__doc__[] = "get_signature() -> Signature or None";
590static PyObject *
591Message_get_signature(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
592{
593 const char *c_str;
594
595 if (!self->msg) return DBusPy_RaiseUnusableMessage();
596 c_str = dbus_message_get_signature(self->msg);
597 if (!c_str) {
598 return PyObject_CallFunction_PyObject_CallFunction_SizeT((PyObject *)&DBusPySignature_Type, "(s)", "");
599 }
600 return PyObject_CallFunction_PyObject_CallFunction_SizeT((PyObject *)&DBusPySignature_Type, "(s)", c_str);
601}
602
603PyDoc_STRVAR(Message_has_signature__doc__,static const char Message_has_signature__doc__[] = "has_signature(signature: str) -> bool"
604"has_signature(signature: str) -> bool")static const char Message_has_signature__doc__[] = "has_signature(signature: str) -> bool";
605static PyObject *
606Message_has_signature(Message *self, PyObject *args)
607{
608 const char *name;
609
610 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "s:has_signature", &name)) {
611 return NULL((void*)0);
612 }
613 if (!self->msg) return DBusPy_RaiseUnusableMessage();
614 return PyBool_FromLong(dbus_message_has_signature(self->msg, name));
615}
616
617PyDoc_STRVAR(Message_get_sender__doc__,static const char Message_get_sender__doc__[] = "get_sender() -> str or None\n\n"
"Return the message's sender unique name, or None if none.\n"
618"get_sender() -> str or None\n\n"static const char Message_get_sender__doc__[] = "get_sender() -> str or None\n\n"
"Return the message's sender unique name, or None if none.\n"
619"Return the message's sender unique name, or None if none.\n")static const char Message_get_sender__doc__[] = "get_sender() -> str or None\n\n"
"Return the message's sender unique name, or None if none.\n"
;
620static PyObject *
621Message_get_sender(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
622{
623 const char *c_str;
624
625 if (!self->msg) return DBusPy_RaiseUnusableMessage();
626 c_str = dbus_message_get_sender(self->msg);
627 if (!c_str) {
628 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
629 }
630 return PyUnicode_FromString(c_str);
631}
632
633PyDoc_STRVAR(Message_has_sender__doc__,static const char Message_has_sender__doc__[] = "has_sender(unique_name: str) -> bool"
634"has_sender(unique_name: str) -> bool")static const char Message_has_sender__doc__[] = "has_sender(unique_name: str) -> bool";
635static PyObject *
636Message_has_sender(Message *self, PyObject *args)
637{
638 const char *name;
639
640 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "s:has_sender", &name)) {
641 return NULL((void*)0);
642 }
643 if (!self->msg) return DBusPy_RaiseUnusableMessage();
644 return PyBool_FromLong(dbus_message_has_sender(self->msg, name));
645}
646
647PyDoc_STRVAR(Message_set_sender__doc__,static const char Message_set_sender__doc__[] = "set_sender(unique_name: str or None)"
648"set_sender(unique_name: str or None)")static const char Message_set_sender__doc__[] = "set_sender(unique_name: str or None)";
649static PyObject *
650Message_set_sender(Message *self, PyObject *args)
651{
652 const char *name;
653
654 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:set_sender", &name)) {
655 return NULL((void*)0);
656 }
657 if (!self->msg) return DBusPy_RaiseUnusableMessage();
658 if (!dbus_py_validate_bus_name(name, 1, 1)) return NULL((void*)0);
659 if (!dbus_message_set_sender(self->msg, name)) return PyErr_NoMemory();
660 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
661}
662
663PyDoc_STRVAR(Message_get_destination__doc__,static const char Message_get_destination__doc__[] = "get_destination() -> str or None\n\n"
"Return the message's destination bus name, or None if none.\n"
664"get_destination() -> str or None\n\n"static const char Message_get_destination__doc__[] = "get_destination() -> str or None\n\n"
"Return the message's destination bus name, or None if none.\n"
665"Return the message's destination bus name, or None if none.\n")static const char Message_get_destination__doc__[] = "get_destination() -> str or None\n\n"
"Return the message's destination bus name, or None if none.\n"
;
666static PyObject *
667Message_get_destination(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
668{
669 const char *c_str;
670
671 if (!self->msg) return DBusPy_RaiseUnusableMessage();
672 c_str = dbus_message_get_destination(self->msg);
673 if (!c_str) {
674 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
675 }
676 return PyUnicode_FromString(c_str);
677}
678
679PyDoc_STRVAR(Message_has_destination__doc__,static const char Message_has_destination__doc__[] = "has_destination(bus_name: str) -> bool"
680"has_destination(bus_name: str) -> bool")static const char Message_has_destination__doc__[] = "has_destination(bus_name: str) -> bool";
681static PyObject *
682Message_has_destination(Message *self, PyObject *args)
683{
684 const char *name;
685
686 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "s:has_destination", &name)) {
687 return NULL((void*)0);
688 }
689 if (!self->msg) return DBusPy_RaiseUnusableMessage();
690 return PyBool_FromLong(dbus_message_has_destination(self->msg, name));
691}
692
693PyDoc_STRVAR(Message_set_destination__doc__,static const char Message_set_destination__doc__[] = "set_destination(bus_name: str or None)"
694"set_destination(bus_name: str or None)")static const char Message_set_destination__doc__[] = "set_destination(bus_name: str or None)";
695static PyObject *
696Message_set_destination(Message *self, PyObject *args)
697{
698 const char *name;
699
700 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:set_destination", &name)) {
701 return NULL((void*)0);
702 }
703 if (!self->msg) return DBusPy_RaiseUnusableMessage();
704 if (!dbus_py_validate_bus_name(name, 1, 1)) return NULL((void*)0);
705 if (!dbus_message_set_destination(self->msg, name)) return PyErr_NoMemory();
706 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
707}
708
709PyDoc_STRVAR(Message_get_interface__doc__,static const char Message_get_interface__doc__[] = "get_interface() -> str or None"
710"get_interface() -> str or None")static const char Message_get_interface__doc__[] = "get_interface() -> str or None";
711static PyObject *
712Message_get_interface(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
713{
714 const char *c_str;
715
716 if (!self->msg) return DBusPy_RaiseUnusableMessage();
717 c_str = dbus_message_get_interface(self->msg);
718 if (!c_str) {
719 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
720 }
721 return PyUnicode_FromString(c_str);
722}
723
724PyDoc_STRVAR(Message_has_interface__doc__,static const char Message_has_interface__doc__[] = "has_interface(interface: str or None) -> bool"
725"has_interface(interface: str or None) -> bool")static const char Message_has_interface__doc__[] = "has_interface(interface: str or None) -> bool";
726static PyObject *
727Message_has_interface(Message *self, PyObject *args)
728{
729 const char *name;
730
731 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:has_interface", &name)) {
732 return NULL((void*)0);
733 }
734 if (!self->msg) return DBusPy_RaiseUnusableMessage();
735 return PyBool_FromLong(dbus_message_has_interface(self->msg, name));
736}
737
738PyDoc_STRVAR(Message_set_interface__doc__,static const char Message_set_interface__doc__[] = "set_interface(name: str or None)"
739"set_interface(name: str or None)")static const char Message_set_interface__doc__[] = "set_interface(name: str or None)";
740static PyObject *
741Message_set_interface(Message *self, PyObject *args)
742{
743 const char *name;
744
745 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:set_interface", &name)) {
746 return NULL((void*)0);
747 }
748 if (!self->msg) return DBusPy_RaiseUnusableMessage();
749 if (!dbus_py_validate_interface_name(name)) return NULL((void*)0);
750 if (!dbus_message_set_interface(self->msg, name)) return PyErr_NoMemory();
751 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
752}
753
754PyDoc_STRVAR(Message_get_error_name__doc__,static const char Message_get_error_name__doc__[] = "get_error_name() -> str or None"
755"get_error_name() -> str or None")static const char Message_get_error_name__doc__[] = "get_error_name() -> str or None";
756static PyObject *
757Message_get_error_name(Message *self, PyObject *unused UNUSED__attribute__((__unused__)))
758{
759 const char *c_str;
760
761 if (!self->msg) return DBusPy_RaiseUnusableMessage();
762 c_str = dbus_message_get_error_name(self->msg);
763 if (!c_str) {
764 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
765 }
766 return PyUnicode_FromString(c_str);
767}
768
769PyDoc_STRVAR(Message_set_error_name__doc__,static const char Message_set_error_name__doc__[] = "set_error_name(name: str or None)"
770"set_error_name(name: str or None)")static const char Message_set_error_name__doc__[] = "set_error_name(name: str or None)";
771static PyObject *
772Message_set_error_name(Message *self, PyObject *args)
773{
774 const char *name;
775
776 if (!PyArg_ParseTuple_PyArg_ParseTuple_SizeT(args, "z:set_error_name", &name)) {
777 return NULL((void*)0);
778 }
779 if (!self->msg) return DBusPy_RaiseUnusableMessage();
780 if (!dbus_py_validate_error_namedbus_py_validate_interface_name(name)) return NULL((void*)0);
781 if (!dbus_message_set_error_name(self->msg, name)) return PyErr_NoMemory();
782 Py_RETURN_NONEreturn _Py_INCREF(((PyObject*)((&_Py_NoneStruct)))), (&
_Py_NoneStruct)
;
783}
784
785static PyMethodDef Message_tp_methods[] = {
786 {"copy", (PyCFunction) (void (*)(void)) Message_copy,
787 METH_NOARGS0x0004, Message_copy__doc__},
788 {"is_method_call", (PyCFunction) (void (*)(void)) Message_is_method_call,
789 METH_VARARGS0x0001, Message_is_method_call__doc__},
790 {"is_signal", (PyCFunction) (void (*)(void)) Message_is_signal,
791 METH_VARARGS0x0001, Message_is_signal__doc__},
792 {"is_error", (PyCFunction) (void (*)(void)) Message_is_error,
793 METH_VARARGS0x0001, Message_is_error__doc__},
794
795 {"get_args_list", (PyCFunction) (void (*)(void)) dbus_py_Message_get_args_list,
796 METH_VARARGS0x0001|METH_KEYWORDS0x0002, dbus_py_Message_get_args_list__doc__},
797 {"guess_signature", (PyCFunction) (void (*)(void)) dbus_py_Message_guess_signature,
798 METH_VARARGS0x0001|METH_STATIC0x0020, dbus_py_Message_guess_signature__doc__},
799 {"append", (PyCFunction) (void (*)(void)) dbus_py_Message_append,
800 METH_VARARGS0x0001|METH_KEYWORDS0x0002, dbus_py_Message_append__doc__},
801
802 {"get_auto_start", (PyCFunction) (void (*)(void)) Message_get_auto_start,
803 METH_NOARGS0x0004, Message_get_auto_start__doc__},
804 {"set_auto_start", (PyCFunction) (void (*)(void)) Message_set_auto_start,
805 METH_VARARGS0x0001, Message_set_auto_start__doc__},
806 {"get_destination", (PyCFunction) (void (*)(void)) Message_get_destination,
807 METH_NOARGS0x0004, Message_get_destination__doc__},
808 {"set_destination", (PyCFunction) (void (*)(void)) Message_set_destination,
809 METH_VARARGS0x0001, Message_set_destination__doc__},
810 {"has_destination", (PyCFunction) (void (*)(void)) Message_has_destination,
811 METH_VARARGS0x0001, Message_has_destination__doc__},
812 {"get_error_name", (PyCFunction) (void (*)(void)) Message_get_error_name,
813 METH_NOARGS0x0004, Message_get_error_name__doc__},
814 {"set_error_name", (PyCFunction) (void (*)(void)) Message_set_error_name,
815 METH_VARARGS0x0001, Message_set_error_name__doc__},
816 {"get_interface", (PyCFunction) (void (*)(void)) Message_get_interface,
817 METH_NOARGS0x0004, Message_get_interface__doc__},
818 {"set_interface", (PyCFunction) (void (*)(void))Message_set_interface,
819 METH_VARARGS0x0001, Message_set_interface__doc__},
820 {"has_interface", (PyCFunction) (void (*)(void))Message_has_interface,
821 METH_VARARGS0x0001, Message_has_interface__doc__},
822 {"get_member", (PyCFunction) (void (*)(void))Message_get_member,
823 METH_NOARGS0x0004, Message_get_member__doc__},
824 {"set_member", (PyCFunction) (void (*)(void))Message_set_member,
825 METH_VARARGS0x0001, Message_set_member__doc__},
826 {"has_member", (PyCFunction) (void (*)(void))Message_has_member,
827 METH_VARARGS0x0001, Message_has_member__doc__},
828 {"get_path", (PyCFunction) (void (*)(void))Message_get_path,
829 METH_NOARGS0x0004, Message_get_path__doc__},
830 {"get_path_decomposed", (PyCFunction) (void (*)(void))Message_get_path_decomposed,
831 METH_NOARGS0x0004, Message_get_path_decomposed__doc__},
832 {"set_path", (PyCFunction) (void (*)(void))Message_set_path,
833 METH_VARARGS0x0001, Message_set_path__doc__},
834 {"has_path", (PyCFunction) (void (*)(void))Message_has_path,
835 METH_VARARGS0x0001, Message_has_path__doc__},
836 {"get_no_reply", (PyCFunction) (void (*)(void))Message_get_no_reply,
837 METH_NOARGS0x0004, Message_get_no_reply__doc__},
838 {"set_no_reply", (PyCFunction) (void (*)(void))Message_set_no_reply,
839 METH_VARARGS0x0001, Message_set_no_reply__doc__},
840 {"get_reply_serial", (PyCFunction) (void (*)(void))Message_get_reply_serial,
841 METH_NOARGS0x0004, Message_get_reply_serial__doc__},
842 {"set_reply_serial", (PyCFunction) (void (*)(void))Message_set_reply_serial,
843 METH_VARARGS0x0001, Message_set_reply_serial__doc__},
844 {"get_sender", (PyCFunction) (void (*)(void))Message_get_sender,
845 METH_NOARGS0x0004, Message_get_sender__doc__},
846 {"set_sender", (PyCFunction) (void (*)(void))Message_set_sender,
847 METH_VARARGS0x0001, Message_set_sender__doc__},
848 {"has_sender", (PyCFunction) (void (*)(void))Message_has_sender,
849 METH_VARARGS0x0001, Message_has_sender__doc__},
850 {"get_serial", (PyCFunction) (void (*)(void))Message_get_serial,
851 METH_NOARGS0x0004, Message_get_serial__doc__},
852 {"get_signature", (PyCFunction) (void (*)(void))Message_get_signature,
853 METH_NOARGS0x0004, Message_get_signature__doc__},
854 {"has_signature", (PyCFunction) (void (*)(void))Message_has_signature,
855 METH_VARARGS0x0001, Message_has_signature__doc__},
856 {"get_type", (PyCFunction) (void (*)(void))Message_get_type,
857 METH_NOARGS0x0004, Message_get_type__doc__},
858 {NULL((void*)0), NULL((void*)0), 0, NULL((void*)0)}
859};
860
861static PyTypeObject MessageType = {
862 PyVarObject_HEAD_INIT(NULL, 0){ { 1, ((void*)0) }, 0 },
863 "dbus.lowlevel.Message", /*tp_name*/
864 sizeof(Message), /*tp_basicsize*/
865 0, /*tp_itemsize*/
866 (destructor)Message_tp_dealloc, /*tp_dealloc*/
867 0, /*tp_print*/
868 0, /*tp_getattr*/
869 0, /*tp_setattr*/
870 0, /*tp_compare*/
871 0, /*tp_repr*/
872 0, /*tp_as_number*/
873 0, /*tp_as_sequence*/
874 0, /*tp_as_mapping*/
875 0, /*tp_hash */
876 0, /*tp_call*/
877 0, /*tp_str*/
878 0, /*tp_getattro*/
879 0, /*tp_setattro*/
880 0, /*tp_as_buffer*/
881 Py_TPFLAGS_DEFAULT( 0 | (1UL << 18) | 0) | Py_TPFLAGS_BASETYPE(1UL << 10), /*tp_flags*/
882 Message_tp_doc, /* tp_doc */
883 0, /* tp_traverse */
884 0, /* tp_clear */
885 0, /* tp_richcompare */
886 0, /* tp_weaklistoffset */
887 0, /* tp_iter */
888 0, /* tp_iternext */
889 Message_tp_methods, /* tp_methods */
890 0, /* tp_members */
891 0, /* tp_getset */
892 0, /* tp_base */
893 0, /* tp_dict */
894 0, /* tp_descr_get */
895 0, /* tp_descr_set */
896 0, /* tp_dictoffset */
897 0, /* tp_init */
898 0, /* tp_alloc */
899 Message_tp_new, /* tp_new */
900};
901
902static PyTypeObject MethodCallMessageType = {
903 PyVarObject_HEAD_INIT(NULL, 0){ { 1, ((void*)0) }, 0 },
904 "dbus.lowlevel.MethodCallMessage", /*tp_name*/
905 0, /*tp_basicsize*/
906 0, /*tp_itemsize*/
907 0, /*tp_dealloc*/
908 0, /*tp_print*/
909 0, /*tp_getattr*/
910 0, /*tp_setattr*/
911 0, /*tp_compare*/
912 MethodCallMessage_tp_repr, /*tp_repr*/
913 0, /*tp_as_number*/
914 0, /*tp_as_sequence*/
915 0, /*tp_as_mapping*/
916 0, /*tp_hash */
917 0, /*tp_call*/
918 0, /*tp_str*/
919 0, /*tp_getattro*/
920 0, /*tp_setattro*/
921 0, /*tp_as_buffer*/
922 Py_TPFLAGS_DEFAULT( 0 | (1UL << 18) | 0) | Py_TPFLAGS_BASETYPE(1UL << 10), /*tp_flags*/
923 MethodCallMessage_tp_doc, /* tp_doc */
924 0, /* tp_traverse */
925 0, /* tp_clear */
926 0, /* tp_richcompare */
927 0, /* tp_weaklistoffset */
928 0, /* tp_iter */
929 0, /* tp_iternext */
930 0, /* tp_methods */
931 0, /* tp_members */
932 0, /* tp_getset */
933 DEFERRED_ADDRESS(&MessageType)0, /* tp_base */
934 0, /* tp_dict */
935 0, /* tp_descr_get */
936 0, /* tp_descr_set */
937 0, /* tp_dictoffset */
938 (initproc)MethodCallMessage_tp_init, /* tp_init */
939 0, /* tp_alloc */
940 0, /* tp_new */
941};
942
943static PyTypeObject MethodReturnMessageType = {
944 PyVarObject_HEAD_INIT(NULL, 0){ { 1, ((void*)0) }, 0 },
945 "dbus.lowlevel.MethodReturnMessage", /*tp_name*/
946 0, /*tp_basicsize*/
947 0, /*tp_itemsize*/
948 0, /*tp_dealloc*/
949 0, /*tp_print*/
950 0, /*tp_getattr*/
951 0, /*tp_setattr*/
952 0, /*tp_compare*/
953 0, /*tp_repr*/
954 0, /*tp_as_number*/
955 0, /*tp_as_sequence*/
956 0, /*tp_as_mapping*/
957 0, /*tp_hash */
958 0, /*tp_call*/
959 0, /*tp_str*/
960 0, /*tp_getattro*/
961 0, /*tp_setattro*/
962 0, /*tp_as_buffer*/
963 Py_TPFLAGS_DEFAULT( 0 | (1UL << 18) | 0) | Py_TPFLAGS_BASETYPE(1UL << 10), /*tp_flags*/
964 MethodReturnMessage_tp_doc, /* tp_doc */
965 0, /* tp_traverse */
966 0, /* tp_clear */
967 0, /* tp_richcompare */
968 0, /* tp_weaklistoffset */
969 0, /* tp_iter */
970 0, /* tp_iternext */
971 0, /* tp_methods */
972 0, /* tp_members */
973 0, /* tp_getset */
974 DEFERRED_ADDRESS(&MessageType)0, /* tp_base */
975 0, /* tp_dict */
976 0, /* tp_descr_get */
977 0, /* tp_descr_set */
978 0, /* tp_dictoffset */
979 (initproc)MethodReturnMessage_tp_init, /* tp_init */
980 0, /* tp_alloc */
981 0, /* tp_new */
982};
983
984static PyTypeObject SignalMessageType = {
985 PyVarObject_HEAD_INIT(NULL, 0){ { 1, ((void*)0) }, 0 },
986 "dbus.lowlevel.SignalMessage", /*tp_name*/
987 0, /*tp_basicsize*/
988 0, /*tp_itemsize*/
989 0, /*tp_dealloc*/
990 0, /*tp_print*/
991 0, /*tp_getattr*/
992 0, /*tp_setattr*/
993 0, /*tp_compare*/
994 SignalMessage_tp_repr, /*tp_repr*/
995 0, /*tp_as_number*/
996 0, /*tp_as_sequence*/
997 0, /*tp_as_mapping*/
998 0, /*tp_hash */
999 0, /*tp_call*/
1000 0, /*tp_str*/
1001 0, /*tp_getattro*/
1002 0, /*tp_setattro*/
1003 0, /*tp_as_buffer*/
1004 Py_TPFLAGS_DEFAULT( 0 | (1UL << 18) | 0) | Py_TPFLAGS_BASETYPE(1UL << 10), /*tp_flags*/
1005 SignalMessage_tp_doc, /* tp_doc */
1006 0, /* tp_traverse */
1007 0, /* tp_clear */
1008 0, /* tp_richcompare */
1009 0, /* tp_weaklistoffset */
1010 0, /* tp_iter */
1011 0, /* tp_iternext */
1012 0, /* tp_methods */
1013 0, /* tp_members */
1014 0, /* tp_getset */
1015 DEFERRED_ADDRESS(&MessageType)0, /* tp_base */
1016 0, /* tp_dict */
1017 0, /* tp_descr_get */
1018 0, /* tp_descr_set */
1019 0, /* tp_dictoffset */
1020 (initproc)SignalMessage_tp_init, /* tp_init */
1021 0, /* tp_alloc */
1022 0, /* tp_new */
1023};
1024
1025static PyTypeObject ErrorMessageType = {
1026 PyVarObject_HEAD_INIT(NULL, 0){ { 1, ((void*)0) }, 0 },
1027 "dbus.lowlevel.ErrorMessage", /*tp_name*/
1028 0, /*tp_basicsize*/
1029 0, /*tp_itemsize*/
1030 0, /*tp_dealloc*/
1031 0, /*tp_print*/
1032 0, /*tp_getattr*/
1033 0, /*tp_setattr*/
1034 0, /*tp_compare*/
1035 0, /*tp_repr*/
1036 0, /*tp_as_number*/
1037 0, /*tp_as_sequence*/
1038 0, /*tp_as_mapping*/
1039 0, /*tp_hash */
1040 0, /*tp_call*/
1041 0, /*tp_str*/
1042 0, /*tp_getattro*/
1043 0, /*tp_setattro*/
1044 0, /*tp_as_buffer*/
1045 Py_TPFLAGS_DEFAULT( 0 | (1UL << 18) | 0) | Py_TPFLAGS_BASETYPE(1UL << 10), /*tp_flags*/
1046 ErrorMessage_tp_doc, /* tp_doc */
1047 0, /* tp_traverse */
1048 0, /* tp_clear */
1049 0, /* tp_richcompare */
1050 0, /* tp_weaklistoffset */
1051 0, /* tp_iter */
1052 0, /* tp_iternext */
1053 0, /* tp_methods */
1054 0, /* tp_members */
1055 0, /* tp_getset */
1056 DEFERRED_ADDRESS(&MessageType)0, /* tp_base */
1057 0, /* tp_dict */
1058 0, /* tp_descr_get */
1059 0, /* tp_descr_set */
1060 0, /* tp_dictoffset */
1061 (initproc)ErrorMessage_tp_init, /* tp_init */
1062 0, /* tp_alloc */
1063 0, /* tp_new */
1064};
1065
1066dbus_bool_t
1067dbus_py_init_message_types(void)
1068{
1069 if (PyType_Ready(&MessageType) < 0) return 0;
1070
1071 MethodCallMessageType.tp_base = &MessageType;
1072 if (PyType_Ready(&MethodCallMessageType) < 0) return 0;
1073
1074 MethodReturnMessageType.tp_base = &MessageType;
1075 if (PyType_Ready(&MethodReturnMessageType) < 0) return 0;
1076
1077 SignalMessageType.tp_base = &MessageType;
1078 if (PyType_Ready(&SignalMessageType) < 0) return 0;
1079
1080 ErrorMessageType.tp_base = &MessageType;
1081 if (PyType_Ready(&ErrorMessageType) < 0) return 0;
1082
1083 return 1;
1084}
1085
1086dbus_bool_t
1087dbus_py_insert_message_types(PyObject *this_module)
1088{
1089 /* PyModule_AddObject steals a ref */
1090 Py_INCREF (&MessageType)_Py_INCREF(((PyObject*)(&MessageType)));
1091 Py_INCREF (&MethodCallMessageType)_Py_INCREF(((PyObject*)(&MethodCallMessageType)));
1092 Py_INCREF (&MethodReturnMessageType)_Py_INCREF(((PyObject*)(&MethodReturnMessageType)));
1093 Py_INCREF (&ErrorMessageType)_Py_INCREF(((PyObject*)(&ErrorMessageType)));
1094 Py_INCREF (&SignalMessageType)_Py_INCREF(((PyObject*)(&SignalMessageType)));
1095
1096 if (PyModule_AddObject(this_module, "Message",
1097 (PyObject *)&MessageType) < 0) return 0;
1098
1099 if (PyModule_AddObject(this_module, "MethodCallMessage",
1100 (PyObject *)&MethodCallMessageType) < 0) return 0;
1101
1102 if (PyModule_AddObject(this_module, "MethodReturnMessage",
1103 (PyObject *)&MethodReturnMessageType) < 0) return 0;
1104
1105 if (PyModule_AddObject(this_module, "ErrorMessage",
1106 (PyObject *)&ErrorMessageType) < 0) return 0;
1107
1108 if (PyModule_AddObject(this_module, "SignalMessage",
1109 (PyObject *)&SignalMessageType) < 0) return 0;
1110
1111 return 1;
1112}
1113
1114/* vim:set ft=c cino< sw=4 sts=4 et: */

/opt/pyrefcon/lib/pyrefcon/models/models/PyUnicode_FromString.model

1#ifndef PyUnicode_FromString
2struct _object;
3typedef struct _object PyObject;
4PyObject* clang_analyzer_PyObject_New_Reference();
5PyObject *PyUnicode_FromString(const char *u) {
6 return clang_analyzer_PyObject_New_Reference();
11
Setting reference count to 1
7}
8#else
9#warning "API PyUnicode_FromString is defined as a macro."
10#endif