aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpython.h
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2022-03-07 18:30:28 -0800
committerAndres Freund <andres@anarazel.de>2022-03-07 18:30:28 -0800
commit9b7e24a2cb37fb52af13219f625cd719e364a346 (patch)
treec35fe718f0a8d8723631b5759a47e37bfb6f7fbf /src/pl/plpython/plpython.h
parentdb23464715f4792298c639153dda7bfd9ad9d602 (diff)
downloadpostgresql-9b7e24a2cb37fb52af13219f625cd719e364a346.tar.gz
postgresql-9b7e24a2cb37fb52af13219f625cd719e364a346.zip
plpython: Code cleanup related to removal of Python 2 support.
Since 19252e8ec93 we reject Python 2 during build configuration. Now that the dust on the buildfarm has settled, remove Python 2 specific code, including the "Python 2/3 porting layer". The code to detect conflicts between plpython using Python 2 and 3 is not removed, in case somebody creates an out-of-tree version adding back support for Python 2. Reviewed-By: Peter Eisentraut <peter@eisentraut.org> Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20211031184548.g4sxfe47n2kyi55r@alap3.anarazel.de
Diffstat (limited to 'src/pl/plpython/plpython.h')
-rw-r--r--src/pl/plpython/plpython.h34
1 files changed, 1 insertions, 33 deletions
diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h
index 05e4362dab9..2a0c9bf0361 100644
--- a/src/pl/plpython/plpython.h
+++ b/src/pl/plpython/plpython.h
@@ -59,37 +59,6 @@
#include <Python.h>
#endif
-/*
- * Python 2/3 strings/unicode/bytes handling. Python 2 has strings
- * and unicode, Python 3 has strings, which are unicode on the C
- * level, and bytes. The porting convention, which is similarly used
- * in Python 2.6, is that "Unicode" is always unicode, and "Bytes" are
- * bytes in Python 3 and strings in Python 2. Since we keep
- * supporting Python 2 and its usual strings, we provide a
- * compatibility layer for Python 3 that when asked to convert a C
- * string to a Python string it converts the C string from the
- * PostgreSQL server encoding to a Python Unicode object.
- */
-#if PY_MAJOR_VERSION >= 3
-#define PyString_Check(x) 0
-#define PyString_AsString(x) PLyUnicode_AsString(x)
-#define PyString_FromString(x) PLyUnicode_FromString(x)
-#define PyString_FromStringAndSize(x, size) PLyUnicode_FromStringAndSize(x, size)
-#endif
-
-/*
- * Python 3 only has long.
- */
-#if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong(x) PyLong_FromLong(x)
-#define PyInt_AsLong(x) PyLong_AsLong(x)
-#endif
-
-/* Python 3 removed the Py_TPFLAGS_HAVE_ITER flag */
-#if PY_MAJOR_VERSION >= 3
-#define Py_TPFLAGS_HAVE_ITER 0
-#endif
-
/* define our text domain for translations */
#undef TEXTDOMAIN
#define TEXTDOMAIN PG_TEXTDOMAIN("plpython")
@@ -130,8 +99,7 @@
#define printf(...) pg_printf(__VA_ARGS__)
/*
- * Used throughout, and also by the Python 2/3 porting layer, so it's easier to
- * just include it everywhere.
+ * Used throughout, so it's easier to just include it everywhere.
*/
#include "plpy_util.h"