Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-14 Thread Nick Coghlan
Karen Tracey wrote: > There is already a bug for this, I believe: > > http://bugs.python.org/issue1242657 Thanks. Raymond, based on your other message, I kicked that issue in your direction. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia -

Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-14 Thread Raymond Hettinger
If you want this changed, I can use a negative return value for other than an attribute error, and modify the calling code to handle the exception. To me this isn't worth making the code slower and more complex. But I can also see wanting to catch a SystemError at any possible step. It has the

Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-14 Thread Guido van Rossum
On Wed, Jan 14, 2009 at 10:11 AM, Raymond Hettinger wrote: > _PyObject_LengthHint() is specified to never fail. > If any exception occurs along the way, it returns a > default value. In the context of checking for length > hints from an iterator, this seems reasonable to me. > > If you want this

Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-14 Thread Raymond Hettinger
_PyObject_LengthHint() is specified to never fail. If any exception occurs along the way, it returns a default value. In the context of checking for length hints from an iterator, this seems reasonable to me. If you want this changed, I can use a negative return value for other than an attribute

Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-14 Thread Karen Tracey
On Wed, Jan 14, 2009 at 6:12 AM, Nick Coghlan wrote: > Dino Viehland wrote: > > We had a bug reported that effectively boils down to we're not > > swallowing exceptions when list calls __len__ > > ( > http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=20598 > ). > > > >

Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-14 Thread Nick Coghlan
Dino Viehland wrote: > We had a bug reported that effectively boils down to we’re not > swallowing exceptions when list calls __len__ > (http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=20598). > > > We can obviously make the change to catch exceptions here in > IronPy

Re: [Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-13 Thread Guido van Rossum
There seems to be an unconditional PyErr_Clear() in _PyObject_LengthHint(). I think that could and should be much more careful; it probably should only ignore AttributeErrors (though there may be unittests to the contrary). On Tue, Jan 13, 2009 at 8:24 PM, Dino Viehland wrote: > We had a bug repo

[Python-Dev] should list's call to __len__ swallow SystemExit?

2009-01-13 Thread Dino Viehland
We had a bug reported that effectively boils down to we’re not swallowing exceptions when list calls __len__ (http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=20598). We can obviously make the change to catch exceptions here in IronPython even if it seems like a bad