You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the implementation of bytes.__new__, there's some special-casing for anything with a __bytes__ method and some special-casing for ints. So I'm not sure it's really equivalent in a lot of cases.
Obviously we could reimplement some of that, and/or do some substitutions for known types.
Is your feature request related to a problem? Please describe.
When writing code like this...
cpdef bytes tobytes(o): return bytes(o)
Cython generates code like this
Compare this to
...which Cython does optimize to use
PyObject_Str
with the followingDescribe the solution you'd like.
Ideally the same optimization would be extended to
bytes(...)
Describe alternatives you've considered.
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: