Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: please provide cython 3.x support #1083

Closed
kloczek opened this issue Oct 3, 2023 · 3 comments
Closed

RFE: please provide cython 3.x support #1083

kloczek opened this issue Oct 3, 2023 · 3 comments

Comments

@kloczek
Copy link

kloczek commented Oct 3, 2023

https://github.com/MagicStack/asyncpg/blob/master/pyproject.toml#L45-L49

@befeleme
Copy link

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)
| ^~~~~~~~~~~~~~~~~~~~~~

musicinmybrain added a commit to musicinmybrain/asyncpg that referenced this issue Nov 13, 2023
@kloczek
Copy link
Author

kloczek commented Nov 13, 2023

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.

@kloczek kloczek closed this as completed Nov 13, 2023
@musicinmybrain
Copy link
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)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants