aboutsummaryrefslogtreecommitdiff
path: root/contrib/ltree_plpython/ltree_plpython.c
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 /contrib/ltree_plpython/ltree_plpython.c
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 'contrib/ltree_plpython/ltree_plpython.c')
-rw-r--r--contrib/ltree_plpython/ltree_plpython.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/contrib/ltree_plpython/ltree_plpython.c b/contrib/ltree_plpython/ltree_plpython.c
index 1570e77dd9f..7431a1150a9 100644
--- a/contrib/ltree_plpython/ltree_plpython.c
+++ b/contrib/ltree_plpython/ltree_plpython.c
@@ -9,10 +9,8 @@ PG_MODULE_MAGIC;
extern void _PG_init(void);
/* Linkage to functions in plpython module */
-#if PY_MAJOR_VERSION >= 3
typedef PyObject *(*PLyUnicode_FromStringAndSize_t) (const char *s, Py_ssize_t size);
static PLyUnicode_FromStringAndSize_t PLyUnicode_FromStringAndSize_p;
-#endif
/*
@@ -22,12 +20,10 @@ void
_PG_init(void)
{
/* Asserts verify that typedefs above match original declarations */
-#if PY_MAJOR_VERSION >= 3
AssertVariableIsOfType(&PLyUnicode_FromStringAndSize, PLyUnicode_FromStringAndSize_t);
PLyUnicode_FromStringAndSize_p = (PLyUnicode_FromStringAndSize_t)
load_external_function("$libdir/" PLPYTHON_LIBNAME, "PLyUnicode_FromStringAndSize",
true, NULL);
-#endif
}
@@ -54,7 +50,7 @@ ltree_to_plpython(PG_FUNCTION_ARGS)
curlevel = LTREE_FIRST(in);
for (i = 0; i < in->numlevel; i++)
{
- PyList_SetItem(list, i, PyString_FromStringAndSize(curlevel->name, curlevel->len));
+ PyList_SetItem(list, i, PLyUnicode_FromStringAndSize(curlevel->name, curlevel->len));
curlevel = LEVEL_NEXT(curlevel);
}