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-83714: Fix stat_nanosecond_timestamp() for 32-bit time_t by vstinner · Pull Request #141069 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Nov 5, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: Add os.statx() function #83714

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-83714: Fix stat_nanosecond_timestamp() for 32-bit time_t
6e56143
@bedevere-app bedevere-app Bot mentioned this pull request Nov 5, 2025
Add os.statx() function #83714
Closed
@vstinner vstinner added the skip news label Nov 5, 2025
@vstinner

vstinner commented Nov 5, 2025

Copy link
Copy Markdown
Member Author

!buildbot x86 Debian

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Nov 5, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 6e56143 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F141069%2Fmerge

The command will test the builders whose names match following regular expression: x86 Debian

The builders matched are:

  • x86 Debian Installed with X PR
  • x86 Debian Non-Debug with X PR
All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner mentioned this pull request Nov 5, 2025
gh-83714: Fix compiler warning in stat_nanosecond_timestamp() #141043
Merged
serhiy-storchaka
serhiy-storchaka reviewed Nov 5, 2025
View reviewed changes
Comment thread Modules/posixmodule.c
{
#if SIZEOF_LONG >= 8
#if SIZEOF_TIME_T == 4
return PyLong_FromLongLong(sec * SEC_TO_NS + nsec);

@serhiy-storchaka serhiy-storchaka Nov 5, 2025

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.

What is the type of SEC_TO_NS? Should not it or sec be cast to long long?

We will get a warning also in the very unlikely case of more than 64-bit long long. Maybe use condition SIZEOF_TIME_T + 4 <= SIZEOF_LONG_LONG?

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Nov 5, 2025

Copy link
Copy Markdown
Member Author

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.

What is the type of SEC_TO_NS?

It's a long long: it uses the LL suffix.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Nov 5, 2025

Copy link
Copy Markdown
Member Author

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.

We will get a warning also in the very unlikely case of more than 64-bit long long.

I don't see which kind of warning would be emitted if long long is larger than 64-bit?

Sorry, something went wrong.

Uh oh!

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

All reactions

@serhiy-storchaka serhiy-storchaka Nov 5, 2025

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.

The same warning. If long long is 128-bit and time_t is 64-bit, then the condition (LLONG_MIN/SEC_TO_NS) <= sec && sec <= (LLONG_MAX/SEC_TO_NS - 1) will be tested, and it will be always true.

I do not know if Python is currently used on any platform with larger than 64-bit long long. This is hypothetical.

Sorry, something went wrong.

Uh oh!

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

All reactions

@serhiy-storchaka serhiy-storchaka Nov 5, 2025

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.

Anyway, this would be just a warning. Not wrong code or missed optimization.

Sorry, something went wrong.

Uh oh!

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

All reactions

@vstinner vstinner Nov 5, 2025

Copy link
Copy Markdown
Member Author

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.

If long long is 128-bit and time_t is 64-bit

Oh ok. Well, I expect many warnings if long long is larger than 64-bit, not just on these lines. We can revisit the code once such platform will exist :-)

Sorry, something went wrong.

Uh oh!

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

All reactions
serhiy-storchaka
serhiy-storchaka approved these changes Nov 5, 2025
View reviewed changes

@serhiy-storchaka serhiy-storchaka 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.

LGTM. 👍

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Modules/posixmodule.c
{
#if SIZEOF_LONG >= 8
#if SIZEOF_TIME_T == 4
return PyLong_FromLongLong(sec * SEC_TO_NS + nsec);

@serhiy-storchaka serhiy-storchaka Nov 5, 2025

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.

Anyway, this would be just a warning. Not wrong code or missed optimization.

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added the awaiting merge label Nov 5, 2025
@vstinner

vstinner commented Nov 5, 2025

Copy link
Copy Markdown
Member Author

The warnings are still fixed with this PR on x86 Debian: https://buildbot.python.org/#/builders/1285/builds/531

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner marked this pull request as ready for review November 5, 2025 20:16
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting merge labels Nov 5, 2025
@vstinner
vstinner merged commit 986bb0a into python:main Nov 5, 2025
53 of 54 checks passed

Uh oh!

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

@vstinner
vstinner deleted the statx_sec_to_ns2 branch November 5, 2025 20:16
@bedevere-app bedevere-app Bot removed the awaiting core review label Nov 5, 2025
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@vstinner @StanFromIreland
pythongh-83714: Fix stat_nanosecond_timestamp() for 32-bit time_t (py…
2d1c846
…thon#141069)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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

@vstinner @bedevere-bot @serhiy-storchaka
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.