Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:

Attached patch, issue10827c.diff, implements the following logic in gettmarg:


    /* If year is specified with less that 4 digits, its interpretation         
                                                                                
                                              
     * depends on the accept2dyear value.                                       
                                                                                
                                              
     *                                                                          
                                                                                
                                              
     * If accept2dyear is true (default), a backward compatibility behavior is  
                                                                                
                                              
     * invoked as follows:                                                      
                                                                                
                                              
     *                                                                          
                                                                                
                                              
     *   - for 2-digit year, century is guessed according to POSIX rules for    
                                                                                
                                              
     *      %y strptime format: 21st century for y < 69, 20th century           
                                                                                
                                              
     *      otherwise.  A deprecation warning is issued when century            
                                                                                
                                              
     *      information is guessed in this way.                                 
                                                                                
                                              
     *                                                                          
                                                                                
                                              
     *   - for 3-digit or negative year, a ValueError exception is raised.      
                                                                                
                                              
     *                                                                          
                                                                                
                                              
     * If accept2dyear is false (set by the program or as a result of a         
                                                                                
                                              
     * non-empty value assigned to PYTHONY2K environment variable) all year     
                                                                                
                                              
     * values are interpreted as given.                                         
                                                                                
                                              
     */

It is easy to restore year >= 1900 limit for strftime, but I would rather add 
tests that time.strftime either produces correct values or raises ValueError 
and see if buildbots discover any platform bugs.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to