[issue16060] Double decref and dereferencing after decref in int()

2012-09-29 Thread Roundup Robot

Roundup Robot added the comment:

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

--

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-28 Thread Georg Brandl

Georg Brandl added the comment:

Applied: d23eb81bd482.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Serhiy, I wonder how you found this :)

I just looked at the code for issue16036.

--

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-28 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Serhiy, I wonder how you found this :)

--
nosy: +jcea

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Mark Dickinson

Mark Dickinson added the comment:

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.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Roundup Robot

Roundup Robot added the comment:

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

--
nosy: +python-dev

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, it generates a segfault in debug mode.

LGTM.

--
type: behavior -> crash

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Mark Dickinson

Mark Dickinson added the comment:

Here's patch that adds a regression test.

--
Added file: http://bugs.python.org/file27319/float2int_dbl_decref_2.patch

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Mark Dickinson

Mark Dickinson added the comment:

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.

--

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> 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).

--

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Mark Dickinson

Mark Dickinson added the comment:

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.

--
nosy: +mark.dickinson
priority: normal -> high

___
Python tracker 

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



[issue16060] Double decref and dereferencing after decref in int()

2012-09-27 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

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.

--
components: Interpreter Core
files: float2int_dbl_decref.patch
keywords: patch
messages: 171371
nosy: benjamin.peterson, storchaka
priority: normal
severity: normal
status: open
title: Double decref and dereferencing after decref in int()
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file27316/float2int_dbl_decref.patch

___
Python tracker 

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