[issue11513] Infinite recursion around raising an exception in tarfile

Andreas Stührk report at bugs.python.org
Tue Mar 15 02:57:42 CET 2011


Andreas Stührk <andy-python at hammerhartes.de> added the comment:

The infinite recursion happens because `open` in tarfile is really `TarFile.open` (see last line in the module). The builtin `open` is imported as `_open`.

I also think that explicitly checking for "fileobj" being None is a cleaner solution. With your current method (trying to open the file beforehand), you will introduce a race condition: If the file exists when you open it for the first time but has been deleted when you try to open it the second time, the exact same error will happen ("fileobj" being None, that is).

----------
nosy: +Trundle

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11513>
_______________________________________


More information about the Python-bugs-list mailing list