Skip to content

Commit

Permalink
setup.py: specify Cython language_level explicitly
Browse files Browse the repository at this point in the history
to silence the warning of
```
/tmp/build-env-p23crgfa/lib64/python3.11/site-packages/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /home/kefu/dev/scylladb/tools/cqlsh/cqlshlib/copyutil.py
  tree = Parsing.p_module(s, pxd, full_module_name)
```

"3str" is the new default. so this change has no impact on the
cythonized python code. with this option, the unprefixed strings
are considered "str" objects. for more details, please see
https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#python-3-syntax-semantics

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov authored and fruch committed Sep 14, 2023
1 parent 5cf026f commit e651e12
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pylib/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def get_extensions():
extensions = [Extension(name='copyutil',
sources=["cqlshlib/copyutil.py"],
define_macros=[("CYTHON_LIMITED_API", "1")])]
return cythonize(extensions)
return cythonize(extensions,
compiler_directives={'language_level': '3str'})
except ImportError:
warnings.warn("installing cython could speed things up for you; `pip install cython`")

Expand Down

0 comments on commit e651e12

Please sign in to comment.