summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-02-25 10:29:19 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-02-25 10:29:19 +0000
commit194447fbbf261cee21f154d912ceffd07a00c180 (patch)
tree3c71842f9ee7e4d6290738b218d9015c3df57612
parent9e00196165a60e9cb93ae391cef0d43a9207ae18 (diff)
parent2997c0eb6cc32a5ea111c30abc2029413fb7b387 (diff)
downloadpsycopg2-194447fbbf261cee21f154d912ceffd07a00c180.tar.gz
Merge branch 'msvc-cleanup' into devel
Merged Jason Erickson devel branch after collapsing a few commits together where it made sense.
-rw-r--r--psycopg/config.h4
-rw-r--r--psycopg/connection_type.c2
-rw-r--r--psycopg/lobject_type.c5
-rw-r--r--psycopg/xid_type.c3
-rw-r--r--setup.py15
5 files changed, 18 insertions, 11 deletions
diff --git a/psycopg/config.h b/psycopg/config.h
index 708f0a8..551cfe4 100644
--- a/psycopg/config.h
+++ b/psycopg/config.h
@@ -51,6 +51,10 @@ extern HIDDEN int psycopg_debug_enabled;
#else /* !__GNUC__ or __APPLE__ */
#ifdef PSYCOPG_DEBUG
#include <stdarg.h>
+#ifdef _WIN32
+#include <process.h>
+#define getpid _getpid
+#endif
static void Dprintf(const char *fmt, ...)
{
va_list ap;
diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c
index 7af6a62..b0c9ddc 100644
--- a/psycopg/connection_type.c
+++ b/psycopg/connection_type.c
@@ -939,7 +939,7 @@ connection_repr(connectionObject *self)
static int
connection_traverse(connectionObject *self, visitproc visit, void *arg)
{
- Py_VISIT(self->tpc_xid);
+ Py_VISIT((PyObject *)(self->tpc_xid));
Py_VISIT(self->async_cursor);
Py_VISIT(self->notice_list);
Py_VISIT(self->notice_filter);
diff --git a/psycopg/lobject_type.c b/psycopg/lobject_type.c
index 51c41d3..ba45de2 100644
--- a/psycopg/lobject_type.c
+++ b/psycopg/lobject_type.c
@@ -124,10 +124,11 @@ static PyObject *
psyco_lobj_read(lobjectObject *self, PyObject *args)
{
PyObject *res;
- int where, end, size = -1;
+ int where, end;
+ Py_ssize_t size = -1;
char *buffer;
- if (!PyArg_ParseTuple(args, "|i", &size)) return NULL;
+ if (!PyArg_ParseTuple(args, "|" CONV_CODE_PY_SSIZE_T, &size)) return NULL;
EXC_IF_LOBJ_CLOSED(self);
EXC_IF_LOBJ_LEVEL0(self);
diff --git a/psycopg/xid_type.c b/psycopg/xid_type.c
index 82d6d89..9e95fd1 100644
--- a/psycopg/xid_type.c
+++ b/psycopg/xid_type.c
@@ -100,7 +100,8 @@ static int
xid_init(XidObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"format_id", "gtrid", "bqual", NULL};
- int format_id, i, gtrid_len, bqual_len;
+ int format_id;
+ size_t i, gtrid_len, bqual_len;
const char *gtrid, *bqual;
PyObject *tmp;
diff --git a/setup.py b/setup.py
index 66c2fed..e87c78d 100644
--- a/setup.py
+++ b/setup.py
@@ -155,6 +155,13 @@ class psycopg_build_ext(build_ext):
def get_pg_config(self, kind):
return get_pg_config(kind, self.pg_config)
+ def get_export_symbols(self, ext):
+ # Fix MSVC seeing two of the same export symbols.
+ if self.get_compiler().lower().startswith('msvc'):
+ return []
+ else:
+ return build_ext.get_export_symbols(self, ext)
+
def build_extension(self, ext):
build_ext.build_extension(self, ext)
@@ -181,13 +188,7 @@ class psycopg_build_ext(build_ext):
compiler_name = self.get_compiler().lower()
compiler_is_msvc = compiler_name.startswith('msvc')
compiler_is_mingw = compiler_name.startswith('mingw')
- if compiler_is_msvc:
- # If we're using MSVC 7.1 or later on a 32-bit platform, add the
- # /Wp64 option to generate warnings about Win64 portability
- # problems.
- if sysVer >= (2,4) and struct.calcsize('P') == 4:
- extra_compiler_args.append('/Wp64')
- elif compiler_is_mingw:
+ if compiler_is_mingw:
# Default MinGW compilation of Python extensions on Windows uses
# only -O:
extra_compiler_args.append('-O3')