mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-15 05:26:37 +03:00
Merge branch 'datetime-macro-accessors' into maint_2_7
This commit is contained in:
commit
bf58f3b194
1
NEWS
1
NEWS
|
@ -11,6 +11,7 @@ What's new in psycopg 2.7.4
|
|||
(:ticket:`632`).
|
||||
- Fixed `~cursor.rowcount` after `~cursor.executemany()` with :sql:`RETURNING` statements
|
||||
(:ticket:`633`).
|
||||
- Fixed compatibility problem with pypy3 (:ticket:`#649`).
|
||||
- Wheel packages compiled against PostgreSQL 10.1 libpq and OpenSSL 1.0.2m.
|
||||
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ _pydatetime_string_delta(pydatetimeObject *self)
|
|||
|
||||
char buffer[8];
|
||||
int i;
|
||||
int a = obj->microseconds;
|
||||
int a = PyDateTime_DELTA_GET_MICROSECONDS(obj);
|
||||
|
||||
for (i=0; i < 6 ; i++) {
|
||||
buffer[5-i] = '0' + (a % 10);
|
||||
|
@ -109,7 +109,9 @@ _pydatetime_string_delta(pydatetimeObject *self)
|
|||
buffer[6] = '\0';
|
||||
|
||||
return Bytes_FromFormat("'%d days %d.%s seconds'::interval",
|
||||
obj->days, obj->seconds, buffer);
|
||||
PyDateTime_DELTA_GET_DAYS(obj),
|
||||
PyDateTime_DELTA_GET_SECONDS(obj),
|
||||
buffer);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
@ -93,6 +93,7 @@ typedef unsigned long Py_uhash_t;
|
|||
#ifndef PyNumber_Int
|
||||
#define PyNumber_Int PyNumber_Long
|
||||
#endif
|
||||
|
||||
#endif /* PY_MAJOR_VERSION > 2 */
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
|
@ -128,6 +129,12 @@ typedef unsigned long Py_uhash_t;
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef PyDateTime_DELTA_GET_DAYS
|
||||
#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days)
|
||||
#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds)
|
||||
#define PyDateTime_DELTA_GET_MICROSECONDS(o) (((PyDateTime_Delta*)o)->microseconds)
|
||||
#endif
|
||||
|
||||
HIDDEN PyObject *Bytes_Format(PyObject *format, PyObject *args);
|
||||
|
||||
/* Mangle the module name into the name of the module init function */
|
||||
|
|
Loading…
Reference in New Issue
Block a user