summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2011-02-22 20:15:44 (GMT)
committerBrett Cannon <bcannon@gmail.com>2011-02-22 20:15:44 (GMT)
commitb94767ff44edf5d461d7cb1c8eb5160f83886358 (patch)
treeb43b482e765b0383b3326779f6815e72b2bacccb /Python
parent79da6b7075a3d51ae042e77a2afca827e7bce435 (diff)
downloadcpython-b94767ff44edf5d461d7cb1c8eb5160f83886358.zip
cpython-b94767ff44edf5d461d7cb1c8eb5160f83886358.tar.gz
cpython-b94767ff44edf5d461d7cb1c8eb5160f83886358.tar.bz2
Issue #8914: fix various warnings from the Clang static analyzer v254.
Diffstat (limited to 'Python')
-rw-r--r--Python/ast.c1
-rw-r--r--Python/bltinmodule.c5
-rw-r--r--Python/ceval.c4
-rw-r--r--Python/dtoa.c4
-rw-r--r--Python/getargs.c5
-rw-r--r--Python/pystrtod.c2
-rw-r--r--Python/sysmodule.c3
7 files changed, 9 insertions, 15 deletions
diff --git a/Python/ast.c b/Python/ast.c
index 4edf335..e62a215 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3231,7 +3231,6 @@ decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, cons
const char *end;
if (encoding == NULL) {
- buf = (char *)s;
u = NULL;
} else {
/* check for integer overflow */
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index f9b3202..42bc809 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -37,7 +37,7 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *func, *name, *bases, *mkw, *meta, *prep, *ns, *cell;
PyObject *cls = NULL;
- Py_ssize_t nargs, nbases;
+ Py_ssize_t nargs;
assert(args != NULL);
if (!PyTuple_Check(args)) {
@@ -61,7 +61,6 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
bases = PyTuple_GetSlice(args, 2, nargs);
if (bases == NULL)
return NULL;
- nbases = nargs - 2;
if (kwds == NULL) {
meta = NULL;
@@ -766,7 +765,6 @@ builtin_exec(PyObject *self, PyObject *args)
{
PyObject *v;
PyObject *prog, *globals = Py_None, *locals = Py_None;
- int plain = 0;
if (!PyArg_UnpackTuple(args, "exec", 1, 3, &prog, &globals, &locals))
return NULL;
@@ -775,7 +773,6 @@ builtin_exec(PyObject *self, PyObject *args)
globals = PyEval_GetGlobals();
if (locals == Py_None) {
locals = PyEval_GetLocals();
- plain = 1;
}
if (!globals || !locals) {
PyErr_SetString(PyExc_SystemError,
diff --git a/Python/ceval.c b/Python/ceval.c
index c10a2ff..9572918 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2690,7 +2690,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(*pfunc);
*pfunc = self;
na++;
- n++;
+ /* n++; */
} else
Py_INCREF(func);
sp = stack_pointer;
@@ -3026,7 +3026,7 @@ fast_yield:
PyTrace_RETURN, retval)) {
Py_XDECREF(retval);
retval = NULL;
- why = WHY_EXCEPTION;
+ /* why = WHY_EXCEPTION; */
}
}
}
diff --git a/Python/dtoa.c b/Python/dtoa.c
index 44dc01f..82b6faa 100644
--- a/Python/dtoa.c
+++ b/Python/dtoa.c
@@ -2055,7 +2055,7 @@ _Py_dg_strtod(const char *s00, char **se)
+ Exp_msk1
;
word1(&rv) = 0;
- dsign = 0;
+ /* dsign = 0; */
break;
}
}
@@ -2092,7 +2092,7 @@ _Py_dg_strtod(const char *s00, char **se)
goto undfl;
}
}
- dsign = 1 - dsign;
+ /* dsign = 1 - dsign; */
break;
}
if ((aadj = ratio(delta, bs)) <= 2.) {
diff --git a/Python/getargs.c b/Python/getargs.c
index 600941d..17d5993 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -966,9 +966,10 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'u': /* raw unicode buffer (Py_UNICODE *) */
case 'Z': /* raw unicode buffer or None */
{
+ Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
+
if (*format == '#') { /* any buffer-like object */
/* "s#" or "Z#" */
- Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
FETCH_SIZE;
if (c == 'Z' && arg == Py_None) {
@@ -984,8 +985,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
format++;
} else {
/* "s" or "Z" */
- Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
-
if (c == 'Z' && arg == Py_None)
*p = NULL;
else if (PyUnicode_Check(arg)) {
diff --git a/Python/pystrtod.c b/Python/pystrtod.c
index 75e3032..7bf21c0 100644
--- a/Python/pystrtod.c
+++ b/Python/pystrtod.c
@@ -954,7 +954,7 @@ format_float_short(double d, char format_code,
/* shouldn't get here: Gay's code should always return
something starting with a digit, an 'I', or 'N' */
strncpy(p, "ERR", 3);
- p += 3;
+ /* p += 3; */
assert(0);
}
goto exit;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index de51155..89fe4f1 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1176,7 +1176,6 @@ PySys_AddXOption(const wchar_t *s)
PyObject *opts;
PyObject *name = NULL, *value = NULL;
const wchar_t *name_end;
- int r;
opts = get_xoptions();
if (opts == NULL)
@@ -1194,7 +1193,7 @@ PySys_AddXOption(const wchar_t *s)
}
if (name == NULL || value == NULL)
goto error;
- r = PyDict_SetItem(opts, name, value);
+ PyDict_SetItem(opts, name, value);
Py_DECREF(name);
Py_DECREF(value);
return;