From 796d1e889f2b5f88b33a425fdfd08d7906cbd66a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 11 Jan 2016 20:13:31 -0500 Subject: [PATCH] Remove no-longer-needed old-style check for incompatible plpythons. Commit 866566a690bb9916 introduced a new mechanism for incompatible plpythons to detect each other. I left the old mechanism in place, because it seems possible that a plpython predating that commit might be used with one postdating it. (This would require updating plpython3 but not plpython2 or vice versa, but that seems well within the realm of possibility.) However, surely it will not be able to happen in 9.6 or later, so we can delete the old mechanism in HEAD. --- src/pl/plpython/plpy_main.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index 922ce57d10..f95039406a 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -66,7 +66,6 @@ static void PLy_pop_execution_context(void); /* static state for Python library conflict detection */ static int *plpython_version_bitmask_ptr = NULL; static int plpython_version_bitmask = 0; -static const int plpython_python_version = PY_MAJOR_VERSION; /* initialize global variables */ PyObject *PLy_interp_globals = NULL; @@ -79,7 +78,6 @@ void _PG_init(void) { int **bitmask_ptr; - const int **version_ptr; /* * Set up a shared bitmask variable telling which Python version(s) are @@ -99,33 +97,10 @@ _PG_init(void) /* * This should be safe even in the presence of conflicting plpythons, and - * it's necessary to do it here for the next error to be localized. + * it's necessary to do it before possibly throwing a conflict error, or + * the error message won't get localized. */ pg_bindtextdomain(TEXTDOMAIN); - - /* - * We used to have a scheme whereby PL/Python would fail immediately if - * loaded into a session in which a conflicting libpython is already - * present. We don't like to do that anymore, but it seems possible that - * a plpython library adhering to the old convention is present in the - * session, in which case we have to fail. We detect an old library if - * plpython_python_version is already defined but the indicated version - * isn't reflected in plpython_version_bitmask. Otherwise, set the - * variable so that the right thing happens if an old library is loaded - * later. - */ - version_ptr = (const int **) find_rendezvous_variable("plpython_python_version"); - if (!(*version_ptr)) - *version_ptr = &plpython_python_version; - else - { - if ((*plpython_version_bitmask_ptr & (1 << **version_ptr)) == 0) - ereport(FATAL, - (errmsg("Python major version mismatch in session"), - errdetail("This session has previously used Python major version %d, and it is now attempting to use Python major version %d.", - **version_ptr, plpython_python_version), - errhint("Start a new session to use a different Python major version."))); - } } /*