summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2010-04-12 23:51:24 -0400
committerJohn Ehresman <jpe@wingware.com>2010-04-15 12:13:35 -0400
commit97a35ad4bf0623636459735e119d1b0fe0ede5ff (patch)
treeab8db69290c067933da2064b501577073825e94b
parentf6f2ed44c84aff3c38fc3eb5961b28621a14fc51 (diff)
downloadpygobject-97a35ad4bf0623636459735e119d1b0fe0ede5ff.tar.gz
pygobject-97a35ad4bf0623636459735e119d1b0fe0ede5ff.tar.xz
pygobject-97a35ad4bf0623636459735e119d1b0fe0ede5ff.zip
Remove remaining PyInt & PyString calls
-rw-r--r--gio/pygio-utils.c10
-rw-r--r--glib/glibmodule.c12
-rw-r--r--gobject/gobjectmodule.c6
-rw-r--r--gobject/pygobject.c10
-rw-r--r--tests/testhelpermodule.c2
5 files changed, 20 insertions, 20 deletions
diff --git a/gio/pygio-utils.c b/gio/pygio-utils.c
index be41453..f51040c 100644
--- a/gio/pygio-utils.c
+++ b/gio/pygio-utils.c
@@ -116,13 +116,13 @@ pygio_pylist_to_uri_glist(PyObject *pyfile_list)
len = PySequence_Size(pyfile_list);
for (i = 0; i < len; i++) {
item = PySequence_GetItem(pyfile_list, i);
- if (!PyString_Check(item)) {
+ if (!_PyUnicode_Check(item)) {
PyErr_SetString(PyExc_TypeError,
"files must be strings");
g_list_free(file_list);
return NULL;
}
- file_list = g_list_prepend(file_list, PyString_AsString(item));
+ file_list = g_list_prepend(file_list, _PyUnicode_AsString(item));
}
file_list = g_list_reverse(file_list);
@@ -145,7 +145,7 @@ strv_to_pylist (char **strv)
list = PyList_New (len);
for (i = 0; i < len; i++)
- PyList_SetItem (list, i, PyString_FromString (strv[i]));
+ PyList_SetItem (list, i, _PyUnicode_FromString (strv[i]));
return list;
}
@@ -191,7 +191,7 @@ pylist_to_strv (PyObject *list,
return FALSE;
}
- if (!PyString_Check (item))
+ if (!_PyUnicode_Check (item))
{
Py_DECREF (item);
g_strfreev (ret);
@@ -199,7 +199,7 @@ pylist_to_strv (PyObject *list,
return FALSE;
}
- ret[i] = g_strdup (PyString_AsString (item));
+ ret[i] = g_strdup (_PyUnicode_AsString (item));
Py_DECREF (item);
}
diff --git a/glib/glibmodule.c b/glib/glibmodule.c
index c529f87..7b96180 100644
--- a/glib/glibmodule.c
+++ b/glib/glibmodule.c
@@ -557,16 +557,16 @@ pyglib_get_application_name(PyObject *self)
static PyObject*
pyglib_set_application_name(PyObject *self, PyObject *arg)
{
- if (!PyString_Check(arg)) {
+ if (!_PyUnicode_Check(arg)) {
PyObject *repr = PyObject_Repr(arg);
- const char *repr_ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char *repr_ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError,
"first argument must be a string, not '%s'",
(repr_ptr ? repr_ptr : "<?>"));
Py_CLEAR(repr);
return NULL;
}
- g_set_application_name(PyString_AS_STRING(arg));
+ g_set_application_name(_PyUnicode_AS_STRING(arg));
Py_INCREF(Py_None);
return Py_None;
}
@@ -587,16 +587,16 @@ pyglib_get_prgname(PyObject *self)
static PyObject*
pyglib_set_prgname(PyObject *self, PyObject *arg)
{
- if (!PyString_Check(arg)) {
+ if (!_PyUnicode_Check(arg)) {
PyObject *repr = PyObject_Repr(arg);
- const char *repr_ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char *repr_ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError,
"first argument must be a string, not '%s'",
(repr_ptr ? repr_ptr : "<?>"));
Py_CLEAR(repr);
return NULL;
}
- g_set_prgname(PyString_AS_STRING(arg));
+ g_set_prgname(_PyUnicode_AS_STRING(arg));
Py_INCREF(Py_None);
return Py_None;
}
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index d431d6a..9a10be5 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -140,7 +140,7 @@ pyg_type_from_name (PyObject *self, PyObject *args)
if (type != 0)
return pyg_type_wrapper_new(type);
repr = PyObject_Repr((PyObject*)self);
- repr_ptr = (repr ? PyString_AsString(repr) : "<?>");
+ repr_ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_RuntimeError, "%s: unknown type name: %s",
(repr_ptr ? repr_ptr : "<?>"), name);
Py_CLEAR(repr);
@@ -1926,7 +1926,7 @@ pyg_add_emission_hook(PyGObject *self, PyObject *args)
if (!g_signal_parse_name(name, gtype, &sigid, &detail, TRUE)) {
PyObject *repr = PyObject_Repr((PyObject*)self);
- const char *repr_ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char *repr_ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
(repr_ptr ? repr_ptr : "<?>"), name);
Py_CLEAR(repr);
@@ -1967,7 +1967,7 @@ pyg_remove_emission_hook(PyGObject *self, PyObject *args)
if (!g_signal_parse_name(name, gtype, &signal_id, NULL, TRUE)) {
PyObject *repr = PyObject_Repr((PyObject*)self);
- const char *repr_ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char *repr_ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
(repr_ptr ? repr_ptr : "<?>"), name);
Py_CLEAR(repr);
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index 28a2a37..33cb927 100644
--- a/gobject/pygobject.c
+++ b/gobject/pygobject.c
@@ -1723,7 +1723,7 @@ pygobject_emit(PyGObject *self, PyObject *args)
if (!g_signal_parse_name(name, G_OBJECT_TYPE(self->obj),
&signal_id, &detail, TRUE)) {
PyObject *repr = PyObject_Repr((PyObject*)self);
- const char* ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char* ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
(ptr ? ptr : "<?>"), name);
Py_CLEAR(repr);
@@ -1801,7 +1801,7 @@ pygobject_stop_emission(PyGObject *self, PyObject *args)
if (!g_signal_parse_name(signal, G_OBJECT_TYPE(self->obj),
&signal_id, &detail, TRUE)) {
PyObject *repr = PyObject_Repr((PyObject*)self);
- const char* ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char* ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "%s: unknown signal name: %s",
(ptr ? ptr : "<?>"), signal);
Py_CLEAR(repr);
@@ -1951,7 +1951,7 @@ pygobject_disconnect_by_func(PyGObject *self, PyObject *args)
closure = gclosure_from_pyfunc(self, pyfunc);
if (!closure) {
PyObject *repr = PyObject_Repr(pyfunc);
- const char* ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char* ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "nothing connected to %s",
(ptr ? ptr : "<?>"));
Py_CLEAR(repr);
@@ -1986,7 +1986,7 @@ pygobject_handler_block_by_func(PyGObject *self, PyObject *args)
closure = gclosure_from_pyfunc(self, pyfunc);
if (!closure) {
PyObject *repr = PyObject_Repr(pyfunc);
- const char* ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char* ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "nothing connected to %s",
(ptr ? ptr : "<?>"));
Py_CLEAR(repr);
@@ -2021,7 +2021,7 @@ pygobject_handler_unblock_by_func(PyGObject *self, PyObject *args)
closure = gclosure_from_pyfunc(self, pyfunc);
if (!closure) {
PyObject *repr = PyObject_Repr(pyfunc);
- const char* ptr = (repr ? PyString_AsString(repr) : "<?>");
+ const char* ptr = (repr ? _PyUnicode_AsString(repr) : "<?>");
PyErr_Format(PyExc_TypeError, "nothing connected to %s",
(ptr ? ptr : "<?>"));
Py_CLEAR(repr);
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index d78cf55..dc8c609 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 = PyInt_FromLong(obj->ref_count); /* should be == 2 at this point */
+ rv = _PyLong_FromLong(obj->ref_count); /* should be == 2 at this point */
g_object_unref(obj);
return rv;
}