Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Unify Copy-On-Write and Spilling #15436
Unify Copy-On-Write and Spilling #15436
Changes from 14 commits
f2bf171
276dd80
2413e99
9f4b0e1
834f6d5
68524e4
2e43f85
659e832
c5355a5
3581579
58f7e8e
6018949
f48c529
dcff299
4a8b43e
7344f9a
1e9d061
dc715e1
3eaf5e3
a4a3ff4
55027fc
504ae9a
53106ee
ac6831a
49625fa
f4458b8
30cd8e6
580dead
6fe2d58
51b4b82
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice, I have removed the direct-use-of-Buffer guard. I think the four mandatory arguments are enough to prevent accidental use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: should we
assert isinstance(owner, BufferOwner)
here? Or is it not necessary because we implicitly require it via the_slices
attribute?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, we could add
assert isinstance(owner, BufferOwner)
inBuffer.__init__
but I am not sure if that is pythonic?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An assertion would basically be there to protect against developer error. There's nothing unpythonic about it, that's definitely what the functionality is there for. The main question I would have is, how would we end up with something other than a BufferOwner here, and how bad would the failure mode be? Unless the assertion makes it markedly easier to debug the code it doesn't add a whole lot of value IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is arguable a little unpythonic to prevent duck-typing by using
isinstance
to force a specify type (as opposed to a general ABC/protocol type).Anyways, in this case
as_buffer()
is the only one creatingExposureTrackedBuffer
and it explicitly sets theowner
toSpillableBufferOwner | SpillableBuffer | BufferOwner
so I don't think a type error here is likely.