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
[BUG] unexpected type Py_UCS4 and base type Python object for indexing #4829
Comments
I got the same for Cython==3.0.8, windows 11, python 3.11.1. I switched to --3str and now I get different errors on fstrings
|
Thanks for the reports, I could reproduce the original issue on the latest master. It's easy to fix there, because it's limited to Python 3.x. A backport to Cython 3.0 might be less easy. |
You probably declared your return type as |
Thank you @scoder for your hint! It solved the issue for me! I used to get the same error message on the following method: def create_numbered_file_path(self, folder_path : str, number : int, extension : str) -> str:
r'''Creates a numbered file path. Example: ("C:\\", 1, "html") => "C:\\1.html"'''
file_name : str = f"{number}.{extension}"
file_path : str = self.create_file_path(folder_path = folder_path, file_name = file_name)
return file_path Using str() around the f-string solved the issue: # ...
file_name : str = str(f"{number}.{extension}")
# ... Information:
|
Hi!
When trying to cythonize the following source code using
cythonize -3
:the following error is printed:
To my understanding,
str(0)[0]
should evaluate to'0'
, which is the first character of the string representation of0
.Surprisingly, I don't get any error using
cythonize --3str
orcythonize -2
. It also works to first assign the result ofstr(0)
to a variable:Environment:
The text was updated successfully, but these errors were encountered: