changeset: 104016:5324906ae307 branch: 3.6 parent: 104012:d020f7290561 user: Serhiy Storchaka date: Thu Sep 22 19:41:20 2016 +0300 files: Lib/test/test_getargs2.py Misc/NEWS Python/ceval.c description: Issue #28086: Single var-positional argument of tuple subtype was passed unscathed to the C-defined function. Now it is converted to exact tuple. diff -r d020f7290561 -r 5324906ae307 Lib/test/test_getargs2.py --- a/Lib/test/test_getargs2.py Thu Sep 22 16:49:51 2016 +0200 +++ b/Lib/test/test_getargs2.py Thu Sep 22 19:41:20 2016 +0300 @@ -471,7 +471,7 @@ ret = get_args(*TupleSubclass([1, 2])) self.assertEqual(ret, (1, 2)) - self.assertIsInstance(ret, tuple) + self.assertIs(type(ret), tuple) ret = get_args() self.assertIn(ret, ((), None)) diff -r d020f7290561 -r 5324906ae307 Misc/NEWS --- a/Misc/NEWS Thu Sep 22 16:49:51 2016 +0200 +++ b/Misc/NEWS Thu Sep 22 19:41:20 2016 +0300 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28086: Single var-positional argument of tuple subtype was passed + unscathed to the C-defined function. Now it is converted to exact tuple. + - Issue #28214: Now __set_name__ is looked up on the class instead of the instance. diff -r d020f7290561 -r 5324906ae307 Python/ceval.c --- a/Python/ceval.c Thu Sep 22 16:49:51 2016 +0200 +++ b/Python/ceval.c Thu Sep 22 19:41:20 2016 +0300 @@ -3310,7 +3310,7 @@ } callargs = POP(); func = TOP(); - if (!PyTuple_Check(callargs)) { + if (!PyTuple_CheckExact(callargs)) { if (Py_TYPE(callargs)->tp_iter == NULL && !PySequence_Check(callargs)) { PyErr_Format(PyExc_TypeError, @@ -3327,7 +3327,7 @@ goto error; } } - assert(PyTuple_Check(callargs)); + assert(PyTuple_CheckExact(callargs)); result = do_call_core(func, callargs, kwargs); Py_DECREF(func);