]> granicus.if.org Git - python/commitdiff
Moved PyObject_{Get,Set}Attr to object.c.
authorGuido van Rossum <guido@python.org>
Tue, 20 May 1997 18:35:19 +0000 (18:35 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 20 May 1997 18:35:19 +0000 (18:35 +0000)
Fixed two 'return NULL' that should be 'return -1'.

Objects/dictobject.c

index 60e2dd2881fc601eee32b3b54bb51a10ea434312..91af7287e4ad1b624b12584baa9b406239d0fd60 100644 (file)
@@ -926,37 +926,6 @@ PyTypeObject PyDict_Type = {
        &dict_as_mapping,       /*tp_as_mapping*/
 };
 
-/* These belong in object.c now */
-
-PyObject *
-PyObject_GetAttr(v, name)
-       PyObject *v;
-       PyObject *name;
-{
-       if (v->ob_type->tp_getattro != NULL)
-               return (*v->ob_type->tp_getattro)(v, name);
-       else
-               return PyObject_GetAttrString(v, PyString_AsString(name));
-}
-
-int
-PyObject_SetAttr(v, name, value)
-       PyObject *v;
-       PyObject *name;
-       PyObject *value;
-{
-       int err;
-       Py_INCREF(name);
-       PyString_InternInPlace(&name);
-       if (v->ob_type->tp_setattro != NULL)
-               err = (*v->ob_type->tp_setattro)(v, name, value);
-       else
-               err = PyObject_SetAttrString(
-                       v, PyString_AsString(name), value);
-       Py_DECREF(name);
-       return err;
-}
-
 /* For backward compatibility with old dictionary interface */
 
 PyObject *
@@ -984,7 +953,7 @@ PyDict_SetItemString(v, key, item)
        int err;
        kv = PyString_FromString(key);
        if (kv == NULL)
-               return NULL;
+               return -1;
        PyString_InternInPlace(&kv);
        err = PyDict_SetItem(v, kv, item);
        Py_DECREF(kv);
@@ -1000,7 +969,7 @@ PyDict_DelItemString(v, key)
        int err;
        kv = PyString_FromString(key);
        if (kv == NULL)
-               return NULL;
+               return -1;
        PyString_InternInPlace(&kv);
        err = PyDict_DelItem(v, kv);
        Py_DECREF(kv);