Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 796d1e8

Browse files
committed
Remove no-longer-needed old-style check for incompatible plpythons.
Commit 866566a 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.
1 parent fb6fcbd commit 796d1e8

File tree

1 file changed

+2
-27
lines changed

1 file changed

+2
-27
lines changed

src/pl/plpython/plpy_main.c

+2-27
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ static void PLy_pop_execution_context(void);
6666
/* static state for Python library conflict detection */
6767
static int *plpython_version_bitmask_ptr = NULL;
6868
static int plpython_version_bitmask = 0;
69-
static const int plpython_python_version = PY_MAJOR_VERSION;
7069

7170
/* initialize global variables */
7271
PyObject *PLy_interp_globals = NULL;
@@ -79,7 +78,6 @@ void
7978
_PG_init(void)
8079
{
8180
int **bitmask_ptr;
82-
const int **version_ptr;
8381

8482
/*
8583
* Set up a shared bitmask variable telling which Python version(s) are
@@ -99,33 +97,10 @@ _PG_init(void)
9997

10098
/*
10199
* This should be safe even in the presence of conflicting plpythons, and
102-
* it's necessary to do it here for the next error to be localized.
100+
* it's necessary to do it before possibly throwing a conflict error, or
101+
* the error message won't get localized.
103102
*/
104103
pg_bindtextdomain(TEXTDOMAIN);
105-
106-
/*
107-
* We used to have a scheme whereby PL/Python would fail immediately if
108-
* loaded into a session in which a conflicting libpython is already
109-
* present. We don't like to do that anymore, but it seems possible that
110-
* a plpython library adhering to the old convention is present in the
111-
* session, in which case we have to fail. We detect an old library if
112-
* plpython_python_version is already defined but the indicated version
113-
* isn't reflected in plpython_version_bitmask. Otherwise, set the
114-
* variable so that the right thing happens if an old library is loaded
115-
* later.
116-
*/
117-
version_ptr = (const int **) find_rendezvous_variable("plpython_python_version");
118-
if (!(*version_ptr))
119-
*version_ptr = &plpython_python_version;
120-
else
121-
{
122-
if ((*plpython_version_bitmask_ptr & (1 << **version_ptr)) == 0)
123-
ereport(FATAL,
124-
(errmsg("Python major version mismatch in session"),
125-
errdetail("This session has previously used Python major version %d, and it is now attempting to use Python major version %d.",
126-
**version_ptr, plpython_python_version),
127-
errhint("Start a new session to use a different Python major version.")));
128-
}
129104
}
130105

131106
/*

0 commit comments

Comments
 (0)