tahoe-lafs / zfec

zfec -- an efficient, portable erasure coding tool
Other
373 stars 44 forks source link

_fecmodule.c uses some deprecated CPython APIs #67

Open exarkun opened 2 years ago

exarkun commented 2 years ago

This is split off of #48 .

There are some warnings when building the C extension on Debian stable:

$ python setup.py bdist_wheel
[...]
zfec/_fecmodule.c:180:9: warning: ‘PyObject_CheckReadBuffer’ is deprecated [-Wdeprecated-declarations]
  180 |         if (!PyObject_CheckReadBuffer(fastinblocksitems[i])) {
      |         ^~
In file included from /usr/include/python3.8/Python.h:147,
                 from zfec/_fecmodule.c:5:
/usr/include/python3.8/abstract.h:328:36: note: declared here
  328 | Py_DEPRECATED(3.0) PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~
zfec/_fecmodule.c:184:9: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
  184 |         if (PyObject_AsReadBuffer(fastinblocksitems[i], (const void**)&(incblocks[i]), &sz))
      |         ^~
In file included from /usr/include/python3.8/Python.h:147,
                 from zfec/_fecmodule.c:5:
/usr/include/python3.8/abstract.h:337:17: note: declared here
  337 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
      |                 ^~~~~~~~~~~~~~~~~~~~~
zfec/_fecmodule.c: In function ‘Decoder_decode’:
zfec/_fecmodule.c:441:9: warning: ‘PyObject_CheckReadBuffer’ is deprecated [-Wdeprecated-declarations]
  441 |         if (!PyObject_CheckReadBuffer(fastblocksitems[i])) {
      |         ^~
In file included from /usr/include/python3.8/Python.h:147,
                 from zfec/_fecmodule.c:5:
/usr/include/python3.8/abstract.h:328:36: note: declared here
  328 | Py_DEPRECATED(3.0) PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj);
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~
zfec/_fecmodule.c:445:9: warning: ‘PyObject_AsReadBuffer’ is deprecated [-Wdeprecated-declarations]
  445 |         if (PyObject_AsReadBuffer(fastblocksitems[i], (const void**)&(cblocks[i]), &sz))
      |         ^~
In file included from /usr/include/python3.8/Python.h:147,
                 from zfec/_fecmodule.c:5:
/usr/include/python3.8/abstract.h:337:17: note: declared here
  337 | PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
      |                 ^~~~~~~~~~~~~~~~~~~~~

Python and compiler versions:

$ python --version
Python 3.8.5

$ x86_64-linux-gnu-gcc --version
x86_64-linux-gnu-gcc (Debian 10.1.0-6) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.