diff -r 160fd3a40072 Lib/test/test_tarfile.py --- a/Lib/test/test_tarfile.py Sat Apr 05 21:53:18 2014 +0200 +++ b/Lib/test/test_tarfile.py Sat Apr 05 22:41:25 2014 +0200 @@ -2135,11 +2135,14 @@ class OpenFileobjNameInteger(unittest.TestCase): # Issue 21044: tarfile.open() should handle fileobj with an integer 'name' # attribute. + filename = support.TESTFN def test_open_fobj_integer_name(self): - import tempfile - with tempfile.TemporaryFile() as fobj: - tarfile.open(fileobj=fobj, mode='w') + fd = os.open(self.filename, os.O_WRONLY | os.O_CREAT) + with os.fdopen(fd, 'wb') as fobj: + for mode in ['', 'gz', 'bz2', 'xz']: + for sep in ['|', ':']: + tarfile.open(fileobj=fobj, mode=('w' + sep + mode)) def setUpModule():