summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-05-20 18:35:19 (GMT)
committerGuido van Rossum <guido@python.org>1997-05-20 18:35:19 (GMT)
commit037b2205e87e988063cd274fd20274b1848afc0e (patch)
tree5674a5ceaff79bafcc4599261d2c7145a914a43b
parent98ff96adbadb88f2ff05ffa0388d1568aa45ebf1 (diff)
downloadcpython-037b2205e87e988063cd274fd20274b1848afc0e.zip
cpython-037b2205e87e988063cd274fd20274b1848afc0e.tar.gz
cpython-037b2205e87e988063cd274fd20274b1848afc0e.tar.bz2
Moved PyObject_{Get,Set}Attr to object.c.
Fixed two 'return NULL' that should be 'return -1'.
-rw-r--r--Objects/dictobject.c35
1 files changed, 2 insertions, 33 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 60e2dd2..91af728 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -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);