[New-bugs-announce] [issue31550] Inconsistent error message for TypeError with subscripting
Anthony Sottile
report at bugs.python.org
Thu Sep 21 23:32:38 EDT 2017
New submission from Anthony Sottile:
There's a bit of history I don't understand and couldn't find the appropriate trail for.
The original error message from the 2.6 era:
$ python2.6 -c 0[0]
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'int' object is unsubscriptable
This was changed in https://github.com/python/cpython/commit/f5fd5239819c5dfb1d7a33484be49dc705544d02 for clarity
As seen in 2.7.1
$ ./python2.7.1 -c 0[0]
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'int' object is not subscriptable
It was later changed in the 2.7 era here:
https://github.com/python/cpython/commit/7d1483cbadbe48620964348a2039690624e7dc8e
To this error message (as demonstrated with 2.7.12):
$ python2.7 -c 0[0]
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'int' object has no attribute '__getitem__'
However, this patch never made it into the 3.x branch:
$ python3.6 -c 0[0]
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'int' object is not subscriptable
Should this patch be (have been) cherry picked into master?
----------
components: Interpreter Core
messages: 302736
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Inconsistent error message for TypeError with subscripting
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31550>
_______________________________________
More information about the New-bugs-announce
mailing list