Dropped ifdef guards against obsolete libpq versions

One of them was actually wrong: lobject_type.c wouldn't have compiled
pre 8.3 (broken in 6e841a41, 2 years ago).
This commit is contained in:
Daniele Varrazzo 2016-08-15 02:31:39 +01:00
parent 3d4f6df0de
commit 5ddc952dbb
5 changed files with 0 additions and 22 deletions

View File

@ -39,11 +39,9 @@ static unsigned char *
binary_escape(unsigned char *from, size_t from_length,
size_t *to_length, PGconn *conn)
{
#if PG_VERSION_NUM >= 80104
if (conn)
return PQescapeByteaConn(conn, from, from_length, to_length);
else
#endif
return PQescapeBytea(from, from_length, to_length);
}

View File

@ -474,8 +474,6 @@ lobject_export(lobjectObject *self, const char *filename)
return retvalue;
}
#if PG_VERSION_NUM >= 80300
RAISES_NEG int
lobject_truncate(lobjectObject *self, size_t len)
{
@ -510,5 +508,3 @@ lobject_truncate(lobjectObject *self, size_t len)
return retvalue;
}
#endif /* PG_VERSION_NUM >= 80300 */

View File

@ -266,8 +266,6 @@ psyco_lobj_get_closed(lobjectObject *self, void *closure)
return closed;
}
#if PG_VERSION_NUM >= 80300
#define psyco_lobj_truncate_doc \
"truncate(len=0) -- Truncate large object to given size."
@ -327,10 +325,8 @@ static struct PyMethodDef lobjectObject_methods[] = {
METH_NOARGS, psyco_lobj_unlink_doc},
{"export",(PyCFunction)psyco_lobj_export,
METH_VARARGS, psyco_lobj_export_doc},
#if PG_VERSION_NUM >= 80300
{"truncate",(PyCFunction)psyco_lobj_truncate,
METH_VARARGS, psyco_lobj_truncate_doc},
#endif /* PG_VERSION_NUM >= 80300 */
{NULL}
};
@ -475,6 +471,3 @@ PyTypeObject lobjectType = {
0, /*tp_alloc*/
lobject_new, /*tp_new*/
};
#endif

View File

@ -164,7 +164,6 @@ exit:
static PyObject *
psyco_quote_ident(PyObject *self, PyObject *args, PyObject *kwargs)
{
#if PG_VERSION_NUM >= 90000
PyObject *ident = NULL, *obj = NULL, *result = NULL;
connectionObject *conn;
const char *str;
@ -204,10 +203,6 @@ exit:
Py_XDECREF(ident);
return result;
#else
PyErr_SetString(NotSupportedError, "PQescapeIdentifier not available in libpq < 9.0");
return NULL;
#endif
}
/** type registration **/
@ -285,9 +280,7 @@ psyco_libcrypto_threads_init(void)
if ((m = PyImport_ImportModule("ssl"))) {
/* disable libcrypto setup in libpq, so it won't stomp on the callbacks
that have already been set up */
#if PG_VERSION_NUM >= 80400
PQinitOpenSSL(1, 0);
#endif
Py_DECREF(m);
}
else {

View File

@ -67,12 +67,10 @@ psycopg_escape_string(connectionObject *conn, const char *from, Py_ssize_t len,
}
{
#if PG_VERSION_NUM >= 80104
int err;
if (conn && conn->pgconn)
ql = PQescapeStringConn(conn->pgconn, to+eq+1, from, len, &err);
else
#endif
ql = PQescapeString(to+eq+1, from, len);
}