[issue20710] Make inspect and pydoc consistent about bound methods

Larry Hastings report at bugs.python.org
Fri Feb 21 01:19:31 CET 2014


New submission from Larry Hastings:

inspect has a bug:
* inspect.ismethod() returns False for bound methods on builtins.

If I fix that, that exposes a bug in pydoc:
* pydoc's two docroutine() functions assume that bound methods
  have a __func__; bound builtins do not.

The only reason pydoc assumed the __func__ attribute was so it could use that instead of the bound function when getting the signature.  I don't know why it cared, but: when it does so, that means it displays "self" for bound methods implemented in Python.

However, since it doesn't do that for bound methods implemented in C, now the behavior is inconsistent.  Should it display self or not?  The consensus was, it should not.  This would make pydoc consistent with inspect.signature.

This patch therefore changes a third thing:

* pydoc: don't display "self" for bound methods implemented in Python.

I propose to merge this for 3.4.0rc2.

----------
assignee: larry
components: Library (Lib)
files: larry.fix.help.on.bound.methods.1.diff
keywords: patch
messages: 211768
nosy: larry, ncoghlan, yselivanov
priority: release blocker
severity: normal
status: open
title: Make inspect and pydoc consistent about bound methods
versions: Python 3.4
Added file: http://bugs.python.org/file34162/larry.fix.help.on.bound.methods.1.diff

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


More information about the Python-bugs-list mailing list