Commit Graph

2584 Commits

Author SHA1 Message Date
Daniele Varrazzo
d177fa9bd0 Allow building docs with Python 3
Use a .pth file to simplify finding the just-built psycopg package into the
docs building env.
2019-02-17 01:36:36 +00:00
Daniele Varrazzo
63ce5ca94f Fixed title level of sqlsate errors table in docs 2019-02-17 01:07:47 +00:00
Daniele Varrazzo
f70d6fd0ed Dropped text docs generation 2019-02-17 00:58:27 +00:00
Daniele Varrazzo
e5e8cec350 Added table of sqlstate exceptions in the docs
Note that the column-spanning cells break text docs. I don't think
anybody cares about them, so going to drop them.
2019-02-17 01:55:14 +01:00
Daniele Varrazzo
d08be18671 Merge branch 'libpq-ptrs' 2019-02-17 00:17:43 +01:00
Daniele Varrazzo
6bbfce7b89 Skip password encryption test if libpq < 10 2019-02-16 22:57:16 +01:00
Daniele Varrazzo
80b7b845d2 Added docs about pgconn_ptr, pgresult_ptr 2019-02-16 18:12:52 +01:00
Daniele Varrazzo
3b7c083c3d Skip tests involving ctypes on Windows
No idea about how to import libpq.
2019-02-16 18:12:52 +01:00
Daniele Varrazzo
7c7bbb9742 Added connection.pgconn_ptr and cursor.pgresult_ptr
Allow interacting with libpq in Python via ctypes.

See #782.
2019-02-16 18:12:52 +01:00
Daniele Varrazzo
1dd8c7435f Mention binary packages no longer installed by default in NEWS
Also fixed an unrelated typo.

[skip ci]
2019-02-16 16:10:03 +01:00
Daniele Varrazzo
495ff79f23 Preparing 2.8 beta release 2019-02-16 14:06:18 +01:00
Daniele Varrazzo
16b35ac77b Merge remote-tracking branch 'origin/errors-module-c' 2019-02-16 13:05:20 +01:00
Daniele Varrazzo
7c148ecee4 Improvements to errors module docs 2019-02-11 01:20:21 +00:00
Daniele Varrazzo
3de4d17519 Fixed use of StandardError in test
In Py3 it's gone.
2019-02-11 00:26:01 +00:00
Daniele Varrazzo
99f680b6fe Allow importing _psycopg even if the 'errors' module is not available 2019-02-10 04:25:06 +00:00
Daniele Varrazzo
30c1befa64 SQLSTATE error classes implemented in C
The module is only used to export them to Python.
2019-02-10 03:45:14 +00:00
Daniele Varrazzo
f1e73507d0 Merge remote-tracking branch 'origin/fast-namedtuple'
Close #838
2019-02-06 02:42:10 +00:00
Daniele Varrazzo
35ec7ad9c1 Use a proper LRU cache for namedtuples
Previous one didn't refresh by last use. Use the stdlib version for py3
and one of our own for py2.

Max size set to 512, which should be fine for everyone (tweaking is
still possible by monkeypatching, as the tests do, but I don't want to
make an interface of it).
2019-02-02 19:29:20 +00:00
Daniele Varrazzo
805527fcd6 Added caching of types generated by NamedTupleCursor
see #838
2019-02-02 14:22:25 +00:00
Daniele Varrazzo
3f20f7934a Merge branch 'drop-display-size' 2019-01-25 17:31:55 +00:00
Daniele Varrazzo
4298718978 Dropped PSYCOPG_DISPLAY_SIZE build parameter
Big and complex _pq_fetch_tuples simplified by moving per-column
calculation to a separate function.
2019-01-25 17:31:39 +00:00
Daniele Varrazzo
00cb2636f5 Merge branch 'module-init-cleanup' 2019-01-23 14:17:07 +00:00
Daniele Varrazzo
65a2a18a1b General cleanup of module init shenanigans
Pass around the module instead of its dict (getting the latter is fast
if needed), mark function raising with negative results, check all errors,
consistent names...
2019-01-23 09:46:18 +00:00
Daniele Varrazzo
66d5c6da07 Incref an object which will be held forever in a static var 2019-01-23 09:46:18 +00:00
Daniele Varrazzo
e9c476266c Decrement the refcount of temporary objects in module init failed
We are going to die anyway, but let's do it in style.
2019-01-22 19:40:42 +00:00
Daniele Varrazzo
63040e5134 Mention new OpenSSL version in wheel package 2019-01-22 12:25:03 +00:00
Daniele Varrazzo
1e6d5fb32d Merge branch 'execute-locks' 2019-01-22 12:24:41 +00:00
Daniele Varrazzo
c34c99aa7f Mention cursor locks cleanup in news file 2019-01-22 11:20:36 +00:00
Daniele Varrazzo
92e615a1a4 Assign the PGresult to the cursor in the execute critical section
Possible cause of the issue reported in #346 (in concurrent
environments).
2019-01-22 11:02:09 +00:00
Daniele Varrazzo
37891500d9 Split pq_execute into sync/async parts 2019-01-22 10:51:27 +00:00
Daniele Varrazzo
eab5d5d93f Date/time modules initialized in separate functions 2019-01-22 09:09:07 +00:00
Daniele Varrazzo
111a71ccee Dropped psyco_errors_fill()
Just use psyco_errors_init() for complete errors initialization
2019-01-21 20:18:53 +00:00
Daniele Varrazzo
1839806c3c Dropped project wide type to define encodings table 2019-01-21 20:18:53 +00:00
Daniele Varrazzo
8f17ccf784 Dropped C API interface
I guess it was unused as it only contained two init functions. The
Capsule should do things better now I guess.
2019-01-21 20:18:53 +00:00
Daniele Varrazzo
7b2e8f0aa4 Respect refcount with PyModule_AddObject()
The function steals a ref. The module is never destroyed so things work
fine but the refcount is wrong.
2019-01-21 20:18:53 +00:00
Daniele Varrazzo
549beeea84 Module constants definition moved in a separate function for clarity 2019-01-21 20:18:53 +00:00
Daniele Varrazzo
4246fdf809 Merge remote-tracking branch 'origin/code-cleanup' 2019-01-21 12:49:05 +00:00
Daniele Varrazzo
e67028f4bc Handle failed allocation in list adaptation 2019-01-21 02:49:38 +00:00
Daniele Varrazzo
7a3bce8fc3 Dropped funny handling of REPLICATION_* constants 2019-01-21 02:49:38 +00:00
Daniele Varrazzo
c77615adc9 _psyco_curs_execute() simplified
Dropped code duplications, more regular increc/decref pattern.

Check the return value of formatting named cursor: would have segfaulted
in case of error.
2019-01-21 02:49:38 +00:00
Daniele Varrazzo
594df09a63 More straightforward semantics for psyco_GetDecimalType
Raise an exception when returning NULL, leave the caller cleaning it.
2019-01-21 02:41:58 +00:00
Daniele Varrazzo
2ad2b27065 Dropped use of converter function to verify copy argument
They weren't really converters, and they confused the static checker
2019-01-21 02:41:58 +00:00
Daniele Varrazzo
3768d9047d Mark psyco_set_error as returning a borrowed object 2019-01-21 02:41:58 +00:00
Daniele Varrazzo
7a1fb9a2e4 Added utils.h file
utils.c functions definition moved out of psycopg.h

Some utility functions defined into psycopgmodule.c moved into utils.c.
2019-01-21 02:41:58 +00:00
Daniele Varrazzo
daff2ea1be Mark setter as raising on negative results
Fixed static check of psyco_conn_cursor().
2019-01-21 02:41:58 +00:00
Daniele Varrazzo
4644715164 Consider the case dereferencing weakref in conn_poll returns NULL
It shouldn't but handle the case to avoid a possible null pointer
dereferencing.
2019-01-21 02:41:58 +00:00
Daniele Varrazzo
5b28d7b9c9 Dropped possible wrong code path in conn_decode
It shouldn't happen for both cdecoder and pydecoder to be null,
but just in case...
2019-01-21 02:41:58 +00:00
Daniele Varrazzo
117f7d33f8 Wrap _Bytes_Resize into a function with clearer semantic
Limit the static checker hacking to a simpler function.
2019-01-21 02:00:04 +00:00
Daniele Varrazzo
f9b798aca9 Avoid unlikely leaks in case of memory errors in Bytes_Format 2019-01-21 02:00:04 +00:00
Daniele Varrazzo
2a05aa2c43 Move var setting into the only case using it
The original function was more complex than this. This refactoring
avoids a false positive in the static checker
2019-01-21 02:00:04 +00:00