Skip to content

Commit

Permalink
Set cython language level to 3
Browse files Browse the repository at this point in the history
Otherwise it fails to convert unicode to 'str':
```
Error compiling Cython file:
------------------------------------------------------------
...
    if metadata_request_timeout is None:
        return stmt
    ms = int(metadata_request_timeout / datetime.timedelta(milliseconds=1))
    if ms == 0:
        return stmt
    return f"{stmt} USING TIMEOUT {ms}ms"
           ^
------------------------------------------------------------

cassandra/util.py:1813:11: Cannot convert Unicode string to 'str' implicitly. This is not portable and requires explicit encoding.
```
  • Loading branch information
dkropachev authored and fruch committed Jan 23, 2025
1 parent 841f583 commit c459906
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,15 @@ def _setup_extensions(self):
extra_compile_args=compile_args)
for m in cython_candidates],
nthreads=build_concurrency,
exclude_failures=not CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST))
exclude_failures=not CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST,
compiler_directives={'language_level': 3},
))

self.extensions.extend(cythonize(NoPatchExtension("*", ["cassandra/*.pyx"], extra_compile_args=compile_args),
nthreads=build_concurrency))
self.extensions.extend(cythonize(
NoPatchExtension("*", ["cassandra/*.pyx"], extra_compile_args=compile_args),
nthreads=build_concurrency,
compiler_directives={'language_level': 3},
))
except Exception:
sys.stderr.write("Failed to cythonize one or more modules. These will not be compiled as extensions (optional).\n")
if CASS_DRIVER_BUILD_EXTENSIONS_ARE_MUST:
Expand Down

0 comments on commit c459906

Please sign in to comment.