| 1 |
#include <Python.h> |
| 2 |
#include "hpy.h" |
| 3 |
|
| 4 |
#ifndef HPY_ABI_CPYTHON |
| 5 |
|
| 6 |
# include "handles.h" |
| 7 |
#endif |
| 8 |
|
| 9 |
_HPy_HIDDEN HPy |
| 10 |
ctx_Compile_s(HPyContext *ctx, const char *utf8_source, const char *utf8_filename, HPy_SourceKind kind) |
| 11 |
{ |
| 12 |
int start; |
| 13 |
switch (kind) |
| 14 |
{ |
| 15 |
case HPy_SourceKind_Expr: start = Py_eval_input; break; |
| 16 |
case HPy_SourceKind_File: start = Py_file_input; break; |
| 17 |
case HPy_SourceKind_Single: start = Py_single_input; break; |
| 18 |
default: |
| 19 |
PyErr_SetString(PyExc_SystemError, "invalid source kind"); |
| 20 |
return HPy_NULL; |
| 21 |
} |
| 22 |
return _py2h(Py_CompileString(utf8_source, utf8_filename, start)); |
| 23 |
} |