Skip to content

Commit f3ab8a7

Browse files
timp87sparkprime
authored andcommitted
Fix the following compiler (clang 11) warning
python/_jsonnet.c:150:19: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] for (i = 0; i < ctx->argc; ++i) { ~ ^ ~~~~~~~~~ Change type of index loop (i) to Py_ssize_t like in all other places in the code. Cast ctx->argc to Py_ssize_t to make them the same type Useful link https://www.python.org/dev/peps/pep-0353
1 parent 56a8038 commit f3ab8a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/_jsonnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ 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;
150+
Py_ssize_t i;
151151

152152
PyEval_RestoreThread(*ctx->py_thread);
153153

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

157157
// Populate python function args.
158158
arglist = PyTuple_New(ctx->argc);
159-
for (i = 0; i < ctx->argc; ++i) {
159+
for (i = 0; i < (Py_ssize_t) ctx->argc; ++i) {
160160
double d;
161161
const char *param_str = jsonnet_json_extract_string(ctx->vm, argv[i]);
162162
int param_null = jsonnet_json_extract_null(ctx->vm, argv[i]);

0 commit comments

Comments
 (0)