[issue20189] inspect.Signature doesn't recognize all builtin types

Larry Hastings report at bugs.python.org
Thu Jan 23 15:28:16 CET 2014


Larry Hastings added the comment:

At last, my refreshed patch.  Changes from the previous patch:

* Had another mildly bright idea.  The name "PyTypeObject *cls"
  is a holdover from < Python 2.2 days, before the merging of classes
  and types.  Now they're both the same thing and the official name
  in Python is "type".  So the self_converter uses the word "type".

* Added __text_signature__ to PyType_Type.

* Removed __text_signature__ from PyMemberDescr_Type, as it's not
  callable.  (What was I thinking!)

* Hand-coded signatures for default docstrings for slots.

* Hand-coded signature for type and object.  (The one for type isn't
  correct, I know, we'll get there.)

* clinic.py now generates self/module/type parameters for most
  text signatures; these are then stripped off if the function is
  bound.

* Ensured that inspect.signature raises ValueError if it can't
  generate a signature for a callable object.

* Added unit tests.

* Suppress the null "self" parameter for METH_STATIC calls in the impl.

* If you have an empty docstring for __new__ or __init__, it suppresses
  the static variables completely.

* Functions with a self converter use the type of self for the
  parsing function.  (Except __new__ and __init__, which must conform
  to using PyObject *.)

Boy am I emotionally ready to check this thing in.

----------
Added file: http://bugs.python.org/file33655/larry.support.text_signature.on.more.types.6.txt

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


More information about the Python-bugs-list mailing list