Qix- / better-exceptions

Pretty and useful exceptions in Python, automatically.
MIT License
4.59k stars 203 forks source link

format_value: catch BaseException #86

Closed blueyed closed 5 years ago

blueyed commented 5 years ago

Ref: https://github.com/Qix-/better-exceptions/issues/85#issuecomment-489930136

blueyed commented 5 years ago

OTOH this would also swallow KeyboardInterrupt then.. which might be problematic if there's some infinite loop in multiple repr's - not sure if this is good.

Qix- commented 5 years ago

OTOH this would also swallow KeyboardInterrupt then.. which might be problematic if there's some infinite loop in multiple repr's - not sure if this is good.

This is indeed problematic. Wouldn't it be okay to check if it's a KeyboardInterrupt exception?

blueyed commented 5 years ago

Ok, we could change it to raise KeyboardInterrupt still - is that what you mean?

Qix- commented 5 years ago

Yeah, I think something like this should work:

# ....
except KeyboardInterrupt:
    raise
blueyed commented 5 years ago

Cool, amended.

Qix- commented 5 years ago

Yeah I think this looks okay. @Delgan any objections?

Delgan commented 5 years ago

@Qix- Yeah, this looks fine. :)

The standard library doesn't even bother with KeyboardInterupt, but do catch BaseException, so this is a welcome improvement.

Qix- commented 5 years ago

Great :)