PostgreSQL Source Code  git master
plpython.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * plpython.h - Python as a procedural language for PostgreSQL
4  *
5  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
6  * Portions Copyright (c) 1994, Regents of the University of California
7  *
8  * src/pl/plpython/plpython.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef PLPYTHON_H
13 #define PLPYTHON_H
14 
15 /* postgres.h needs to be included before Python.h, as usual */
16 #if !defined(POSTGRES_H)
17 #error postgres.h must be included before plpython.h
18 #elif defined(Py_PYTHON_H)
19 #error Python.h must be included via plpython.h
20 #endif
21 
22 /*
23  * Python versions <= 3.8 otherwise define a replacement, causing macro
24  * redefinition warnings.
25  */
26 #define HAVE_SNPRINTF 1
27 
28 #if defined(_MSC_VER) && defined(_DEBUG)
29 /* Python uses #pragma to bring in a non-default libpython on VC++ if
30  * _DEBUG is defined */
31 #undef _DEBUG
32 /* Also hide away errcode, since we load Python.h before postgres.h */
33 #define errcode __msvc_errcode
34 #include <Python.h>
35 #undef errcode
36 #define _DEBUG
37 #elif defined (_MSC_VER)
38 #define errcode __msvc_errcode
39 #include <Python.h>
40 #undef errcode
41 #else
42 #include <Python.h>
43 #endif
44 
45 /* define our text domain for translations */
46 #undef TEXTDOMAIN
47 #define TEXTDOMAIN PG_TEXTDOMAIN("plpython")
48 
49 /*
50  * Used throughout, so it's easier to just include it everywhere.
51  */
52 #include "plpy_util.h"
53 
54 #endif /* PLPYTHON_H */