Skip to content

Commit fe9f081

Browse files
author
Anselm Kruis
committed
Merge branch 3.6 into 3.6-slp.
2 parents dfa2c9e + 023532e commit fe9f081

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ What's New in Python 3.6.1 release candidate 1?
1010
Core and Builtins
1111
-----------------
1212

13+
- bpo-29684: Fix minor regression of PyEval_CallObjectWithKeywords.
14+
It should raise TypeError when kwargs is not a dict. But it might
15+
cause segv when args=NULL and kwargs is not a dict.
16+
1317
- Issue #28598: Support __rmod__ for subclasses of str being called before
1418
str.__mod__. Patch by Martijn Pieters.
1519

Python/ceval.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5203,14 +5203,7 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
52035203
assert(!PyErr_Occurred());
52045204
#endif
52055205

5206-
if (args == NULL) {
5207-
STACKLESS_PROMOTE_ALL();
5208-
result = _PyObject_FastCallDict(func, NULL, 0, kwargs);
5209-
STACKLESS_ASSERT();
5210-
return result;
5211-
}
5212-
5213-
if (!PyTuple_Check(args)) {
5206+
if (args != NULL && !PyTuple_Check(args)) {
52145207
PyErr_SetString(PyExc_TypeError,
52155208
"argument list must be a tuple");
52165209
return NULL;
@@ -5223,7 +5216,12 @@ PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs)
52235216
}
52245217

52255218
STACKLESS_PROMOTE_ALL();
5226-
result = PyObject_Call(func, args, kwargs);
5219+
if (args == NULL) {
5220+
result = _PyObject_FastCallDict(func, NULL, 0, kwargs);
5221+
}
5222+
else {
5223+
result = PyObject_Call(func, args, kwargs);
5224+
}
52275225
STACKLESS_ASSERT();
52285226

52295227
return result;

0 commit comments

Comments
 (0)