Author zhanying
Recipients belopolsky, eric.smith, p-ganssle, zhanying
Date 2020-04-10.03:05:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <2699b179.26b5.171620cb9b1.Coremail.python82@126.com>
In-reply-to <1586436351.53.0.765877217301.issue40236@roundup.psfhosted.org>
Content
i read the source code, in this part

def _calc_julian_from_U_or_W(year, week_of_year, day_of_week, week_starts_Mon):
"""Calculate the Julian day based on the year, week of the year, and day of
    the week, with week_start_day representing whether the week of the year
    assumes the week starts on Sunday or Monday (6 or 0)."""
first_weekday = datetime_date(year, 1, 1).weekday()
# If we are dealing with the %U directive (week starts on Sunday), it's
    # easier to just shift the view to Sunday being the first day of the
    # week.
if not week_starts_Mon:
        first_weekday = (first_weekday + 1) % 7
day_of_week = (day_of_week + 1) % 7
# Need to watch out for a week 0 (when the first day of the year is not
    # the same as that specified by %U or %W).
week_0_length = (7 - first_weekday) % 7
if week_of_year == 0:
return 1 + day_of_week - first_weekday
else:
        days_to_week = week_0_length + (7 * (week_of_year - 1))
return 1 + days_to_week + day_of_week

when first_weekday is 0, that year start with Monday, week_of_year equar 0 or 1, this func return same value

At 2020-04-09 20:45:51, "Eric V. Smith" <report@bugs.python.org> wrote:
>
>Eric V. Smith <eric@trueblade.com> added the comment:
>
>Can you tell us what platform you're on? Also, please include the header that's printed out when you run python from the command line. For example, mine shows:
>
>$ python3
>Python 3.7.6 (default, Jan 30 2020, 10:29:04) 
>[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
>
>----------
>components: +Library (Lib)
>nosy: +eric.smith
>
>_______________________________________
>Python tracker <report@bugs.python.org>
><https://bugs.python.org/issue40236>
>_______________________________________
History
Date User Action Args
2020-04-10 03:05:38zhanyingsetrecipients: + zhanying, belopolsky, eric.smith, p-ganssle
2020-04-10 03:05:38zhanyinglinkissue40236 messages
2020-04-10 03:05:38zhanyingcreate