Issue 18780: SystemError when formatting int subclass (original) (raw)

Created on 2013-08-19 14:10 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue18780.stoneleaf.01.patch ethan.furman,2013-08-28 02:12 review
Messages (14)
msg195631 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-19 14:10
>>> class I(int): ... def __str__(self): ... return 'spam' ... >>> '%i' % (I(42),) Traceback (most recent call last): File "", line 1, in SystemError: Objects/unicodeobject.c:13595: bad argument to internal function This issue is related to and will be fixed when use PyNumber_ToBase() for any int subclass (not only for bool).
msg195634 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-08-19 14:36
formatlong() should copy the string if Py_REFCNT(str) != 1.
msg195778 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-08-21 12:03
I think we should just use PyNumber_ToBase() for any int and int subclass. The calling __str__() for special case looks weird.
msg195813 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-08-21 18:17
I'll get my patch separated and over here when I get back home (on a business trip at the moment).
msg196343 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-08-28 02:12
Okay, simple fix, patch and tests attached.
msg196528 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2013-08-30 12:44
lgtm
msg196652 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-31 17:19
New changeset 33727fbb4668 by Ethan Furman in branch 'default': Close #18780: %-formatting now prints value for int subclasses with %d, %i, and %u codes. http://hg.python.org/cpython/rev/33727fbb4668
msg196668 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-31 19:49
New changeset 833246d42825 by Ethan Furman in branch 'default': Issue #18780: code cleanup. http://hg.python.org/cpython/rev/833246d42825
msg221461 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2014-06-24 14:49
Should this patch also go into the 3.3 branch? It only went into 3.4. If yes, how should I go about doing that?
msg221501 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-06-24 21:29
The 3.3 branch is now only open for security fixes so this issue doesn't appear to warrant backporting there.
msg221504 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2014-06-24 22:02
Cool, leaving it closed.
msg221505 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2014-06-24 22:10
On Tue, Jun 24, 2014 at 2:29 PM, Ned Deily <report@bugs.python.org> wrote: > > Ned Deily added the comment: > > The 3.3 branch is now only open for security fixes so this issue doesn't > appear to warrant backporting there. > > ---------- > These questions keep popping up in various places, being asked even by core devs like here. Is there a place where this is described formally? I.e. 3.5 is trunk, 3.4 is bug fixes, 3.3 is security fixes, doc fixes good everywhere, and some info about 2.7? I imagine since this only changes once per 18 months or so, it should not be difficult to maintain and can just be part of the release manager's job.
msg221506 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-06-24 22:18
It is described in the developer's guide. The current status is summarized here: https://docs.python.org/devguide/devcycle.html#summary
msg221507 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2014-06-24 22:21
On Tue, Jun 24, 2014 at 3:18 PM, Ned Deily <report@bugs.python.org> wrote: > > Ned Deily added the comment: > > It is described in the developer's guide. The current status is > summarized here: > > https://docs.python.org/devguide/devcycle.html#summary > > Excellent. Thanks Ned.
History
Date User Action Args
2022-04-11 14:57:49 admin set github: 62980
2014-06-24 22:21:58 eli.bendersky set messages: +
2014-06-24 22🔞20 ned.deily set messages: +
2014-06-24 22:10:04 eli.bendersky set messages: +
2014-06-24 22:02:02 ethan.furman set messages: + versions: - Python 3.3
2014-06-24 21:29:16 ned.deily set nosy: + ned.deilymessages: +
2014-06-24 14:49:31 ethan.furman set assignee: ethan.furmanmessages: +
2013-08-31 19:49:06 python-dev set messages: +
2013-08-31 17:19:16 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: patch review -> resolved
2013-08-30 12:44:37 eli.bendersky set messages: +
2013-08-28 02:13:00 ethan.furman set files: + issue18780.stoneleaf.01.patchnosy: + ncoghlanmessages: + keywords: + patchstage: patch review
2013-08-21 18:17:34 ethan.furman set messages: +
2013-08-21 13:51:30 serhiy.storchaka set nosy: + barry, eric.smith, eli.bendersky, ethan.furman
2013-08-21 12:03:07 serhiy.storchaka set messages: +
2013-08-19 14:36:16 vstinner set messages: +
2013-08-19 14:10:34 serhiy.storchaka create