Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-135001: Change the default encoding parameter value ofcalendar.HTMLCalendar to utf-8#135002

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Wulian233 wants to merge9 commits intopython:main
base:main
Choose a base branch
Loading
fromWulian233:calendar

Conversation

Wulian233
Copy link
Contributor

@Wulian233Wulian233 commentedJun 1, 2025
edited
Loading

@Wulian233Wulian233 changed the titlegh-135001: Change the default parameter value ofcalendar.HTMLCalendar to utf-8gh-135001: Change the default encoding parameter value ofcalendar.HTMLCalendar to utf-8Jun 1, 2025
@@ -560,12 +560,10 @@ def formatyear(self, theyear, width=3):
a('</table>')
return ''.join(v)

def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's keep it None and haveif encoding is None: encoding = 'utf-8'. Some subclasses may useNone to signify "use the default value".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please leave the None.

@picnixzpicnixz marked this pull request as draftJune 1, 2025 12:07
@picnixz
Copy link
Member

Making it a draft as it's a WIP.

@Wulian233Wulian233 marked this pull request as ready for reviewJune 1, 2025 13:00
@Wulian233Wulian233 requested a review frompicnixzJune 1, 2025 13:39
picnixz
picnixz previously requested changesJun 2, 2025
@@ -932,7 +928,7 @@ def test_several_leapyears_in_range(self):


def conv(s):
return s.replace('\n', os.linesep).encode()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why was this changed?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is a side effect of me previously specifying the encoding='utf-8'. Now following review suggestion to use utf-8 by default when it's None, there's no need to modify this part anymore

The comment below is for the same reason, it's my lack of thoughtfulness

@@ -872,10 +872,6 @@ def main(args=None):

options = parser.parse_args(args)

if options.locale and not options.encoding:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why was this removed? I think we should keep it that way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Maybe some systems have non utf8 encoding and their locale doesn't support utf8

@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@Wulian233
Copy link
ContributorAuthor

The new commit resolves the above review and requires you to confirm that it is resolved. Thanks!

I have made the requested changes; please review again

@bedevere-app
Copy link

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

@bedevere-appbedevere-appbot requested a review frompicnixzJune 2, 2025 08:38
Comment on lines 95 to 96
* The default *encoding* parameter value in :meth:`calendar.HTMLCalendar.formatyearpage`
is now utf-8.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
* The default *encoding*parameter value in:meth:`calendar.HTMLCalendar.formatyearpage`
is now utf-8.
* The default *encoding*for`calendar.HTMLCalendar.formatyearpage` is ``'utf-8'``
Previously, it defaulted to:func:`sys.getdefaultencoding`.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This made lint failed

Doc/whatsnew/3.15.rst:95: default role used (hint: for inline literals, use double backticks) (default-role)
Doc/whatsnew/3.15.rst:276: default role used (hint: for inline literals, use double backticks) (default-role)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I forgot the meth role :')

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

All fixed, the test failure was an unrelated probabilistic event

Comment on lines 264 to 267
* The default *encoding* parameter value in :meth:`calendar.HTMLCalendar.formatyearpage`
is now utf-8.

(Contributed by Jiahao Li in :gh:`135001`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
* The default *encoding* parameter value in:meth:`calendar.HTMLCalendar.formatyearpage`
is now utf-8.
(Contributed by Jiahao Li in:gh:`135001`.)
* The default *encoding* for `calendar.HTMLCalendar.formatyearpage` is now ``'utf-8'``.
Previously, it defaulted to:func:`sys.getdefaultencoding`.
(Contributed by Jiahao Li in:gh:`135001`.)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@picnixzpicnixzpicnixz left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Wulian233@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp