classification
Title: 'round' function doesn't honour a descriptor __round__
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, mark.dickinson, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-04-13 20:02 by mark.dickinson, last changed 2013-04-13 21:56 by benjamin.peterson. This issue is now closed.

Files
File name Uploaded Description Edit
round_descriptor.patch mark.dickinson, 2013-04-13 20:02 review
round_descriptor2.patch mark.dickinson, 2013-04-13 20:08 review
Messages (8)
msg186813 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 20:02
Benjamin pointed out on #python-dev that the builtin round function should be using _PyObject_LookupSpecial to look up the __round__ method.  Here's a fix.
msg186815 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 20:05
Whoops.  That patch introduces a new refleak;  will fix shortly.
msg186817 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 20:08
Non-leaky patch.
msg186848 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-04-13 21:09
Perhaps it will be good to add a new test when X doesn't not have a special method. I don't see this case is covered.
msg186854 - (view) Author: Roundup Robot (python-dev) Date: 2013-04-13 21:19
New changeset cc59c215f19e by Benjamin Peterson in branch 'default':
properly lookup the __round__ special method (closes #17722)
http://hg.python.org/cpython/rev/cc59c215f19e
msg186855 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-04-13 21:19
Sorry for trampling on you; I had a patch already in my wc.
msg186860 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2013-04-13 21:54
No problem.

Do you usually keep patches in your WC?
msg186861 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-04-13 21:56
In this case, I had almost finished a patch as I was talking with you on IRC, but I had to go play in a show for 3 hours.
History
Date User Action Args
2013-04-13 21:56:03benjamin.petersonsetmessages: + msg186861
2013-04-13 21:54:44mark.dickinsonsetmessages: + msg186860
2013-04-13 21:19:55benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg186855
2013-04-13 21:19:09python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg186854

resolution: fixed
stage: patch review -> resolved
2013-04-13 21:09:14serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg186848
2013-04-13 20:08:55mark.dickinsonsetfiles: + round_descriptor2.patch

messages: + msg186817
2013-04-13 20:05:20mark.dickinsonsetmessages: + msg186815
2013-04-13 20:02:20mark.dickinsoncreate