[issue20326] Argument Clinic should use a non-error-prone syntax to mark text signatures

Nick Coghlan report at bugs.python.org
Sun Jan 26 14:44:17 CET 2014


Nick Coghlan added the comment:

Stefan actually picked up on an existing bug there, that this patch just changes the spelling of:

>>> int.__rdivmod__.__doc__
'__rdivmod__(self, value)\nReturns divmod(value, self).'
>>> int.__rdivmod__.__text_signature__
'(self, value)'

When reviewing Larry's typeobject.c patch, both Guido and I missed the fact that some of the "slot" macros have implicit lines in their docstrings if the signature is common across all instances of that slot:

#define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
    ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
           NAME "(self)\n" DOC)
#define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
    ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
           NAME "(self, value)\nReturns self" DOC "value.")
#define BINSLOT(NAME, SLOT, FUNCTION, DOC) \
    ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
           NAME "(self, value)\nReturns self" DOC "value.")
#define RBINSLOT(NAME, SLOT, FUNCTION, DOC) \
    ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
           NAME "(self, value)\nReturns value" DOC "self.")
#define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
    ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
           NAME "(self, value)\n" DOC)
#define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
    ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
           NAME "(self, value)\n" DOC)

For those, we need to change the macro and then remove the redundant info from the individual slot definitions.

----------

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


More information about the Python-bugs-list mailing list