[issue27901] inspect.ismethod returns different results on the same basic code between Python2.7 Python3.5

Anthony Flury report at bugs.python.org
Tue Aug 30 15:26:21 EDT 2016


New submission from Anthony Flury:

Consider the following code in Python2.7 & Python3.5 

    import inspect
    
    class a(object):
         def m(self):
             pass

in Python 2.7 
    
    inspect.ismethod(a.m) returns True

in Python 3.5
 
    inspect.ismethod(a.m) returns False

Not sure which is `correct`, but I can see the Python3.5 result causing some issues with automatic code documenters. 

I have code which will break under Python3.5 with this - my code performs static analysis of code, detecting functions, classes, attributes, and also traversing the mro to find inherited methods etc. Amongst other things this code identifies methods on classes, without instantiating those classes.

This may simply require a documentation change to explain the difference on Py3.5 - rather than a code change.

----------
components: Library (Lib)
messages: 273955
nosy: anthony-flury
priority: normal
severity: normal
status: open
title: inspect.ismethod returns different results on the same basic code between Python2.7 Python3.5
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27901>
_______________________________________


More information about the Python-bugs-list mailing list