Daniele Varrazzo
31812c01e6
Further modeling of exception raising
2012-03-04 04:38:44 +00:00
Daniele Varrazzo
5bfb6cdefe
Use more compact macros to annotate functions for the static checker
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
a167822e26
Use the newly provided attributes to validate exceptions raising
...
Be more consistent in using 0 for success, <0 for failure, and to check
for values < 0 instead of specific -1.
2012-03-01 02:53:28 +00:00
Daniele Varrazzo
3b36100ec1
Dropped hardcoded list of exceptions in init functions
...
Use the already available exctable array.
This stops the gcc-python-plugin complaining about access to potentially
uninitialized memory.
2012-02-23 20:09:28 +00:00
Daniele Varrazzo
09be4dc5d1
Fixed potential failures while setting exceptions attributes
2012-02-23 19:48:46 +00:00
Daniele Varrazzo
7d67ecbed3
Fixed potential NULL incref
2012-02-23 19:47:36 +00:00
Daniele Varrazzo
1b27820389
Fixed refcount of exceptions dicts
2012-02-23 19:36:30 +00:00
Daniele Varrazzo
08fbd86495
Check errors in module typecasters init
2012-02-23 19:20:51 +00:00
Daniele Varrazzo
ff61cf25b6
Fixed refcount of None if namedtuples are not available
2012-02-23 18:50:06 +00:00
Daniele Varrazzo
026899e0c1
Check errors when populating encodings map
2012-02-23 18:50:06 +00:00
Daniele Varrazzo
db987250c8
Avoid installing Error.__reduce_ex__ on Python 2.4
...
It is not used by the pickle protocol, and if called manually fails in an
unsettling way, probably because the exceptions were old-style classes.
2012-01-14 18:01:15 +00:00
Daniele Varrazzo
43daba38e7
Make Error and subclasses picklable
...
Useful for multiprocessing interaction.
Closes ticket #90 .
2012-01-14 17:34:09 +00:00
Daniele Varrazzo
d2b67364fd
connect() supports generic keyword arguments passed to the dsn
2011-11-17 01:51:25 +00:00
Daniele Varrazzo
dde4c0de3d
Decimal adapter registration moved from C to Python
...
Fixes Decimal adaptation in sub-interpreter, where the Decimal class has
a different identity from the one in the main interpreter.
Closes ticket #52 .
2011-10-14 22:35:56 +01:00
Daniele Varrazzo
e3054ac9f3
Added new_array_type() function
...
Allows the creation of a generic array typecaster from Python.
2011-09-22 15:51:21 +01:00
Daniele Varrazzo
c8ec747903
Don't fail import if mx.DateTime module is not found at import time
...
A better fix for ticket #53 .
2011-06-04 14:16:24 +01:00
Daniele Varrazzo
531292bca5
Merge branch 'neg-escape' into devel
2011-05-30 22:09:23 +01:00
Daniele Varrazzo
281427f450
Fixed escape for negative numbers prefixed by minus operator
...
Closes ticket #57 .
2011-05-30 22:00:20 +01:00
Daniele Varrazzo
834c7d1288
Fixed a few docstrings mixed up
2011-05-11 12:59:31 +01:00
Daniele Varrazzo
beffb02d56
Stricter declaration and correct use of psyco_set_error
...
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.
2011-02-21 00:31:09 +00:00
Daniele Varrazzo
556b4d461e
Documentation cleanup
...
Added several links to the Python documentation using the 'intersphinx'
extension.
2011-02-19 16:16:28 +00:00
Daniele Varrazzo
8a08114314
Correctly handle exceptions with non-ascii chars in the message
...
Previous implementation would have barfed in canse of non-utf-8 data in
the message.
2011-02-19 14:16:53 +00:00
Daniele Varrazzo
c620f18be1
Provide cursor.description as named tuple if possible
...
If namedtuple() is not available, use regular tuples.
2011-02-19 00:05:43 +00:00
Daniele Varrazzo
b6d6fbbe8c
Use a global object for NULL
...
Small optimization as NULL is a frequent value to build.
2011-02-17 20:09:52 +00:00
Daniele Varrazzo
3ae2f221b3
Adapt bytearray and memoryview to bytes if available
2011-02-15 17:30:43 +00:00
Daniele Varrazzo
9deb16484d
Don't define a CObject API in Python 3.2
...
The API is not available: a PyCapsule should be used. Nobody seems
needing it for now.
2011-01-08 01:24:16 +00:00
Daniele Varrazzo
d3f3f1caf0
Added utility method to return a string in the connection encoding.
...
In Py2 the result is plain string, in Py3 an unicode decoded in the
connection encoding.
2010-12-31 03:18:27 +01:00
Daniele Varrazzo
cb6b52945b
The library can be compiled with Python 3.
...
Just compiled! No test run yet and many points to review, marked in the
code.
The patch is largely Martin von Löwis work, simplified after refactoring
in the previous commits and adapted to the new code (as the patch was
originally for Psycopg 2.0.9)
2010-12-21 04:24:36 +00:00
Daniele Varrazzo
7b5d80d36d
Added a few missing encodings.
...
EUC_CN, EUC_JIS_2004, ISO885910, ISO885916, LATIN10, SHIFT_JIS_2004.
2010-12-21 04:02:14 +00:00
Daniele Varrazzo
657bcb4828
Encodings mapping reordered in a more maintainable order.
2010-12-21 04:02:14 +00:00
Daniele Varrazzo
8dfa9915eb
Using Py_TYPE and Py_REFCNT macros.
2010-12-21 04:02:13 +00:00
Daniele Varrazzo
6d7916cfe1
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.
2010-12-12 13:39:32 +00:00
Daniele Varrazzo
288f9ee809
Work around CentOS 5.5 x86_64 buld problem.
...
Closes ticket #23
2010-12-04 13:51:21 +00:00
Daniele Varrazzo
163cf5bfb4
mx.DateTime module initialized as it is supposed to be.
...
No need to pass the api pointer around. Dropped compiler warnings.
2010-11-19 00:28:49 +00:00
Daniele Varrazzo
3e3aa676a9
datetime module initialized as it is supposed to be.
...
Dropped compiler warnings. It wouldn't blow up if any api was called.
No need to pass type pointers around.
2010-11-19 00:28:39 +00:00
Daniele Varrazzo
2f29429e88
Expose the Xid object in the extension module.
2010-11-05 09:34:49 +00:00
Daniele Varrazzo
0021e56d80
Added connection.xid() and related objects.
...
By James Henstridge on 2008-07-23.
Merged from lp:~jamesh/psycopg/two-phase-commit/revision/356
* psycopg/connection_type.c (psyco_conn_xid): add a
Connection.xid() method that instantiates Xid objects.
* psycopg/psycopgmodule.c (init_psycopg): initialise the Xid
object type.
* psycopg/xid.h:
* psycopg/xid_type.c: Implement a basic transaction ID object for
use in two phase commit.
2010-11-05 09:34:47 +00:00
Daniele Varrazzo
4ec298e112
Notify object exposed in the extensions module.
2010-11-05 09:34:47 +00:00
Daniele Varrazzo
f435d15c95
Adding Notify object with payload.
2010-11-05 09:34:46 +00:00
Daniele Varrazzo
8ba0f00d21
Added 'get_wait_callback()' function.
2010-04-21 15:21:32 +01:00
Daniele Varrazzo
1446f046e9
Added wait callback and functions to deal with it.
2010-04-21 15:21:32 +01:00
Daniele Varrazzo
c75ddea895
Pass the async parameter to the connection only if nonzero.
...
This avoids breaking connection subclasses redefining '__init__' (at
least when used sync, which is good for most of the people).
2010-04-05 18:31:09 +01:00
Federico Di Gregorio
34317dc4c3
Support asynchronous connection building
...
After calling psycopg2.connect(dsn, async=True) you can poll the
connection that will tell you whether its file descriptor should be
waited on to become writable or readable or that the connection
attempt has succeeded.
Edited commit by Jan to not expose internal state in extensions.py.
2010-04-05 11:30:03 +02:00
Federico Di Gregorio
192034dc38
Fixed problem with decimal.Decimal conversions
2010-02-21 01:04:00 +01:00
Daniele Varrazzo
74403ff5a8
Fixed newline in docstring.
2010-02-14 00:39:48 +01:00
Daniele Varrazzo
04db8e7428
Fixed docstring for 'QueryCanceledError' exception.
2010-02-14 00:35:48 +01:00
Federico Di Gregorio
611606d532
Changes license to LGPL3 + OpenSSL exception on all source files
2010-02-12 23:34:53 +01:00
Federico Di Gregorio
a3ce636be0
Fixed error in register_type()
2009-03-02 10:56:53 +01:00
Federico Di Gregorio
eb25f9f154
Added adapter to handle float('inf') and float('nan')
2009-01-23 00:09:20 +01:00
Federico Di Gregorio
e22451736a
register_type() now works on connection and cursor subclasses
2009-01-22 11:02:38 +01:00