mirror of
https://github.com/google/go-jsonnet.git
synced 2025-08-07 14:57:24 +02:00
port some Python wrapper code fixes from C++ jsonnet
See commits on the C++ repo: -913281d203
-842d31eefd
This commit is contained in:
parent
e1304d1698
commit
9e1e952016
@ -186,7 +186,7 @@ static struct JsonnetJsonValue *cpython_native_callback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call python function.
|
// Call python function.
|
||||||
result = PyEval_CallObject(ctx->callback, arglist);
|
result = PyObject_CallObject(ctx->callback, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
@ -226,7 +226,7 @@ static int cpython_import_callback(void *ctx_, const char *base, const char *rel
|
|||||||
|
|
||||||
PyEval_RestoreThread(*ctx->py_thread);
|
PyEval_RestoreThread(*ctx->py_thread);
|
||||||
arglist = Py_BuildValue("(s, s)", base, rel);
|
arglist = Py_BuildValue("(s, s)", base, rel);
|
||||||
result = PyEval_CallObject(ctx->callback, arglist);
|
result = PyObject_CallObject(ctx->callback, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
|
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
@ -255,7 +255,7 @@ static int cpython_import_callback(void *ctx_, const char *base, const char *rel
|
|||||||
success = 0;
|
success = 0;
|
||||||
} else {
|
} else {
|
||||||
char *content_buf;
|
char *content_buf;
|
||||||
ssize_t content_len;
|
Py_ssize_t content_len;
|
||||||
#if PY_MAJOR_VERSION >= 3
|
#if PY_MAJOR_VERSION >= 3
|
||||||
const char *found_here_cstr = PyUnicode_AsUTF8(file_name);
|
const char *found_here_cstr = PyUnicode_AsUTF8(file_name);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user