[issue26961] Provide an API to help debug super().__getattribute__ results

2016-05-05 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26961] Provide an API to help debug super().__getattribute__ results

2016-05-05 Thread Doug Hellmann

Doug Hellmann added the comment:

@Nick - Being able to get to the source is ok, but if I can get the actual type 
I can always get the source from that. I don't need the actual type object 
except to know what it is, and it seems more flexible to return the class 
object than a name or other reference to it that I then have to turn into the 
class object if I really did need it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26961] Provide an API to help debug super().__getattribute__ results

2016-05-05 Thread Doug Hellmann

Doug Hellmann added the comment:

The specific case I have right now is with a large code base written by someone 
else who is seeing a TypeError when they call super(their-local-class, 
self).__init__() because whatever class super() is returning is expecting 
arguments to __init__(). The TypeError thrown doesn't say what is being called 
(that's a separate issue) so I was trying to debug. The __init__() method of 
super() is a special wrapper, so there isn't any way using only super() to 
access the class it has decided to use. I'm currently walking the MRO by hand 
to find the class that's causing the problem. I expected to be able to do 
something like super(their-local-class, self).give_me_the_type_with('__init__') 
and get back a class.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26961] Provide an API to help debug super().__getattribute__ results

2016-05-05 Thread Nick Coghlan

Nick Coghlan added the comment:

Actually, since this is intended primarily for debugging:

Doug, do you actually need the type information? Or would combining 
inspect.getsourcefile() and inspect.getlines() with super().__init__ to locate 
the source code for the offending method implementation be sufficient?

If that's the case, then the only benefit of this API would be to extend such 
debugging to extension module types in addition to regular Python classes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26961] Provide an API to help debug super().__getattribute__ results

2016-05-04 Thread Nick Coghlan

Nick Coghlan added the comment:

The main reason for suggesting operator is that it needs to be in an extension 
module if it's going to share the underlying lookup algorithm used by 
super().__getattribute__ rather than reimplementing it.

I'm not particularly concerned about the exact API name though, so I changed 
the title of the issue to explain the problem to be solved, rather than to 
propose a particular solution.

Doug, could you provide a specific example of the cryptic traceback that 
started the discussion?

--
title: Add operator.get_providing_type -> Provide an API to help debug 
super().__getattribute__ results

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com