Commit d79ee4c1 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #28086: Single var-positional argument of tuple subtype was passed

unscathed to the C-defined function.  Now it is converted to exact tuple.
parent 8740c993
...@@ -471,7 +471,7 @@ class Tuple_TestCase(unittest.TestCase): ...@@ -471,7 +471,7 @@ class Tuple_TestCase(unittest.TestCase):
ret = get_args(*TupleSubclass([1, 2])) ret = get_args(*TupleSubclass([1, 2]))
self.assertEqual(ret, (1, 2)) self.assertEqual(ret, (1, 2))
self.assertIsInstance(ret, tuple) self.assertIs(type(ret), tuple)
ret = get_args() ret = get_args()
self.assertIn(ret, ((), None)) self.assertIn(ret, ((), None))
......
...@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2 ...@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
Core and Builtins 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 - Issue #28214: Now __set_name__ is looked up on the class instead of the
instance. instance.
......
...@@ -3310,7 +3310,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) ...@@ -3310,7 +3310,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
} }
callargs = POP(); callargs = POP();
func = TOP(); func = TOP();
if (!PyTuple_Check(callargs)) { if (!PyTuple_CheckExact(callargs)) {
if (Py_TYPE(callargs)->tp_iter == NULL && if (Py_TYPE(callargs)->tp_iter == NULL &&
!PySequence_Check(callargs)) { !PySequence_Check(callargs)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
...@@ -3327,7 +3327,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) ...@@ -3327,7 +3327,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
goto error; goto error;
} }
} }
assert(PyTuple_Check(callargs)); assert(PyTuple_CheckExact(callargs));
result = do_call_core(func, callargs, kwargs); result = do_call_core(func, callargs, kwargs);
Py_DECREF(func); Py_DECREF(func);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment