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 2012年09月27日 08:46 by serhiy.storchaka, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| float2int_dbl_decref.patch | serhiy.storchaka, 2012年09月27日 08:46 | review | ||
| float2int_dbl_decref_2.patch | mark.dickinson, 2012年09月27日 17:08 | review | ||
| Messages (12) | |||
|---|---|---|---|
| msg171371 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月27日 08:46 | |
In function convert_integral_to_int() in file Objects/abstract.c integral double decrefed and dereferenced after decrefing if returned value of __int__() is not int. Python 3.3 only affected. Here is a patch. |
|||
| msg171376 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月27日 15:33 | |
Nice catch! And indeed, the following code generates a segfault on my machine: class B(object): def __int__(self): return 43.0 class A(object): def __trunc__(self): return B() int(A()) The patch should probably include a regression test. |
|||
| msg171380 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月27日 16:48 | |
> And indeed, the following code generates a segfault on my machine: I was going to give similar example and assign crash type to issue, but on my machine it does not generate a segfault. > The patch should probably include a regression test. Someone borrowed Guido's time machine and have already done this test (see NonIntegral in Lib/test/test_int.py). |
|||
| msg171382 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月27日 17:02 | |
That test doesn't look quite the same, though: the return value of __trunc__ is an object that has __trunc__ rather than __int__. And all the existing tests pass on my machine without issues. |
|||
| msg171383 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月27日 17:08 | |
Here's patch that adds a regression test. |
|||
| msg171385 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月27日 17:29 | |
Ah, it generates a segfault in debug mode. LGTM. |
|||
| msg171386 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年09月27日 18:39 | |
New changeset 690287f8ea95 by Mark Dickinson in branch 'default': Issue #16060: Fix a double DECREF in int() implementation. Thanks Serhiy Storchaka. http://hg.python.org/cpython/rev/690287f8ea95 |
|||
| msg171388 - (view) | Author: Mark Dickinson (mark.dickinson) * (Python committer) | Date: 2012年09月27日 18:43 | |
Applied. Thanks! I'm not sure whether this is worthy of inclusion in Python 3.3.0; on one hand, it's a segfault from core Python. On the other, it doesn't look that easy to trigger by accident. On balance, I'd say it's safe to wait for Python 3.3.1 for this. Adding Georg to the nosy in case he disagrees. |
|||
| msg171415 - (view) | Author: Jesús Cea Avión (jcea) * (Python committer) | Date: 2012年09月28日 08:36 | |
Serhiy, I wonder how you found this :) |
|||
| msg171424 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年09月28日 09:37 | |
> Serhiy, I wonder how you found this :) I just looked at the code for issue16036. |
|||
| msg171461 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2012年09月28日 13:35 | |
Applied: d23eb81bd482. |
|||
| msg171556 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年09月29日 07:27 | |
New changeset d23eb81bd482 by Mark Dickinson in branch 'default': Issue #16060: Fix a double DECREF in int() implementation. Thanks Serhiy Storchaka. http://hg.python.org/cpython/rev/d23eb81bd482 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:36 | admin | set | github: 60264 |
| 2012年09月29日 07:27:39 | python-dev | set | messages: + msg171556 |
| 2012年09月28日 13:35:29 | georg.brandl | set | status: open -> closed resolution: fixed messages: + msg171461 |
| 2012年09月28日 09:37:59 | serhiy.storchaka | set | messages: + msg171424 |
| 2012年09月28日 08:36:15 | jcea | set | nosy:
+ jcea messages: + msg171415 |
| 2012年09月27日 18:51:51 | mark.dickinson | set | assignee: mark.dickinson |
| 2012年09月27日 18:43:07 | mark.dickinson | set | nosy:
+ georg.brandl messages: + msg171388 |
| 2012年09月27日 18:39:18 | python-dev | set | nosy:
+ python-dev messages: + msg171386 |
| 2012年09月27日 17:29:42 | serhiy.storchaka | set | type: behavior -> crash messages: + msg171385 |
| 2012年09月27日 17:08:47 | mark.dickinson | set | files:
+ float2int_dbl_decref_2.patch messages: + msg171383 |
| 2012年09月27日 17:02:51 | mark.dickinson | set | messages: + msg171382 |
| 2012年09月27日 16:48:13 | serhiy.storchaka | set | messages: + msg171380 |
| 2012年09月27日 15:33:54 | mark.dickinson | set | priority: normal -> high nosy: + mark.dickinson messages: + msg171376 |
| 2012年09月27日 08:46:57 | serhiy.storchaka | create | |