Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
calendar.HTMLCalendar
to utf-8calendar.HTMLCalendar
to utf-8Lib/calendar.py Outdated
@@ -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): |
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.
Let's keep it None and haveif encoding is None: encoding = 'utf-8'
. Some subclasses may useNone
to signify "use the default value".
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.
Please leave the None.
Uh oh!
There was an error while loading.Please reload this page.
Making it a draft as it's a WIP. |
Lib/test/test_calendar.py Outdated
@@ -932,7 +928,7 @@ def test_several_leapyears_in_range(self): | |||
def conv(s): | |||
return s.replace('\n', os.linesep).encode() |
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.
Why was this changed?
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.
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
Lib/calendar.py Outdated
@@ -872,10 +872,6 @@ def main(args=None): | |||
options = parser.parse_args(args) | |||
if options.locale and not options.encoding: |
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.
Why was this removed? I think we should keep it that way
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.
Maybe some systems have non utf8 encoding and their locale doesn't support utf8
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 phrase |
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 |
Thanks for making the requested changes! @picnixz: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Doc/whatsnew/3.15.rst Outdated
* The default *encoding* parameter value in :meth:`calendar.HTMLCalendar.formatyearpage` | ||
is now utf-8. |
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 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`. |
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.
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)
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.
I forgot the meth role :')
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.
All fixed, the test failure was an unrelated probabilistic event
Doc/whatsnew/3.15.rst Outdated
* The default *encoding* parameter value in :meth:`calendar.HTMLCalendar.formatyearpage` | ||
is now utf-8. | ||
(Contributed by Jiahao Li in :gh:`135001`.) |
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 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`.) |
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2025-06-01-19-45-55.gh-issue-135001.KsBXSl.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
calendar.HTMLCalendar
to utf-8 #135001📚 Documentation preview 📚:https://cpython-previews--135002.org.readthedocs.build/