Some systems reportedly don't expand '%OB' and '%Ob'.
In this case (and similar theoretically possible ones, like expanding to empty
string or 'OB'), fall back to the month_name & month_abbr.
except ValueError:
standalone_month_name = month_name
standalone_month_abbr = month_abbr
+else:
+ # Some systems that do not support '%OB' will keep it as-is (i.e.,
+ # we get [..., '%OB', '%OB', '%OB']), so for non-distinct names,
+ # we fall back to month_name/month_abbr.
+ if len(set(standalone_month_name)) != len(set(month_name)):
+ standalone_month_name = month_name
+ if len(set(standalone_month_abbr)) != len(set(month_abbr)):
+ standalone_month_abbr = month_abbr
def isleap(year):