[Python-Dev] Attribute error: providing type name (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Sun Nov 30 20:47:34 CET 2008


Filip Gruszczyński wrote:

Well, if this is not an inconvenient spot that requires a gross hack to print the type name I'd love to get some instructions or direction, and try to change it myself. Unfortunately it's the first time I looked into Python source and it's pretty big - I tried browsing exceptions.c and errors.c, but couldn't find any simple place, where I could place the required type information.

You need to look at the places that raise AttributeError; grep the entire source for it (both C and .py files). In PyObject_GetAttr (or PyObject_GenericGetAttr), you'll find the place where the case of functions is dealt with.

Alternatively, pick a specific test case, and try to find out where it raises the exception. E.g. set a debugger breakpoint, on PyErr_SetString and PyErr_Format, and see whether your test case triggers that breakpoint. Then walk up the stack to find out where the exception is raised.

I can of course post it on the bug tracker, but I believe I could learn something on this ;-)

I sure hope so.

And I don't like missing a chance to get a glance at something new.

Good luck!

Martin



More information about the Python-Dev mailing list