From abf2723c0a9d89740b433bf49b82ad765e87d5d4 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 3 Oct 2023 11:25:15 +0200 Subject: [PATCH] chore: drop support for Python 3.6 --- NEWS | 6 ++++++ doc/src/install.rst | 2 +- psycopg/python.h | 4 ++-- psycopg/typecast_datetime.c | 20 -------------------- scripts/build/appveyor.py | 3 +-- setup.py | 3 +-- tox.ini | 2 +- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index 29d922ff..6cf72820 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ Current release --------------- +What's new in psycopg 2.9.9 +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- Drop support for Python 3.6. + + What's new in psycopg 2.9.8 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/src/install.rst b/doc/src/install.rst index 76748cb3..967d09aa 100644 --- a/doc/src/install.rst +++ b/doc/src/install.rst @@ -131,7 +131,7 @@ The current `!psycopg2` implementation supports: .. 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 client library version from 9.1 diff --git a/psycopg/python.h b/psycopg/python.h index 491d285f..37de2316 100644 --- a/psycopg/python.h +++ b/psycopg/python.h @@ -27,8 +27,8 @@ #ifndef PSYCOPG_PYTHON_H #define PSYCOPG_PYTHON_H 1 -#if PY_VERSION_HEX < 0x03060000 -#error "psycopg requires Python 3.6" +#if PY_VERSION_HEX < 0x03070000 +#error "psycopg requires Python 3.7" #endif #include diff --git a/psycopg/typecast_datetime.c b/psycopg/typecast_datetime.c index b105a4c4..f601a540 100644 --- a/psycopg/typecast_datetime.c +++ b/psycopg/typecast_datetime.c @@ -103,18 +103,8 @@ _parse_inftz(const char *str, PyObject *curs) 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; Py_INCREF(tzinfo); -#endif /* m.replace(tzinfo=tzinfo) */ 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 */ 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 (!(tzinfo = PyObject_CallFunctionObjArgs( 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 */ 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 (!(tzinfo = PyObject_CallFunctionObjArgs(tzinfo_factory, tzoff, NULL))) { goto exit; diff --git a/scripts/build/appveyor.py b/scripts/build/appveyor.py index 1196c99b..5c7cd591 100755 --- a/scripts/build/appveyor.py +++ b/scripts/build/appveyor.py @@ -660,7 +660,7 @@ class Options: For large values of 2, occasionally. """ 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 @property @@ -742,7 +742,6 @@ class Options: # Py 3.6--3.8 = VS Ver. 14.0 (VS 2015) # Py 3.9 = VS Ver. 16.0 (VS 2019) vsvers = { - '36': '14.0', '37': '14.0', '38': '14.0', '39': '16.0', diff --git a/setup.py b/setup.py index 16d20f4a..4e9f1698 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,6 @@ Intended Audience :: Developers License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Programming Language :: Python Programming Language :: Python :: 3 -Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -551,7 +550,7 @@ setup(name="psycopg2", url="https://psycopg.org/", license="LGPL with exceptions", platforms=["any"], - python_requires='>=3.6', + python_requires='>=3.7', description=readme.split("\n")[0], long_description="\n".join(readme.split("\n")[2:]).lstrip(), classifiers=[x for x in classifiers.split("\n") if x], diff --git a/tox.ini b/tox.ini index 26755273..bfb01684 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [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] commands = make check