X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fpython.c;h=b991f45fd0da76994be3ae6b8e3d4e0d72849c10;hb=b55658bb615f6d33e70791d2a7d2a0f2114598cc;hp=deab4be111f0f33651d049037051a8ea79074cae;hpb=5b4053d27b6a24e2f18e678f0d8c3343b7dfad7c;p=collectd.git diff --git a/src/python.c b/src/python.c index deab4be1..b991f45f 100644 --- a/src/python.c +++ b/src/python.c @@ -1124,21 +1124,23 @@ static int cpy_config(oconfig_item_t *ci) { continue; } } else if (strcasecmp(item->key, "Encoding") == 0) { -#ifdef IS_PY3K - ERROR("python: \"Encoding\" was used in the config file but Python3 was used, which does not support changing encodings"); - status = 1; - continue; -#endif char *encoding = NULL; if (cf_util_get_string(item, &encoding) != 0) { status = 1; continue; } +#ifdef IS_PY3K + ERROR("python: \"Encoding\" was used in the config file but Python3 was used, which does not support changing encodings"); + status = 1; + sfree(encoding); + continue; +#else /* Why is this even necessary? And undocumented? */ if (PyUnicode_SetDefaultEncoding(encoding)) { cpy_log_exception("setting default encoding"); status = 1; } +#endif sfree(encoding); } else if (strcasecmp(item->key, "LogTraces") == 0) { _Bool log_traces;