Xpra: Ticket #1884: Compiling error with Python 3.7.0-rc1

Hi all.

On Fedora 29 (devel branch), Python-3.7.0-rc1, GCC-8.1.1.

Recompiling xpra-2.3.1 i'm obtaining this error:

gcc -pthread -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall
-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-fstack-protector-strong -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-fPIC -Ixpra/buffers -I/usr/include/python3.7m -c xpra/buffers/buffers.c
-o build/temp.linux-x86_64-3.7/xpra/buffers/buffers.o -O3 -Wall -Werror
-fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
xpra/buffers/buffers.c: In function ‘_object_as_buffer’:
xpra/buffers/buffers.c:43:5: error: ‘PyObject_AsReadBuffer’ is
deprecated [-Werror=deprecated-declarations]
     return PyObject_AsReadBuffer(obj, buffer, buffer_len);
     ^~~~~~
In file included from /usr/include/python3.7m/Python.h:128,
                 from xpra/buffers/buffers.c:8:
/usr/include/python3.7m/abstract.h:489:17: note: declared here
 PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj,
                 ^~~~~~~~~~~~~~~~~~~~~
xpra/buffers/buffers.c: In function ‘_object_as_write_buffer’:
xpra/buffers/buffers.c:56:5: error: ‘PyObject_AsWriteBuffer’ is
deprecated [-Werror=deprecated-declarations]
     return PyObject_AsWriteBuffer(obj, buffer, buffer_len);
     ^~~~~~
In file included from /usr/include/python3.7m/Python.h:128,
                 from xpra/buffers/buffers.c:8:
/usr/include/python3.7m/abstract.h:500:17: note: declared here
 PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj,
                 ^~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
error: command 'gcc' failed with exit status 1

Can you fix it please? Full build log: https://koji.fedoraproject.org/koji/getfile?taskID=27753977&volume=DEFAULT&name=build.log



Sat, 23 Jun 2018 11:33:54 GMT - Antoine Martin: status changed; milestone set

FYI: building with --without-strict should workaround this problem.


Sat, 23 Jun 2018 13:13:15 GMT - Antonio:

FYI: building with --without-strict should workaround this problem.

Workaround confirmed.


Mon, 25 Jun 2018 05:09:33 GMT - Antoine Martin: priority, milestone changed

No rush to fix this, it might be easier to replace this code when we remove python2 support.

Here's what python 3.6 does to provide this function:

int PyObject_AsReadBuffer(PyObject *obj,
                          const void **buffer,
                          Py_ssize_t *buffer_len)
{
    Py_buffer view;
    if (obj == NULL || buffer == NULL || buffer_len == NULL) {
        null_error();
        return -1;
    }
    if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) != 0)
        return -1;
    *buffer = view.buf;
    *buffer_len = view.len;
    PyBuffer_Release(&view);
    return 0;
}

Tue, 10 Jul 2018 14:51:21 GMT - Antoine Martin: status, milestone changed; resolution set

The deprecation warnings and silenced with python 3.7 or later in r19908.

This will do for now, will follow up in #1878


Sat, 23 Jan 2021 05:36:21 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1884