[Python-checkins] python/nondist/sandbox/datetime datetime.c,1.59,1.60
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
Wed, 11 Dec 2002 19:15:05 -0800
Update of /cvsroot/python/python/nondist/sandbox/datetime
In directory sc8-pr-cvs1:/tmp/cvs-serv12542
Modified Files:
datetime.c
Log Message:
format_utcoffset(): If utcoffset() returns None, store a \0 byte into
the buffer. The callers really have no way to know (or any reason to
care) whether this actually wrote a utcoffset into the buffer.
Index: datetime.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/datetime/datetime.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** datetime.c 12 Dec 2002 01:11:08 -0000 1.59
--- datetime.c 12 Dec 2002 03:15:02 -0000 1.60
***************
*** 749,756 ****
/* Add an hours & minutes UTC offset string to buf. buf has no more than
* buflen bytes remaining. The UTC offset is gotten by calling
! * tzinfo.uctoffset(tzinfoarg). If that returns None, nothing is done.
! * Else the returned value is checked for sanity (an integer in range),
! * and if that's OK it's converted to an hours & minutes string of the
! * form
* sign HH sep MM
* Returns 0 if everything is OK. If the return value from utcoffset() is
--- 749,756 ----
/* Add an hours & minutes UTC offset string to buf. buf has no more than
* buflen bytes remaining. The UTC offset is gotten by calling
! * tzinfo.uctoffset(tzinfoarg). If that returns None, \0 is stored into
! * *buf, and that's all. Else the returned value is checked for sanity (an
! * integer in range), and if that's OK it's converted to an hours & minutes
! * string of the form
* sign HH sep MM
* Returns 0 if everything is OK. If the return value from utcoffset() is
***************
*** 770,775 ****
if (offset == -1 && PyErr_Occurred())
return -1;
! if (none)
return 0;
sign = '+';
if (offset < 0) {
--- 770,777 ----
if (offset == -1 && PyErr_Occurred())
return -1;
! if (none) {
! *buf = '\0';
return 0;
+ }
sign = '+';
if (offset < 0) {