[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-16 Thread R. David Murray
R. David Murray added the comment: This fix reveals a second bug. Without this fix, a non-existent file raises an IOError with an appropriate error message, but with the chained exception. After this fix, it raises an error that says 'not a gzip file', which while technically true is not ve

[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-15 Thread Evan Dandrea
Changes by Evan Dandrea : Removed file: http://bugs.python.org/file21222/tarfile-fix-multiple-exception-on-enoent.patch ___ Python tracker ___ __

[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-15 Thread Evan Dandrea
Changes by Evan Dandrea : Added file: http://bugs.python.org/file21223/tarfile-fix-multiple-exception-on-enoent.patch ___ Python tracker ___

[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-15 Thread Evan Dandrea
Evan Dandrea added the comment: *facepalm* Indeed, thanks for pointing that out and nice catch on the race condition. Attached is a patch to fix the issue as you've suggested, and adds a test case for it. -- keywords: +patch Added file: http://bugs.python.org/file21222/tarfile-fix-m

[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-14 Thread Andreas Stührk
Andreas Stührk 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 curren

[issue11513] Infinite recursion around raising an exception in tarfile

2011-03-14 Thread Evan Dandrea
New submission from Evan Dandrea : Using Python tip from Sunday, I noticed that tarfile does not elegantly handle ENOENT by raising a single exception: >>> tarfile.TarFile.gzopen('fdsfd', 'r') Traceback (most recent call last): File "/home/evan/hg/cpython/Lib/tarfile.py", line 1808, in gzopen