[issue10011] `except` doesn't use `isinstance`

2010-10-08 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Questions should be asked on python-list or other discussion forums, not nere. 
If this were a feature-request, it would need a realistic use-case. If the 
implied change were requested, I would think it should be rejected as 
conflicting with the language definition, which to me stipulates that when an 
exception is raised, nothing happens until it is caught.

--
nosy: +terry.reedy
resolution:  - invalid
status: open - closed
versions:  -Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10011] `except` doesn't use `isinstance`

2010-10-02 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

Also, how important is the performance of exception checking *after* an 
exception was raised? I mean, wouldn't it matter only for programs that raise 
and catch hundreds of exceptions a second?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10011] `except` doesn't use `isinstance`

2010-10-02 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

It matters when exceptions are expected or are a normal part of control flow. 
For example StopIteration.

--
nosy: +benjamin.peterson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10011] `except` doesn't use `isinstance`

2010-10-01 Thread Ram Rachum

New submission from Ram Rachum cool...@cool-rr.com:

Is there a reason why `execpt` compares base classes instead of using 
`isinstance`? This prevents using `__instancecheck__` to override the instance 
check.

--
components: Interpreter Core
messages: 117844
nosy: cool-RR
priority: normal
severity: normal
status: open
title: `except` doesn't use `isinstance`
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10011] `except` doesn't use `isinstance`

2010-10-01 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Mainly to protect against potential infinite recursion with isinstance checks. 
Also, performance is probably better.

Here are the relevant code and comments in PyErr_GivenExceptionMatches() (in 
Python/errors.c):

/* PyObject_IsSubclass() can recurse and therefore is
   not safe (see test_bad_getattr in test.pickletester). */
res = PyType_IsSubtype((PyTypeObject *)err, (PyTypeObject *)exc);

--
nosy: +pitrou
versions:  -Python 2.5, Python 2.6, Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10011] `except` doesn't use `isinstance`

2010-10-01 Thread Ram Rachum

Ram Rachum cool...@cool-rr.com added the comment:

I don't understand the infinite recursion argument. If there's such an infinite 
recursion, wouldn't it be due to a bug in the user's implementation of 
__instancecheck__?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com