This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add reference to the object missing an attribute to AttributeError
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, flying sheep, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-10-24 15:02 by flying sheep, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
attribute_error_origin.patch flying sheep, 2014-10-24 15:02 Patch adding the origin of an AttributeError
Messages (6)
msg229923 - (view) Author: (flying sheep) * Date: 2014-10-24 15:02
Trying to replicate a Ruby Gem that raises a “did you mean” error when mistyping a method name, I hit a showstopper:

There seems to be no way to get the object which misses an attribute from an AttributeError.

I propose the appended patch (it might be completely broken because I’m not experienced in the Python C API, but I tried)
msg229926 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-24 15:07
This is a duplicate of issue18156.
msg230007 - (view) Author: (flying sheep) * Date: 2014-10-25 15:13
No, this is about the object which misses an argument, not the attribute name.

But thanks for the pointer: one combined fix for both would be the smartest thing to do.
msg230010 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-10-25 17:35
See also PEP 473.
msg230500 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-11-02 16:08
I think we should be pursued together with #18156, so I'm going to close this.  Serhiy already added a reference to this issue there.
msg230503 - (view) Author: (flying sheep) * Date: 2014-11-02 16:31
sure, go ahead! i wasn’t aware of PEP nor issue, so sorry for filing a dupe.
History
Date User Action Args
2022-04-11 14:58:09adminsetgithub: 66905
2014-11-02 16:31:27flying sheepsetmessages: + msg230503
2014-11-02 16:08:54ezio.melottisetstatus: open -> closed

nosy: + ezio.melotti
messages: + msg230500

resolution: duplicate
stage: resolved
2014-10-25 17:35:40serhiy.storchakasetmessages: + msg230010
2014-10-25 15:26:33r.david.murraysetsuperseder: Add an 'attr' attribute to AttributeError ->
stage: resolved -> (no value)
resolution: duplicate -> (no value)
versions: + Python 3.5, - Python 3.6
2014-10-25 15:13:21flying sheepsetstatus: closed -> open

messages: + msg230007
2014-10-24 15:07:45serhiy.storchakasetstatus: open -> closed

superseder: Add an 'attr' attribute to AttributeError

nosy: + serhiy.storchaka
messages: + msg229926
resolution: duplicate
stage: resolved
2014-10-24 15:02:59flying sheepcreate