Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion 5 Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ get_attrib_from_keywords(PyObject *kwds)
return NULL;
}
attrib = PyDict_Copy(attrib);
PyDict_DelItem(kwds, attrib_str);
if (attrib && PyDict_DelItem(kwds, attrib_str) < 0) {
Py_DECREF(attrib);
attrib = NULL;
}
} else {
attrib = PyDict_New();
}
Expand Down
8 changes: 5 additions & 3 deletions 8 Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,11 @@ local_clear(localobject *self)
for(tstate = PyInterpreterState_ThreadHead(tstate->interp);
tstate;
tstate = PyThreadState_Next(tstate))
if (tstate->dict &&
PyDict_GetItem(tstate->dict, self->key))
PyDict_DelItem(tstate->dict, self->key);
if (tstate->dict && PyDict_GetItem(tstate->dict, self->key)) {
if (PyDict_DelItem(tstate->dict, self->key)) {
PyErr_Clear();
}
}
}
return 0;
}
Expand Down
12 changes: 8 additions & 4 deletions 12 Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,14 @@ remove_unusable_flags(PyObject *m)
else {
if (PyDict_GetItemString(
dict,
win_runtime_flags[i].flag_name) != NULL) {
PyDict_DelItemString(
dict,
win_runtime_flags[i].flag_name);
win_runtime_flags[i].flag_name) != NULL)
{
if (PyDict_DelItemString(
dict,
win_runtime_flags[i].flag_name))
{
PyErr_Clear();
}
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions 18 Objects/namespaceobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ namespace_repr(PyObject *ns)
PyObject *value, *item;

value = PyDict_GetItem(d, key);
assert(value != NULL);

item = PyUnicode_FromFormat("%S=%R", key, value);
if (item == NULL) {
loop_error = 1;
}
else {
loop_error = PyList_Append(pairs, item);
Py_DECREF(item);
if (value != NULL) {
item = PyUnicode_FromFormat("%S=%R", key, value);
if (item == NULL) {
loop_error = 1;
}
else {
loop_error = PyList_Append(pairs, item);
Py_DECREF(item);
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion 6 Python/_warnings.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ already_warned(PyObject *registry, PyObject *key, int should_set)
version_obj = _PyDict_GetItemId(registry, &PyId_version);
if (version_obj == NULL
|| !PyLong_CheckExact(version_obj)
|| PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version) {
|| PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version)
{
if (PyErr_Occurred()) {
return -1;
}
PyDict_Clear(registry);
version_obj = PyLong_FromLong(_PyRuntime.warnings.filters_version);
if (version_obj == NULL)
Expand Down
2 changes: 1 addition & 1 deletion 2 Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -5027,7 +5027,7 @@ unicode_concatenate(PyObject *v, PyObject *w,
PyObject *names = f->f_code->co_names;
PyObject *name = GETITEM(names, oparg);
PyObject *locals = f->f_locals;
if (PyDict_CheckExact(locals) &&
if (locals && PyDict_CheckExact(locals) &&
PyDict_GetItem(locals, name) == v) {
if (PyDict_DelItem(locals, name) != 0) {
PyErr_Clear();
Expand Down
6 changes: 4 additions & 2 deletions 6 Python/codecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ PyObject *_PyCodec_Lookup(const char *encoding)

/* Next, scan the search functions in order of registration */
args = PyTuple_New(1);
if (args == NULL)
goto onError;
if (args == NULL) {
Py_DECREF(v);
return NULL;
}
PyTuple_SET_ITEM(args,0,v);

len = PyList_Size(interp->codec_search_path);
Expand Down
4 changes: 2 additions & 2 deletions 4 Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -2138,10 +2138,10 @@ _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file)
}

mod = _PyImport_FindExtensionObject(name, path);
if (mod != NULL) {
if (mod != NULL || PyErr_Occurred()) {
Py_DECREF(name);
Py_DECREF(path);
Py_INCREF(mod);
Py_XINCREF(mod);
return mod;
}

Expand Down
6 changes: 6 additions & 0 deletions 6 Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,9 @@ new_interpreter(PyThreadState **tstate_p)
PyDict_SetItemString(interp->sysdict, "modules", modules);
_PySys_EndInit(interp->sysdict, &interp->config);
}
else if (PyErr_Occurred()) {
goto handle_error;
}

bimod = _PyImport_FindBuiltin("builtins", modules);
if (bimod != NULL) {
Expand All @@ -1425,6 +1428,9 @@ new_interpreter(PyThreadState **tstate_p)
goto handle_error;
Py_INCREF(interp->builtins);
}
else if (PyErr_Occurred()) {
goto handle_error;
}

/* initialize builtin exceptions */
_PyExc_Init(bimod);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.