Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25095b2

Browse files
author
Victor Stinner
committed
Remove useless assignments
Warnings found by the the Clang Static Analyzer.
1 parent 58bc7a1 commit 25095b2

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

Modules/faulthandler.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,10 @@ static int
10051005
faulthandler_env_options(void)
10061006
{
10071007
PyObject *xoptions, *key, *module, *res;
1008-
int enable;
10091008

10101009
if (!Py_GETENV("PYTHONFAULTHANDLER")) {
1010+
int has_key;
1011+
10111012
xoptions = PySys_GetXOptions();
10121013
if (xoptions == NULL)
10131014
return -1;
@@ -1016,13 +1017,11 @@ faulthandler_env_options(void)
10161017
if (key == NULL)
10171018
return -1;
10181019

1019-
enable = PyDict_Contains(xoptions, key);
1020+
has_key = PyDict_Contains(xoptions, key);
10201021
Py_DECREF(key);
1021-
if (!enable)
1022+
if (!has_key)
10221023
return 0;
10231024
}
1024-
else
1025-
enable = 1;
10261025

10271026
module = PyImport_ImportModule("faulthandler");
10281027
if (module == NULL) {

Python/import.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,6 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
17331733
Py_UNICODE buf[MAXPATHLEN+1];
17341734
Py_ssize_t buflen = MAXPATHLEN+1;
17351735
PyObject *path_unicode, *filename;
1736-
const Py_UNICODE *base;
17371736
Py_ssize_t len;
17381737
struct stat statbuf;
17391738
static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
@@ -1751,7 +1750,6 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
17511750
else
17521751
return 0;
17531752

1754-
base = PyUnicode_AS_UNICODE(path_unicode);
17551753
len = PyUnicode_GET_SIZE(path_unicode);
17561754
if (len + 2 + PyUnicode_GET_SIZE(name) + MAXSUFFIXSIZE >= buflen) {
17571755
Py_DECREF(path_unicode);
@@ -2275,12 +2273,10 @@ case_ok(PyObject *filename, Py_ssize_t prefix_delta, PyObject *name)
22752273
static int
22762274
find_init_module(PyObject *directory)
22772275
{
2278-
size_t len;
22792276
struct stat statbuf;
22802277
PyObject *filename;
22812278
int match;
22822279

2283-
len = PyUnicode_GET_SIZE(directory);
22842280
filename = PyUnicode_FromFormat("%U%c__init__.py", directory, SEP);
22852281
if (filename == NULL)
22862282
return -1;

0 commit comments

Comments
 (0)