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

Traceback changed in 2.6 for unhashable objects #46737

Closed
mg mannequin opened this issue Mar 25, 2008 · 3 comments
Closed

Traceback changed in 2.6 for unhashable objects #46737

mg mannequin opened this issue Mar 25, 2008 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@mg
Copy link
Mannequin

mg mannequin commented Mar 25, 2008

BPO 2485
Nosy @benjaminp, @bitdancer

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 2009-03-24.20:21:28.059>
created_at = <Date 2008-03-25.21:28:01.203>
labels = ['interpreter-core', 'type-bug', 'invalid']
title = 'Traceback changed in 2.6 for unhashable objects'
updated_at = <Date 2009-03-24.20:21:28.033>
user = 'https://bugs.python.org/mg'

bugs.python.org fields:

activity = <Date 2009-03-24.20:21:28.033>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2009-03-24.20:21:28.059>
closer = 'benjamin.peterson'
components = ['Interpreter Core']
creation = <Date 2008-03-25.21:28:01.203>
creator = 'mg'
dependencies = []
files = []
hgrepos = []
issue_num = 2485
keywords = []
message_count = 3.0
messages = ['64517', '84095', '84111']
nosy_count = 3.0
nosy_names = ['benjamin.peterson', 'mg', 'r.david.murray']
pr_nums = []
priority = 'low'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue2485'
versions = ['Python 2.6']

@mg
Copy link
Mannequin Author

mg mannequin commented Mar 25, 2008

The traceback message given when trying to hash unhashable objects has
changed from Python 2.5 to 2.6:

Python 2.5.2a0 (r251:54863, Feb 10 2008, 01:31:28) 
>>> hash([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list objects are unhashable

Python 2.6a1 (r26a1:61143, Mar 25 2008, 19:41:30) 
>>> hash([])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'

This breaks my Doctests unless I add a somewhat ugly "# doctest:
+IGNORE_EXCEPTION_DETAIL" comment, so if this is not done on purpose, I
would prefer Python 2.6 to output the same as 2.5.

@mg mg mannequin added the type-bug An unexpected behavior, bug, or error label Mar 25, 2008
@bitdancer
Copy link
Member

In 2.5, the fact that list was unhashable was checked in the list
object, and that message was hardcoded there. In 2.6, the check for
unhashableness uses generic code, and the resulting error substitutes
the type name into the message. This message already existed and was
used for other types, the difference between 2.5 and 2.6 is that list is
now covered by the generic code and is not a special case.

So, yes, this was intentional and no, it isn't going to get changed.

@bitdancer bitdancer added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Mar 24, 2009
@benjaminp
Copy link
Contributor

Error messages are not part of the API.

@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-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants