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.

Title: PyNumberMethods has left-over fields in Py3
Type: compile error Stage:
Components: Interpreter Core Versions: Python 3.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: amaury.forgeotdarc, benjamin.peterson, georg.brandl, gvanrossum, scoder
Priority: release blocker Keywords: patch

Created on 2008-05-29 07:55 by scoder, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
pynumbermethods-cleanup.patch scoder, 2008-05-29 07:55 Patch that removes the fields from the struct
Messages (9)
msg67477 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-05-29 07:55
Here is a patch that removes three unused fields from the
PyNumberMethods struct in Py3. Since two fields were already removed
(one even before the ones this patch removes), there is no way existing
Py2 C code that uses this struct can work in Py3 without changes, so it
doesn't add any problems.
msg67593 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-06-01 14:20
This seems to have been applied in current SVN.
msg67630 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-06-02 06:05
Not to me...
msg67753 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-06-06 07:59
:) sorry, that's the problem when you don't have commit rights and leave
the changes in your local copy.

So this is still an open issue that should be fixed before beta1, thanks.
msg67761 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-06-06 11:45
Let me quote a comment from GvR about the similar issue1185:

Can you redo the patch while keeping the slot *position* (though not the
name or type)?  The wasted space is minimal (4-8 bytes per type or class
object) and it means a lot for third party code if the positional struct
initialization never breaks due to insertion or removal of a slot. 
Since everyone has a zero here anyway, I propose to name the slot
nb_reserved and make its type int.

OTOH, it's python 3.0, and we are allowed to break things...
msg67762 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-06-06 11:52
I would accept that if this had been done in all cases, but as I wrote
in my first comment, the previously existing slot "nb_divide", which
comes *before* the named ones, has already been removed, so there is no
way existing Py2 code can work unchanged in Py3, even if we leave the
three fields in.
msg67903 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2008-06-10 13:05
The change that removed the nb_divide and nb_inplace_divide members is here:

It dates back to March 2006.

(changing issue type to "compile error" as that's what you currently get
for Py2 code due to this change)
msg68000 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-06-11 17:26
I say let's go with the cleanup.  Extensions that want to be compiled
under 2.x and 3.0 will need lots of #ifdef code anyway.
msg68014 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-06-11 20:22
Applied in r64149.
Date User Action Args
2022-04-11 14:56:35adminsetgithub: 47247
2008-06-11 20:22:25benjamin.petersonsetstatus: open -> closed
resolution: accepted -> fixed
messages: + msg68014
2008-06-11 18:19:03benjamin.petersonsetassignee: benjamin.peterson
nosy: + benjamin.peterson
2008-06-11 17:55:41barrysetresolution: accepted
2008-06-11 17:26:35gvanrossumsetnosy: + gvanrossum
messages: + msg68000
2008-06-11 12:14:41barrysetpriority: critical -> release blocker
2008-06-10 13:17:04georg.brandlsetpriority: critical
2008-06-10 13:05:46scodersettype: compile error
messages: + msg67903
2008-06-06 11:52:11scodersetmessages: + msg67762
2008-06-06 11:45:18amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg67761
2008-06-06 07:59:30scodersetmessages: + msg67753
2008-06-02 06:05:09georg.brandlsetstatus: closed -> open
resolution: out of date -> (no value)
messages: + msg67630
nosy: + georg.brandl
2008-06-01 21:44:00benjamin.petersonsetstatus: open -> closed
resolution: out of date
2008-06-01 14:20:22scodersetmessages: + msg67593
2008-05-29 07:55:57scodercreate