Julien Palard added the comment:

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);
}
```

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28754>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to