Skip to content

Commit 37f21ed

Browse files
committed
Remove support for Python older than 2.6
Supporting very old Python versions is a maintenance burden, especially with the several variant test files to maintain for Python <2.6. Since we have dropped support for older OpenSSL versions in 7b283d0, RHEL 5 is now effectively desupported, and that was also the only mainstream operating system still using Python versions before 2.6, so it's a good time to drop those as well. Reviewed-by: Tom Lane <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/98b69261-298c-13d2-f34d-836fd9c29b21%402ndquadrant.com
1 parent f5d2871 commit 37f21ed

12 files changed

+7
-1503
lines changed

config/python.m4

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ python_majorversion=`echo "$python_fullversion" | sed '[s/^\([0-9]*\).*/\1/]'`
3737
python_minorversion=`echo "$python_fullversion" | sed '[s/^[0-9]*\.\([0-9]*\).*/\1/]'`
3838
python_version=`echo "$python_fullversion" | sed '[s/^\([0-9]*\.[0-9]*\).*/\1/]'`
3939
# Reject unsupported Python versions as soon as practical.
40-
if test "$python_majorversion" -lt 3 -a "$python_minorversion" -lt 4; then
41-
AC_MSG_ERROR([Python version $python_version is too old (version 2.4 or later is required)])
40+
if test "$python_majorversion" -lt 3 -a "$python_minorversion" -lt 6; then
41+
AC_MSG_ERROR([Python version $python_version is too old (version 2.6 or later is required)])
4242
fi
4343
4444
AC_MSG_CHECKING([for Python distutils module])

configure

+2-2
Original file line numberDiff line numberDiff line change
@@ -9616,8 +9616,8 @@ python_majorversion=`echo "$python_fullversion" | sed 's/^\([0-9]*\).*/\1/'`
96169616
python_minorversion=`echo "$python_fullversion" | sed 's/^[0-9]*\.\([0-9]*\).*/\1/'`
96179617
python_version=`echo "$python_fullversion" | sed 's/^\([0-9]*\.[0-9]*\).*/\1/'`
96189618
# Reject unsupported Python versions as soon as practical.
9619-
if test "$python_majorversion" -lt 3 -a "$python_minorversion" -lt 4; then
9620-
as_fn_error $? "Python version $python_version is too old (version 2.4 or later is required)" "$LINENO" 5
9619+
if test "$python_majorversion" -lt 3 -a "$python_minorversion" -lt 6; then
9620+
as_fn_error $? "Python version $python_version is too old (version 2.6 or later is required)" "$LINENO" 5
96219621
fi
96229622

96239623
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python distutils module" >&5

doc/src/sgml/installation.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ su - postgres
196196
language, you need a <productname>Python</productname>
197197
installation with the header files and
198198
the <application>distutils</application> module. The minimum
199-
required version is <productname>Python</productname> 2.4.
199+
required version is <productname>Python</productname> 2.6.
200200
<productname>Python 3</productname> is supported if it's
201201
version 3.1 or later; but see
202202
<xref linkend="plpython-python23"/>

doc/src/sgml/plpython.sgml

+2-14
Original file line numberDiff line numberDiff line change
@@ -1335,9 +1335,8 @@ $$ LANGUAGE plpythonu;
13351335

13361336
<para>
13371337
Context managers syntax using the <literal>with</literal> keyword
1338-
is available by default in Python 2.6. If using PL/Python with an
1339-
older Python version, it is still possible to use explicit
1340-
subtransactions, although not as transparently. You can call the
1338+
is available by default in Python 2.6. For compatibility with
1339+
older Python versions, you can call the
13411340
subtransaction manager's <literal>__enter__</literal> and
13421341
<literal>__exit__</literal> functions using the
13431342
<literal>enter</literal> and <literal>exit</literal> convenience
@@ -1367,17 +1366,6 @@ plpy.execute(plan, [result])
13671366
$$ LANGUAGE plpythonu;
13681367
</programlisting>
13691368
</para>
1370-
1371-
<note>
1372-
<para>
1373-
Although context managers were implemented in Python 2.5, to use
1374-
the <literal>with</literal> syntax in that version you need to
1375-
use a <ulink
1376-
url="https://docs.python.org/release/2.5/ref/future.html">future
1377-
statement</ulink>. Because of implementation details, however,
1378-
you cannot use future statements in PL/Python functions.
1379-
</para>
1380-
</note>
13811369
</sect2>
13821370
</sect1>
13831371

src/pl/plpython/expected/README

-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
Guide to alternative expected files:
22

3-
plpython_error_0.out Python 2.4 and older
43
plpython_error_5.out Python 3.5 and newer
54

65
plpython_unicode.out server encoding != SQL_ASCII
76
plpython_unicode_3.out server encoding == SQL_ASCII
87

9-
plpython_subtransaction_0.out Python 2.4 and older (without with statement)
10-
plpython_subtransaction_5.out Python 2.5 (without with statement)
11-
128
plpython_types_3.out Python 3.x

0 commit comments

Comments
 (0)