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

2011-01-08 Thread STINNER Victor
STINNER Victor 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; ]. -- ___ Python trac

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

2011-01-07 Thread STINNER Victor
STINNER Victor 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

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

2011-01-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Commit link: r87829 -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mai

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

2011-01-07 Thread Alexander Belopolsky
Alexander Belopolsky 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 discussion starting at http://mail.

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

2011-01-06 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Added file: http://bugs.python.org/file20295/issue10827c.diff ___ Python tracker ___ ___ Python-bugs-list ma

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

2011-01-06 Thread Alexander Belopolsky
Alexander Belopolsky 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-05 Thread Alexander Belopolsky
Alexander Belopolsky 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 so that it is now easy to accept

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

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Tue, Jan 4, 2011 at 1:49 PM, Georg Brandl 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: http://bugs.python.org/file20261/issue10827a.diff

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

2011-01-04 Thread Georg Brandl
Georg Brandl added the comment: But if it fails, why not just let it fail? -- nosy: +georg.brandl ___ Python tracker ___ ___ Python-b

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

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Tue, Jan 4, 2011 at 1:30 PM, Alexander Belopolsky wrote: .. > This is clearly a bug.  (Although Y2K note contradicts time.accept2dyear > documentation.) > PyObject_IsTrue() may fail - this is probably the reason for the current odd logic. My patch s

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

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky 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; time.asctime((99,) + (0,)*8)

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

2011-01-04 Thread Andreas Stührk
Changes by Andreas Stührk : -- nosy: +Trundle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

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

2011-01-04 Thread Alexander Belopolsky
Alexander Belopolsky 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 overrunning a fixed size buffer

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

2011-01-04 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : """ > 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 time.accept2dyear=False, we