mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Klocwork made another run and found a bunch more problems.
This is the first batch of fixes that should be easy to verify based on context. This fixes problem numbers: 220 (ast), 323-324 (symtable), 321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
This commit is contained in:
parent
2a899c8b76
commit
6f5ff3f3eb
8 changed files with 28 additions and 3 deletions
|
@ -915,6 +915,8 @@ symtable_new_tmpname(struct symtable *st)
|
|||
PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]",
|
||||
++st->st_cur->ste_tmpname);
|
||||
tmp = PyString_InternFromString(tmpname);
|
||||
if (!tmp)
|
||||
return 0;
|
||||
if (!symtable_add_def(st, tmp, DEF_LOCAL))
|
||||
return 0;
|
||||
Py_DECREF(tmp);
|
||||
|
@ -1323,8 +1325,11 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
|
|||
PyObject *name = (a->asname == NULL) ? a->name : a->asname;
|
||||
const char *base = PyString_AS_STRING(name);
|
||||
char *dot = strchr(base, '.');
|
||||
if (dot)
|
||||
if (dot) {
|
||||
store_name = PyString_FromStringAndSize(base, dot - base);
|
||||
if (!store_name)
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
store_name = name;
|
||||
Py_INCREF(store_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue