Issue 18166: 'value' attribute for ValueError
Created on 2013-06-07 20:56 by brett.cannon, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg190781 - (view) | Author: Brett Cannon (brett.cannon) * ![]() |
Date: 2013-06-07 20:56 | |
A 'value attribute for ValueError could store a weakref to the value which triggered the exception. It should be a weakref so at to prevent accidental prevention of GC of the value. |
|||
| msg228594 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014-10-05 17:32 | |
Just a gentle reminder guys. |
|||
| msg240945 - (view) | Author: Ofer Schwarz (blackfawn) * | Date: 2015-04-14 16:53 | |
There's actually no advantage for a weakref here, since the exception object already holds an indirect reference to all the raising frame's locals through __traceback__. |
|||
| msg241033 - (view) | Author: Ofer Schwarz (blackfawn) * | Date: 2015-04-14 21:29 | |
So, this is actually impossible to do. Since exceptions are c-level classes, adding members to ValueError means anything that multiple-inherits from ValueError and any other complex exception gets a multiple bases layout conflict. There's already one such class - _pyio.UnsupportedOperation inherits both ValueError and OSError - but the bigger issue is that this would break compatibility. After discussing it (face-to-face) with a bunch of core devs, I think the only reasonable course of action is to close the issue and never speak of this again. |
|||
| msg241042 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2015-04-14 22:09 | |
Thanks for the analysis. Closing then! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:46 | admin | set | github: 62366 |
| 2015-04-14 22:09:41 | pitrou | set | status: open -> closed nosy:
+ pitrou resolution: rejected |
| 2015-04-14 21:29:19 | blackfawn | set | messages: + msg241033 |
| 2015-04-14 16:53:00 | blackfawn | set | nosy:
+ blackfawn messages: + msg240945 |
| 2014-10-05 17:32:34 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages:
+ msg228594 |
| 2013-06-15 21:06:15 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2013-06-14 16:26:05 | cvrebert | set | nosy:
+ cvrebert |
| 2013-06-07 21:23:57 | barry | set | nosy:
+ barry |
| 2013-06-07 20:56:56 | brett.cannon | create | |
