diff -r 18906f36f033 Lib/test/test_tarfile.py --- a/Lib/test/test_tarfile.py Mon Mar 24 18:18:39 2014 +0100 +++ b/Lib/test/test_tarfile.py Mon Mar 24 19:24:58 2014 +0100 @@ -2132,6 +2132,16 @@ self._test_partial_input("r:bz2") +class OpenFileobjNameInteger(unittest.TestCase): + # Issue 21044: tarfile.open() should handle fileobj with an integer 'name' + # attribute. + + def test_open_fobj_integer_name(self): + import tempfile + with tempfile.TemporaryFile() as fobj: + tarfile.open(fileobj=fobj, mode='w') + + def setUpModule(): support.unlink(TEMPDIR) os.makedirs(TEMPDIR)