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-52551: Use wcsftime() to implement time.strftime() on Windows by serhiy-storchaka · Pull Request #125658 · python/cpython

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Oct 17, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member
  • Issue: time.strftime() and Unicode characters on Windows #52551

Sorry, something went wrong.

Uh oh!

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

All reactions
@serhiy-storchaka
pythongh-52551: Use wcsftime() to implement time.strftime() on Windows
629ff02
@serhiy-storchaka
serhiy-storchaka requested a review from vstinner October 17, 2024 17:37
@serhiy-storchaka
serhiy-storchaka requested review from abalkin and pganssle as code owners October 17, 2024 17:37
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 17, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Oct 17, 2024
time.strftime() and Unicode characters on Windows #52551
Closed
@serhiy-storchaka
Fix test.
0c0f987
vstinner
vstinner reviewed Oct 18, 2024
View reviewed changes
Comment thread Modules/timemodule.c Outdated
#ifdef MS_WINDOWS
/* wcsftime() doesn't format correctly time zones, see issue #10653 */
# undef HAVE_WCSFTIME
# define HAVE_WCSFTIME

@vstinner vstinner Oct 18, 2024

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.

There are compiler warnings: 'HAVE_WCSFTIME': macro redefinition [D:\a\cpython\cpython\PCbuild_freeze_module.vcxproj]

Sorry, something went wrong.

Uh oh!

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

All reactions

@serhiy-storchaka serhiy-storchaka Oct 18, 2024

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.

Oh, I did not find where it was defined in C.

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner

vstinner commented Oct 18, 2024

Copy link
Copy Markdown
Member

Is #54862 issue solved on Windows?

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka

serhiy-storchaka commented Oct 18, 2024

Copy link
Copy Markdown
Member Author

Is #54862 issue solved on Windows?

What exactly is that issue about? I get no mojibake:

>>> import time
>>> time.strftime('%Z')
'Фінляндія (літо)'
>>> time.tzname
('Фінляндія (зима)', 'Фінляндія (літо)')

But it crashes on invalid format string (like %f).

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka
HAVE_WCSFTIME is already defined.
16782e9
@serhiy-storchaka

serhiy-storchaka commented Oct 18, 2024

Copy link
Copy Markdown
Member Author

But it crashes on invalid format string (like %f).

Well, this was unrelated.

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka
Merge branch 'main' into strftime-windows-wcsftime
0e1bdf7
@vstinner

vstinner commented Oct 18, 2024

Copy link
Copy Markdown
Member

Is #54862 issue solved on Windows?

I changed my Windows language to French and the timezone to UTC+14, I managed to get a non-ASCII timezone name:

vstinner@WIN C:\victor\python\main>python
Python 3.14.0a1+ (heads/pr/125658:0e1bdf72d94, Oct 18 2024, 16:46:59) [MSC v.1941 64 bit (AMD64)] on win32
>>> import time; time.strftime("%Z")
'Îles de la Ligne '

So at least for this locale (French_France.1252), it works as expected.

All reactions

Sorry, something went wrong.

Uh oh!

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

vstinner
vstinner approved these changes Oct 18, 2024
View reviewed changes

@vstinner vstinner 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
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 18, 2024
@serhiy-storchaka

serhiy-storchaka commented Oct 19, 2024

Copy link
Copy Markdown
Member Author

Thank you for your review @vstinner.

All reactions

Sorry, something went wrong.

Uh oh!

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

@serhiy-storchaka
serhiy-storchaka merged commit a7443a1 into python:main Oct 19, 2024
@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 19, 2024
@serhiy-storchaka
serhiy-storchaka deleted the strftime-windows-wcsftime branch October 19, 2024 08:29
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
@serhiy-storchaka @ebonnal
pythongh-52551: Use wcsftime() to implement time.strftime() on Windows (
2cf7336
pythonGH-125658)
@serhiy-storchaka serhiy-storchaka mentioned this pull request Oct 20, 2025
date.strftime and datetime.strftime format dates wrong in some locales. #130528
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes
@pganssle pganssle Awaiting requested review from pganssle pganssle is a code owner
@abalkin abalkin Awaiting requested review from abalkin

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.

2 participants

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