Previously we only checked for the existence of the include files, but this
doesn't imply the presence of the module. Particularly true in restricted
environments such as virtualenv.
Closes ticket #53.
The encoding can be set by PGCLIENTENCODING, which may be an alternative
spelling. Bug reported by Peter Eisentraut.
At this point the idea of considering one of the random spellings such as
EUC_CN as somewhat "blessed" is debunked. So just store the cleaned-up
version of the encoding in the mapping table. Note that the cleaned-up
version was needed by the unicode adapter: this requirement has been
surpassed as the connection now contains a copy of the Python codec name
set whenever the client encoding is set.
PG 9.0 uses the hex format by default, and clients < 9.0 can't parse that
format, requiring client update and great care in what is linked at runtime,
and generally giving headache to users and transitively us.
The MSVC compiler sees a request for the main symbol (init__pyscopg) to be
exported twice during the build process and issues a warning in 64bit mode.
One symbol is from distutils exporting the library with the
build_ext.get_export_symbols() function, the other is from the #define
PyMODINIT_FUNC (define in pyport.h) that begins the main _psycopg module.
This patch overrides the get_export_symbols function and returns an empty
array of symbols to export if the compiler is MSVC.
Looks like there is a case for installing hstore somewhere else (see
ticket #45). And after all the typecaster can be registered on a list of
OIDs, so let's grab them all.
- Check return value of PyErr_Malloc and set an exception in case of error
- Avoid exposing variables with refcount 0 as connection attributes.
- PyErr_Free guards itself for NULL input
It has long been used in wrong ways, with the function receiving a
connection or lobject instead of a cursor. It has always been unnoticed
(nobody has noticed the wrong object attached to the exception in the
wrong cases) but it started crashing the interpreter with Python 3.2 on
Windows.
Thanks to Jason Erickson for finding the problem and helping fixing it.