[pywin32-checkins] pywin32/com/win32com/client build.py,1.39,1.40
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
|
From: Mark H. <mha...@us...> - 2009-01-26 00:47:37
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4651/com/win32com/client Modified Files: build.py Log Message: Merge optional support for using datetime objects from py3k-integration branch. Currently must be enabled at build time and only currently enabled for py3k (although it does work with all versions >= 2.4) Index: build.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/build.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** build.py 25 Jan 2009 03:35:15 -0000 1.39 --- build.py 26 Jan 2009 00:47:31 -0000 1.40 *************** *** 24,27 **** --- 24,28 ---- from pywintypes import TimeType import winerror + import datetime # A string ending with a quote can not be safely triple-quoted. *************** *** 558,568 **** if inOut & pythoncom.PARAMFLAG_FHASDEFAULT: ! # hack for Unicode until it repr's better. val = defArgVal[2] if type(val) is TimeType: year=val.year; month=val.month; day=val.day; hour=val.hour; minute=val.minute; second=val.second; msec=val.msec return "pywintypes.Time((%(year)d, %(month)d, %(day)d, %(hour)d, %(minute)d, %(second)d,0,0,0,%(msec)d))" % locals() ! else: ! return repr(val) return None --- 559,573 ---- if inOut & pythoncom.PARAMFLAG_FHASDEFAULT: ! # times need special handling... val = defArgVal[2] + if isinstance(val, datetime.datetime): + # VARIANT <-> SYSTEMTIME conversions always lose any sub-second + # resolution, so just use a 'timetuple' here. + return repr(tuple(val.utctimetuple())) if type(val) is TimeType: + # must be the 'old' pywintypes time object... year=val.year; month=val.month; day=val.day; hour=val.hour; minute=val.minute; second=val.second; msec=val.msec return "pywintypes.Time((%(year)d, %(month)d, %(day)d, %(hour)d, %(minute)d, %(second)d,0,0,0,%(msec)d))" % locals() ! return repr(val) return None |