diff options
author | John Ehresman <jpe@wingware.com> | 2010-04-16 15:08:54 -0400 |
---|---|---|
committer | John Ehresman <jpe@wingware.com> | 2010-04-16 15:08:54 -0400 |
commit | 7b5007d63a72ba6bb7f087a67af890bf987e42cb (patch) | |
tree | 0f2f156049003a8a04bbaeb8f4d4e88d9288abbf | |
parent | 9debda32a5877b582e93592c9a2f750d1cac9c20 (diff) | |
download | pygobject-7b5007d63a72ba6bb7f087a67af890bf987e42cb.tar.gz |
Rename _PyLong macros to PYGLIB_PyLong
-rw-r--r-- | codegen/libcodegen/argtypes.py | 14 | ||||
-rw-r--r-- | codegen/libcodegen/reversewrapper.py | 4 | ||||
-rw-r--r-- | gio/goutputstream.override | 4 | ||||
-rw-r--r-- | glib/glibmodule.c | 14 | ||||
-rw-r--r-- | glib/pygiochannel.c | 20 | ||||
-rw-r--r-- | glib/pyglib-python-compat.h | 24 | ||||
-rw-r--r-- | glib/pyglib.c | 10 | ||||
-rw-r--r-- | glib/pygsource.c | 12 | ||||
-rw-r--r-- | glib/pygspawn.c | 18 | ||||
-rw-r--r-- | gobject/gobjectmodule.c | 30 | ||||
-rw-r--r-- | gobject/pygenum.c | 24 | ||||
-rw-r--r-- | gobject/pygflags.c | 40 | ||||
-rw-r--r-- | gobject/pygobject-private.h | 4 | ||||
-rw-r--r-- | gobject/pygobject.c | 8 | ||||
-rw-r--r-- | gobject/pygparamspec.c | 16 | ||||
-rw-r--r-- | gobject/pygtype.c | 38 | ||||
-rw-r--r-- | tests/testhelpermodule.c | 2 |
17 files changed, 141 insertions, 141 deletions
diff --git a/codegen/libcodegen/argtypes.py b/codegen/libcodegen/argtypes.py index b506ce6e..c4a0e227 100644 --- a/codegen/libcodegen/argtypes.py +++ b/codegen/libcodegen/argtypes.py @@ -184,14 +184,14 @@ class IntArg(ArgType): info.add_parselist('i', ['&' + pname], [pname]) def write_return(self, ptype, ownsreturn, info): info.varlist.add('int', 'ret') - info.codeafter.append(' return _PyLong_FromLong(ret);') + info.codeafter.append(' return PYGLIB_PyLong_FromLong(ret);') class UIntArg(ArgType): dflt = (' if (py_%(name)s) {\n' ' if (PyLong_Check(py_%(name)s))\n' ' %(name)s = PyLong_AsUnsignedLong(py_%(name)s);\n' - ' else if (_PyLong_Check(py_%(name)s))\n' - ' %(name)s = _PyLong_AsLong(py_%(name)s);\n' + ' else if (PYGLIB_PyLong_Check(py_%(name)s))\n' + ' %(name)s = PYGLIB_PyLong_AsLong(py_%(name)s);\n' ' else\n' ' PyErr_SetString(PyExc_TypeError, "Parameter \'%(name)s\' must be an int or a long");\n' ' if (PyErr_Occurred())\n' @@ -199,8 +199,8 @@ class UIntArg(ArgType): ' }\n') before = (' if (PyLong_Check(py_%(name)s))\n' ' %(name)s = PyLong_AsUnsignedLong(py_%(name)s);\n' - ' else if (_PyLong_Check(py_%(name)s))\n' - ' %(name)s = _PyLong_AsLong(py_%(name)s);\n' + ' else if (PYGLIB_PyLong_Check(py_%(name)s))\n' + ' %(name)s = PYGLIB_PyLong_AsLong(py_%(name)s);\n' ' else\n' ' PyErr_SetString(PyExc_TypeError, "Parameter \'%(name)s\' must be an int or a long");\n' ' if (PyErr_Occurred())\n' @@ -276,7 +276,7 @@ class LongArg(ArgType): info.add_parselist('l', ['&' + pname], [pname]) def write_return(self, ptype, ownsreturn, info): info.varlist.add(ptype, 'ret') - info.codeafter.append(' return _PyLong_FromLong(ret);\n') + info.codeafter.append(' return PYGLIB_PyLong_FromLong(ret);\n') class BoolArg(IntArg): def write_return(self, ptype, ownsreturn, info): @@ -293,7 +293,7 @@ class TimeTArg(ArgType): info.add_parselist('i', ['&' + pname], [pname]) def write_return(self, ptype, ownsreturn, info): info.varlist.add('time_t', 'ret') - info.codeafter.append(' return _PyLong_FromLong(ret);') + info.codeafter.append(' return PYGLIB_PyLong_FromLong(ret);') class ULongArg(ArgType): def write_param(self, ptype, pname, pdflt, pnull, info): diff --git a/codegen/libcodegen/reversewrapper.py b/codegen/libcodegen/reversewrapper.py index cfbb7561..a0a44224 100644 --- a/codegen/libcodegen/reversewrapper.py +++ b/codegen/libcodegen/reversewrapper.py @@ -526,7 +526,7 @@ class IntParam(Parameter): def convert_c2py(self): self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = _PyLong_FromLong(%s);" % + self.wrapper.write_code(code=("py_%s = PYGLIB_PyLong_FromLong(%s);" % (self.name, self.name)), cleanup=("Py_DECREF(py_%s);" % self.name)) self.wrapper.add_pyargv_item("py_%s" % self.name) @@ -563,7 +563,7 @@ class IntPtrParam(Parameter): def convert_c2py(self): if self.props["direction"] == "inout": self.wrapper.add_declaration("PyObject *py_%s;" % self.name) - self.wrapper.write_code(code=("py_%s = _PyLong_FromLong(*%s);" % + self.wrapper.write_code(code=("py_%s = PYGLIB_PyLong_FromLong(*%s);" % (self.name, self.name)), cleanup=("Py_DECREF(py_%s);" % self.name)) self.wrapper.add_pyargv_item("py_%s" % self.name) diff --git a/gio/goutputstream.override b/gio/goutputstream.override index 04af1cab..536ecb0b 100644 --- a/gio/goutputstream.override +++ b/gio/goutputstream.override @@ -51,7 +51,7 @@ _wrap_g_output_stream_write(PyGObject *self, if (pyg_error_check(&error)) return NULL; - return _PyLong_FromLong(written); + return PYGLIB_PyLong_FromLong(written); } %% override g_output_stream_write_all kwargs @@ -85,7 +85,7 @@ _wrap_g_output_stream_write_all(PyGObject *self, if (pyg_error_check(&error)) return NULL; - return _PyLong_FromLong(written); + return PYGLIB_PyLong_FromLong(written); } %% override g_output_stream_write_async kwargs diff --git a/glib/glibmodule.c b/glib/glibmodule.c index 39aa2382..80efb38c 100644 --- a/glib/glibmodule.c +++ b/glib/glibmodule.c @@ -80,7 +80,7 @@ get_handler_priority(gint *priority, PyObject *kwargs) return -1; } - *priority = _PyLong_AsLong(val); + *priority = PYGLIB_PyLong_AsLong(val); if (PyErr_Occurred()) { PyErr_Clear(); PyErr_SetString(PyExc_ValueError, "could not get priority value"); @@ -135,7 +135,7 @@ pyglib_idle_add(PyObject *self, PyObject *args, PyObject *kwargs) handler_id = g_idle_add_full(priority, _pyglib_handler_marshal, data, _pyglib_destroy_notify); - return _PyLong_FromLong(handler_id); + return PYGLIB_PyLong_FromLong(handler_id); } @@ -175,7 +175,7 @@ pyglib_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs) handler_id = g_timeout_add_full(priority, interval, _pyglib_handler_marshal, data, _pyglib_destroy_notify); - return _PyLong_FromLong(handler_id); + return PYGLIB_PyLong_FromLong(handler_id); } static PyObject * @@ -214,7 +214,7 @@ pyglib_timeout_add_seconds(PyObject *self, PyObject *args, PyObject *kwargs) handler_id = g_timeout_add_seconds_full(priority, interval, _pyglib_handler_marshal, data, _pyglib_destroy_notify); - return _PyLong_FromLong(handler_id); + return PYGLIB_PyLong_FromLong(handler_id); } static gboolean @@ -305,7 +305,7 @@ pyglib_io_add_watch(PyObject *self, PyObject *args, PyObject *kwargs) (GDestroyNotify)_pyglib_destroy_notify); g_io_channel_unref(iochannel); - return _PyLong_FromLong(handler_id); + return PYGLIB_PyLong_FromLong(handler_id); } static PyObject * @@ -385,7 +385,7 @@ pyglib_child_watch_add(PyObject *unused, PyObject *args, PyObject *kwargs) Py_INCREF(child_data->data); id = g_child_watch_add_full(priority, pid, child_watch_func, child_data, child_watch_dnotify); - return _PyLong_FromLong(id); + return PYGLIB_PyLong_FromLong(id); } static PyObject * @@ -479,7 +479,7 @@ pyglib_get_user_special_dir(PyObject *unused, PyObject *args, PyObject *kwargs) static PyObject * pyglib_main_depth(PyObject *unused) { - return _PyLong_FromLong(g_main_depth()); + return PYGLIB_PyLong_FromLong(g_main_depth()); } static PyObject * diff --git a/glib/pygiochannel.c b/glib/pygiochannel.c index d588862e..0dea769c 100644 --- a/glib/pygiochannel.c +++ b/glib/pygiochannel.c @@ -92,7 +92,7 @@ py_io_channel_shutdown(PyGIOChannel* self, PyObject *args, PyObject *kwargs) if (pyglib_error_check(&error)) return NULL; - return _PyLong_FromLong(ret); + return PYGLIB_PyLong_FromLong(ret); } /* character encoding conversion involved functions. @@ -116,7 +116,7 @@ py_io_channel_set_buffer_size(PyGIOChannel* self, PyObject *args, PyObject *kwar static PyObject* py_io_channel_get_buffer_size(PyGIOChannel* self) { - return _PyLong_FromLong(g_io_channel_get_buffer_size(self->channel)); + return PYGLIB_PyLong_FromLong(g_io_channel_get_buffer_size(self->channel)); } static PyObject* @@ -137,7 +137,7 @@ py_io_channel_set_buffered(PyGIOChannel* self, PyObject *args, PyObject *kwargs) static PyObject* py_io_channel_get_buffered(PyGIOChannel* self) { - return _PyLong_FromLong(g_io_channel_get_buffered(self->channel)); + return PYGLIB_PyLong_FromLong(g_io_channel_get_buffered(self->channel)); } static PyObject* @@ -272,7 +272,7 @@ py_io_channel_write_chars(PyGIOChannel* self, PyObject *args, PyObject *kwargs) if (pyglib_error_check(&error)) return NULL; - return _PyLong_FromLong(count); + return PYGLIB_PyLong_FromLong(count); } static PyObject* @@ -335,7 +335,7 @@ py_io_channel_flush(PyGIOChannel* self) if (pyglib_error_check(&error)) return NULL; - return _PyLong_FromLong(status); + return PYGLIB_PyLong_FromLong(status); } static PyObject* @@ -354,19 +354,19 @@ py_io_channel_set_flags(PyGIOChannel* self, PyObject *args, PyObject *kwargs) if (pyglib_error_check(&error)) return NULL; - return _PyLong_FromLong(status); + return PYGLIB_PyLong_FromLong(status); } static PyObject* py_io_channel_get_flags(PyGIOChannel* self) { - return _PyLong_FromLong(g_io_channel_get_flags(self->channel)); + return PYGLIB_PyLong_FromLong(g_io_channel_get_flags(self->channel)); } static PyObject* py_io_channel_get_buffer_condition(PyGIOChannel* self) { - return _PyLong_FromLong(g_io_channel_get_buffer_condition(self->channel)); + return PYGLIB_PyLong_FromLong(g_io_channel_get_buffer_condition(self->channel)); } static PyObject* @@ -517,7 +517,7 @@ py_io_channel_win32_poll(PyObject *self, PyObject *args, PyObject *kwargs) pyfd = PyList_GET_ITEM(pyfds, i); ((PyGPollFD *) pyfd)->pollfd = pollfd[i]; } - return _PyLong_FromLong(result); + return PYGLIB_PyLong_FromLong(result); } static PyObject * @@ -631,7 +631,7 @@ py_io_channel_seek(PyGIOChannel* self, PyObject *args, PyObject *kwargs) if (pyglib_error_check(&error)) return NULL; - return _PyLong_FromLong(status); + return PYGLIB_PyLong_FromLong(status); } #if 0 // Not wrapped diff --git a/glib/pyglib-python-compat.h b/glib/pyglib-python-compat.h index 62c441e1..8fc28e4f 100644 --- a/glib/pyglib-python-compat.h +++ b/glib/pyglib-python-compat.h @@ -101,12 +101,12 @@ static int _pyglib_init_##modname(PyObject *module) #define PYGLIB_PyBytes_Size PyString_Size #define PYGLIB_PyBytes_Check PyString_Check -#define _PyLong_Check PyInt_Check -#define _PyLong_FromLong PyInt_FromLong -#define _PyLong_AsLong PyInt_AsLong -#define _PyLongObject PyIntObject -#define _PyLong_Type PyInt_Type -#define _PyLong_AS_LONG PyInt_AS_LONG +#define PYGLIB_PyLong_Check PyInt_Check +#define PYGLIB_PyLong_FromLong PyInt_FromLong +#define PYGLIB_PyLong_AsLong PyInt_AsLong +#define PYGLIB_PyLongObject PyIntObject +#define PYGLIB_PyLong_Type PyInt_Type +#define PYGLIB_PyLong_AS_LONG PyInt_AS_LONG #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #ifndef PyVarObject_HEAD_INIT @@ -183,12 +183,12 @@ PyTypeObject symbol = { \ #define PYGLIB_PyUnicode_GET_SIZE PyUnicode_GET_SIZE #define PYGLIB_PyUnicode_Resize PyUnicode_Resize #define PYGLIB_PyUnicode_Type PyUnicode_Type -#define _PyLong_Check PyLong_Check -#define _PyLong_FromLong PyLong_FromLong -#define _PyLong_AsLong PyLong_AsLong -#define _PyLong_AS_LONG(o) PyLong_AS_LONG((PyObject*)(o)) -#define _PyLongObject PyLongObject -#define _PyLong_Type PyLong_Type +#define PYGLIB_PyLong_Check PyLong_Check +#define PYGLIB_PyLong_FromLong PyLong_FromLong +#define PYGLIB_PyLong_AsLong PyLong_AsLong +#define PYGLIB_PyLong_AS_LONG(o) PyLong_AS_LONG((PyObject*)(o)) +#define PYGLIB_PyLongObject PyLongObject +#define PYGLIB_PyLong_Type PyLong_Type #define PYGLIB_PyBytes_FromStringAndSize PyBytes_FromStringAndSize #define PYGLIB_PyBytes_Resize(o, len) _PyBytes_Resize(o, len) diff --git a/glib/pyglib.c b/glib/pyglib.c index 6b8ded21..48e0fc13 100644 --- a/glib/pyglib.c +++ b/glib/pyglib.c @@ -264,7 +264,7 @@ pyglib_error_check(GError **error) if (exception_table != NULL) { PyObject *item; - item = PyDict_GetItem(exception_table, _PyLong_FromLong((*error)->domain)); + item = PyDict_GetItem(exception_table, PYGLIB_PyLong_FromLong((*error)->domain)); if (item != NULL) exc_type = item; } @@ -280,7 +280,7 @@ pyglib_error_check(GError **error) PyObject_SetAttrString(exc_instance, "domain", Py_None); PyObject_SetAttrString(exc_instance, "code", - d=_PyLong_FromLong((*error)->code)); + d=PYGLIB_PyLong_FromLong((*error)->code)); Py_DECREF(d); if ((*error)->message) { @@ -351,7 +351,7 @@ pyglib_gerror_exception_check(GError **error) } py_code = PyObject_GetAttrString(value, "code"); - if (!py_code || !_PyLong_Check(py_code)) { + if (!py_code || !PYGLIB_PyLong_Check(py_code)) { bad_gerror_message = "glib.GError instances must have a 'code' int attribute"; Py_DECREF(py_message); Py_DECREF(py_domain); @@ -359,7 +359,7 @@ pyglib_gerror_exception_check(GError **error) } g_set_error(error, g_quark_from_string(PYGLIB_PyUnicode_AsString(py_domain)), - _PyLong_AsLong(py_code), PYGLIB_PyUnicode_AsString(py_message)); + PYGLIB_PyLong_AsLong(py_code), PYGLIB_PyUnicode_AsString(py_message)); Py_DECREF(py_message); Py_DECREF(py_code); @@ -397,7 +397,7 @@ pyglib_register_exception_for_domain(gchar *name, exception_table = PyDict_New(); PyDict_SetItem(exception_table, - _PyLong_FromLong(error_domain), + PYGLIB_PyLong_FromLong(error_domain), exception); return exception; diff --git a/glib/pygsource.c b/glib/pygsource.c index 5dabd3c2..77bf1cf0 100644 --- a/glib/pygsource.c +++ b/glib/pygsource.c @@ -109,7 +109,7 @@ pyg_source_attach(PyGSource *self, PyObject *args, PyObject *kwargs) } id = g_source_attach(self->source, context); - return _PyLong_FromLong(id); + return PYGLIB_PyLong_FromLong(id); } static PyObject * @@ -283,7 +283,7 @@ pyg_source_get_priority(PyGSource *self, void *closure) { CHECK_DESTROYED(self, NULL); - return _PyLong_FromLong(g_source_get_priority(self->source)); + return PYGLIB_PyLong_FromLong(g_source_get_priority(self->source)); } static int @@ -296,12 +296,12 @@ pyg_source_set_priority(PyGSource *self, PyObject *value, void *closure) return -1; } - if (!_PyLong_Check(value)) { + if (!PYGLIB_PyLong_Check(value)) { PyErr_SetString(PyExc_TypeError, "type mismatch"); return -1; } - g_source_set_priority(self->source, _PyLong_AsLong(value)); + g_source_set_priority(self->source, PYGLIB_PyLong_AsLong(value)); return 0; } @@ -339,7 +339,7 @@ pyg_source_get_id(PyGSource *self, void *closure) return NULL; } - return _PyLong_FromLong(g_source_get_id(self->source)); + return PYGLIB_PyLong_FromLong(g_source_get_id(self->source)); } static PyGetSetDef pyg_source_getsets[] = { @@ -426,7 +426,7 @@ pyg_source_prepare(GSource *source, gint *timeout) } ret = PyObject_IsTrue(PyTuple_GET_ITEM(t, 0)); - *timeout = _PyLong_AsLong(PyTuple_GET_ITEM(t, 1)); + *timeout = PYGLIB_PyLong_AsLong(PyTuple_GET_ITEM(t, 1)); if (*timeout == -1 && PyErr_Occurred()) { ret = FALSE; diff --git a/glib/pygspawn.c b/glib/pygspawn.c index 4483e07c..1bb7e137 100644 --- a/glib/pygspawn.c +++ b/glib/pygspawn.c @@ -32,12 +32,12 @@ struct _PyGChildSetupData { PyObject *data; }; -PYGLIB_DEFINE_TYPE("glib.Pid", PyGPid_Type, _PyLongObject) +PYGLIB_DEFINE_TYPE("glib.Pid", PyGPid_Type, PYGLIB_PyLongObject) static PyObject * pyg_pid_close(PyObject *self, PyObject *args, PyObject *kwargs) { - g_spawn_close_pid(_PyLong_AsLong(self)); + g_spawn_close_pid(PYGLIB_PyLong_AsLong(self)); Py_INCREF(Py_None); return Py_None; } @@ -50,8 +50,8 @@ static PyMethodDef pyg_pid_methods[] = { static void pyg_pid_free(PyObject *gpid) { - g_spawn_close_pid((GPid) _PyLong_AsLong(gpid)); - _PyLong_Type.tp_free((void *) gpid); + g_spawn_close_pid((GPid) PYGLIB_PyLong_AsLong(gpid)); + PYGLIB_PyLong_Type.tp_free((void *) gpid); } static int @@ -68,9 +68,9 @@ pyg_pid_new(GPid pid) return PyObject_CallMethod((PyObject*)&PyLong_Type, "__new__", "Oi", &PyGPid_Type, pid); #else - _PyLongObject *pygpid; + PYGLIB_PyLongObject *pygpid; - pygpid = PyObject_NEW(_PyLongObject, &PyGPid_Type); + pygpid = PyObject_NEW(PYGLIB_PyLongObject, &PyGPid_Type); pygpid->ob_ival = pid; return (PyObject *) pygpid; #endif @@ -229,21 +229,21 @@ pyglib_spawn_async(PyObject *object, PyObject *args, PyObject *kwargs) if (envp) g_free(envp); if (standard_input) - pystdin = _PyLong_FromLong(*standard_input); + pystdin = PYGLIB_PyLong_FromLong(*standard_input); else { Py_INCREF(Py_None); pystdin = Py_None; } if (standard_output) - pystdout = _PyLong_FromLong(*standard_output); + pystdout = PYGLIB_PyLong_FromLong(*standard_output); else { Py_INCREF(Py_None); pystdout = Py_None; } if (standard_error) - pystderr = _PyLong_FromLong(*standard_error); + pystderr = PYGLIB_PyLong_FromLong(*standard_error); else { Py_INCREF(Py_None); pystderr = Py_None; diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index e7cea4e0..63d2ca5b 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -788,7 +788,7 @@ pyg_param_spec_from_object (PyObject *tuple) } item = PyTuple_GetItem(tuple, val_length-1); - if (!_PyLong_Check(item)) { + if (!PYGLIB_PyLong_Check(item)) { PyErr_SetString(PyExc_TypeError, "last element in tuple must be an int"); return NULL; @@ -798,7 +798,7 @@ pyg_param_spec_from_object (PyObject *tuple) slice = PySequence_GetSlice(tuple, 4, val_length-1); pspec = create_property(prop_name, prop_type, nick, blurb, slice, - _PyLong_AsLong(item)); + PYGLIB_PyLong_AsLong(item)); return pspec; } @@ -862,13 +862,13 @@ add_properties (GType instance_type, PyObject *properties) break; } item = PyTuple_GetItem(value, val_length-1); - if (!_PyLong_Check(item)) { + if (!PYGLIB_PyLong_Check(item)) { PyErr_SetString(PyExc_TypeError, "last element in __gproperties__ value tuple must be an int"); ret = FALSE; break; } - flags = _PyLong_AsLong(item); + flags = PYGLIB_PyLong_AsLong(item); /* slice is the extra items in the tuple */ slice = PySequence_GetSlice(value, 3, val_length-1); @@ -1376,7 +1376,7 @@ pyg_signal_new(PyObject *self, PyObject *args) return_type, n_params, param_types); g_free(param_types); if (signal_id != 0) - return _PyLong_FromLong(signal_id); + return PYGLIB_PyLong_FromLong(signal_id); PyErr_SetString(PyExc_RuntimeError, "could not create signal"); return NULL; } @@ -1477,7 +1477,7 @@ pyg_signal_list_ids (PyObject *self, PyObject *args, PyObject *kwargs) } for (i = 0; i < n; i++) - PyTuple_SetItem(list, i, _PyLong_FromLong(ids[i])); + PyTuple_SetItem(list, i, PYGLIB_PyLong_FromLong(ids[i])); g_free(ids); if (class) g_type_class_unref(class); @@ -1525,7 +1525,7 @@ pyg_signal_lookup (PyObject *self, PyObject *args, PyObject *kwargs) g_type_class_unref(class); else g_type_default_interface_unref(iface); - return _PyLong_FromLong(id); + return PYGLIB_PyLong_FromLong(id); } static PyObject * @@ -1613,10 +1613,10 @@ pyg_signal_query (PyObject *self, PyObject *args, PyObject *kwargs) goto done; } - PyTuple_SET_ITEM(py_query, 0, _PyLong_FromLong(query.signal_id)); + PyTuple_SET_ITEM(py_query, 0, PYGLIB_PyLong_FromLong(query.signal_id)); PyTuple_SET_ITEM(py_query, 1, PYGLIB_PyUnicode_FromString(query.signal_name)); PyTuple_SET_ITEM(py_query, 2, pyg_type_wrapper_new(query.itype)); - PyTuple_SET_ITEM(py_query, 3, _PyLong_FromLong(query.signal_flags)); + PyTuple_SET_ITEM(py_query, 3, PYGLIB_PyLong_FromLong(query.signal_flags)); PyTuple_SET_ITEM(py_query, 4, pyg_type_wrapper_new(query.return_type)); for (i = 0; i < query.n_params; i++) { PyTuple_SET_ITEM(params_list, i, @@ -2361,12 +2361,12 @@ pyg_integer_richcompare(PyObject *v, PyObject *w, int op) gboolean t; switch (op) { - case Py_EQ: t = _PyLong_AS_LONG(v) == _PyLong_AS_LONG(w); break; - case Py_NE: t = _PyLong_AS_LONG(v) != _PyLong_AS_LONG(w); break; - case Py_LE: t = _PyLong_AS_LONG(v) <= _PyLong_AS_LONG(w); break; - case Py_GE: t = _PyLong_AS_LONG(v) >= _PyLong_AS_LONG(w); break; - case Py_LT: t = _PyLong_AS_LONG(v) < _PyLong_AS_LONG(w); break; - case Py_GT: t = _PyLong_AS_LONG(v) > _PyLong_AS_LONG(w); break; + case Py_EQ: t = PYGLIB_PyLong_AS_LONG(v) == PYGLIB_PyLong_AS_LONG(w); break; + case Py_NE: t = PYGLIB_PyLong_AS_LONG(v) != PYGLIB_PyLong_AS_LONG(w); break; + case Py_LE: t = PYGLIB_PyLong_AS_LONG(v) <= PYGLIB_PyLong_AS_LONG(w); break; + case Py_GE: t = PYGLIB_PyLong_AS_LONG(v) >= PYGLIB_PyLong_AS_LONG(w); break; + case Py_LT: t = PYGLIB_PyLong_AS_LONG(v) < PYGLIB_PyLong_AS_LONG(w); break; + case Py_GT: t = PYGLIB_PyLong_AS_LONG(v) > PYGLIB_PyLong_AS_LONG(w); break; default: g_assert_not_reached(); } diff --git a/gobject/pygenum.c b/gobject/pygenum.c index c8c14fbc..c47b9536 100644 --- a/gobject/pygenum.c +++ b/gobject/pygenum.c @@ -44,7 +44,7 @@ pyg_enum_val_new(PyObject* subclass, GType gtype, PyObject *intval) subclass, intval); #else item = ((PyTypeObject *)stub)->tp_alloc((PyTypeObject *)subclass, 0); - ((_PyLongObject*)item)->ob_ival = PyInt_AS_LONG(intval); + ((PyLongObject*)item)->ob_ival = PyInt_AS_LONG(intval); #endif ((PyGEnum*)item)->gtype = gtype; @@ -56,7 +56,7 @@ pyg_enum_richcompare(PyGEnum *self, PyObject *other, int op) { static char warning[256]; - if (!_PyLong_Check(other)) { + if (!PYGLIB_PyLong_Check(other)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } @@ -83,13 +83,13 @@ pyg_enum_repr(PyGEnum *self) g_assert(G_IS_ENUM_CLASS(enum_class)); for (index = 0; index < enum_class->n_values; index++) - if (_PyLong_AS_LONG(self) == enum_class->values[index].value) + if (PYGLIB_PyLong_AS_LONG(self) == enum_class->values[index].value) break; value = enum_class->values[index].value_name; if (value) sprintf(tmp, "<enum %s of type %s>", value, g_type_name(self->gtype)); else - sprintf(tmp, "<enum %ld of type %s>", _PyLong_AS_LONG(self), g_type_name(self->gtype)); + sprintf(tmp, "<enum %ld of type %s>", PYGLIB_PyLong_AS_LONG(self), g_type_name(self->gtype)); g_type_class_unref(enum_class); @@ -151,7 +151,7 @@ pyg_enum_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) g_type_class_unref(eclass); - intvalue = _PyLong_FromLong(value); + intvalue = PYGLIB_PyLong_FromLong(value); ret = PyDict_GetItem(values, intvalue); Py_DECREF(intvalue); Py_DECREF(values); @@ -181,11 +181,11 @@ pyg_enum_from_gtype (GType gtype, int value) if (!pyclass) pyclass = pyg_enum_add(NULL, g_type_name(gtype), NULL, gtype); if (!pyclass) - return _PyLong_FromLong(value); + return PYGLIB_PyLong_FromLong(value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__enum_values__"); - intvalue = _PyLong_FromLong(value); + intvalue = PYGLIB_PyLong_FromLong(value); retval = PyDict_GetItem(values, intvalue); if (retval) { Py_INCREF(retval); @@ -258,7 +258,7 @@ pyg_enum_add (PyObject * module, for (i = 0; i < eclass->n_values; i++) { PyObject *item, *intval; - intval = _PyLong_FromLong(eclass->values[i].value); + intval = PYGLIB_PyLong_FromLong(eclass->values[i].value); item = pyg_enum_val_new(stub, gtype, intval); PyDict_SetItem(values, intval, item); Py_DECREF(intval); @@ -290,7 +290,7 @@ pyg_enum_reduce(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, ":GEnum.__reduce__")) return NULL; - return Py_BuildValue("(O(i)O)", Py_TYPE(self), _PyLong_AsLong(self), + return Py_BuildValue("(O(i)O)", Py_TYPE(self), PYGLIB_PyLong_AsLong(self), PyObject_GetAttrString(self, "__dict__")); } @@ -304,7 +304,7 @@ pyg_enum_get_value_name(PyGEnum *self, void *closure) enum_class = g_type_class_ref(self->gtype); g_assert(G_IS_ENUM_CLASS(enum_class)); - enum_value = g_enum_get_value(enum_class, _PyLong_AS_LONG(self)); + enum_value = g_enum_get_value(enum_class, PYGLIB_PyLong_AS_LONG(self)); retval = PYGLIB_PyUnicode_FromString(enum_value->value_name); g_type_class_unref(enum_class); @@ -322,7 +322,7 @@ pyg_enum_get_value_nick(PyGEnum *self, void *closure) enum_class = g_type_class_ref(self->gtype); g_assert(G_IS_ENUM_CLASS(enum_class)); - enum_value = g_enum_get_value(enum_class, _PyLong_AS_LONG(self)); + enum_value = g_enum_get_value(enum_class, PYGLIB_PyLong_AS_LONG(self)); retval = PYGLIB_PyUnicode_FromString(enum_value->value_nick); g_type_class_unref(enum_class); @@ -352,7 +352,7 @@ pygobject_enum_register_types(PyObject *d) PyGEnum_Type.tp_new = pyg_enum_new; #else PyGEnum_Type.tp_base = &PyLong_Type; - PyGEnum_Type.tp_new = _PyLong_Type.tp_new; + PyGEnum_Type.tp_new = PyLong_Type.tp_new; #endif PyGEnum_Type.tp_repr = (reprfunc)pyg_enum_repr; diff --git a/gobject/pygflags.c b/gobject/pygflags.c index 3be5583c..ab553373 100644 --- a/gobject/pygflags.c +++ b/gobject/pygflags.c @@ -45,7 +45,7 @@ pyg_flags_val_new(PyObject* subclass, GType gtype, PyObject *intval) subclass, intval); #else item = ((PyTypeObject *)stub)->tp_alloc((PyTypeObject *)subclass, 0); - ((_PyLongObject*)item)->ob_ival = PyInt_AS_LONG(intval); + ((PyLongObject*)item)->ob_ival = PyInt_AS_LONG(intval); #endif ((PyGFlags*)item)->gtype = gtype; @@ -57,7 +57,7 @@ pyg_flags_richcompare(PyGFlags *self, PyObject *other, int op) { static char warning[256]; - if (!_PyLong_Check(other)) { + if (!PYGLIB_PyLong_Check(other)) { Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } @@ -111,13 +111,13 @@ pyg_flags_repr(PyGFlags *self) char *tmp, *retval; PyObject *pyretval; - tmp = generate_repr(self->gtype, _PyLong_AS_LONG(self)); + tmp = generate_repr(self->gtype, PYGLIB_PyLong_AS_LONG(self)); if (tmp) retval = g_strdup_printf("<flags %s of type %s>", tmp, g_type_name(self->gtype)); else - retval = g_strdup_printf("<flags %ld of type %s>", _PyLong_AS_LONG(self), + retval = g_strdup_printf("<flags %ld of type %s>", PYGLIB_PyLong_AS_LONG(self), g_type_name(self->gtype)); g_free(tmp); @@ -170,7 +170,7 @@ pyg_flags_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) g_type_class_unref(eclass); - pyint = _PyLong_FromLong(value); + pyint = PYGLIB_PyLong_FromLong(value); ret = PyDict_GetItem(values, pyint); Py_DECREF(pyint); Py_DECREF(values); @@ -200,11 +200,11 @@ pyg_flags_from_gtype (GType gtype, int value) if (!pyclass) pyclass = pyg_flags_add(NULL, g_type_name(gtype), NULL, gtype); if (!pyclass) - return _PyLong_FromLong(value); + return PYGLIB_PyLong_FromLong(value); values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict, "__flags_values__"); - pyint = _PyLong_FromLong(value); + pyint = PYGLIB_PyLong_FromLong(value); retval = PyDict_GetItem(values, pyint); if (!retval) { PyErr_Clear(); @@ -275,7 +275,7 @@ pyg_flags_add (PyObject * module, for (i = 0; i < eclass->n_values; i++) { PyObject *item, *intval; - intval = _PyLong_FromLong(eclass->values[i].value); + intval = PYGLIB_PyLong_FromLong(eclass->values[i].value); item = pyg_flags_val_new(stub, gtype, intval); PyDict_SetItem(values, intval, item); Py_DECREF(intval); @@ -306,32 +306,32 @@ static PyObject * pyg_flags_and(PyGFlags *a, PyGFlags *b) { if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) - return _PyLong_Type.tp_as_number->nb_and((PyObject*)a, + return PYGLIB_PyLong_Type.tp_as_number->nb_and((PyObject*)a, (PyObject*)b); return pyg_flags_from_gtype(a->gtype, - _PyLong_AS_LONG(a) & _PyLong_AS_LONG(b)); + PYGLIB_PyLong_AS_LONG(a) & PYGLIB_PyLong_AS_LONG(b)); } static PyObject * pyg_flags_or(PyGFlags *a, PyGFlags *b) { if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) - return _PyLong_Type.tp_as_number->nb_or((PyObject*)a, + return PYGLIB_PyLong_Type.tp_as_number->nb_or((PyObject*)a, (PyObject*)b); - return pyg_flags_from_gtype(a->gtype, _PyLong_AS_LONG(a) | _PyLong_AS_LONG(b)); + return pyg_flags_from_gtype(a->gtype, PYGLIB_PyLong_AS_LONG(a) | PYGLIB_PyLong_AS_LONG(b)); } static PyObject * pyg_flags_xor(PyGFlags *a, PyGFlags *b) { if (!PyGFlags_Check(a) || !PyGFlags_Check(b)) - return _PyLong_Type.tp_as_number->nb_xor((PyObject*)a, + return PYGLIB_PyLong_Type.tp_as_number->nb_xor((PyObject*)a, (PyObject*)b); return pyg_flags_from_gtype(a->gtype, - _PyLong_AS_LONG(a) ^ _PyLong_AS_LONG(b)); + PYGLIB_PyLong_AS_LONG(a) ^ PYGLIB_PyLong_AS_LONG(b)); } @@ -354,7 +354,7 @@ pyg_flags_get_first_value_name(PyGFlags *self, void *closure) flags_class = g_type_class_ref(self->gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); - flags_value = g_flags_get_first_value(flags_class, _PyLong_AS_LONG(self)); + flags_value = g_flags_get_first_value(flags_class, PYGLIB_PyLong_AS_LONG(self)); if (flags_value) retval = PYGLIB_PyUnicode_FromString(flags_value->value_name); else { @@ -376,7 +376,7 @@ pyg_flags_get_first_value_nick(PyGFlags *self, void *closure) flags_class = g_type_class_ref(self->gtype); g_assert(G_IS_FLAGS_CLASS(flags_class)); - flags_value = g_flags_get_first_value(flags_class, _PyLong_AS_LONG(self)); + flags_value = g_flags_get_first_value(flags_class, PYGLIB_PyLong_AS_LONG(self)); if (flags_value) retval = PYGLIB_PyUnicode_FromString(flags_value->value_nick); else { @@ -400,7 +400,7 @@ pyg_flags_get_value_names(PyGFlags *self, void *closure) retval = PyList_New(0); for (i = 0; i < flags_class->n_values; i++) - if ((_PyLong_AS_LONG(self) & flags_class->values[i].value) == flags_class->values[i].value) + if ((PYGLIB_PyLong_AS_LONG(self) & flags_class->values[i].value) == flags_class->values[i].value) PyList_Append(retval, PYGLIB_PyUnicode_FromString(flags_class->values[i].value_name)); g_type_class_unref(flags_class); @@ -420,7 +420,7 @@ pyg_flags_get_value_nicks(PyGFlags *self, void *closure) retval = PyList_New(0); for (i = 0; i < flags_class->n_values; i++) - if ((_PyLong_AS_LONG(self) & flags_class->values[i].value) == flags_class->values[i].value) + if ((PYGLIB_PyLong_AS_LONG(self) & flags_class->values[i].value) == flags_class->values[i].value) PyList_Append(retval, PYGLIB_PyUnicode_FromString(flags_class->values[i].value_nick)); g_type_class_unref(flags_class); @@ -466,10 +466,10 @@ pygobject_flags_register_types(PyObject *d) PyGFlags_Type.tp_new = pyg_enum_new; #else PyGFlags_Type.tp_base = &PyLong_Type; - PyGFlags_Type.tp_new = _PyLong_Type.tp_new; + PyGFlags_Type.tp_new = PyLong_Type.tp_new; #endif - PyGFlags_Type.tp_base = &_PyLong_Type; + PyGFlags_Type.tp_base = &PYGLIB_PyLong_Type; PyGFlags_Type.tp_repr = (reprfunc)pyg_flags_repr; PyGFlags_Type.tp_as_number = &pyg_flags_as_number; PyGFlags_Type.tp_str = (reprfunc)pyg_flags_repr; diff --git a/gobject/pygobject-private.h b/gobject/pygobject-private.h index 2a09eed4..d1b8f249 100644 --- a/gobject/pygobject-private.h +++ b/gobject/pygobject-private.h @@ -175,7 +175,7 @@ const gchar * pyg_constant_strip_prefix(const gchar *name, const gchar *strip_pr /* pygflags */ typedef struct { - _PyLongObject parent; + PYGLIB_PyLongObject parent; GType gtype; } PyGFlags; @@ -194,7 +194,7 @@ extern PyObject * pyg_flags_from_gtype (GType gtype, #define PyGEnum_Check(x) (g_type_is_a(((PyGFlags*)x)->gtype, G_TYPE_ENUM)) typedef struct { - _PyLongObject parent; + PYGLIB_PyLongObject parent; GType gtype; } PyGEnum; diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 590bdbdf..5ecc1ff0 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -1963,7 +1963,7 @@ pygobject_disconnect_by_func(PyGObject *self, PyObject *args) 0, 0, closure, NULL, NULL); - return _PyLong_FromLong(retval); + return PYGLIB_PyLong_FromLong(retval); } static PyObject * @@ -1998,7 +1998,7 @@ pygobject_handler_block_by_func(PyGObject *self, PyObject *args) 0, 0, closure, NULL, NULL); - return _PyLong_FromLong(retval); + return PYGLIB_PyLong_FromLong(retval); } static PyObject * @@ -2033,7 +2033,7 @@ pygobject_handler_unblock_by_func(PyGObject *self, PyObject *args) 0, 0, closure, NULL, NULL); - return _PyLong_FromLong(retval); + return PYGLIB_PyLong_FromLong(retval); } static PyMethodDef pygobject_methods[] = { @@ -2088,7 +2088,7 @@ pygobject_get_dict(PyGObject *self, void *closure) static PyObject * pygobject_get_refcount(PyGObject *self, void *closure) { - return _PyLong_FromLong(self->obj->ref_count); + return PYGLIB_PyLong_FromLong(self->obj->ref_count); } static int diff --git a/gobject/pygparamspec.c b/gobject/pygparamspec.c index 5a43b225..b449c308 100644 --- a/gobject/pygparamspec.c +++ b/gobject/pygparamspec.c @@ -126,7 +126,7 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) } else if (!strcmp(attr, "blurb") || !strcmp(attr, "__doc__")) { return Py_BuildValue("s", g_param_spec_get_blurb(pspec)); } else if (!strcmp(attr, "flags")) { - return _PyLong_FromLong(pspec->flags); + return PYGLIB_PyLong_FromLong(pspec->flags); } else if (!strcmp(attr, "value_type")) { return pyg_type_wrapper_new(pspec->value_type); } else if (!strcmp(attr, "owner_type")) { @@ -143,9 +143,9 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) return PYGLIB_PyUnicode_FromFormat( "%c", G_PARAM_SPEC_CHAR(pspec)->default_value); } else if (!strcmp(attr, "minimum")) { - return _PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->minimum); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->minimum); } else if (!strcmp(attr, "maximum")) { - return _PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->maximum); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_CHAR(pspec)->maximum); } } else if (G_IS_PARAM_SPEC_UCHAR(pspec)) { if (!strcmp(attr, "__members__")) { @@ -158,9 +158,9 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) return PYGLIB_PyUnicode_FromFormat( "%c", G_PARAM_SPEC_UCHAR(pspec)->default_value); } else if (!strcmp(attr, "minimum")) { - return _PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->minimum); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->minimum); } else if (!strcmp(attr, "maximum")) { - return _PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->maximum); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_UCHAR(pspec)->maximum); } } else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) { if (!strcmp(attr, "__members__")) { @@ -178,11 +178,11 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) "flags", "maximum", "minimum", "name", "nick", "owner_type", "value_type"); } else if (!strcmp(attr, "default_value")) { - return _PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->default_value); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->default_value); } else if (!strcmp(attr, "minimum")) { - return _PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->minimum); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->minimum); } else if (!strcmp(attr, "maximum")) { - return _PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->maximum); + return PYGLIB_PyLong_FromLong(G_PARAM_SPEC_INT(pspec)->maximum); } } else if (G_IS_PARAM_SPEC_UINT(pspec)) { if (!strcmp(attr, "__members__")) { diff --git a/gobject/pygtype.c b/gobject/pygtype.c index 868f2736..924e8e54 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -191,7 +191,7 @@ _wrap_g_type_wrapper__get_interfaces(PyGTypeWrapper *self, void *closure) static PyObject * _wrap_g_type_wrapper__get_depth(PyGTypeWrapper *self, void *closure) { - return _PyLong_FromLong(g_type_depth(self->type)); + return PYGLIB_PyLong_FromLong(g_type_depth(self->type)); } static PyGetSetDef _PyGTypeWrapper_getsets[] = { @@ -375,7 +375,7 @@ pyg_type_from_object(PyObject *obj) if (PyType_Check(obj)) { PyTypeObject *tp = (PyTypeObject *)obj; - if (tp == &_PyLong_Type) + if (tp == &PYGLIB_PyLong_Type) return G_TYPE_INT; else if (tp == &PyBool_Type) return G_TYPE_BOOLEAN; @@ -445,8 +445,8 @@ pyg_enum_get_value(GType enum_type, PyObject *obj, gint *val) if (!obj) { *val = 0; res = 0; - } else if (_PyLong_Check(obj)) { - *val = _PyLong_AsLong(obj); + } else if (PYGLIB_PyLong_Check(obj)) { + *val = PYGLIB_PyLong_AsLong(obj); res = 0; if (PyObject_TypeCheck(obj, &PyGEnum_Type) && ((PyGEnum *) obj)->gtype != enum_type) { @@ -518,8 +518,8 @@ pyg_flags_get_value(GType flag_type, PyObject *obj, gint *val) if (!obj) { *val = 0; res = 0; - } else if (_PyLong_Check(obj)) { - *val = _PyLong_AsLong(obj); + } else if (PYGLIB_PyLong_Check(obj)) { + *val = PYGLIB_PyLong_AsLong(obj); res = 0; } else if (PyLong_Check(obj)) { *val = PyLong_AsLongLong(obj); @@ -745,11 +745,11 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) Py_DECREF(tmp); break; case G_TYPE_UCHAR: - if (_PyLong_Check(obj)) { + if (PYGLIB_PyLong_Check(obj)) { glong val; - val = _PyLong_AsLong(obj); + val = PYGLIB_PyLong_AsLong(obj); if (val >= 0 && val <= 255) - g_value_set_uchar(value, (guchar)_PyLong_AsLong (obj)); + g_value_set_uchar(value, (guchar)PYGLIB_PyLong_AsLong (obj)); else return -1; } else if ((tmp = PyObject_Str(obj))) { @@ -764,14 +764,14 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) g_value_set_boolean(value, PyObject_IsTrue(obj)); break; case G_TYPE_INT: - g_value_set_int(value, _PyLong_AsLong(obj)); + g_value_set_int(value, PYGLIB_PyLong_AsLong(obj)); break; case G_TYPE_UINT: { - if (_PyLong_Check(obj)) { + if (PYGLIB_PyLong_Check(obj)) { glong val; - val = _PyLong_AsLong(obj); + val = PYGLIB_PyLong_AsLong(obj); if (val >= 0 && val <= G_MAXUINT) g_value_set_uint(value, (guint)val); else @@ -782,7 +782,7 @@ pyg_value_from_pyobject(GValue *value, PyObject *obj) } break; case G_TYPE_LONG: - g_value_set_long(value, _PyLong_AsLong(obj)); + g_value_set_long(value, PYGLIB_PyLong_AsLong(obj)); break; case G_TYPE_ULONG: g_value_set_ulong(value, PyLong_AsUnsignedLong(obj)); @@ -966,7 +966,7 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) return PyBool_FromLong(g_value_get_boolean(value)); } case G_TYPE_INT: - return _PyLong_FromLong(g_value_get_int(value)); + return PYGLIB_PyLong_FromLong(g_value_get_int(value)); case G_TYPE_UINT: { /* in Python, the Int object is backed by a long. If a @@ -974,19 +974,19 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) an Int. Otherwise, use a Long object to avoid overflow. This matches the ULongArg behavior in codegen/argtypes.h */ #if (G_MAXUINT <= G_MAXLONG) - return _PyLong_FromLong((glong) g_value_get_uint(value)); + return PYGLIB_PyLong_FromLong((glong) g_value_get_uint(value)); #else return PyLong_FromUnsignedLong((gulong) g_value_get_uint(value)); #endif } case G_TYPE_LONG: - return _PyLong_FromLong(g_value_get_long(value)); + return PYGLIB_PyLong_FromLong(g_value_get_long(value)); case G_TYPE_ULONG: { gulong val = g_value_get_ulong(value); if (val <= G_MAXLONG) - return _PyLong_FromLong((glong) val); + return PYGLIB_PyLong_FromLong((glong) val); else return PyLong_FromUnsignedLong(val); } @@ -995,7 +995,7 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) gint64 val = g_value_get_int64(value); if (G_MINLONG <= val && val <= G_MAXLONG) - return _PyLong_FromLong((glong) val); + return PYGLIB_PyLong_FromLong((glong) val); else return PyLong_FromLongLong(val); } @@ -1004,7 +1004,7 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) guint64 val = g_value_get_uint64(value); if (val <= G_MAXLONG) - return _PyLong_FromLong((glong) val); + return PYGLIB_PyLong_FromLong((glong) val); else return PyLong_FromUnsignedLongLong(val); } diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index c6fd9f53..26d3cbe2 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -82,7 +82,7 @@ _wrap_test_g_object_new (PyObject * self) PyObject *rv; obj = g_object_new(g_type_from_name("PyGObject"), NULL); - rv = _PyLong_FromLong(obj->ref_count); /* should be == 2 at this point */ + rv = PYGLIB_PyLong_FromLong(obj->ref_count); /* should be == 2 at this point */ g_object_unref(obj); return rv; } |