aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpy_main.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl/plpython/plpy_main.h')
-rw-r--r--src/pl/plpython/plpy_main.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pl/plpython/plpy_main.h b/src/pl/plpython/plpy_main.h
index a71aead1769..cb214bf83c7 100644
--- a/src/pl/plpython/plpy_main.h
+++ b/src/pl/plpython/plpy_main.h
@@ -10,4 +10,19 @@
/* the interpreter's globals dict */
extern PyObject *PLy_interp_globals;
+/*
+ * A stack of PL/Python execution contexts. Each time user-defined Python code
+ * is called, an execution context is created and put on the stack. After the
+ * Python code returns, the context is destroyed.
+ */
+typedef struct PLyExecutionContext
+{
+ PLyProcedure *curr_proc; /* the currently executing procedure */
+ MemoryContext scratch_ctx; /* a context for things like type I/O */
+ struct PLyExecutionContext *next; /* previous stack level */
+} PLyExecutionContext;
+
+/* Get the current execution context */
+extern PLyExecutionContext *PLy_current_execution_context(void);
+
#endif /* PLPY_MAIN_H */