Skip to content

Commit 8ca3433

Browse files
committed
Fix some python bindings C compiler warnings
1 parent f1458db commit 8ca3433

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/_jsonnet.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ static struct JsonnetJsonValue *cpython_native_callback(
147147
void *ctx_, const struct JsonnetJsonValue * const *argv, int *succ)
148148
{
149149
const struct NativeCtx *ctx = ctx_;
150-
int i;
151150

152151
PyEval_RestoreThread(*ctx->py_thread);
153152

@@ -156,7 +155,7 @@ static struct JsonnetJsonValue *cpython_native_callback(
156155

157156
// Populate python function args.
158157
arglist = PyTuple_New(ctx->argc);
159-
for (i = 0; i < ctx->argc; ++i) {
158+
for (size_t i = 0; i < ctx->argc; ++i) {
160159
double d;
161160
const char *param_str = jsonnet_json_extract_string(ctx->vm, argv[i]);
162161
int param_null = jsonnet_json_extract_null(ctx->vm, argv[i]);
@@ -263,7 +262,9 @@ static int cpython_import_callback(void *ctx_, const char *base, const char *rel
263262
const char *found_here_cstr = PyString_AsString(file_name);
264263
#endif
265264
if (PyBytes_Check(file_content)) {
266-
PyBytes_AsStringAndSize(file_content, &content_buf, &content_len);
265+
char *content_buf2;
266+
PyBytes_AsStringAndSize(file_content, &content_buf2, &content_len);
267+
content_buf = content_buf2;
267268
} else {
268269
#if PY_MAJOR_VERSION >= 3
269270
content_buf = PyUnicode_AsUTF8(file_content);

0 commit comments

Comments
 (0)