-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Fix or remove dead assignments identified by scan-build #16267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,8 +221,9 @@ _sharedexception_bind(PyObject *exctype, PyObject *exc, PyObject *tb) | |
if (err->name == NULL) { | ||
if (PyErr_ExceptionMatches(PyExc_MemoryError)) { | ||
failure = "out of memory copying exception type name"; | ||
} else { | ||
failure = "unable to encode and copy exception type name"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This appears to be an actual bugfix. |
||
} | ||
failure = "unable to encode and copy exception type name"; | ||
goto finally; | ||
} | ||
|
||
|
@@ -237,8 +238,9 @@ _sharedexception_bind(PyObject *exctype, PyObject *exc, PyObject *tb) | |
if (err->msg == NULL) { | ||
if (PyErr_ExceptionMatches(PyExc_MemoryError)) { | ||
failure = "out of memory copying exception message"; | ||
} else { | ||
failure = "unable to encode and copy exception message"; | ||
} | ||
failure = "unable to encode and copy exception message"; | ||
goto finally; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1639,7 +1639,6 @@ idna_converter(PyObject *obj, struct maybe_idna *data) | |
return 1; | ||
} | ||
data->obj = NULL; | ||
len = -1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is dead code now, but Doesn't look terribly dangerous, but maybe it would make sense to leave it as |
||
if (PyBytes_Check(obj)) { | ||
data->buf = PyBytes_AsString(obj); | ||
len = PyBytes_Size(obj); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,7 +265,7 @@ config_init_module_search_paths(PyConfig *config, _PyPathConfig *pathconfig) | |
|
||
const wchar_t *sys_path = pathconfig->module_search_path; | ||
const wchar_t delim = DELIM; | ||
const wchar_t *p = sys_path; | ||
const wchar_t *p; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind to move the variable declaration inside the loop to even show better its scope? |
||
while (1) { | ||
p = wcschr(sys_path, delim); | ||
if (p == NULL) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -680,7 +680,6 @@ pyinit_config(_PyRuntimeState *runtime, | |
if (_PyStatus_EXCEPTION(status)) { | ||
return status; | ||
} | ||
config = &tstate->interp->config; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, this one I'm having trouble understanding how it happened and if it was actually intended to have some effect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is correct. I wrote the config, but it's no longer needed to update the config variable. |
||
*tstate_p = tstate; | ||
|
||
status = pycore_init_types(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For anyone else reading, the way this diff is displayed is a bit misleading - line 2488 is not shown, but the same value is assigned when
whole_us
is declared, then overwritten here.An alternative would be to delete 2488 and change this into a declaration, or to keep the declaration and assignment lines separate, but I'm indifferent between the three.