This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Argument Clinic should understand Python special methods
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: georg.brandl, larry, python-dev
Priority: normal Keywords:

Created on 2014-01-12 21:11 by larry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit larry, 2014-01-12 21:11 review larry, 2014-01-12 21:31 review
Messages (3)
msg207980 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-12 21:11
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.
msg207981 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-01-12 21:31
Updated patch incorporating changes from Georg Brandl.  Thanks Georg!
msg207986 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-12 22:13
New changeset bc5f257f5cc1 by Larry Hastings in branch 'default':
Issue #20228: Argument Clinic now has special support for class special
Date User Action Args
2022-04-11 14:57:56adminsetgithub: 64427
2014-01-12 22:13:55larrysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-01-12 22:13:18python-devsetnosy: + python-dev
messages: + msg207986
2014-01-12 21:31:51larrysetfiles: +

messages: + msg207981
2014-01-12 21:11:48larrycreate