-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hy/plpython3 #2
Hy/plpython3 #2
Changes from 1 commit
9cb01d6
8324d34
2654197
3a49354
627a791
27d6c90
d8f2c9b
a2ad886
a3b4e60
fdd5567
53939be
36f664e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ static void PLy_pop_execution_context(void); | |
static int *plpython_version_bitmask_ptr = NULL; | ||
static int plpython_version_bitmask = 0; | ||
static const int plpython_python_version = PY_MAJOR_VERSION; | ||
static bool inited = false; | ||
|
||
/* initialize global variables */ | ||
PyObject *PLy_interp_globals = NULL; | ||
|
@@ -85,15 +86,25 @@ bool PLy_enter_python_intepreter = false; | |
bool PLy_add_path = false; | ||
|
||
/* GUC variables */ | ||
// need to add ifdef | ||
#if PY_MAJOR_VERSION >= 3 | ||
char *plpython3_path = NULL; | ||
void | ||
static void | ||
assign_plpython3_python_path(const char *newval, void *extra) | ||
{ | ||
if (Gp_role != GP_ROLE_EXECUTE) | ||
if (inited) | ||
ereport(WARNING, (errmsg("PYTHONPATH for plpython3 can only set once in one session"))); | ||
} | ||
bool | ||
check_path(char **newval, void **extra, GucSource source) { | ||
if (PLy_add_path) | ||
{ | ||
GUC_check_errmsg("SET PYTHONPATH for plpython3 can only set once in one session"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the above can be changed, then we need to modify this message. |
||
return false; | ||
} | ||
PLy_add_path = true; | ||
ereport(WARNING, (errmsg("PYTHONPATH for plpython3 can only set once in one session"))); | ||
return true; | ||
} | ||
#endif | ||
|
||
void | ||
|
@@ -157,10 +168,11 @@ _PG_init(void) | |
gettext_noop("Python path for plpython3."), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. last comment : There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy that. |
||
NULL, | ||
&plpython3_path, | ||
NULL, | ||
PGC_USERSET, 0, | ||
"", | ||
PGC_USERSET, | ||
GUC_GPDB_NEED_SYNC, | ||
check_path, | ||
NULL, | ||
assign_plpython3_python_path, | ||
NULL); | ||
#endif | ||
pg_bindtextdomain(TEXTDOMAIN); | ||
|
@@ -174,7 +186,6 @@ _PG_init(void) | |
static void | ||
PLy_initialize(void) | ||
{ | ||
static bool inited = false; | ||
|
||
/* | ||
* Check for multiple Python libraries before actively doing anything with | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it static, it should not be used out of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy that.