summaryrefslogtreecommitdiff
path: root/Lib/datetime.py
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-08-02 17:49:30 -0400
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-08-02 17:49:30 -0400
commit43746c37704861947179185b4c037e5f18f89a7c (patch)
tree3223ce1101db5f782c32888e83e64bae66290d09 /Lib/datetime.py
parent711120d8fd0445b33655101d72b0f576646bff9f (diff)
downloadcpython-git-43746c37704861947179185b4c037e5f18f89a7c.tar.gz
Closes #27661: Added tzinfo keyword argument to datetime.combine.
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r--Lib/datetime.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py
index df8eb666a0..9f942a207e 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -1479,15 +1479,17 @@ class datetime(date):
return cls.utcfromtimestamp(t)
@classmethod
- def combine(cls, date, time):
+ def combine(cls, date, time, tzinfo=True):
"Construct a datetime from a given date and a given time."
if not isinstance(date, _date_class):
raise TypeError("date argument must be a date instance")
if not isinstance(time, _time_class):
raise TypeError("time argument must be a time instance")
+ if tzinfo is True:
+ tzinfo = time.tzinfo
return cls(date.year, date.month, date.day,
time.hour, time.minute, time.second, time.microsecond,
- time.tzinfo, fold=time.fold)
+ tzinfo, fold=time.fold)
def timetuple(self):
"Return local time tuple compatible with time.localtime()."