]> granicus.if.org Git - python/commitdiff
Issue #28086: Single var-positional argument of tuple subtype was passed
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 22 Sep 2016 16:41:20 +0000 (19:41 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 22 Sep 2016 16:41:20 +0000 (19:41 +0300)
unscathed to the C-defined function.  Now it is converted to exact tuple.

Lib/test/test_getargs2.py
Misc/NEWS
Python/ceval.c

index 5750bfa5f88d4a75ff38c241f273b88621cb8edd..8a194aa03d42784685d674e2e8b3153bcdb8ac0a 100644 (file)
@@ -471,7 +471,7 @@ class Tuple_TestCase(unittest.TestCase):
 
         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))
index aca0ba0fb11d3f0ea1667c031954eb8e86de7466..2f531a82ab536e13584789b00e27cf2a98922e0c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
 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.
 
index ff36d365b3445585d835a557021d609ac0c67420..39cf33019d8130335532837b030a58c3534d1175 100644 (file)
@@ -3310,7 +3310,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
             }
             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 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
                     goto error;
                 }
             }
-            assert(PyTuple_Check(callargs));
+            assert(PyTuple_CheckExact(callargs));
 
             result = do_call_core(func, callargs, kwargs);
             Py_DECREF(func);