[issue23902] let exception react to being raised or the setting of magic properties (like __cause__) within Python

2022-01-10 Thread Irit Katriel


Change by Irit Katriel :


--
stage:  -> resolved
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23902] let exception react to being raised or the setting of magic properties (like __cause__) within Python

2022-01-01 Thread Irit Katriel


Irit Katriel  added the comment:

I think this proposal should be rejected. We cannot safely pass control back to 
python code in the midst of raising an exception.

--
resolution:  -> rejected
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23902] let exception react to being raised or the setting of magic properties (like __cause__) within Python

2021-10-20 Thread Irit Katriel


Irit Katriel  added the comment:

> It seems sufficient to call a magic method on the exception immediately after 
> these the traceback/cause/context parameters have been set while it is being 
> raised


What should happen if this callback raises an exception?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue23902] let exception react to being raised or the setting of magic properties (like __cause__) within Python

2015-04-09 Thread Travis Everett

New submission from Travis Everett:

I've been working on a testing tool which raises its own exceptions from those 
thrown by code under test. The tool's exceptions do some analysis to categorize 
and add additional information to the underlying exceptions, and they need 
access to the __cause__ property in order to build this information.

Unfortunately, because the __cause__ property isn't available on the exception 
objects at init time, some number of workarounds must be employed which make 
the exception harder to use properly and code handling it less intuitive. While 
the workarounds are fine at the moment, it would be ideal if the exceptions 
could be notified instead of burdening the site of each use with workarounds.

It seems sufficient to call a magic method on the exception immediately after 
these the traceback/cause/context parameters have been set while it is being 
raised, allowing the exception to perform any essential work. A 
bells-and-whistles implementation might be a magic method called at raise time 
with all of these properties as arguments (and the responsibility to deal with 
them)--but I assume there are reasons exception objects don't already have this 
level of control.

--
messages: 240377
nosy: abathur
priority: normal
severity: normal
status: open
title: let exception react to being raised or the setting of magic properties 
(like __cause__) within Python
type: enhancement
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

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



[issue23902] let exception react to being raised or the setting of magic properties (like __cause__) within Python

2015-04-09 Thread R. David Murray

R. David Murray added the comment:

Can't you use a __setattr__ hook?  Your use case seems pretty specialized.

--
nosy: +r.david.murray

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