Skip to content

RFE: please provide cython 3.x support #1083

Closed

Description

Activity

  1. befeleme commented on Nov 13, 2023

    @befeleme

    We've built asyncpg in Fedora Linux with Cython 3.0.5 successfully, although with quite a few warnings.

    Build warnings
    
      asyncpg/pgproto/pgproto.c: In function ‘__Pyx_PyLong_AbsNeg’:
      asyncpg/pgproto/pgproto.c:46832:97: warning: unsigned conversion from ‘int’ to ‘uintptr_t’ {aka ‘long unsigned int’} changes value from ‘-4’ to ‘18446744073709551612’ [-Wsign-conversion]
      46832 |             ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
            |                                                                                                 ^
      In file included from /usr/include/python3.12/internal/pycore_frame.h:9,
                       from asyncpg/pgproto/pgproto.c:49619:
      /usr/include/python3.12/internal/pycore_code.h: In function ‘write_varint’:
      /usr/include/python3.12/internal/pycore_code.h:362:12: warning: conversion from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Wconversion]
        362 |     *ptr = val;
            |            ^~~
      /usr/include/python3.12/internal/pycore_code.h: In function ‘write_signed_varint’:
      /usr/include/python3.12/internal/pycore_code.h:375:30: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
        375 |     return write_varint(ptr, val);
            |                              ^~~
      /usr/include/python3.12/internal/pycore_code.h: In function ‘write_location_entry_start’:
      /usr/include/python3.12/internal/pycore_code.h:382:12: warning: conversion from ‘int’ to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Wconversion]
        382 |     *ptr = 128 | (code << 3) | (length - 1);
            |            ^~~
      /usr/include/python3.12/internal/pycore_code.h: In function ‘adaptive_counter_bits’:
      /usr/include/python3.12/internal/pycore_code.h:423:45: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
        423 |     return (value << ADAPTIVE_BACKOFF_BITS) |
            |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        424 |         (backoff & ((1<
    

    asyncpg/protocol/protocol.c: In function ‘__Pyx_PyUnicode_AsDouble_WithSpaces’:
    asyncpg/protocol/protocol.c:4194:58: warning: conversion to ‘long unsigned int’ from ‘Py_ssize_t’ {aka ‘long int’} may change the sign of the result [-Wsign-conversion]
    4194 | char number = (char) PyMem_Malloc((length + 1) * sizeof(char));
    | ^
    In file included from /usr/include/python3.12/internal/pycore_frame.h:9,
    from asyncpg/protocol/protocol.c:105482:
    /usr/include/python3.12/internal/pycore_code.h: In function ‘write_varint’:
    /usr/include/python3.12/internal/pycore_code.h:362:12: warning: conversion from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Wconversion]
    362 | *ptr = val;
    | ^~~
    /usr/include/python3.12/internal/pycore_code.h: In function ‘write_signed_varint’:
    /usr/include/python3.12/internal/pycore_code.h:375:30: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
    375 | return write_varint(ptr, val);
    | ^~~
    /usr/include/python3.12/internal/pycore_code.h: In function ‘write_location_entry_start’:
    /usr/include/python3.12/internal/pycore_code.h:382:12: warning: conversion from ‘int’ to ‘uint8_t’ {aka ‘unsigned char’} may change value [-Wconversion]
    382 | *ptr = 128 | (code << 3) | (length - 1);
    | ^~~
    /usr/include/python3.12/internal/pycore_code.h: In function ‘adaptive_counter_bits’:
    /usr/include/python3.12/internal/pycore_code.h:423:45: warning: conversion from ‘int’ to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
    423 | return (value << ADAPTIVE_BACKOFF_BITS) |
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    424 | (backoff & ((1<<ADAPTIVE_BACKOFF_BITS)-1));
    | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /usr/include/python3.12/internal/pycore_code.h: In function ‘adaptive_counter_backoff’:
    /usr/include/python3.12/internal/pycore_code.h:446:26: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
    446 | unsigned int value = (1 << backoff) - 1;
    | ^
    /usr/include/python3.12/internal/pycore_code.h:447:34: warning: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Wsign-conversion]
    447 | return adaptive_counter_bits(value, backoff);
    | ^~~~~
    /usr/include/python3.12/internal/pycore_code.h:447:41: warning: conversion to ‘int’ from ‘unsigned int’ may change the sign of the result [-Wsign-conversion]
    447 | return adaptive_counter_bits(value, backoff);
    | ^~~~~~~
    asyncpg/protocol/protocol.c: In function ‘__Pyx__PyBytes_AsDouble’:
    asyncpg/protocol/protocol.c:108361:58: warning: conversion to ‘long unsigned int’ from ‘Py_ssize_t’ {aka ‘long int’} may change the sign of the result [-Wsign-conversion]
    108361 | char number = (char) PyMem_Malloc((digits + 1) * sizeof(char));
    | ^
    gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -Iasyncpg/pgproto -Iasyncpg/pgproto/ -I/usr/include/python3.12 -c asyncpg/protocol/record/recordobj.c -o build/temp.linux-x86_64-cpython-312/asyncpg/protocol/record/recordobj.o -O2 -fsigned-char -Wall -Wsign-compare -Wconversion
    asyncpg/protocol/record/recordobj.c: In function ‘record_dealloc’:
    asyncpg/protocol/record/recordobj.c:101:5: warning: ‘UsingDeprecatedTrashcanMacro’ is deprecated [-Wdeprecated-declarations]
    101 | Py_TRASHCAN_SAFE_BEGIN(o)
    | ^~~~~~~~~~~~~~~~~~~~~~

  2. added a commit that references this issue on Nov 13, 2023
    d40d5a8
  3. kloczek commented on Nov 13, 2023

    @kloczek
    Author

    After trimming build dependencies using below patch

    --- a/pyproject.toml
    +++ b/pyproject.toml
    @@ -50,7 +50,7 @@
         "setuptools>=60",
         "wheel",
    
    -    "Cython(>=0.29.24,<3.0.0)"
    +    "Cython(>=3.0.0)"
     ]
     build-backend = "setuptools.build_meta"
    
    --- a/setup.py
    +++ b/setup.py
    @@ -25,7 +25,7 @@
     from setuptools.command import build_ext as setuptools_build_ext
    
    
    -CYTHON_DEPENDENCY = 'Cython(>=0.29.24,<0.30.0)'
    +CYTHON_DEPENDENCY = 'Cython(>=0.30.0)'
    
     CFLAGS = ['-O2']
     LDFLAGS = []

    Looks like build is OK.

    Closing.

  4. musicinmybrain commented on Mar 28, 2024

    @musicinmybrain
    Contributor

    Just noting that the upper-bound excluding Cython 3.x is still present in master:

    "Cython(>=0.29.24,<3.0.0)"

    CYTHON_DEPENDENCY = 'Cython(>=0.29.24,<0.30.0)'

  5. added a commit that references this issue on Jul 12, 2024
    a68e151
  6. added a commit that references this issue on Jul 17, 2024
    258d8a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions