Title: [1021] trunk: Fix deprecation warning issue with Python 3.8
Revision
1021
Author
cito
Date
2019-10-03 14:34:54 -0400 (Thu, 03 Oct 2019)

Log Message

Fix deprecation warning issue with Python 3.8

Modified Paths


Diff

Modified: trunk/pgconn.c (1020 => 1021)


--- trunk/pgconn.c	2019-10-03 11:38:50 UTC (rev 1020)
+++ trunk/pgconn.c	2019-10-03 18:34:54 UTC (rev 1021)
@@ -419,7 +419,7 @@
 conn_prepare(connObject *self, PyObject *args)
 {
     char *name, *query;
-    int name_length, query_length;
+    Py_ssize_t name_length, query_length;
     PGresult *result;
 
     if (!self->cnx) {
@@ -461,7 +461,7 @@
 conn_describe_prepared(connObject *self, PyObject *args)
 {
     char *name;
-    int name_length;
+    Py_ssize_t name_length;
     PGresult *result;
 
     if (!self->cnx) {
@@ -510,7 +510,7 @@
 conn_putline(connObject *self, PyObject *args)
 {
     char *line;
-    int line_length;
+    Py_ssize_t line_length;
 
     if (!self->cnx) {
         PyErr_SetString(PyExc_TypeError, "Connection is not valid");

Modified: trunk/pglarge.c (1020 => 1021)


--- trunk/pglarge.c	2019-10-03 11:38:50 UTC (rev 1020)
+++ trunk/pglarge.c	2019-10-03 18:34:54 UTC (rev 1021)
@@ -223,7 +223,8 @@
 large_write(largeObject *self, PyObject *args)
 {
     char *buffer;
-    int size, bufsize;
+    int size;
+    Py_ssize_t bufsize;
 
     /* gets arguments */
     if (!PyArg_ParseTuple(args, "s#", &buffer, &bufsize)) {
@@ -239,7 +240,7 @@
 
     /* sends query */
     if ((size = lo_write(self->pgcnx->cnx, self->lo_fd, buffer,
-                         bufsize)) != bufsize)
+                         (int)bufsize)) != bufsize)
     {
         PyErr_SetString(PyExc_IOError, "Buffer truncated during write");
         return NULL;

Modified: trunk/pgmodule.c (1020 => 1021)


--- trunk/pgmodule.c	2019-10-03 11:38:50 UTC (rev 1020)
+++ trunk/pgmodule.c	2019-10-03 18:34:54 UTC (rev 1021)
@@ -13,6 +13,7 @@
 
 /* Note: This should be linked against the same C runtime lib as Python */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <libpq-fe.h>

Modified: trunk/py3c.h (1020 => 1021)


--- trunk/py3c.h	2019-10-03 11:38:50 UTC (rev 1020)
+++ trunk/py3c.h	2019-10-03 18:34:54 UTC (rev 1021)
@@ -4,6 +4,7 @@
 
 #ifndef _PY3C_COMPAT_H_
 #define _PY3C_COMPAT_H_
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #if PY_MAJOR_VERSION >= 3
_______________________________________________
PyGreSQL mailing list
PyGreSQL@Vex.Net
https://mail.vex.net/mailman/listinfo/pygresql

Reply via email to