GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-152433: Windows: use GetFileSizeEx instead of GetFileSize by thexai · Pull Request #152383 · python/cpython

Conversation

@thexai

@thexai thexai commented Jun 27, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

GetFileSizeEx is available in all supported Windows versions and has the advantage is also present in UWP, then allows build also in UWP with the same common code.

It also simplifies error checking and makes handling files larger than 4GB easier.

The ultimate goal is to upstream some of Kodi patches required to build Python for Xbox... This is just the first step.

  • Issue: Windows: improve compatibility to build for UWP / Xbox #152433

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app

bedevere-app Bot commented Jun 27, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@python-cla-bot

python-cla-bot Bot commented Jun 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added the awaiting review label Jun 27, 2026
@thexai

thexai commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

This change is transparent: users won't notice anything different.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thexai thexai changed the title [Windows] Use GetFileSizeEx instead of GetFileSize gh-152433: Windows: use GetFileSizeEx instead of GetFileSize Jun 27, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Jun 27, 2026
Windows: improve compatibility to build for UWP / Xbox #152433
Open
@chris-eibl
chris-eibl self-requested a review June 27, 2026 18:21
chris-eibl
chris-eibl approved these changes Jun 27, 2026
View reviewed changes

@chris-eibl chris-eibl left a comment

Copy link
Copy Markdown
Member

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.

Thanks, LGTM. Even less code and works the same as before on all supported Windows platforms.

I'm on the fence regarding a news entry - leaving it up to @zooba

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jun 27, 2026
@thexai thexai mentioned this pull request Jun 28, 2026
gh-152433: Windows: enable mmapmodule for UWP #152473
Merged
@thexai
thexai force-pushed the windows-getfilesizeex branch from fb47fb6 to 8b9c4cb Compare June 28, 2026 11:05
zooba
zooba reviewed Jun 29, 2026
View reviewed changes

@zooba zooba left a comment

Copy link
Copy Markdown
Member

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.

Approved with an update to NEWS to mention that it affects mmap/memory-mapped files. I suggested a wording that's fine, but if you want to word it differently or reference specific functions, go ahead.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Misc/NEWS.d/next/Windows/2026-06-28-13-03-57.gh-issue-152433.jUXFwC.rst Outdated
@@ -0,0 +1 @@
Replace ``GetFileSize()`` with ``GetFileSizeEx()``, which is UWP compatible.

@zooba zooba Jun 29, 2026

Copy link
Copy Markdown
Member

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.

Suggested change
Replace ``GetFileSize()`` with ``GetFileSizeEx()``, which is UWP compatible.
Use the Windows API ``GetFileSizeEx()`` for memory mapped files, rather than the older ``GetFileSize()``.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

thexai reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@thexai
thexai force-pushed the windows-getfilesizeex branch 3 times, most recently from 2791f86 to 7952170 Compare June 30, 2026 14:12
@thexai
pythongh-152433: Windows: Use GetFileSizeEx instead of GetFileSize
bbf56b4
GetFileSizeEx is available in all supported Windows versions and has the
advantage is also present in UWP, then allows build also in UWP with
the same common code.

It also simplifies error checking and makes handling files larger
than 4GB easier.
@thexai
thexai force-pushed the windows-getfilesizeex branch from 7952170 to bbf56b4 Compare June 30, 2026 15:14
@chris-eibl
chris-eibl merged commit f37602a into python:main Jun 30, 2026
54 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 30, 2026
@chris-eibl

chris-eibl commented Jun 30, 2026

Copy link
Copy Markdown
Member

Thanks @thexai!

Since you have more PRs in the pipeline: per our devguide please do not force-push (this makes reviewing harder, we finally squash-merge the PR anyway) or merge with main without a good reason. TiA.

thexai reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thexai
thexai deleted the windows-getfilesizeex branch July 1, 2026 14:09
maurycy added a commit to maurycy/cpython that referenced this pull request Jul 1, 2026
@maurycy
Merge branch 'main' into maurycy/bye-abba
da7d768
* main: (266 commits)
  pythongh-151626: Fix tests that fail when PYTHONPYCACHEPREFIX is set (pythonGH-151952)
  pythongh-152728: IDLE - move 3 toplevel fix_xyz functions to idlelb.util (python#152729)
  pythongh-152711: Add pythoninfo-build command to Platforms/Android (python#152713)
  pythongh-152715: Add pythoninfo-build command to Platforms/Apple (python#152716)
  pythongh-152433: Windows: enable mmapmodule for UWP (python#152473)
  pythongh-152433: Windows: use GetFileSizeEx instead of GetFileSize for memory mapped files (python#152383)
  pythonGH-81881: Raise `SpecialFileError` for sockets and devices in `shutil.copyfile` (python#142693)
  pythongh-152502: Detect the curses mouse interface and is_* methods portably (pythonGH-152705)
  pythongh-145857: Replace `DELETE_GLOBAL` with `PUSH_NULL; STORE_GLOBAL` (pythonGH-146314)
  pythongh-145854: Replace `DELETE_NAME` with `PUSH_NULL; STORE_NAME` (pythonGH-146006)
  pythongh-152680: Detect container/VM in test.pythoninfo (python#152668)
  pythongh-152682: Fix NULL dereference on OOM in `symtable_visit_type_param_bound_or_default` (python#152684)
  pythongh-151881: Skip tk_inactive negativity check on Windows (pythonGH-152683)
  pythongh-152546: Refactor `mappingproxy.__new__` to use `PyDictProxy_New` (python#152547)
  pythongh-151126: Fix a possible crash during the startup with no memory under `Py_STACKREF_DEBUG` (python#152478)
  pythongh-152635: Raise MemoryError when the lock allocation fails in `_interpchannels.create()` (python#152642)
  pythongh-151029: Fix `test_remote_exec_deleted_static_executable` on static installed builds (pythonGH-152653)
  pythongh-121249: Deprecate using F/D type codes in the struct module (python#152309)
  pythongh-152192: Fix JUMP_BACKWARD passing a truncated oparg to the jit tracer (pythonGH-152382)
  Don't require the `_test{internal}capi` modules in `test_monitoring.py` (python#152311)
  ...
thexai added a commit to thexai/cpython that referenced this pull request Jul 17, 2026
@thexai
pythongh-152433: Windows: use GetFileSizeEx instead of GetFileSize fo…
0bd21cf
…r memory mapped files (python#152383)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@zooba zooba zooba left review comments
@chris-eibl chris-eibl chris-eibl approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@thexai @chris-eibl @zooba
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.