forked from niner/inline-python-pm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
py2pl.h
24 lines (21 loc) · 806 Bytes
/
py2pl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef PY2PL_H
#define PY2PL_H
extern SV* Py2Pl (PyObject * const obj);
extern PyObject *Pl2Py(SV * const obj);
extern void croak_python_exception();
extern SV* py_true;
extern SV* py_false;
extern PyObject *PyExc_Perl;
#if PY_MAJOR_VERSION < 3
#define PY_INSTANCE_CHECK(obj) PyInstance_Check((obj))
#define PY_IS_STRING(obj) (PyString_Check((obj)) || PyUnicode_Check((obj)))
#else
#define PY_INSTANCE_CHECK(obj) 0
#define PY_IS_STRING(obj) (PyBytes_Check((obj)) || PyUnicode_Check((obj)))
#endif
#define PY_IS_OBJECT(obj) \
(((obj)->ob_type->tp_flags & Py_TPFLAGS_HEAPTYPE) \
|| PY_INSTANCE_CHECK((obj)) \
|| (! is_string && PyMapping_Check((obj)) && ((obj)->ob_type != &PyDict_Type) && \
((obj)->ob_type != &PyList_Type) && ((obj)->ob_type != &PyTuple_Type)) )
#endif