2 #ifndef EL__SCRIPTING_PYTHON_CORE_H
3 #define EL__SCRIPTING_PYTHON_CORE_H
9 /* PyString_AsStringAndSize() takes a Py_ssize_t * in Python 2.5 but
10 * an int * in Python 2.4. To be compatible with both, ELinks uses
11 * Py_ssize_t and defines it here if necessary. The public-domain
12 * PEP 353 <http://www.python.org/dev/peps/pep-0353/> suggests the
13 * following snippet, so we can use the Py_ssize_t name even though
14 * Python generally reserves names starting with "Py_". */
15 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
16 typedef int Py_ssize_t
;
17 #define PY_SSIZE_T_MAX INT_MAX
18 #define PY_SSIZE_T_MIN INT_MIN
20 /* End of PEP 353 snippet. */
24 extern struct session
*python_ses
;
25 extern PyObject
*python_elinks_err
;
27 void alert_python_error(void);
29 void init_python(struct module
*module
);
30 void cleanup_python(struct module
*module
);
32 int add_python_methods(PyObject
*dict
, PyObject
*name
, PyMethodDef
*methods
);
35 #define PYTHON_DOCSTRING(str) str
37 #define PYTHON_DOCSTRING(str) ""