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.

Author mdk
Recipients larry, mdk, rhettinger
Date 2016-11-20.20:12:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479672776.7.0.136227196021.issue28754@psf.upfronthosting.co.za>
In-reply-to
Content
I searched an occurrence of what I'm describing which is already using clinic and there is, at least, one in Modules/binascii.c line 1090:

TL;DR: The idea is to use the `modulename.fnname [as c_basename] = modulename.existing_fn_name` clinic syntax, drop a "This function is also available as …" in the docstring, and check if they return the same thing in the tests.

This way looks good to me, it uses the dedicated syntax which looks right, and I'll drop the `self.assertEqual(self.module.bisect, self.module.bisect_right)` which is an implementation detail, replacing it by tests checking that both have the same behavior.

```
/*[clinic input]
binascii.b2a_hex

    data: Py_buffer
    /

Hexadecimal representation of binary data.

The return value is a bytes object.  This function is also
available as "hexlify()".
[clinic start generated code]*/

static PyObject *
binascii_b2a_hex_impl(PyObject *module, Py_buffer *data)
/*[clinic end generated code: output=92fec1a95c9897a0 input=96423cfa299ff3b1]*/
{
    return _Py_strhex_bytes((const char *)data->buf, data->len);
}

/*[clinic input]
binascii.hexlify = binascii.b2a_hex

Hexadecimal representation of binary data.

The return value is a bytes object.
[clinic start generated code]*/

static PyObject *
binascii_hexlify_impl(PyObject *module, Py_buffer *data)
/*[clinic end generated code: output=749e95e53c14880c input=2e3afae7f083f061]*/
{
    return _Py_strhex_bytes((const char *)data->buf, data->len);
}
```
History
Date User Action Args
2016-11-20 20:12:56mdksetrecipients: + mdk, rhettinger, larry
2016-11-20 20:12:56mdksetmessageid: <1479672776.7.0.136227196021.issue28754@psf.upfronthosting.co.za>
2016-11-20 20:12:56mdklinkissue28754 messages
2016-11-20 20:12:56mdkcreate