File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ def test_tuple(self):
2626 for i in xrange (- len (t ), len (t )- 1 ):
2727 self .assertEqual (t [i ], astuple [i ])
2828
29+ def test_tuple_subclass (self ):
30+ # Issue 1820
31+ t = time .localtime ()
32+ s = ('%s ' * len (t )) % t # This used to fail because t was not a tuple subclass
33+ self .assert_ (isinstance (t , tuple ))
34+
2935 def test_repr (self ):
3036 t = time .gmtime ()
3137 self .assert_ (repr (t ))
Original file line number Diff line number Diff line change @@ -686,6 +686,7 @@ Wojtek Walczak
686686Charles Waldman
687687Richard Walker
688688Larry Wall
689+ Leif Walsh
689690Greg Ward
690691Barry Warsaw
691692Steve Waterbury
Original file line number Diff line number Diff line change @@ -975,6 +975,10 @@ Library
975975Extension Modules
976976-----------------
977977
978+ - Issue 1820: structseq objects did not subclass from tuple so they did
979+ not pass isinstance(t, tuple) tests and they could not be passed to
980+ the % string formatting operator as an input tuple.
981+
978982- _winreg's HKEY object has gained __enter__ and __exit__ methods to support
979983 the context manager protocol. The _winreg module also gained a new function
980984 ``ExpandEnvironmentStrings`` to expand REG_EXPAND_SZ keys.
Original file line number Diff line number Diff line change @@ -460,7 +460,7 @@ static PyTypeObject _struct_sequence_template = {
460460 structseq_methods , /* tp_methods */
461461 NULL , /* tp_members */
462462 0 , /* tp_getset */
463- 0 , /* tp_base */
463+ & PyTuple_Type , /* tp_base */
464464 0 , /* tp_dict */
465465 0 , /* tp_descr_get */
466466 0 , /* tp_descr_set */
You can’t perform that action at this time.
0 commit comments