]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: hardwire language_level to 3
authorKefu Chai <k.chai@proxmox.com>
Fri, 23 Jan 2026 01:36:22 +0000 (09:36 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 29 Jan 2026 00:45:50 +0000 (08:45 +0800)
Previously, to maintain backward compatibility with Python 2, we set
'language_level' to sys.version_info.major, so the value would be 2
when building with Python 2, and 3 with Python 3. Now that Python 2
support has been dropped, we can hardwire it to "3".

This change also removes the comment about switching to
`language_level=3str` in the future. According to the Cython 3.1+
documentation,

> language_level=3 is now the default. language_level=3str has become a
> legacy alias.

see https://cython.readthedocs.io/en/3.1.x/src/changes.html.

For context, in Cython < 3.1, language_level=3 and language_level=3str
had different meanings:
- 3 = unprefixed strings are unicode
- 3str = unprefixed strings follow Python version (bytes in Py2, unicode
  in Py3)

Since we no longer support Python 2, this distinction is irrelevant and
the comment can be safely removed.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/pybind/cephfs/setup.py
src/pybind/rados/rados.pxd
src/pybind/rados/rados.pyx
src/pybind/rados/setup.py
src/pybind/rbd/rbd.pyx
src/pybind/rbd/setup.py
src/pybind/rgw/rgw.pyx
src/pybind/rgw/setup.py

index c94ac2037ed7e615d7cec4127a77f3e32dc3c5dd..a44d4708faa1364be8a642db1e92d846d78ca626 100755 (executable)
@@ -226,7 +226,6 @@ setup(
                 **ext_args
             )
         ],
-        compiler_directives={'language_level': sys.version_info.major},
         build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
         **cythonize_args
     ),
index 2bcb49411833f1c677dba3f4b43b44c56a74f1b2..7731640084ba6f2028399896da11e3db8bdc9a00 100644 (file)
@@ -1,3 +1,4 @@
+# cython: language_level=3
 # cython: embedsignature=True
 #
 # Shared object for librbdpy
index f86b90307556cfc8de582aba163f7e0225412532..508206244f4db354f201b49f82fff74cafea7c28 100644 (file)
@@ -1,3 +1,4 @@
+# cython: language_level=3
 # cython: embedsignature=True, binding=True
 """
 This module is a thin wrapper around librados.
index 72cfe365dda9c04c83201fdd307d0b963f0f4562..ec345f9718cf402569d02fe70393447b599952dc 100755 (executable)
@@ -217,8 +217,6 @@ setup(
                 **ext_args
             )
         ],
-        # use "3str" when Cython 3.0 is available
-        compiler_directives={'language_level': sys.version_info.major},
         compile_time_env=cython_constants,
         build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
     ),
index cd491213e7f86add25fc8ebef44dd2469d235bd4..1a4c6ded18f8297a484cad7fe59f6f61d44c04cf 100644 (file)
@@ -1,3 +1,4 @@
+# cython: language_level=3
 # cython: embedsignature=True
 """
 This module is a thin wrapper around librbd.
index f5e654287c5d9870c3516b14dcf59d55061e4de2..237385c4b3c571e415d3a9a27cdfe716b001efad 100755 (executable)
@@ -155,7 +155,7 @@ else:
     sys.exit(1)
 
 cmdclass = {}
-compiler_directives={'language_level': sys.version_info.major}
+compiler_directives = {}
 try:
     from Cython.Build import cythonize
     from Cython.Distutils import build_ext
index afb8d53be4d868fcf8583b6be9066fc2e9c4e796..bec58b0ef0e2b6624388ed18c651667050199f75 100644 (file)
@@ -1,3 +1,4 @@
+# cython: language_level=3
 """
 This module is a thin wrapper around rgw_file.
 """
index 8b9b9ac1fef26e953102916e2ee7582904f752b3..374167cbbca4978ac31d1fbb682620ecc29512c8 100755 (executable)
@@ -226,7 +226,6 @@ setup(
                 **ext_args
             )
         ],
-        compiler_directives={'language_level': sys.version_info.major},
         build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
         **cythonize_args
     ),