-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
read!
on byte array ignores custom read
methods defined on the eltype
#9327
Comments
I updated the gist to include both the failure to byte-reverse and to read too many bytes. The ouput is as follows:
I tested this on master. I haven't tried it on stable yet. |
I can confirm that 0.3.3 has the bug as well. The definitions in |
OK, it turns out the issue is that, because my instance of My sense is that it is unlikely that both should coexist in base as two methods of the same function---especially having such distinct semantics for so similar a signature. If I had to pick, I'd keep the more generic version in I'd like to hear feedback about what the path forward should be (if there needs to be a fix). |
Nice analysis, @twadleigh. And ouch, this is a nasty one. It almost seems there need to be two entirely different notions of I'll also add permalinks for those line numbers you referenced: Lines 191 to 202 in 62685fc
Lines 191 to 202 in 62685fc
(If you haven't discovered it yet, a cool trick is to hit "y" when you're on a source-code page; GitHub then "specializes" the URL to a specific commit, ensuring that if you select particular lines your link won't become out of date as the code changes.) Finally, with regards to endian conversion, I almost wonder if that should be done via a wrapper around the |
read
for array of immutable fails if the file footprint is not the same as the memory footprint.read!
in iostream.h shadows read!
in io.h
read!
in iostream.h shadows read!
in io.hread!
in iostream.jl shadows read!
in io.jl
@timholy: thanks for the tip on permalinks. This was a nasty gotcha, a little bit faith-shaking, even. (And it immediately followed my getting burned by the " I'll work out a PR that tries to deconflict these. I think, while I'm at it, I'll propose a new array constructor or two that is friendly to compound types. |
Very related: #6466 I think we should considerably narrow the |
We could also add a |
Yeah, I was thinking of something like a TimHolyTrait so that I think we should also make sure all the various specializations of |
I just started to look into making a proposal to fix this. I noticed that the docs and help strings for The byte swapping issue I ran into may be fixed by associating with a stream an endianness that can differ from that of the hardware, in which case byte swapping happens implicitly. (Was this more or less what you were suggesting in your comment, @timholy?) As for the other issue (stream footprint differs from memory footprint), it would seem there are two possible ways forward:
I'll start down the path for 1. but I also want to make sure that removing CBR from the stated semantics for |
read!
in iostream.jl shadows read!
in io.jlread!
on byte array ignores custom read
methods defined on the eltype
Super stale. Closing. |
I've written up an example script demonstrating a failure as a gist.
I also ran into another, seemingly related, issue where my read fn was doing big-endian-to-little-endian byte swaps, but the array version of read was ignoring that and reading the values as little endian. I'll see if I can put together a failing test case for that, as well.
The text was updated successfully, but these errors were encountered: