-
Notifications
You must be signed in to change notification settings - Fork 572
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
open memoryview object as-is they were bytes #4272
base: main
Are you sure you want to change the base?
Conversation
…rotocol and avoids an unecessary copy
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
I don't think that this change makes sense. |
Could you point me where that copy happens in my fork? The change I
proposed works as is, without any extra copy as far as I can see.
I'm also not sure how the mv would behave any differently from a bytes
object, apart from what type(obj) returns of, hence my proposed change, as
that's more or less how the python doc define mem views
Le sam. 8 févr. 2025, 14:36, Jorj X. McKie ***@***.***> a
écrit :
… I don't think that this change makes sense.
The base library does ultimately require a memory area to work with, it
cannot use memoryview objects directly.
So we would have to convert a memoryview object to bytes before calling
MuPDF. This conversion (bytes(mv), respectively mv.tobytes()) however
*does* make a copy and thus negates any assumed advantage.
I think that for a memoryview object mv passing bytes(mv) to the
constructor is a negligible effort.
—
Reply to this email directly, view it on GitHub
<#4272 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHNVDRXOZYUL5ROJX3QUYT2OYB7TAVCNFSM6AAAAABWTHBF6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNBVGY2DMMJRGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@arthurdarcet - sorry, you are right: |
… simplify code a bit
9d18b28
to
cd7824b
Compare
@JorjMcKie of course - just pushed that. I also moved some tests a bit, but logic should still be exactly the same. |
it supports the same protocol and avoids an unecessary copy