Skip to content

Commit e08e468

Browse files
author
James William Pye
committed
Remove use of classmethod on parse_tuple_message.
Tuple data is represented by builtins.tuple now.
1 parent 5322aac commit e08e468

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

postgresql/port/optimized/element3.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
/*
2-
* copyright 2009, James William Pye
3-
* http://python.projects.postgresql.org
4-
*
5-
*//*
6-
* element3 optimizations.
2+
* .port.optimized - .protocol.element3 optimizations
73
*/
84
#define include_element3_functions \
95
mFUNC(cat_messages, METH_O, "cat the serialized form of the messages in the given list") \
10-
mFUNC(parse_tuple_message, METH_VARARGS, "parse the given tuple data into a tuple of raw data") \
6+
mFUNC(parse_tuple_message, METH_O, "parse the given tuple data into a tuple of raw data") \
117
mFUNC(pack_tuple_data, METH_O, "serialize the give tuple message[tuple of bytes()]") \
128

139
/*
@@ -202,15 +198,14 @@ _unpack_tuple_data(PyObject *dst, uint16_t natts, register const char *data, Py_
202198
}
203199

204200
static PyObject *
205-
parse_tuple_message(PyObject *self, PyObject *args)
201+
parse_tuple_message(PyObject *self, PyObject *arg)
206202
{
207203
PyObject *rob;
208-
PyObject *typ;
209204
const char *data;
210205
Py_ssize_t dlen = 0;
211206
uint16_t natts = 0;
212207

213-
if (!PyArg_ParseTuple(args, "Oy#", &typ, &data, &dlen))
208+
if (PyObject_AsReadBuffer(arg, (const void **) &data, &dlen))
214209
return(NULL);
215210

216211
if (dlen < 2)

postgresql/protocol/element3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def parse(typ, data,
475475
natts -= 1
476476
return T(atts)
477477
try:
478-
parse = classmethod(parse_tuple_message)
478+
parse = parse_tuple_message
479479
except NameError:
480480
# This is an override when port.optimized is available.
481481
pass

0 commit comments

Comments
 (0)