mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-18 01:50:32 +03:00
Stricter use of PyArg_ParseTuple typed objects
The function expect PyObject *, not subclasses.
This commit is contained in:
parent
3e66022912
commit
79de02d7d5
|
@ -113,14 +113,14 @@ qstring_str(qstringObject *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
qstring_prepare(qstringObject *self, PyObject *args)
|
qstring_prepare(qstringObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
connectionObject *conn;
|
PyObject *conn;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O!", &connectionType, &conn))
|
if (!PyArg_ParseTuple(args, "O!", &connectionType, &conn))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Py_CLEAR(self->conn);
|
Py_CLEAR(self->conn);
|
||||||
Py_INCREF(conn);
|
Py_INCREF(conn);
|
||||||
self->conn = conn;
|
self->conn = (connectionObject *)conn;
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,12 +58,17 @@ replmsg_repr(replicationMessageObject *self)
|
||||||
static int
|
static int
|
||||||
replmsg_init(PyObject *obj, PyObject *args, PyObject *kwargs)
|
replmsg_init(PyObject *obj, PyObject *args, PyObject *kwargs)
|
||||||
{
|
{
|
||||||
replicationMessageObject *self = (replicationMessageObject*) obj;
|
PyObject *cur = NULL;
|
||||||
|
replicationMessageObject *self = (replicationMessageObject *)obj;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O!O", &cursorType, &self->cursor, &self->payload))
|
if (!PyArg_ParseTuple(
|
||||||
|
args, "O!O", &cursorType, &cur, &self->payload)) {
|
||||||
return -1;
|
return -1;
|
||||||
Py_XINCREF(self->cursor);
|
}
|
||||||
Py_XINCREF(self->payload);
|
|
||||||
|
Py_INCREF(cur);
|
||||||
|
self->cursor = (cursorObject *)cur;
|
||||||
|
Py_INCREF(self->payload);
|
||||||
|
|
||||||
self->data_size = 0;
|
self->data_size = 0;
|
||||||
self->data_start = 0;
|
self->data_start = 0;
|
||||||
|
@ -76,7 +81,7 @@ replmsg_init(PyObject *obj, PyObject *args, PyObject *kwargs)
|
||||||
static int
|
static int
|
||||||
replmsg_traverse(replicationMessageObject *self, visitproc visit, void *arg)
|
replmsg_traverse(replicationMessageObject *self, visitproc visit, void *arg)
|
||||||
{
|
{
|
||||||
Py_VISIT((PyObject* )self->cursor);
|
Py_VISIT((PyObject *)self->cursor);
|
||||||
Py_VISIT(self->payload);
|
Py_VISIT(self->payload);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user