This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年11月01日 16:52 by flox, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue13312.patch | belopolsky, 2015年03月01日 23:07 | |||
| issue13312.v2.patch | martin.panter, 2016年07月14日 05:41 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 8912 | merged | gregory.p.smith, 2018年08月25日 00:29 | |
| PR 8913 | merged | miss-islington, 2018年08月25日 01:09 | |
| PR 8914 | merged | miss-islington, 2018年08月25日 01:09 | |
| Messages (19) | |||
|---|---|---|---|
| msg146793 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月01日 16:52 | |
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 ? + |
|||
| msg146818 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月02日 00:28 | |
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 |
|||
| msg146822 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月02日 02:22 | |
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 |
|||
| msg146828 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月02日 07:09 | |
It fails for very low negative years: -2147483648 <= year < -2147481748 (-1<<31) <= year < (-1<<31) + 1900 Every other value behaves correctly on this FreeBSD buildbot: - (-1<<31) + 1900 <= year < (+1<<31) : correctly formatted with '%Z' - year < (-1<<31) : raises OverfowError - year >= (+1<<31) : raises OverfowError |
|||
| msg146829 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2011年11月02日 07:11 | |
I mean formatted with '%Y', of course. |
|||
| msg146830 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年11月02日 07:14 | |
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 |
|||
| msg220505 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014年06月13日 22:00 | |
The failing negative years test is still being skipped. I'm assuming this was not originally intended. |
|||
| msg236981 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2015年03月01日 21:37 | |
I believe that this can be closed as the test code was changed completely in #17960. |
|||
| msg236985 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年03月01日 21:45 | |
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. |
|||
| msg236988 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年03月01日 22:00 | |
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. |
|||
| msg236989 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2015年03月01日 22:03 | |
Sorry should have been #17690. |
|||
| msg236993 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年03月01日 22:30 | |
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? |
|||
| msg236994 - (view) | Author: Alexander Belopolsky (belopolsky) * (Python committer) | Date: 2015年03月01日 23:07 | |
Attached patch eliminates undefined behavior, but I am not sure fixing this is worth the trouble. |
|||
| msg270371 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2016年07月14日 05:41 | |
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. |
|||
| msg324026 - (view) | Author: Gregory P. Smith (gregory.p.smith) * (Python committer) | Date: 2018年08月25日 01:08 | |
New changeset 76be0fffff8b7dbe649ad4821144461800ffb0d0 by Gregory P. Smith in branch 'master': bpo-13312: Avoid int underflow in time year. (GH-8912) https://github.com/python/cpython/commit/76be0fffff8b7dbe649ad4821144461800ffb0d0 |
|||
| msg324038 - (view) | Author: miss-islington (miss-islington) | Date: 2018年08月25日 05:53 | |
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 |
|||
| msg324039 - (view) | Author: miss-islington (miss-islington) | Date: 2018年08月25日 05:53 | |
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 |
|||
| msg324040 - (view) | Author: Gregory P. Smith (gregory.p.smith) * (Python committer) | Date: 2018年08月25日 05:54 | |
OverflowError is now raised for negative values that would trigger a problem and the unittest has been updated to test this. |
|||
| msg324177 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2018年08月27日 13:38 | |
Note for myself: Python 2.7 is not affected by this bug because it doesn't accept year < 1900. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:23 | admin | set | github: 57521 |
| 2018年08月27日 13:38:03 | vstinner | set | messages: + msg324177 |
| 2018年08月25日 05:54:42 | gregory.p.smith | set | status: open -> closed resolution: fixed messages: + msg324040 stage: patch review -> resolved |
| 2018年08月25日 05:53:24 | miss-islington | set | messages: + msg324039 |
| 2018年08月25日 05:53:03 | miss-islington | set | nosy:
+ miss-islington messages: + msg324038 |
| 2018年08月25日 01:09:10 | miss-islington | set | pull_requests: + pull_request8386 |
| 2018年08月25日 01:09:04 | miss-islington | set | pull_requests: + pull_request8385 |
| 2018年08月25日 01:08:53 | gregory.p.smith | set | messages: + msg324026 |
| 2018年08月25日 00:29:09 | gregory.p.smith | set | stage: needs patch -> patch review pull_requests: + pull_request8384 |
| 2018年08月25日 00:19:27 | gregory.p.smith | set | assignee: gregory.p.smith nosy: + gregory.p.smith versions: + Python 3.6, Python 3.7, Python 3.8, - Python 3.5 |
| 2017年06月10日 12:29:59 | jwilk | set | nosy:
+ jwilk |
| 2016年07月15日 02:53:36 | martin.panter | link | issue1621 dependencies |
| 2016年07月14日 14:51:38 | BreamoreBoy | set | nosy:
- BreamoreBoy |
| 2016年07月14日 05:41:49 | martin.panter | set | files:
+ issue13312.v2.patch nosy: + martin.panter messages: + msg270371 |
| 2015年03月01日 23:07:52 | belopolsky | set | files:
+ issue13312.patch nosy: + vstinner messages: + msg236994 keywords: + patch |
| 2015年03月01日 22:30:58 | belopolsky | set | messages: + msg236993 |
| 2015年03月01日 22:03:41 | BreamoreBoy | set | messages: + msg236989 |
| 2015年03月01日 22:00:00 | belopolsky | set | messages:
+ msg236988 components: + Tests, - Library (Lib) versions: + Python 3.5, - Python 3.3 |
| 2015年03月01日 21:45:10 | belopolsky | set | messages: + msg236985 |
| 2015年03月01日 21:37:09 | BreamoreBoy | set | messages: + msg236981 |
| 2014年06月13日 22:00:33 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg220505 |
| 2011年11月02日 07:14:15 | python-dev | set | messages: + msg146830 |
| 2011年11月02日 07:11:12 | flox | set | messages: + msg146829 |
| 2011年11月02日 07:09:26 | flox | set | messages: - msg146827 |
| 2011年11月02日 07:09:10 | flox | set | messages: + msg146828 |
| 2011年11月02日 07:04:31 | flox | set | messages: + msg146827 |
| 2011年11月02日 02:22:56 | python-dev | set | messages: + msg146822 |
| 2011年11月02日 00:28:36 | python-dev | set | nosy:
+ python-dev messages: + msg146818 |
| 2011年11月01日 16:52:38 | flox | create | |