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

Commitc5f8871

Browse files
gh-136571: Convert more code in datetime to Argument Clinic
This adds signatures for some classes and methods.date.fromisocalendar() can now raise OverflowError for arguments thatdon't fit in the C int.
1 parentc7d24b8 commitc5f8871

File tree

11 files changed

+2403
-656
lines changed

11 files changed

+2403
-656
lines changed

‎Doc/library/datetime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ locations where different offsets are used in different days of the year or
23832383
where historical changes have been made to civil time.
23842384

23852385

2386-
..class::timezone(offset, name=None)
2386+
..class::timezone(offset[, name])
23872387

23882388
The *offset* argument must be specified as a:class:`timedelta`
23892389
object representing the difference between the local time and UTC. It must

‎Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/internal/pycore_global_strings.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,9 @@ struct _Py_global_strings {
382382
STRUCT_FOR_ID(d_parameter_type)
383383
STRUCT_FOR_ID(data)
384384
STRUCT_FOR_ID(database)
385+
STRUCT_FOR_ID(date)
385386
STRUCT_FOR_ID(day)
387+
STRUCT_FOR_ID(days)
386388
STRUCT_FOR_ID(debug)
387389
STRUCT_FOR_ID(decode)
388390
STRUCT_FOR_ID(decoder)
@@ -491,6 +493,7 @@ struct _Py_global_strings {
491493
STRUCT_FOR_ID(hi)
492494
STRUCT_FOR_ID(hook)
493495
STRUCT_FOR_ID(hour)
496+
STRUCT_FOR_ID(hours)
494497
STRUCT_FOR_ID(id)
495498
STRUCT_FOR_ID(ident)
496499
STRUCT_FOR_ID(identity_hint)
@@ -586,8 +589,10 @@ struct _Py_global_strings {
586589
STRUCT_FOR_ID(metadata)
587590
STRUCT_FOR_ID(method)
588591
STRUCT_FOR_ID(microsecond)
592+
STRUCT_FOR_ID(microseconds)
589593
STRUCT_FOR_ID(milliseconds)
590594
STRUCT_FOR_ID(minute)
595+
STRUCT_FOR_ID(minutes)
591596
STRUCT_FOR_ID(mod)
592597
STRUCT_FOR_ID(mode)
593598
STRUCT_FOR_ID(module)
@@ -698,6 +703,7 @@ struct _Py_global_strings {
698703
STRUCT_FOR_ID(scheduler)
699704
STRUCT_FOR_ID(script)
700705
STRUCT_FOR_ID(second)
706+
STRUCT_FOR_ID(seconds)
701707
STRUCT_FOR_ID(security_attributes)
702708
STRUCT_FOR_ID(seek)
703709
STRUCT_FOR_ID(seekable)
@@ -762,9 +768,12 @@ struct _Py_global_strings {
762768
STRUCT_FOR_ID(text)
763769
STRUCT_FOR_ID(threading)
764770
STRUCT_FOR_ID(throw)
771+
STRUCT_FOR_ID(time)
765772
STRUCT_FOR_ID(timeout)
766773
STRUCT_FOR_ID(timer)
767774
STRUCT_FOR_ID(times)
775+
STRUCT_FOR_ID(timespec)
776+
STRUCT_FOR_ID(timestamp)
768777
STRUCT_FOR_ID(timetuple)
769778
STRUCT_FOR_ID(timeunit)
770779
STRUCT_FOR_ID(top)
@@ -796,6 +805,7 @@ struct _Py_global_strings {
796805
STRUCT_FOR_ID(wbits)
797806
STRUCT_FOR_ID(week)
798807
STRUCT_FOR_ID(weekday)
808+
STRUCT_FOR_ID(weeks)
799809
STRUCT_FOR_ID(which)
800810
STRUCT_FOR_ID(who)
801811
STRUCT_FOR_ID(withdata)

‎Include/internal/pycore_runtime_init_generated.h

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/internal/pycore_unicodeobject_generated.h

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Lib/_pydatetime.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ def fromisocalendar(cls, year, week, day):
10831083

10841084
@classmethod
10851085
defstrptime(cls,date_string,format):
1086-
"""Parsea datestring according to the given format (like time.strptime())."""
1086+
"""Parse string according to the given date format (like time.strptime())."""
10871087
import_strptime
10881088
return_strptime._strptime_datetime_date(cls,date_string,format)
10891089

@@ -1310,7 +1310,7 @@ def __reduce__(self):
13101310

13111311

13121312
classtzinfo:
1313-
"""Abstract base class for time zone infoclasses.
1313+
"""Abstract base class for time zone infoobjects.
13141314
13151315
Subclasses must override the tzname(), utcoffset() and dst() methods.
13161316
"""
@@ -1468,7 +1468,7 @@ def __new__(cls, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold
14681468

14691469
@classmethod
14701470
defstrptime(cls,date_string,format):
1471-
"""string, format -> newtimeparsed from a string (like time.strptime())."""
1471+
"""Parsestring according to the giventimeformat (like time.strptime())."""
14721472
import_strptime
14731473
return_strptime._strptime_datetime_time(cls,date_string,format)
14741474

@@ -1776,7 +1776,7 @@ def __reduce__(self):
17761776

17771777

17781778
classdatetime(date):
1779-
"""datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
1779+
"""A combination of a date and a time.
17801780
17811781
The year, month and day arguments are required. tzinfo may be None, or an
17821782
instance of a tzinfo subclass. The remaining arguments may be ints.
@@ -2209,7 +2209,7 @@ def __str__(self):
22092209

22102210
@classmethod
22112211
defstrptime(cls,date_string,format):
2212-
'string, format -> new datetime parsed from a string (like time.strptime()).'
2212+
"""Parsestring according to the given date and time format (like time.strptime())."""
22132213
import_strptime
22142214
return_strptime._strptime_datetime_datetime(cls,date_string,format)
22152215

@@ -2435,6 +2435,8 @@ def _isoweek1monday(year):
24352435

24362436

24372437
classtimezone(tzinfo):
2438+
"""Fixed offset from UTC implementation of tzinfo."""
2439+
24382440
__slots__='_offset','_name'
24392441

24402442
# Sentinel value to disallow None

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp