- Ensure fds are closed on exceptions (markmc, #404211)

epel9
Jeremy Katz 17 years ago
parent ee3c87e24e
commit aae8f4ae2f

@ -3,10 +3,11 @@
Summary: A high-level cross-protocol url-grabber Summary: A high-level cross-protocol url-grabber
Name: python-urlgrabber Name: python-urlgrabber
Version: 3.0.0 Version: 3.0.0
Release: 3%{?dist} Release: 4%{?dist}
Source0: urlgrabber-%{version}.tar.gz Source0: urlgrabber-%{version}.tar.gz
Patch0: urlgrabber-keepalive.patch Patch0: urlgrabber-keepalive.patch
Patch1: urlgrabber-string-type.patch Patch1: urlgrabber-string-type.patch
Patch2: urlgrabber-3.0.0-cleanup.patch
License: LGPLv2+ License: LGPLv2+
Group: Development/Libraries Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@ -24,6 +25,7 @@ authentication, proxies and more.
%setup -q -n urlgrabber-%{version} %setup -q -n urlgrabber-%{version}
%patch0 -p0 %patch0 -p0
%patch1 -p1 %patch1 -p1
%patch2 -p1
%build %build
python setup.py build python setup.py build
@ -43,6 +45,9 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/urlgrabber %{_bindir}/urlgrabber
%changelog %changelog
* Mon Dec 3 2007 Jeremy Katz <katzj@redhat.com> - 3.0.0-4
- Ensure fds are closed on exceptions (markmc, #404211)
* Wed Oct 10 2007 Jeremy Katz <katzj@redhat.com> - 3.0.0-3 * Wed Oct 10 2007 Jeremy Katz <katzj@redhat.com> - 3.0.0-3
- fix type checking of strings to also include unicode strings; fixes - fix type checking of strings to also include unicode strings; fixes
regets from yum (#235618) regets from yum (#235618)

@ -0,0 +1,28 @@
diff -up urlgrabber-3.0.0/urlgrabber/grabber.py.cleanup urlgrabber-3.0.0/urlgrabber/grabber.py
--- urlgrabber-3.0.0/urlgrabber/grabber.py.cleanup 2007-11-29 10:25:13.000000000 +0000
+++ urlgrabber-3.0.0/urlgrabber/grabber.py 2007-11-29 10:26:15.000000000 +0000
@@ -1204,16 +1204,18 @@ class URLGrabberFileObject:
bs = 1024*8
size = 0
- if amount is not None: bs = min(bs, amount - size)
- block = self.read(bs)
- size = size + len(block)
- while block:
- new_fo.write(block)
+ try:
if amount is not None: bs = min(bs, amount - size)
block = self.read(bs)
size = size + len(block)
+ while block:
+ new_fo.write(block)
+ if amount is not None: bs = min(bs, amount - size)
+ block = self.read(bs)
+ size = size + len(block)
+ finally:
+ new_fo.close()
- new_fo.close()
try:
modified_tuple = self.hdr.getdate_tz('last-modified')
modified_stamp = rfc822.mktime_tz(modified_tuple)
Loading…
Cancel
Save