[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-27 Thread STINNER Victor


STINNER Victor  added the comment:

Note for myself: Python 2.7 is not affected by this bug because it doesn't 
accept year < 1900.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

OverflowError is now raised for negative values that would trigger a problem 
and the unittest has been updated to test this.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread miss-islington


miss-islington  added the comment:


New changeset d5f017bbd65f37ac53fd3c6c439a53155eef2475 by Miss Islington (bot) 
in branch '3.7':
bpo-13312: Avoid int underflow in time year. (GH-8912)
https://github.com/python/cpython/commit/d5f017bbd65f37ac53fd3c6c439a53155eef2475


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread miss-islington


miss-islington  added the comment:


New changeset c47acc2bb1d0a3fb6dda14ced958d272fb2821a6 by Miss Islington (bot) 
in branch '3.6':
bpo-13312: Avoid int underflow in time year. (GH-8912)
https://github.com/python/cpython/commit/c47acc2bb1d0a3fb6dda14ced958d272fb2821a6


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8386

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8385

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset 76be0f8b7dbe649ad4821144461800ffb0d0 by Gregory P. Smith in 
branch 'master':
bpo-13312: Avoid int underflow in time year. (GH-8912)
https://github.com/python/cpython/commit/76be0f8b7dbe649ad4821144461800ffb0d0


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +8384
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2018-08-24 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith
versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2017-06-10 Thread Jakub Wilk

Changes by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2016-07-14 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2016-07-13 Thread Martin Panter

Martin Panter added the comment:

If you enable GCC’s -ftrapv option, the subtraction overflow triggers an abort. 
Alexander’s patch works around the problem for asctime(), but the problem still 
exists in other cases, such as:

>>> time.mktime((-2**31 + 1899, *(0,) * 8))
Aborted (core dumped)
[Exit 134]

Attaching a version of the patch without the conflicting whitespace changes.

Why does Python even need to support such extreme time values? It would seem 
much simpler to raise an exception.

--
nosy: +martin.panter
Added file: http://bugs.python.org/file43709/issue13312.v2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2015-03-01 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

As far as I can tell, the original report was about a test failing due to a 
system-dependent behavior of time.asctime().  However, since changeset 
1e62a0cee092 (see issue #8013), we no longer call system asctime.  I believe 
the test disabled in 1a0bfc26af57 can now be restored.

--
components: +Tests -Library (Lib)
versions: +Python 3.5 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2015-03-01 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Attached patch eliminates undefined behavior, but I am not sure fixing this is 
worth the trouble.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file38290/issue13312.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2015-03-01 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

We still have the following in Lib/test/test_time.py:

# Issue #13312: it may return wrong value for year  TIME_MINYEAR + 1900
# Skip the value test, but check that no error is raised
self.yearstr(TIME_MINYEAR)


I reviewed the current time.asctime() code and it does look like it invokes 
undefined behavior for extremely large negative years.

The problem is that in C struct tm, year is stored as year - 1900 and for year 
 -2147481748 (= -2**31 + 1900) we trigger an overflow of a signed integer.

Can someone confirm that on AMD64 FreeBSD subtracting 1900 from -2147483648 and 
then adding it back does not give -2147483648?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2015-03-01 Thread Mark Lawrence

Mark Lawrence added the comment:

Sorry should have been #17690.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2015-03-01 Thread Mark Lawrence

Mark Lawrence added the comment:

I believe that this can be closed as the test code was changed completely in 
#17960.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2015-03-01 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Mark,

Issue #17960 (Clarify the required behaviour of locals()) does not seem to be 
relevant here.  I think you meant to refer to a changeset, not issue number.  
If so please use hash number such as d877d7f3b679.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2014-06-13 Thread Mark Lawrence

Mark Lawrence added the comment:

The failing negative years test is still being skipped.  I'm assuming this was 
not originally intended.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-02 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

It fails for very low negative years:
  -2147481749 = year = -2147483648
  (-131) + 1900 = year = (-131)

Every other value behaves correctly on this FreeBSD buildbot:
 - (-131) + 1900  year  (+131) : correctly formatted with '%Z'
 - year   (-131) : raises OverfowError
 - year = (+131) : raises OverfowError

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-02 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

It fails for very low negative years:
  -2147483648 = year  -2147481748 
  (-131)= year  (-131) + 1900 

Every other value behaves correctly on this FreeBSD buildbot:
 - (-131) + 1900 = year  (+131) : correctly formatted with '%Z'
 - year   (-131) : raises OverfowError
 - year = (+131) : raises OverfowError

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-02 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
Removed message: http://bugs.python.org/msg146827

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-02 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

I mean formatted with '%Y', of course.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-02 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 1a0bfc26af57 by Florent Xicluna in branch 'default':
Issue #13312: skip the failing negative years for now.
http://hg.python.org/cpython/rev/1a0bfc26af57

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-01 Thread Florent Xicluna

New submission from Florent Xicluna florent.xicl...@gmail.com:

On builder AMD64 FreeBSD 8.2 3.x for the TIME_MINYEAR:


==
FAIL: test_negative (test.test_time.TestStrftime4dyear)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_time.py, 
line 397, in test_negative
return super().test_negative()
  File 
/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_time.py, 
line 425, in test_negative
self.assertEqual(self.yearstr(TIME_MINYEAR), str(TIME_MINYEAR))
AssertionError: '2147483648' != '-2147483648'
- 2147483648
+ -2147483648
? +

--
components: Library (Lib)
keywords: buildbot
messages: 146793
nosy: belopolsky, flox
priority: normal
severity: normal
stage: needs patch
status: open
title: test_time fails: strftime('%Y', y) for negative year
type: behavior
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-01 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 9cb1b85237a9 by Florent Xicluna in branch 'default':
Issue #13312: skip the single failing value for now.
http://hg.python.org/cpython/rev/9cb1b85237a9

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13312] test_time fails: strftime('%Y', y) for negative year

2011-11-01 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d877d7f3b679 by Florent Xicluna in branch 'default':
Actually, there's more than one failing value. (changeset 9cb1b85237a9, issue 
#13312).
http://hg.python.org/cpython/rev/d877d7f3b679

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13312
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com