Commit 0b03f10a authored by Brett Cannon's avatar Brett Cannon

Remove three unneeded variable assignments.

Found using Clang's static analyzer.
parent 8a478ced
This diff is collapsed.
...@@ -2697,7 +2697,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) ...@@ -2697,7 +2697,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(*pfunc); Py_DECREF(*pfunc);
*pfunc = self; *pfunc = self;
na++; na++;
n++;
} else } else
Py_INCREF(func); Py_INCREF(func);
sp = stack_pointer; sp = stack_pointer;
......
...@@ -1382,7 +1382,6 @@ bigcomp(U *rv, const char *s0, BCinfo *bc) ...@@ -1382,7 +1382,6 @@ bigcomp(U *rv, const char *s0, BCinfo *bc)
Bigint *b, *d; Bigint *b, *d;
int b2, d2, dd, i, nd, nd0, odd, p2, p5; int b2, d2, dd, i, nd, nd0, odd, p2, p5;
dd = 0; /* silence compiler warning about possibly unused variable */
nd = bc->nd; nd = bc->nd;
nd0 = bc->nd0; nd0 = bc->nd0;
p5 = nd + bc->e0; p5 = nd + bc->e0;
...@@ -2362,7 +2361,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits, ...@@ -2362,7 +2361,7 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
/* set pointers to NULL, to silence gcc compiler warnings and make /* set pointers to NULL, to silence gcc compiler warnings and make
cleanup easier on error */ cleanup easier on error */
mlo = mhi = b = S = 0; mlo = mhi = S = 0;
s0 = 0; s0 = 0;
u.d = dd; u.d = dd;
...@@ -2713,8 +2712,6 @@ _Py_dg_dtoa(double dd, int mode, int ndigits, ...@@ -2713,8 +2712,6 @@ _Py_dg_dtoa(double dd, int mode, int ndigits,
* and for all and pass them and a shift to quorem, so it * and for all and pass them and a shift to quorem, so it
* can do shifts and ors to compute the numerator for q. * can do shifts and ors to compute the numerator for q.
*/ */
if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
i = 32 - i;
#define iInc 28 #define iInc 28
i = dshift(S, s2); i = dshift(S, s2);
b2 += i; b2 += i;
......
...@@ -28,7 +28,7 @@ getcwd(char *buf, int size) ...@@ -28,7 +28,7 @@ getcwd(char *buf, int size)
{ {
char localbuf[MAXPATHLEN+1]; char localbuf[MAXPATHLEN+1];
char *ret; char *ret;
if (size <= 0) { if (size <= 0) {
errno = EINVAL; errno = EINVAL;
return NULL; return NULL;
...@@ -59,14 +59,13 @@ getcwd(char *buf, int size) ...@@ -59,14 +59,13 @@ getcwd(char *buf, int size)
{ {
FILE *fp; FILE *fp;
char *p; char *p;
int sts;
if (size <= 0) { if (size <= 0) {
errno = EINVAL; errno = EINVAL;
return NULL; return NULL;
} }
if ((fp = popen(PWD_CMD, "r")) == NULL) if ((fp = popen(PWD_CMD, "r")) == NULL)
return NULL; return NULL;
if (fgets(buf, size, fp) == NULL || (sts = pclose(fp)) != 0) { if (fgets(buf, size, fp) == NULL || pclose(fp) != 0) {
errno = EACCES; /* Most likely error */ errno = EACCES; /* Most likely error */
return NULL; return NULL;
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
...@@ -826,7 +826,7 @@ parse_source_module(const char *pathname, FILE *fp) ...@@ -826,7 +826,7 @@ parse_source_module(const char *pathname, FILE *fp)
flags.cf_flags = 0; flags.cf_flags = 0;
mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, &flags, mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, &flags,
NULL, arena); NULL, arena);
if (mod) { if (mod) {
co = PyAST_Compile(mod, pathname, NULL, arena); co = PyAST_Compile(mod, pathname, NULL, arena);
...@@ -884,7 +884,7 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat) ...@@ -884,7 +884,7 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
mode_t mode = srcstat->st_mode & ~S_IEXEC; mode_t mode = srcstat->st_mode & ~S_IEXEC;
#else #else
mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH; mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH;
#endif #endif
fp = open_exclusive(cpathname, mode); fp = open_exclusive(cpathname, mode);
if (fp == NULL) { if (fp == NULL) {
...@@ -972,7 +972,7 @@ load_source_module(char *name, char *pathname, FILE *fp) ...@@ -972,7 +972,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
char *cpathname; char *cpathname;
PyCodeObject *co; PyCodeObject *co;
PyObject *m; PyObject *m;
if (fstat(fileno(fp), &st) != 0) { if (fstat(fileno(fp), &st) != 0) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
"unable to get file status from '%s'", "unable to get file status from '%s'",
...@@ -1406,7 +1406,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, ...@@ -1406,7 +1406,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
else { else {
char warnstr[MAXPATHLEN+80]; char warnstr[MAXPATHLEN+80];
sprintf(warnstr, "Not importing directory " sprintf(warnstr, "Not importing directory "
"'%.*s': missing __init__.py", "'%.*s': missing __init__.py",
MAXPATHLEN, buf); MAXPATHLEN, buf);
if (PyErr_Warn(PyExc_ImportWarning, if (PyErr_Warn(PyExc_ImportWarning,
warnstr)) { warnstr)) {
...@@ -1427,7 +1427,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, ...@@ -1427,7 +1427,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
else { else {
char warnstr[MAXPATHLEN+80]; char warnstr[MAXPATHLEN+80];
sprintf(warnstr, "Not importing directory " sprintf(warnstr, "Not importing directory "
"'%.*s': missing __init__.py", "'%.*s': missing __init__.py",
MAXPATHLEN, buf); MAXPATHLEN, buf);
if (PyErr_Warn(PyExc_ImportWarning, if (PyErr_Warn(PyExc_ImportWarning,
warnstr)) { warnstr)) {
...@@ -2266,7 +2266,7 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level) ...@@ -2266,7 +2266,7 @@ get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level)
modname = PyDict_GetItem(globals, namestr); modname = PyDict_GetItem(globals, namestr);
if (modname == NULL || !PyString_Check(modname)) if (modname == NULL || !PyString_Check(modname))
return Py_None; return Py_None;
modpath = PyDict_GetItem(globals, pathstr); modpath = PyDict_GetItem(globals, pathstr);
if (modpath != NULL) { if (modpath != NULL) {
/* __path__ is set, so modname is already the package name */ /* __path__ is set, so modname is already the package name */
...@@ -2621,7 +2621,7 @@ PyImport_ReloadModule(PyObject *m) ...@@ -2621,7 +2621,7 @@ PyImport_ReloadModule(PyObject *m)
struct filedescr *fdp; struct filedescr *fdp;
FILE *fp = NULL; FILE *fp = NULL;
PyObject *newm; PyObject *newm;
if (modules_reloading == NULL) { if (modules_reloading == NULL) {
Py_FatalError("PyImport_ReloadModule: " Py_FatalError("PyImport_ReloadModule: "
"no modules_reloading dictionary!"); "no modules_reloading dictionary!");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment