GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — gh-78502: Add a trackfd parameter to mmap.mmap() on Windows by serhiy-storchaka · Pull Request #138238 · python/cpython Conversation
|
|
🤖 New build scheduled with the buildbot fleet by @serhiy-storchaka for commit 558beef 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F138238%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not much of a Windows expert, but, the code looks good to me! Thank you!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Other than that condition, looks fine to me.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| #ifdef MS_WINDOWS | ||
| if (self->file_handle != INVALID_HANDLE_VALUE) { | ||
| if (self->file_handle != INVALID_HANDLE_VALUE || !self->trackfd) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't like combining an error condition check with a state check like this, it gives us a way to call GetFileSize(INVALID_HANDLE_VALUE, ...).
Maybe this should be && self->trackfd instead?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
They both are state checks. The behavior is consistent with Posix -- if trackfd is false, we get an OSError. We could raise a different error, but then we need to change the Posix code too. Is it fine to do this in this PR, or better open a separate PR?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We should never deliberately pass INVALID_HANDLE_VALUE to a Win32 API, but we might in this case because of the or condition.
If trackfd is false, we should just raise an error directly, rather than relying on the OS to generate an error code for us.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If trackfd is false, we should just raise an error directly, rather than relying on the OS to generate an error code for us.
I agree with that.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
||
| #ifdef MS_WINDOWS | ||
| if (self->file_handle != INVALID_HANDLE_VALUE) { | ||
| if (self->file_handle != INVALID_HANDLE_VALUE || !self->trackfd) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If trackfd is false, we should just raise an error directly, rather than relying on the OS to generate an error code for us.
I agree with that.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Victor Stinner <[email protected]>
|
Before merging this PR, it would be convenient to merge #24781. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…thonGH-138238) If trackfd is False, the file handle corresponding to fileno will not be duplicated.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.