chore: drop support for Python 3.6

This commit is contained in:
Daniele Varrazzo 2023-10-03 11:25:15 +02:00
parent 2da65a715c
commit abf2723c0a
7 changed files with 12 additions and 28 deletions

6
NEWS
View File

@ -1,6 +1,12 @@
Current release Current release
--------------- ---------------
What's new in psycopg 2.9.9
^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Drop support for Python 3.6.
What's new in psycopg 2.9.8 What's new in psycopg 2.9.8
^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -131,7 +131,7 @@ The current `!psycopg2` implementation supports:
.. ..
NOTE: keep consistent with setup.py and the /features/ page. NOTE: keep consistent with setup.py and the /features/ page.
- Python versions from 3.6 to 3.11 - Python versions from 3.7 to 3.11
- PostgreSQL server versions from 7.4 to 15 - PostgreSQL server versions from 7.4 to 15
- PostgreSQL client library version from 9.1 - PostgreSQL client library version from 9.1

View File

@ -27,8 +27,8 @@
#ifndef PSYCOPG_PYTHON_H #ifndef PSYCOPG_PYTHON_H
#define PSYCOPG_PYTHON_H 1 #define PSYCOPG_PYTHON_H 1
#if PY_VERSION_HEX < 0x03060000 #if PY_VERSION_HEX < 0x03070000
#error "psycopg requires Python 3.6" #error "psycopg requires Python 3.7"
#endif #endif
#include <structmember.h> #include <structmember.h>

View File

@ -103,18 +103,8 @@ _parse_inftz(const char *str, PyObject *curs)
goto exit; goto exit;
} }
#if defined(PYPY_VERSION) || PY_VERSION_HEX < 0x03070000
{
PyObject *tzoff;
if (!(tzoff = PyDelta_FromDSU(0, 0, 0))) { goto exit; }
tzinfo = PyObject_CallFunctionObjArgs(tzinfo_factory, tzoff, NULL);
Py_DECREF(tzoff);
if (!tzinfo) { goto exit; }
}
#else
tzinfo = PyDateTime_TimeZone_UTC; tzinfo = PyDateTime_TimeZone_UTC;
Py_INCREF(tzinfo); Py_INCREF(tzinfo);
#endif
/* m.replace(tzinfo=tzinfo) */ /* m.replace(tzinfo=tzinfo) */
if (!(args = PyTuple_New(0))) { goto exit; } if (!(args = PyTuple_New(0))) { goto exit; }
@ -178,11 +168,6 @@ _parse_noninftz(const char *str, Py_ssize_t len, PyObject *curs)
appropriate tzinfo object calling the factory */ appropriate tzinfo object calling the factory */
Dprintf("typecast_PYDATETIMETZ_cast: UTC offset = %ds", tzsec); Dprintf("typecast_PYDATETIMETZ_cast: UTC offset = %ds", tzsec);
#if PY_VERSION_HEX < 0x03070000
/* Before Python 3.7 the timezone offset had to be a whole number
* of minutes, so round the seconds to the closest minute */
tzsec = 60 * (int)round(tzsec / 60.0);
#endif
if (!(tzoff = PyDelta_FromDSU(0, tzsec, 0))) { goto exit; } if (!(tzoff = PyDelta_FromDSU(0, tzsec, 0))) { goto exit; }
if (!(tzinfo = PyObject_CallFunctionObjArgs( if (!(tzinfo = PyObject_CallFunctionObjArgs(
tzinfo_factory, tzoff, NULL))) { tzinfo_factory, tzoff, NULL))) {
@ -270,11 +255,6 @@ typecast_PYTIME_cast(const char *str, Py_ssize_t len, PyObject *curs)
appropriate tzinfo object calling the factory */ appropriate tzinfo object calling the factory */
Dprintf("typecast_PYTIME_cast: UTC offset = %ds", tzsec); Dprintf("typecast_PYTIME_cast: UTC offset = %ds", tzsec);
#if PY_VERSION_HEX < 0x03070000
/* Before Python 3.7 the timezone offset had to be a whole number
* of minutes, so round the seconds to the closest minute */
tzsec = 60 * (int)round(tzsec / 60.0);
#endif
if (!(tzoff = PyDelta_FromDSU(0, tzsec, 0))) { goto exit; } if (!(tzoff = PyDelta_FromDSU(0, tzsec, 0))) { goto exit; }
if (!(tzinfo = PyObject_CallFunctionObjArgs(tzinfo_factory, tzoff, NULL))) { if (!(tzinfo = PyObject_CallFunctionObjArgs(tzinfo_factory, tzoff, NULL))) {
goto exit; goto exit;

View File

@ -660,7 +660,7 @@ class Options:
For large values of 2, occasionally. For large values of 2, occasionally.
""" """
rv = os.environ['PY_VER'] rv = os.environ['PY_VER']
assert rv in ('36', '37', '38', '39', '310', '311'), rv assert rv in ('37', '38', '39', '310', '311'), rv
return rv return rv
@property @property
@ -742,7 +742,6 @@ class Options:
# Py 3.6--3.8 = VS Ver. 14.0 (VS 2015) # Py 3.6--3.8 = VS Ver. 14.0 (VS 2015)
# Py 3.9 = VS Ver. 16.0 (VS 2019) # Py 3.9 = VS Ver. 16.0 (VS 2019)
vsvers = { vsvers = {
'36': '14.0',
'37': '14.0', '37': '14.0',
'38': '14.0', '38': '14.0',
'39': '16.0', '39': '16.0',

View File

@ -52,7 +52,6 @@ Intended Audience :: Developers
License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 3 Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.9
@ -551,7 +550,7 @@ setup(name="psycopg2",
url="https://psycopg.org/", url="https://psycopg.org/",
license="LGPL with exceptions", license="LGPL with exceptions",
platforms=["any"], platforms=["any"],
python_requires='>=3.6', python_requires='>=3.7',
description=readme.split("\n")[0], description=readme.split("\n")[0],
long_description="\n".join(readme.split("\n")[2:]).lstrip(), long_description="\n".join(readme.split("\n")[2:]).lstrip(),
classifiers=[x for x in classifiers.split("\n") if x], classifiers=[x for x in classifiers.split("\n") if x],

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = {3.6,3.7,3.8,3.9,3.10,3.11} envlist = {3.7,3.8,3.9,3.10,3.11}
[testenv] [testenv]
commands = make check commands = make check