Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 102fe3f

Browse files
committed
Further changes following discussion on INTERFACES mailing list:
- Use PyObject_Del() rather than macro version - Check version and drop back to PyMem_Del() for older systems.
1 parent eb32be6 commit 102fe3f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/interfaces/python/pgmodule.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@
3535
#include <stdlib.h>
3636
#include <string.h>
3737

38+
# PyObject_Del does not exist in older versions of Python.
39+
#if PY_VERSION_HEX < 0x01060000
40+
#define PyObject_Del(op) PyMem_Del((op))
41+
#endif
42+
3843
static PyObject *PGError;
39-
static const char *PyPgVersion = "3.3";
44+
static const char *PyPgVersion = "3.4 (beta)";
4045

4146
/* taken from fileobject.c */
4247
#define BUF(v) PyString_AS_STRING((PyStringObject *)(v))
@@ -343,7 +348,7 @@ pgsource_dealloc(pgsourceobject * self)
343348
PQclear(self->last_result);
344349

345350
Py_XDECREF(self->pgcnx);
346-
PyObject_DEL(self);
351+
PyObject_Del(self);
347352
}
348353

349354
/* closes object */
@@ -990,7 +995,7 @@ pglarge_dealloc(pglargeobject * self)
990995
lo_close(self->pgcnx->cnx, self->lo_fd);
991996

992997
Py_XDECREF(self->pgcnx);
993-
PyObject_DEL(self);
998+
PyObject_Del(self);
994999
}
9951000

9961001
/* opens large object */
@@ -1546,7 +1551,7 @@ pg_dealloc(pgobject * self)
15461551
if (self->cnx)
15471552
PQfinish(self->cnx);
15481553

1549-
PyObject_DEL(self);
1554+
PyObject_Del(self);
15501555
}
15511556

15521557
/* close without deleting */
@@ -1579,7 +1584,7 @@ pgquery_dealloc(pgqueryobject * self)
15791584
if (self->last_result)
15801585
PQclear(self->last_result);
15811586

1582-
PyObject_DEL(self);
1587+
PyObject_Del(self);
15831588
}
15841589

15851590
/* resets connection */

0 commit comments

Comments
 (0)