diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-18 12:21:45 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-18 12:28:34 +0200 |
commit | 85f1a9aa87699e2b2a57509ff9bbe132db259de8 (patch) | |
tree | 492353da0f302a78d7843be9f51b27092f8bbca8 | |
parent | e8d97dfd7dd7c729c21d2881266f90f2e0072c49 (diff) | |
download | pygobject-85f1a9aa87699e2b2a57509ff9bbe132db259de8.tar.gz |
Use Py_TYPE() everywhere
-rw-r--r-- | gi/pygi-array.c | 2 | ||||
-rw-r--r-- | gi/pygi-basictype.c | 16 | ||||
-rw-r--r-- | gi/pygi-closure.c | 2 | ||||
-rw-r--r-- | gi/pygi-enum-marshal.c | 4 | ||||
-rw-r--r-- | gi/pygi-error.c | 2 | ||||
-rw-r--r-- | gi/pygi-hashtable.c | 2 | ||||
-rw-r--r-- | gi/pygi-list.c | 4 | ||||
-rw-r--r-- | gi/pygi-object.c | 2 | ||||
-rw-r--r-- | gi/pygi-resulttuple.c | 2 | ||||
-rw-r--r-- | gi/pygi-struct-marshal.c | 8 |
10 files changed, 22 insertions, 22 deletions
diff --git a/gi/pygi-array.c b/gi/pygi-array.c index a0634dcc..073e1436 100644 --- a/gi/pygi-array.c +++ b/gi/pygi-array.c @@ -215,7 +215,7 @@ _pygi_marshal_from_py_array (PyGIInvokeState *state, if (!PySequence_Check (py_arg)) { PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c index d5ce8169..02940929 100644 --- a/gi/pygi-basictype.c +++ b/gi/pygi-basictype.c @@ -102,7 +102,7 @@ base_float_checks (PyObject *object) { if (!PyNumber_Check (object)) { PyErr_Format (PyExc_TypeError, "Must be number, not %s", - object->ob_type->tp_name); + Py_TYPE (object)->tp_name); return NULL; } @@ -212,7 +212,7 @@ pygi_gunichar_from_py (PyObject *py_arg, gunichar *result) #endif } else { PyErr_Format (PyExc_TypeError, "Must be string, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -260,7 +260,7 @@ pygi_gtype_from_py (PyObject *py_arg, GType *type) if (temp == 0) { PyErr_Format (PyExc_TypeError, "Must be gobject.GType, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -294,7 +294,7 @@ pygi_utf8_from_py (PyObject *py_arg, gchar **result) #endif else { PyErr_Format (PyExc_TypeError, "Must be string, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -343,7 +343,7 @@ filename_from_py_unix (PyObject *py_arg, gchar **result) Py_DECREF (bytes); } else { PyErr_Format (PyExc_TypeError, "Must be bytes, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -387,7 +387,7 @@ filename_from_py_win32 (PyObject *py_arg, gchar **result) Py_DECREF (bytes); } else { PyErr_Format (PyExc_TypeError, "Must be unicode, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } #else @@ -437,7 +437,7 @@ filename_from_py_win32 (PyObject *py_arg, gchar **result) Py_DECREF (bytes); } else { PyErr_Format (PyExc_TypeError, "Must be str, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } #endif @@ -463,7 +463,7 @@ base_number_checks (PyObject *object) if (!PyNumber_Check (object)) { PyErr_Format (PyExc_TypeError, "Must be number, not %s", - object->ob_type->tp_name); + Py_TYPE (object)->tp_name); return NULL; } diff --git a/gi/pygi-closure.c b/gi/pygi-closure.c index 0eef41e7..d8788762 100644 --- a/gi/pygi-closure.c +++ b/gi/pygi-closure.c @@ -741,7 +741,7 @@ _pygi_marshal_from_py_interface_callback (PyGIInvokeState *state, if (!PyCallable_Check (py_arg)) { PyErr_Format (PyExc_TypeError, "Callback needs to be a function or method not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } diff --git a/gi/pygi-enum-marshal.c b/gi/pygi-enum-marshal.c index e98d023a..fc330895 100644 --- a/gi/pygi-enum-marshal.c +++ b/gi/pygi-enum-marshal.c @@ -181,7 +181,7 @@ err: if (interface) g_base_info_unref (interface); PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", - iface_cache->type_name, py_arg->ob_type->tp_name); + iface_cache->type_name, Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -228,7 +228,7 @@ _pygi_marshal_from_py_interface_flags (PyGIInvokeState *state, err: PyErr_Format (PyExc_TypeError, "Expected a %s, but got %s", - iface_cache->type_name, py_arg->ob_type->tp_name); + iface_cache->type_name, Py_TYPE (py_arg)->tp_name); return FALSE; } diff --git a/gi/pygi-error.c b/gi/pygi-error.c index 85aaf29c..8e4a7934 100644 --- a/gi/pygi-error.c +++ b/gi/pygi-error.c @@ -125,7 +125,7 @@ pygi_error_marshal_from_py (PyObject *pyerr, GError **error) if (PyObject_IsInstance (pyerr, PyGError) != 1) { PyErr_Format (PyExc_TypeError, "Must be GLib.Error, not %s", - pyerr->ob_type->tp_name); + Py_TYPE (pyerr)->tp_name); return FALSE; } diff --git a/gi/pygi-hashtable.c b/gi/pygi-hashtable.c index f0cda78f..285eca19 100644 --- a/gi/pygi-hashtable.c +++ b/gi/pygi-hashtable.c @@ -70,7 +70,7 @@ _pygi_marshal_from_py_ghash (PyGIInvokeState *state, py_keys = PyMapping_Keys (py_arg); if (py_keys == NULL) { PyErr_Format (PyExc_TypeError, "Must be mapping, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } diff --git a/gi/pygi-list.c b/gi/pygi-list.c index b2986231..712c372c 100644 --- a/gi/pygi-list.c +++ b/gi/pygi-list.c @@ -50,7 +50,7 @@ _pygi_marshal_from_py_glist (PyGIInvokeState *state, if (!PySequence_Check (py_arg)) { PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -127,7 +127,7 @@ _pygi_marshal_from_py_gslist (PyGIInvokeState *state, if (!PySequence_Check (py_arg)) { PyErr_Format (PyExc_TypeError, "Must be sequence, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } diff --git a/gi/pygi-object.c b/gi/pygi-object.c index 07fd5995..aa9ac48d 100644 --- a/gi/pygi-object.c +++ b/gi/pygi-object.c @@ -163,7 +163,7 @@ _pygi_marshal_from_py_interface_object (PyGIInvokeState *state, ( (PyGIInterfaceCache *)arg_cache)->type_name, module ? PYGLIB_PyUnicode_AsString(module) : "", module ? "." : "", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); if (module) Py_DECREF (module); return FALSE; diff --git a/gi/pygi-resulttuple.c b/gi/pygi-resulttuple.c index f3a58e1e..0d060d01 100644 --- a/gi/pygi-resulttuple.c +++ b/gi/pygi-resulttuple.c @@ -125,7 +125,7 @@ resulttuple_dir(PyObject *self) Py_DECREF (mapping_attr); if (mapping == NULL) goto error; - items = PyObject_Dir ((PyObject*)self->ob_type); + items = PyObject_Dir ((PyObject*)Py_TYPE (self)); if (items == NULL) goto error; mapping_values = PyDict_Keys (mapping); diff --git a/gi/pygi-struct-marshal.c b/gi/pygi-struct-marshal.c index a3877157..a7705a53 100644 --- a/gi/pygi-struct-marshal.c +++ b/gi/pygi-struct-marshal.c @@ -106,7 +106,7 @@ pygi_arg_gvalue_from_py_marshal (PyObject *py_arg, GValue *value; GType object_type; - object_type = pyg_type_from_object_strict ( (PyObject *) py_arg->ob_type, FALSE); + object_type = pyg_type_from_object_strict ( (PyObject *) Py_TYPE (py_arg), FALSE); if (object_type == G_TYPE_INVALID) { PyErr_SetString (PyExc_RuntimeError, "unable to retrieve object's GType"); return FALSE; @@ -145,7 +145,7 @@ pygi_arg_gvalue_from_py_cleanup (PyGIInvokeState *state, /* Note py_arg can be NULL for hash table which is a bug. */ if (was_processed && py_arg != NULL) { GType py_object_type = - pyg_type_from_object_strict ( (PyObject *) py_arg->ob_type, FALSE); + pyg_type_from_object_strict ( (PyObject *) Py_TYPE (py_arg), FALSE); /* When a GValue was not passed, it means the marshalers created a new * one to pass in, clean this up. @@ -172,7 +172,7 @@ pygi_arg_gclosure_from_py_marshal (PyObject *py_arg, if ( !(PyCallable_Check(py_arg) || g_type_is_a (object_gtype, G_TYPE_CLOSURE))) { PyErr_Format (PyExc_TypeError, "Must be callable, not %s", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); return FALSE; } @@ -314,7 +314,7 @@ type_error: type_name, module ? PYGLIB_PyUnicode_AsString(module) : "", module ? "." : "", - py_arg->ob_type->tp_name); + Py_TYPE (py_arg)->tp_name); if (module) Py_DECREF (module); g_free (type_name); |