Merge branch 'msvc-cleanup' into devel

Merged Jason Erickson devel branch after collapsing a few commits together
where it made sense.
This commit is contained in:
Daniele Varrazzo 2011-02-25 10:29:19 +00:00
commit 194447fbbf
5 changed files with 18 additions and 11 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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')