[merge] http multirange support
Martin Pool
mbp at canonical.com
Wed Jul 19 01:07:27 BST 2006
On 18 Jul 2006, Andrew Bennetts <andrew at canonical.com> wrote:
> On Tue, Jul 18, 2006 at 06:16:08PM +1000, Martin Pool wrote:
> > On 13 Jul 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> [...]
> > > + tell = getattr(data, 'tell', None)
> > > + if tell is None:
> > > + return StringIO(data.read())
> > > + return data
> >
> > Why not just do 'if not hasattr'...?
>
> I don't know if this is John's reason, but one big disadvantage of hasattr is
> that it swallows all exceptions, such as KeyboardInterrupt (and silently converts
> them to a return value of False).
>
> It's a pretty minor issue for things that are normal attributes, but for
> instance in the ZODB world it's a major problem because attribute access can
> cause an ConflictError, which is a very bad thing to ignore.
That's rather awful.
Maybe we should recommend against it and try to pull them out as we do
for bare except.
Maybe this will be fixed in 2.5 with the new BaseException?
> I'm not sure it's a significant concern for bzr, but the issue with hasattr is
> enough that some people never use it just in case.
It's not the end of the world but it looks bad to ignore ^c, and it's a
bit gross that it might cause incorrect behaviour.
--
Martin
More information about the bazaar
mailing list