Commit Graph

3061 Commits

Author SHA1 Message Date
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
Daniele Varrazzo
43d779966b Avoid using PyErr_BadInternalCall as the static checker doesn't get it 2019-01-21 02:00:04 +00:00
Daniele Varrazzo
003fc6dde1 Use the real definition of Py_LOCAL_INLINE 2019-01-21 02:00:04 +00:00
Daniele Varrazzo
fe915ac461 Bytes_Format: use a couple of macros instead of functions
The type was already checked upstream in the func body.
2019-01-21 02:00:04 +00:00
Daniele Varrazzo
15cba69a20 psycopg_escape_string: don't make me cringe
Just reformatted.
2019-01-21 02:00:04 +00:00
Daniele Varrazzo
79de02d7d5 Stricter use of PyArg_ParseTuple typed objects
The function expect PyObject *, not subclasses.
2019-01-21 02:00:04 +00:00
Daniele Varrazzo
3e66022912 Respect PyCFunction signature in METH_NOARGS functions
A second parameter does exist, although it's always NULL.
2019-01-21 02:00:04 +00:00
Daniele Varrazzo
5b08dc45b1 Merge remote-tracking branch 'origin/register-bytes'
Close #835
2019-01-19 15:32:46 +00:00
Daniele Varrazzo
49777de74c Added documentation for BYTES caster 2019-01-18 16:15:15 +00:00
Daniele Varrazzo
ddbe495d70 Added BYTESARRAY typecaster 2019-01-18 15:47:01 +00:00
Daniele Varrazzo
4ab4247189 Added test for BYTES typecaster 2019-01-18 15:10:17 +00:00
Daniele Varrazzo
fd31a7d41b Fixed typecast definition order
Didn't notice that the order matter: the last typecaster registered is
the effective one so let STRING win over UNICODE and BYTES.
2019-01-18 15:09:20 +00:00
Daniele Varrazzo
f713dc9fc1 Preliminary test for a BYTES adapter.
Allow returning unparsed bytes from databases with mixed encodings. See
issue #519.
2019-01-18 13:17:02 +00:00
Daniele Varrazzo
4a41c9a8cc
Merge pull request #828 from wbolster/patch-1
mention postgresql 11 in install docs
2019-01-08 12:21:18 +00:00
Daniele Varrazzo
07d9fb8718 Don't call CLEARPGRES on the cursor state without holding the gil
There is a chance it is executed by two different threads resulting in
issue #384.

I havent't found any other case that may lead to double free.
2019-01-02 13:15:00 +01:00
Daniele Varrazzo
ddcf808d56 Couple of objects into NEWS entries converted into links 2018-12-27 15:04:43 +01:00
Daniele Varrazzo
b26a0b149d Added # char to a few issues in news
Just a formatting thing #ocd #youdontcare #really.
2018-12-27 15:01:45 +01:00
Daniele Varrazzo
f3695e36c7 Merge remote-tracking branch 'eternalflow/execute-values-returning-clause-support' 2018-12-27 14:53:12 +01:00
Daniele Varrazzo
7c8d2f484e Mention execute_values() fetch in news 2018-12-27 14:51:18 +01:00
Daniele Varrazzo
bde9fc6dea Docs wordsmith for execute_values() fetch param 2018-12-27 14:42:58 +01:00
Daniele Varrazzo
6fdac46137 Some harmless adjustments in execute_values() code
No optional result, and create the list only if requred.
2018-12-27 14:39:13 +01:00
wouter bolsterlee
107f779061
mention postgresql 11 in install docs 2018-12-07 15:10:18 +01:00
Daniele Varrazzo
25fc044d13
Merge pull request #823 from jdufresne/dep-pool
Dropped deprecated PersistentConnectionPool
2018-12-05 11:32:20 +00:00
Daniele Varrazzo
de79aba66d
Merge pull request #819 from jdufresne/ctypes
Remove unnecessary test decorator 'skip_if_cant_cast'
2018-12-05 11:30:48 +00:00