Skip to content
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

Fix crashes in popone/popall when default is returned #450

Merged
merged 4 commits into from Dec 30, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/450.bugfix
@@ -0,0 +1 @@
Fix crashes in ``popone``/``popall`` when default is returned.
4 changes: 2 additions & 2 deletions multidict/_multidict.c
Expand Up @@ -478,9 +478,7 @@ multidict_get(MultiDictObject *self, PyObject *args, PyObject *kwds)
{
return NULL;
}
Py_INCREF(Py_None); // incref the default if not set
ret = _multidict_getone(self, key, _default);
Py_DECREF(Py_None);
return ret;
}

Expand Down Expand Up @@ -775,6 +773,7 @@ multidict_popone(MultiDictObject *self, PyObject *args, PyObject *kwds)
_default != NULL)
{
PyErr_Clear();
Py_INCREF(_default);
return _default;
}

Expand Down Expand Up @@ -803,6 +802,7 @@ multidict_popall(MultiDictObject *self, PyObject *args, PyObject *kwds)
_default != NULL)
{
PyErr_Clear();
Py_INCREF(_default);
return _default;
}

Expand Down