@@ -2663,7 +2663,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
26632663 PyObject * intersection = _PyDictView_Intersect (sum , arg );
26642664
26652665 if (intersection == NULL ) {
2666- if (PyErr_ExceptionMatches (PyExc_AttributeError )) {
2666+ if (PyErr_ExceptionMatches (PyExc_AttributeError ) ||
2667+ !PyMapping_Check (arg )) {
26672668 int function_location = (oparg >>8 ) & 0xff ;
26682669 PyObject * func = (
26692670 PEEK (function_location + num_maps ));
@@ -2707,9 +2708,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
27072708
27082709 if (PyDict_Update (sum , arg ) < 0 ) {
27092710 if (PyErr_ExceptionMatches (PyExc_AttributeError )) {
2710- PyErr_Format (PyExc_TypeError ,
2711- "'%.200s' object is not a mapping" ,
2712- arg -> ob_type -> tp_name );
2711+ if (with_call ) {
2712+ int function_location = (oparg >>8 ) & 0xff ;
2713+ PyObject * func = PEEK (function_location + num_maps );
2714+ PyErr_Format (PyExc_TypeError ,
2715+ "%.200s%.200s argument after ** "
2716+ "must be a mapping, not %.200s" ,
2717+ PyEval_GetFuncName (func ),
2718+ PyEval_GetFuncDesc (func ),
2719+ arg -> ob_type -> tp_name );
2720+ }
2721+ else {
2722+ PyErr_Format (PyExc_TypeError ,
2723+ "'%.200s' object is not a mapping" ,
2724+ arg -> ob_type -> tp_name );
2725+ }
27132726 }
27142727 Py_DECREF (sum );
27152728 goto error ;
0 commit comments