1 /* Debug code for _dbus_bindings.
3 * Copyright (C) 2006 Collabora Ltd.
5 * Licensed under the Academic Free License version 2.1
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 # include <sys/types.h>
30 # define DBG(format, ...) fprintf(stderr, "DEBUG: " format "\n",\
32 static void _dbg_exc(void)
35 /* This is a little mad. We want to get the traceback without
36 clearing the error indicator. */
37 PyErr_Fetch(&c
, &v
, &t
); /* 3 new refs */
38 Py_XINCREF(c
); Py_XINCREF(v
); Py_XINCREF(t
); /* now we own 6 refs */
39 PyErr_Restore(c
, v
, t
); /* steals 3 refs */
41 PyErr_Restore(c
, v
, t
); /* steals another 3 refs */
43 # define DBG_EXC(format, ...) do {DBG(format, __VA_ARGS__); \
44 _dbg_exc();} while (0)
47 # define DBG(format, ...) do {} while (0)
48 # define DBG_EXC(format, ...) do {} while (0)