[issue20228] Argument Clinic should understand Python special methods

Larry Hastings report at bugs.python.org
Sun Jan 12 22:11:48 CET 2014


New submission from Larry Hastings:

As per Georg's request (and hacks in other places), Argument Clinic should have support for special methods.  To wit:

__init__ should be required to be an instance method.  Clinic should suppress its methoddef #define.

__new__ should be required to be a class method.  Its C function name should have the __new__ stripped off, and by convention its first argument should be "PyTypeObject *type".  Clinic should suppress its methoddef #define.

All other dunder-methods which have special slots in the PyTypeObject structure should be rejected by Argument Clinic.  (Their arguments are pre-parsed, and they don't have docstrings... what would Clinic do for them?)  Obviously generic dunder-methods ("__getstate__", "__sizeof__") are still fine.

----------
assignee: larry
components: Demos and Tools
files: larry.special.methods.support.patch.1.txt
messages: 207980
nosy: georg.brandl, larry
priority: normal
severity: normal
stage: patch review
status: open
title: Argument Clinic should understand Python special methods
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file33433/larry.special.methods.support.patch.1.txt

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


More information about the Python-bugs-list mailing list