diff options
Diffstat (limited to 'psycopg/adapter_binary.c')
-rw-r--r-- | psycopg/adapter_binary.c | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/psycopg/adapter_binary.c b/psycopg/adapter_binary.c index b08c144..3edcea8 100644 --- a/psycopg/adapter_binary.c +++ b/psycopg/adapter_binary.c @@ -159,8 +159,7 @@ binary_prepare(binaryObject *self, PyObject *args) self->conn = conn; Py_INCREF(self->conn); - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } static PyObject * @@ -221,17 +220,6 @@ binary_setup(binaryObject *self, PyObject *str) return 0; } -static int -binary_traverse(PyObject *obj, visitproc visit, void *arg) -{ - binaryObject *self = (binaryObject *)obj; - - Py_VISIT(self->wrapped); - Py_VISIT(self->buffer); - Py_VISIT(self->conn); - return 0; -} - static void binary_dealloc(PyObject* obj) { @@ -266,12 +254,6 @@ binary_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return type->tp_alloc(type, 0); } -static void -binary_del(PyObject* self) -{ - PyObject_GC_Del(self); -} - static PyObject * binary_repr(binaryObject *self) { @@ -286,61 +268,41 @@ binary_repr(binaryObject *self) PyTypeObject binaryType = { PyVarObject_HEAD_INIT(NULL, 0) "psycopg2._psycopg.Binary", - sizeof(binaryObject), - 0, + sizeof(binaryObject), 0, binary_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ - 0, /*tp_compare*/ (reprfunc)binary_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ - 0, /*tp_call*/ (reprfunc)binary_str, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /*tp_flags*/ binaryType_doc, /*tp_doc*/ - - binary_traverse, /*tp_traverse*/ + 0, /*tp_traverse*/ 0, /*tp_clear*/ - 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ 0, /*tp_iternext*/ - - /* Attribute descriptor and subclassing stuff */ - binaryObject_methods, /*tp_methods*/ binaryObject_members, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ - 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - binary_init, /*tp_init*/ - 0, /*tp_alloc will be set to PyType_GenericAlloc in module init*/ + 0, /*tp_alloc*/ binary_new, /*tp_new*/ - (freefunc)binary_del, /*tp_free Low-level free-memory routine */ - 0, /*tp_is_gc For PyObject_IS_GC */ - 0, /*tp_bases*/ - 0, /*tp_mro method resolution order */ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0 /*tp_weaklist*/ }; |