diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-12-12 10:55:19 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-12-12 13:39:32 +0000 |
commit | 6d7916cfe12657408103ed20100436b64fb2b163 (patch) | |
tree | 673f3a608dd2ae55f34df902119d4baa9b258162 | |
parent | 9fa1eac2b49a799eda0e4d00c903e5e9a683931a (diff) | |
download | psycopg2-6d7916cfe12657408103ed20100436b64fb2b163.tar.gz |
Internal imports simplified.
.c files only need to import psycopg.h: it will in turn import
dependencies from Python and libpq and configure.h. psycopg.h should be
the first to be imported, so the basic imports are not required in
the .h's
As a guideline I'm trying to import from the most specific to the most
generic to detect missing imports in the .h's.
45 files changed, 110 insertions, 257 deletions
diff --git a/psycopg/adapter_asis.c b/psycopg/adapter_asis.c index 31cfabb..5f3da8b 100644 --- a/psycopg/adapter_asis.c +++ b/psycopg/adapter_asis.c @@ -22,20 +22,18 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. */ - -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <stringobject.h> -#include <string.h> #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/adapter_asis.h" #include "psycopg/microprotocols_proto.h" +#include <structmember.h> +#include <stringobject.h> +#include <string.h> + + /** the AsIs object **/ static PyObject * diff --git a/psycopg/adapter_asis.h b/psycopg/adapter_asis.h index 28992a6..04ba08b 100644 --- a/psycopg/adapter_asis.h +++ b/psycopg/adapter_asis.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_ASIS_H #define PSYCOPG_ASIS_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_binary.c b/psycopg/adapter_binary.c index 9b4a1c3..63d705e 100644 --- a/psycopg/adapter_binary.c +++ b/psycopg/adapter_binary.c @@ -23,21 +23,17 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <stringobject.h> - -#include <libpq-fe.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" -#include "psycopg/connection.h" + #include "psycopg/adapter_binary.h" #include "psycopg/microprotocols_proto.h" +#include "psycopg/connection.h" + +#include <structmember.h> +#include <stringobject.h> +#include <string.h> + /** the quoting code */ diff --git a/psycopg/adapter_binary.h b/psycopg/adapter_binary.h index 37aec70..899f5ce 100644 --- a/psycopg/adapter_binary.h +++ b/psycopg/adapter_binary.h @@ -26,12 +26,6 @@ #ifndef PSYCOPG_BINARY_H #define PSYCOPG_BINARY_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <libpq-fe.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 08b0cd6..9fd0857 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -23,8 +23,12 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> +#define PSYCOPG_MODULE +#include "psycopg/psycopg.h" + +#include "psycopg/adapter_datetime.h" +#include "psycopg/microprotocols_proto.h" + #include <structmember.h> #include <stringobject.h> #include <datetime.h> @@ -32,12 +36,6 @@ #include <time.h> #include <string.h> -#define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" -#include "psycopg/psycopg.h" -#include "psycopg/adapter_datetime.h" -#include "psycopg/microprotocols_proto.h" extern HIDDEN PyObject *pyPsycopgTzModule; extern HIDDEN PyObject *pyPsycopgTzLOCAL; diff --git a/psycopg/adapter_datetime.h b/psycopg/adapter_datetime.h index a2c36fb..dd59e9b 100644 --- a/psycopg/adapter_datetime.h +++ b/psycopg/adapter_datetime.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_DATETIME_H #define PSYCOPG_DATETIME_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_list.c b/psycopg/adapter_list.c index f9ab509..d4436b0 100644 --- a/psycopg/adapter_list.c +++ b/psycopg/adapter_list.c @@ -23,19 +23,16 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <stringobject.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/adapter_list.h" #include "psycopg/microprotocols.h" #include "psycopg/microprotocols_proto.h" +#include <structmember.h> +#include <stringobject.h> + /* list_str, list_getquoted - return result of quoting */ diff --git a/psycopg/adapter_list.h b/psycopg/adapter_list.h index a368e1a..d713610 100644 --- a/psycopg/adapter_list.h +++ b/psycopg/adapter_list.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_LIST_H #define PSYCOPG_LIST_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_mxdatetime.c b/psycopg/adapter_mxdatetime.c index c87d8a6..3ce0f03 100644 --- a/psycopg/adapter_mxdatetime.c +++ b/psycopg/adapter_mxdatetime.c @@ -23,19 +23,18 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> +#define PSYCOPG_MODULE +#include "psycopg/psycopg.h" + +/* TODO: check if still compiles ok: I have no mx on this box */ +#include "psycopg/adapter_mxdatetime.h" +#include "psycopg/microprotocols_proto.h" + #include <structmember.h> #include <stringobject.h> #include <mxDateTime.h> #include <string.h> -#define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" -#include "psycopg/psycopg.h" -#include "psycopg/adapter_mxdatetime.h" -#include "psycopg/microprotocols_proto.h" int psyco_adapter_mxdatetime_init(void) diff --git a/psycopg/adapter_mxdatetime.h b/psycopg/adapter_mxdatetime.h index 5fdeb96..bd9d4c9 100644 --- a/psycopg/adapter_mxdatetime.h +++ b/psycopg/adapter_mxdatetime.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_MXDATETIME_H #define PSYCOPG_MXDATETIME_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_pboolean.c b/psycopg/adapter_pboolean.c index edffe8f..8425805 100644 --- a/psycopg/adapter_pboolean.c +++ b/psycopg/adapter_pboolean.c @@ -23,19 +23,16 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <stringobject.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/adapter_pboolean.h" #include "psycopg/microprotocols_proto.h" +#include <structmember.h> +#include <stringobject.h> +#include <string.h> + /** the Boolean object **/ diff --git a/psycopg/adapter_pboolean.h b/psycopg/adapter_pboolean.h index de5cd9f..b1bb18a 100644 --- a/psycopg/adapter_pboolean.h +++ b/psycopg/adapter_pboolean.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_PBOOLEAN_H #define PSYCOPG_PBOOLEAN_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_pdecimal.c b/psycopg/adapter_pdecimal.c index 347461a..b9850b4 100644 --- a/psycopg/adapter_pdecimal.c +++ b/psycopg/adapter_pdecimal.c @@ -23,19 +23,16 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <floatobject.h> -#include <math.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/adapter_pdecimal.h" #include "psycopg/microprotocols_proto.h" +#include <structmember.h> +#include <floatobject.h> +#include <math.h> + /** the Decimal object **/ diff --git a/psycopg/adapter_pdecimal.h b/psycopg/adapter_pdecimal.h index 82825a2..4f89fad 100644 --- a/psycopg/adapter_pdecimal.h +++ b/psycopg/adapter_pdecimal.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_PDECIMAL_H #define PSYCOPG_PDECIMAL_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_pfloat.c b/psycopg/adapter_pfloat.c index 3e9f341..3ae34a4 100644 --- a/psycopg/adapter_pfloat.c +++ b/psycopg/adapter_pfloat.c @@ -23,19 +23,16 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <floatobject.h> -#include <math.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/adapter_pfloat.h" #include "psycopg/microprotocols_proto.h" +#include <structmember.h> +#include <floatobject.h> +#include <math.h> + /** the Float object **/ diff --git a/psycopg/adapter_pfloat.h b/psycopg/adapter_pfloat.h index 12b40e0..7439c04 100644 --- a/psycopg/adapter_pfloat.h +++ b/psycopg/adapter_pfloat.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_PFLOAT_H #define PSYCOPG_PFLOAT_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/adapter_qstring.c b/psycopg/adapter_qstring.c index 59c1d7b..1b147f5 100644 --- a/psycopg/adapter_qstring.c +++ b/psycopg/adapter_qstring.c @@ -23,22 +23,17 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <stringobject.h> - -#include <libpq-fe.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/connection.h" #include "psycopg/adapter_qstring.h" #include "psycopg/microprotocols_proto.h" +#include <structmember.h> +#include <stringobject.h> +#include <string.h> + /* qstring_quote - do the quote process on plain and unicode strings */ diff --git a/psycopg/adapter_qstring.h b/psycopg/adapter_qstring.h index 83a8a7d..db986be 100644 --- a/psycopg/adapter_qstring.h +++ b/psycopg/adapter_qstring.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_QSTRING_H #define PSYCOPG_QSTRING_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/connection.h b/psycopg/connection.h index 76a6a09..477c690 100644 --- a/psycopg/connection.h +++ b/psycopg/connection.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_CONNECTION_H #define PSYCOPG_CONNECTION_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <libpq-fe.h> - -#include "psycopg/config.h" #include "psycopg/xid.h" #ifdef __cplusplus diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c index 73292b8..e04d510 100644 --- a/psycopg/connection_int.c +++ b/psycopg/connection_int.c @@ -23,19 +23,18 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" #include "psycopg/psycopg.h" + #include "psycopg/connection.h" #include "psycopg/cursor.h" #include "psycopg/pqpath.h" #include "psycopg/green.h" #include "psycopg/notify.h" +#include <string.h> + + /* conn_notice_callback - process notices */ static void diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index 3469dc2..d884b00 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -23,18 +23,9 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <stringobject.h> - -#include <string.h> -#include <ctype.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/connection.h" #include "psycopg/cursor.h" #include "psycopg/pqpath.h" @@ -42,6 +33,13 @@ #include "psycopg/green.h" #include "psycopg/xid.h" +#include <structmember.h> +#include <stringobject.h> + +#include <string.h> +#include <ctype.h> + + /** DBAPI methods **/ /* cursor method - allocate a new cursor */ diff --git a/psycopg/cursor.h b/psycopg/cursor.h index 96ca2b7..b9c0e3a 100644 --- a/psycopg/cursor.h +++ b/psycopg/cursor.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_CURSOR_H #define PSYCOPG_CURSOR_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <libpq-fe.h> - -#include "psycopg/config.h" #include "psycopg/connection.h" #ifdef __cplusplus diff --git a/psycopg/cursor_int.c b/psycopg/cursor_int.c index 004ba82..f53db30 100644 --- a/psycopg/cursor_int.c +++ b/psycopg/cursor_int.c @@ -23,16 +23,15 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" #include "psycopg/psycopg.h" + #include "psycopg/cursor.h" #include "psycopg/pqpath.h" +#include <string.h> + + /* curs_reset - reset the cursor to a clean state */ void diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 488a5cd..064b985 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -23,15 +23,9 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/cursor.h" #include "psycopg/connection.h" #include "psycopg/green.h" @@ -39,9 +33,13 @@ #include "psycopg/typecast.h" #include "psycopg/microprotocols.h" #include "psycopg/microprotocols_proto.h" -#include "pgversion.h" + +#include <structmember.h> +#include <string.h> + #include <stdlib.h> + extern PyObject *pyPsycopgTzFixedOffsetTimezone; diff --git a/psycopg/green.c b/psycopg/green.c index 4c7cc40..c9b6e07 100644 --- a/psycopg/green.c +++ b/psycopg/green.c @@ -24,13 +24,13 @@ */ #define PSYCOPG_MODULE -#include "psycopg/python.h" #include "psycopg/psycopg.h" -#include "psycopg/config.h" + #include "psycopg/green.h" #include "psycopg/connection.h" #include "psycopg/pqpath.h" + HIDDEN PyObject *wait_callback = NULL; static PyObject *have_wait_callback(void); diff --git a/psycopg/lobject.h b/psycopg/lobject.h index 2d6715c..cddfa6e 100644 --- a/psycopg/lobject.h +++ b/psycopg/lobject.h @@ -26,11 +26,8 @@ #ifndef PSYCOPG_LOBJECT_H #define PSYCOPG_LOBJECT_H 1 -#include <Python.h> -#include <libpq-fe.h> #include <libpq/libpq-fs.h> -#include "psycopg/config.h" #include "psycopg/connection.h" #ifdef __cplusplus diff --git a/psycopg/lobject_int.c b/psycopg/lobject_int.c index bac2afb..d6ebd44 100644 --- a/psycopg/lobject_int.c +++ b/psycopg/lobject_int.c @@ -23,17 +23,15 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" #include "psycopg/psycopg.h" -#include "psycopg/connection.h" + #include "psycopg/lobject.h" +#include "psycopg/connection.h" #include "psycopg/pqpath.h" +#include <string.h> + #ifdef PSYCOPG_EXTENSIONS static void diff --git a/psycopg/lobject_type.c b/psycopg/lobject_type.c index 7490112..98c1164 100644 --- a/psycopg/lobject_type.c +++ b/psycopg/lobject_type.c @@ -23,20 +23,18 @@ * License for more details. */ -#include <Python.h> -#include <structmember.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/lobject.h" #include "psycopg/connection.h" #include "psycopg/microprotocols.h" #include "psycopg/microprotocols_proto.h" #include "psycopg/pqpath.h" +#include <structmember.h> +#include <string.h> + #ifdef PSYCOPG_EXTENSIONS diff --git a/psycopg/microprotocols.c b/psycopg/microprotocols.c index 12ec7fb..a523d7d 100644 --- a/psycopg/microprotocols.c +++ b/psycopg/microprotocols.c @@ -23,18 +23,15 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" -#include "psycopg/cursor.h" -#include "psycopg/connection.h" + #include "psycopg/microprotocols.h" #include "psycopg/microprotocols_proto.h" +#include "psycopg/cursor.h" +#include "psycopg/connection.h" + +#include <structmember.h> /** the adapters registry **/ diff --git a/psycopg/microprotocols.h b/psycopg/microprotocols.h index 08e8610..df084c5 100644 --- a/psycopg/microprotocols.h +++ b/psycopg/microprotocols.h @@ -26,9 +26,6 @@ #ifndef PSYCOPG_MICROPROTOCOLS_H #define PSYCOPG_MICROPROTOCOLS_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include "psycopg/config.h" #include "psycopg/connection.h" #include "psycopg/cursor.h" diff --git a/psycopg/microprotocols_proto.c b/psycopg/microprotocols_proto.c index 1c17a85..620ca3f 100644 --- a/psycopg/microprotocols_proto.c +++ b/psycopg/microprotocols_proto.c @@ -23,19 +23,16 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> +#define PSYCOPG_MODULE +#include "psycopg/psycopg.h" + +#include "psycopg/microprotocols_proto.h" + #include <structmember.h> #include <stringobject.h> #include <string.h> -#define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" -#include "psycopg/psycopg.h" -#include "psycopg/microprotocols_proto.h" - /** void protocol implementation **/ diff --git a/psycopg/microprotocols_proto.h b/psycopg/microprotocols_proto.h index d7a67f2..614a263 100644 --- a/psycopg/microprotocols_proto.h +++ b/psycopg/microprotocols_proto.h @@ -26,12 +26,6 @@ #ifndef PSYCOPG_ISQLQUOTE_H #define PSYCOPG_ISQLQUOTE_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <libpq-fe.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/notify.h b/psycopg/notify.h index 1490fb4..645fdd7 100644 --- a/psycopg/notify.h +++ b/psycopg/notify.h @@ -26,10 +26,6 @@ #ifndef PSYCOPG_NOTIFY_H #define PSYCOPG_NOTIFY_H 1 -#include <Python.h> - -#include "psycopg/config.h" - extern HIDDEN PyTypeObject NotifyType; typedef struct { diff --git a/psycopg/notify_type.c b/psycopg/notify_type.c index 5396970..963ff83 100644 --- a/psycopg/notify_type.c +++ b/psycopg/notify_type.c @@ -23,16 +23,14 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/notify.h" +#include <structmember.h> + + static const char notify_doc[] = "A notification received from the backend.\n\n" "`!Notify` instances are made available upon reception on the\n" diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index c6fb6cd..e15fc7a 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -29,14 +29,9 @@ connection. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/pqpath.h" #include "psycopg/connection.h" #include "psycopg/cursor.h" @@ -44,6 +39,8 @@ #include "psycopg/typecast.h" #include "psycopg/pgtypes.h" +#include <string.h> + /* Strip off the severity from a Postgres error message. */ static const char * diff --git a/psycopg/pqpath.h b/psycopg/pqpath.h index 51a640d..8e9e20a 100644 --- a/psycopg/pqpath.h +++ b/psycopg/pqpath.h @@ -26,7 +26,6 @@ #ifndef PSYCOPG_PQPATH_H #define PSYCOPG_PQPATH_H 1 -#include "psycopg/config.h" #include "psycopg/cursor.h" #include "psycopg/connection.h" diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index db44807..f68e2ca 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -23,13 +23,9 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/connection.h" #include "psycopg/cursor.h" #include "psycopg/green.h" diff --git a/psycopg/python.h b/psycopg/python.h index f4256d8..27d4bb4 100644 --- a/psycopg/python.h +++ b/psycopg/python.h @@ -26,8 +26,6 @@ #ifndef PSYCOPG_PYTHON_H #define PSYCOPG_PYTHON_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> #include <structmember.h> #if PY_VERSION_HEX < 0x02040000 diff --git a/psycopg/typecast.c b/psycopg/typecast.c index 6da1eff..f12178b 100644 --- a/psycopg/typecast.c +++ b/psycopg/typecast.c @@ -23,14 +23,11 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" #include "psycopg/psycopg.h" -#include "psycopg/python.h" + +#include <structmember.h> + #include "psycopg/typecast.h" #include "psycopg/cursor.h" diff --git a/psycopg/typecast.h b/psycopg/typecast.h index 0623220..cbae10a 100644 --- a/psycopg/typecast.h +++ b/psycopg/typecast.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_TYPECAST_H #define PSYCOPG_TYPECAST_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/typecast_binary.c b/psycopg/typecast_binary.c index 6a707ea..6336c6f 100644 --- a/psycopg/typecast_binary.c +++ b/psycopg/typecast_binary.c @@ -25,7 +25,6 @@ #include "typecast_binary.h" -#include <libpq-fe.h> #include <stdlib.h> diff --git a/psycopg/typecast_binary.h b/psycopg/typecast_binary.h index 1406456..bc70992 100644 --- a/psycopg/typecast_binary.h +++ b/psycopg/typecast_binary.h @@ -26,11 +26,6 @@ #ifndef PSYCOPG_TYPECAST_BINARY_H #define PSYCOPG_TYPECAST_BINARY_H 1 -#define PY_SSIZE_T_CLEAN -#include <Python.h> - -#include "psycopg/config.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/psycopg/utils.c b/psycopg/utils.c index d8d3307..22464e6 100644 --- a/psycopg/utils.c +++ b/psycopg/utils.c @@ -23,14 +23,13 @@ * License for more details. */ -#include <Python.h> -#include <string.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" #include "psycopg/psycopg.h" + #include "psycopg/connection.h" #include "psycopg/pgtypes.h" + +#include <string.h> #include <stdlib.h> char * diff --git a/psycopg/xid.h b/psycopg/xid.h index 017f3b4..e63db61 100644 --- a/psycopg/xid.h +++ b/psycopg/xid.h @@ -27,10 +27,6 @@ #ifndef PSYCOPG_XID_H #define PSYCOPG_XID_H 1 -#include <Python.h> - -#include "psycopg/config.h" - extern HIDDEN PyTypeObject XidType; typedef struct { diff --git a/psycopg/xid_type.c b/psycopg/xid_type.c index 606cb64..54f8553 100644 --- a/psycopg/xid_type.c +++ b/psycopg/xid_type.c @@ -24,16 +24,14 @@ * License for more details. */ -#define PY_SSIZE_T_CLEAN -#include <Python.h> -#include <structmember.h> - #define PSYCOPG_MODULE -#include "psycopg/config.h" -#include "psycopg/python.h" #include "psycopg/psycopg.h" + #include "psycopg/xid.h" +#include <structmember.h> + + static const char xid_doc[] = "A transaction identifier used for two-phase commit.\n\n" "Usually returned by the connection methods `~connection.xid()` and\n" |