[Python-Dev] PEP 485 isclose() implementation review requested (original) (raw)

Chris Barker chris.barker at noaa.gov
Mon May 18 01:02:49 CEST 2015


Folks,

After a huge delay, I finally found the time to implement the PEP 485 isclose() function, in C. I tihnk it's time for some review. I appologise for the fact that I have little experience with C, and haven't used the raw C API for years, but it's a pretty simple function, and there's lots of code to copy, so I think it's in OK shape. I hav not yet integrated it with the cPyton source code -- it belongs in mathmodule.c, but I found it easier to put it in a separate module while figuring it out.

You can find the code in the same gitHub repo as the draft PEP and python prototyping code:

https://github.com/PythonCHB/close_pep

the code is in: is_close_module.c

There is a test module in: test_isclose_c.py

and it can be built with:

python3 setup.py build_ext --inplace

Let me know if I should restructure it or put it anywhere else before it gets reviewed but in the meantime, i welcome any feedback.

Thanks, -Chris

A few questions I have off the bat:

C-API (and plain C) questions:

is_close_module.c:61:17: warning: incompatible pointer types initializing 'PyCFunction' (aka 'PyObject ()(PyObject *, PyObject *)') with an expression of type 'PyObject *(PyObject *, PyObject *, PyObject *)' [-Wincompatible-pointer-types] {"isclose", isclose_c, METH_VARARGS | METH_KEYWORDS,

but it seems to be working -- and I've copied, as well as I can, the examples.

Functionality Questions:

--

Christopher Barker, Ph.D. Oceanographer

Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150517/bdd265e1/attachment.html>



More information about the Python-Dev mailing list