Bugs item #1715302, was opened at 2007-05-08 16:49
Message generated for change (Comment added) made by alanmcintyre
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1715302&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Erik Wickstrom (erikcw)
Assigned to: Nobody/Anonymous (nobody)
Summary: datetime.date won't accept 08 or 09 as valid days.

Initial Comment:
The method won't accept 08 or 09 as valid days, but will accept 07.

Here is my output:

Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> t = datetime.date(2007, 05, 07)
>>> print t
2007-05-07
>>> t = datetime.date(2007, 05, 08)
  File "<stdin>", line 1
    t = datetime.date(2007, 05, 08)
                                 ^
SyntaxError: invalid token
>>> t = datetime.date(2007, 05, 09)
  File "<stdin>", line 1
    t = datetime.date(2007, 05, 09)
                                 ^
SyntaxError: invalid token
>>> t = datetime.date(2007, 05, 10)
>>> print t
2007-05-10
>>>

I was able to reproduce this on another machine as well:
Python 2.4.3 (#1, Aug  6 2006, 20:52:01)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.


----------------------------------------------------------------------

Comment By: Alan McIntyre (alanmcintyre)
Date: 2007-05-08 17:24

Message:
Logged In: YES 
user_id=1115903
Originator: NO

Recommend closing this as not a bug.

A number with a leading zero is interpreted as octal literal, so trying to
interpret 08 gives an error, since anything bigger than 7 isn't allowed in
octal numbers.  For your examples above, you should do this:

t = datetime.date(2007, 5, 8)
t = datetime.date(2007, 5, 9)

and then it works as expected. 



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1715302&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to