8000 Silence some writable-string warnings · matplotlib/matplotlib@db98d01 · GitHub
[go: up one dir, main page]

Skip to content

Commit db98d01

Browse files
committed
Silence some writable-string warnings
Cast string constants explicitly to (char*) since the method calls aren't going to modify the strings.
1 parent 3380256 commit db98d01

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/file_compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ mpl_PyFile_OpenFile(PyObject *filename, const char *mode)
192192
if (open == NULL) {
193193
return NULL;
194194
}
195-
return PyObject_CallFunction(open, "Os", filename, mode);
195+
return PyObject_CallFunction(open, (char*)"Os", filename, mode);
196196
}
197197

198198
static NPY_INLINE int
199199
mpl_PyFile_CloseFile(PyObject *file)
200200
{
201201
PyObject *ret;
202202

203-
ret = PyObject_CallMethod(file, "close", NULL);
203+
ret = PyObject_CallMethod(file, (char*)"close", NULL);
204204
if (ret == NULL) {
205205
return -1;
206206
}

src/ft2font.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,7 @@ FT2Font::make_open_args(PyObject *py_file_arg, FT_Open_Args *open_args)
22082208
open_args->stream = &stream;
22092209
} else {
22102210
if (PyObject_HasAttrString(py_file_arg, "read") &&
2211-
(data = PyObject_CallMethod(py_file_arg, "read", ""))) {
2211+
(data = PyObject_CallMethod(py_file_arg, (char*)"read", (char*)""))) {
22122212
if (PyBytes_AsStringAndSize(data, &data_ptr, &data_len)) {
22132213
goto exit;
22142214
}

0 commit comments

Comments
 (0)
0