-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
New copystring
function
#54424
Comments
Here is an example where using the io = IOBuffer()
write(io, [0x61,0x62,0x63])
seekstart(io)
a = read(io, 3)
b = reshape(a, 1, 3)
c = reshape(b, 3)
s = String(a)
@show s
c[1] = 0x62
@show s This changes |
|
Maybe |
Python calls this function
It should maybe take a |
There is already a Line 179 in d01d256
Maybe this can be changed to avoid mutating the input. |
One solution could be to make I'm willing to pitch a PR if that's an acceptable solution. |
I think that is a good solution. |
That seems completely unacceptable? Isn't the whole reason not to make this slow pretty much the reason for the current behavior of |
@KristofferC the point is that with this change With this change in combination with #54372, existing users will see a regression that is fixed by replacing instances of |
The whole reason we didn't do this X years ago was that adding this type of perf regression to code run everywhere was not acceptable. I don't see why it would be now. |
This is the comment I was thinking about: #24388 (comment) |
|
Fixed by #54927 |
Since calling
String
on aview
of anAbstractVector{UInt8}
is potential UB #54372 (comment)I think it would be helpful to have a function.
I could use this to fix
ZipArchives.jl
by replacing current uses of theString
constructor on vectors of bytes withcopystring
.Would this be better in a separate
CopyStrings.jl
package?The text was updated successfully, but these errors were encountered: