Re: Any way to turn off exception handling? (debugging)

2010-02-12 Thread Vinay Sajip
On Feb 11, 7:12 pm, mk mrk...@gmail.com wrote: Peter Otten wrote: try:    ... except socket.error:    ... #untested import socket class SocketWrapper:     def __getattr__(self, name):         return getattr(socket, name)     error = None import module_using_socket

Re: Any way to turn off exception handling? (debugging)

2010-02-12 Thread Duncan Booth
Peter Otten __pete...@web.de wrote: You could try to shadow the exception class with None: ZeroDivisionError = None try: ... 1/0 ... except ZeroDivisionError: ... print caught ... Traceback (most recent call last): File stdin, line 2, in module ZeroDivisionError: integer

Re: Any way to turn off exception handling? (debugging)

2010-02-12 Thread Peter Otten
Duncan Booth wrote: Peter Otten __pete...@web.de wrote: You could try to shadow the exception class with None: This works in Python 2.x but will break in Python 3. None is not a valid exception specification and Python 3 will check for that and complain. A better solution is to use an

Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Hello everyone, I'm getting an exception (on socket) handled in a program I'm trying to debug. I have trouble locating where exactly that happens. In such situation turning exception handling off could be useful, bc unhandled exception stack trace is precisely what I'm trying to obtain.

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Steve Holden
mk wrote: Hello everyone, I'm getting an exception (on socket) handled in a program I'm trying to debug. I have trouble locating where exactly that happens. In such situation turning exception handling off could be useful, bc unhandled exception stack trace is precisely what I'm trying to

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Steve Holden wrote: I'm getting an exception (on socket) handled in a program I'm trying to debug. I have trouble locating where exactly that happens. If the exception is currently being trapped by a handler in your code It's not my code. you could just insert a raise statement at the

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Simon Brunning
On 11 February 2010 16:17, mk mrk...@gmail.com wrote: I'm getting an exception (on socket) handled in a program I'm trying to debug. I have trouble locating where exactly that happens. In such situation turning exception handling off could be useful, bc unhandled exception stack trace is

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Simon Brunning wrote: Not as far as I know. Besides, the chances are that if you were to be able to turn off exception handling altogether your code wouldn't make it as far as the code you are interested in anyway. Sure, but I could deal with that, jerry-rigging the code as exceptions go by,

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Stephen Hansen
On Thu, Feb 11, 2010 at 9:32 AM, mk mrk...@gmail.com wrote: Simon Brunning wrote: Not as far as I know. Besides, the chances are that if you were to be able to turn off exception handling altogether your code wouldn't make it as far as the code you are interested in anyway. Sure, but I

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly breaks. Ouch. Sure I

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Paul Rubin
mk mrk...@gmail.com writes: Um... run your code in a debugger. ..except the code in question is multithreaded and pdb is no good for that, and last time I checked, yappi was broken. Try winpdb.org. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Stephen Hansen wrote: the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly breaks.

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Peter Otten
mk wrote: the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly breaks. Ouch.

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread Steve Holden
mk wrote: Stephen Hansen wrote: the uncommon, the exceptional, case. If one could somehow turn off exceptions, you can't even do a for loop: every for loop would become infinite-- exceptions are how Python signals the end of an iterator. Think about that, *every* for loop in Python suddenly

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Paul Rubin wrote: mk mrk...@gmail.com writes: Um... run your code in a debugger. ..except the code in question is multithreaded and pdb is no good for that, and last time I checked, yappi was broken. Try winpdb.org. This is a treasure! In minutes I've had this attached to remote process

Re: Any way to turn off exception handling? (debugging)

2010-02-11 Thread mk
Peter Otten wrote: try: ... except socket.error: ... #untested import socket class SocketWrapper: def __getattr__(self, name): return getattr(socket, name) error = None import module_using_socket module_using_socket.socket = SocketWrapper() Very interesting