MagicStack/httptools

Deprecation warnings in Python 3.10

tirkarthi opened this issue · 3 comments

I am not sure if its due to the deprecation warnings but there are failures while installing it on Python 3.10. Error log as below :

Probably related to python/cpython#20878

    Running setup.py install for httptools ... error
    ERROR: Command errored out with exit status 1:
     command: /root/dev-denv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3qm507hv/httptools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3qm507hv/httptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ldf_awgo/install-record.txt --single-version-externally-managed --compile --install-headers /root/dev-denv/include/site/python3.10/httptools
         cwd: /tmp/pip-install-3qm507hv/httptools/
    Complete output (155 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.10
    creating build/lib.linux-x86_64-3.10/httptools
    copying httptools/_version.py -> build/lib.linux-x86_64-3.10/httptools
    copying httptools/__init__.py -> build/lib.linux-x86_64-3.10/httptools
    creating build/lib.linux-x86_64-3.10/httptools/parser
    copying httptools/parser/__init__.py -> build/lib.linux-x86_64-3.10/httptools/parser
    copying httptools/parser/errors.py -> build/lib.linux-x86_64-3.10/httptools/parser
    running egg_info
    writing httptools.egg-info/PKG-INFO
    writing dependency_links to httptools.egg-info/dependency_links.txt
    writing requirements to httptools.egg-info/requires.txt
    writing top-level names to httptools.egg-info/top_level.txt
    reading manifest file 'httptools.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'httptools.egg-info/SOURCES.txt'
    copying httptools/parser/parser.c -> build/lib.linux-x86_64-3.10/httptools/parser
    running build_ext
    building 'httptools.parser.parser' extension
    creating build/temp.linux-x86_64-3.10
    creating build/temp.linux-x86_64-3.10/httptools
    creating build/temp.linux-x86_64-3.10/httptools/parser
    creating build/temp.linux-x86_64-3.10/vendor
    creating build/temp.linux-x86_64-3.10/vendor/http-parser
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/root/dev-denv/include -I/root/cpython/Include -I/root/cpython -I/tmp/pip-install-3qm507hv/httptools/vendor/http-parser -c httptools/parser/parser.c -o build/temp.linux-x86_64-3.10/httptools/parser/parser.o -O2
    httptools/parser/parser.c: In function ‘__pyx_tp_dealloc_9httptools_6parser_6parser_HttpParser’:
    httptools/parser/parser.c:8187:5: error: lvalue required as increment operand
         ++Py_REFCNT(o);
         ^~
    httptools/parser/parser.c:8189:5: error: lvalue required as decrement operand
         --Py_REFCNT(o);
         ^~
    httptools/parser/parser.c: In function ‘__Pyx_ParseOptionalKeywords’:
    httptools/parser/parser.c:10178:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10178:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:580:45: note: declared here
     Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                                 ^~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10178:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10178:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10178:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:580:45: note: declared here
     Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                                 ^~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10178:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                         (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                         ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10194:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                             (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                             ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10194:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                             (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                             ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:580:45: note: declared here
     Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                                 ^~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10194:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                             (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                             ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10194:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                             (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                             ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10194:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
                             (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                             ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:580:45: note: declared here
     Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
                                                 ^~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c:10194:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
                             (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                             ^
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:446:26: note: declared here
     static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
    httptools/parser/parser.c: In function ‘__Pyx_decode_c_bytes’:
    httptools/parser/parser.c:10379:9: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
             return PyUnicode_FromUnicode(NULL, 0);
             ^~~~~~
    In file included from /root/cpython/Include/unicodeobject.h:1026:0,
                     from /root/cpython/Include/Python.h:97,
                     from httptools/parser/parser.c:20:
    /root/cpython/Include/cpython/unicodeobject.h:551:42: note: declared here
     Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
                                              ^~~~~~~~~~~~~~~~~~~~~
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /root/dev-denv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3qm507hv/httptools/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3qm507hv/httptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ldf_awgo/install-record.txt --single-version-externally-managed --compile --install-headers /root/dev-denv/include/site/python3.10/httptools Check the logs for full command output.

Probably related to python/cpython#20878

Warnings are comes from it. But errors are not.

httptools/parser/parser.c:8187:5: error: lvalue required as increment operand
         ++Py_REFCNT(o);
         ^~
    httptools/parser/parser.c:8189:5: error: lvalue required as decrement operand
         --Py_REFCNT(o);
         ^~

Try regenerating parser.c with newest Cython release. It will solve all warnings and errors.

HttpTools is going to Depreciated in Python 3.10 version?

Fixed in #70.