Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'value' attribute for ValueError #62366

Closed
brettcannon opened this issue Jun 7, 2013 · 5 comments
Closed

'value' attribute for ValueError #62366

brettcannon opened this issue Jun 7, 2013 · 5 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@brettcannon
Copy link
Member

BPO 18166
Nosy @warsaw, @brettcannon, @pitrou, @ezio-melotti

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2015-04-14.22:09:41.854>
created_at = <Date 2013-06-07.20:56:56.703>
labels = ['interpreter-core', 'type-feature']
title = "'value' attribute for ValueError"
updated_at = <Date 2015-04-14.22:09:41.852>
user = 'https://github.com/brettcannon'

bugs.python.org fields:

activity = <Date 2015-04-14.22:09:41.852>
actor = 'pitrou'
assignee = 'none'
closed = True
closed_date = <Date 2015-04-14.22:09:41.854>
closer = 'pitrou'
components = ['Interpreter Core']
creation = <Date 2013-06-07.20:56:56.703>
creator = 'brett.cannon'
dependencies = []
files = []
hgrepos = []
issue_num = 18166
keywords = []
message_count = 5.0
messages = ['190781', '228594', '240945', '241033', '241042']
nosy_count = 7.0
nosy_names = ['barry', 'brett.cannon', 'pitrou', 'ezio.melotti', 'cvrebert', 'BreamoreBoy', 'blackfawn']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue18166'
versions = ['Python 3.5']

@brettcannon
Copy link
Member Author

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.

@brettcannon brettcannon added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Jun 7, 2013
@BreamoreBoy
Copy link
Mannequin

BreamoreBoy mannequin commented Oct 5, 2014

Just a gentle reminder guys.

@blackfawn
Copy link
Mannequin

blackfawn mannequin commented Apr 14, 2015

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__.

@blackfawn
Copy link
Mannequin

blackfawn mannequin commented Apr 14, 2015

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.

@pitrou
Copy link
Member

pitrou commented Apr 14, 2015

Thanks for the analysis. Closing then!

@pitrou pitrou closed this as completed Apr 14, 2015
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants