[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: time.asctime(), time.ctime() and time.strftime() are no more not limited for the year field if accept2dyear=0. Except with Visual Studio or on Solaris: the year is limited to the range [1; ]. --

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-07 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Committed in 87829. I added a year = 1900 check in time.strftime for now because removing or relaxing this limit should be done in coordination with similar datetime module issue. See #1777412. See also python-dev

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-07 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Commit link: r87829 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10827 ___

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-07 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I tried time.asctime() on Windows 32 bits (compiled with Visual Studio) with accept2dyear=False: it accepts years in [-2^31; 2^31-1], cool. -- ___ Python tracker rep...@bugs.python.org

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-06 Thread Alexander Belopolsky
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

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-06 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: Added file: http://bugs.python.org/file20295/issue10827c.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10827 ___

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-05 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Attached patch, issue10827b.diff, fixes the accept2dyear = True issue and removes unnecessary struct_time to tuple conversion, but otherwise does not change the Y2K behavior. The code handling accept2dyear is refactored

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Alexander Belopolsky
New submission from Alexander Belopolsky belopol...@users.sourceforge.net: http://docs.python.org/library/time.html#time-y2kissues Values 100–1899 are always illegal. Why are these values illegal? The GNU libc accepts year in [1900-2^31; 2^31-1] (tm_year in [-2147483648; 2147481747]). If

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: The system libc would raise an error (return NULL) if it doesn't know how to format years older than 1900. As experience with asctime has shown, system libc can do whatever it pleases with out of range values including

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Andreas Stührk
Changes by Andreas Stührk andy-pyt...@hammerhartes.de: -- nosy: +Trundle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10827 ___ ___

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am attaching a patch. While working on the patch, I noticed that although time.accept2dyear is documented as boolean, the current code expects int and treats any non-int including True as 0: time.accept2dyear = True;

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Jan 4, 2011 at 1:30 PM, Alexander Belopolsky rep...@bugs.python.org wrote: .. This is clearly a bug.  (Although Y2K note contradicts time.accept2dyear documentation.) PyObject_IsTrue() may fail - this is

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: But if it fails, why not just let it fail? -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10827 ___

[issue10827] Functions in time module should support year 1900 when accept2dyear = 0

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Jan 4, 2011 at 1:49 PM, Georg Brandl rep...@bugs.python.org wrote: .. But if it fails, why not just let it fail? Sure. That's what I meant by fixing the patch. See new patch attached. -- Added file: