Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyNumberMethods has left-over fields in Py3 #47247

Closed
scoder opened this issue May 29, 2008 · 9 comments
Closed

PyNumberMethods has left-over fields in Py3 #47247

scoder opened this issue May 29, 2008 · 9 comments
Assignees
Labels
build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker

Comments

@scoder
Copy link
Contributor

scoder commented May 29, 2008

BPO 2997
Nosy @gvanrossum, @birkenfeld, @amauryfa, @scoder, @benjaminp
Files
  • pynumbermethods-cleanup.patch: Patch that removes the fields from the struct
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/benjaminp'
    closed_at = <Date 2008-06-11.20:22:25.688>
    created_at = <Date 2008-05-29.07:55:57.389>
    labels = ['interpreter-core', 'build', 'release-blocker']
    title = 'PyNumberMethods has left-over fields in Py3'
    updated_at = <Date 2008-06-11.20:22:25.642>
    user = 'https://github.com/scoder'

    bugs.python.org fields:

    activity = <Date 2008-06-11.20:22:25.642>
    actor = 'benjamin.peterson'
    assignee = 'benjamin.peterson'
    closed = True
    closed_date = <Date 2008-06-11.20:22:25.688>
    closer = 'benjamin.peterson'
    components = ['Interpreter Core']
    creation = <Date 2008-05-29.07:55:57.389>
    creator = 'scoder'
    dependencies = []
    files = ['10461']
    hgrepos = []
    issue_num = 2997
    keywords = ['patch']
    message_count = 9.0
    messages = ['67477', '67593', '67630', '67753', '67761', '67762', '67903', '68000', '68014']
    nosy_count = 5.0
    nosy_names = ['gvanrossum', 'georg.brandl', 'amaury.forgeotdarc', 'scoder', 'benjamin.peterson']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue2997'
    versions = ['Python 3.0']

    @scoder
    Copy link
    Contributor Author

    scoder commented May 29, 2008

    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.

    @scoder scoder added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label May 29, 2008
    @scoder
    Copy link
    Contributor Author

    scoder commented Jun 1, 2008

    This seems to have been applied in current SVN.

    @birkenfeld
    Copy link
    Member

    Not to me...

    @birkenfeld birkenfeld reopened this Jun 2, 2008
    @scoder
    Copy link
    Contributor Author

    scoder commented Jun 6, 2008

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

    @amauryfa
    Copy link
    Member

    amauryfa commented Jun 6, 2008

    Let me quote a comment from GvR about the similar bpo-1185:

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

    @scoder
    Copy link
    Contributor Author

    scoder commented Jun 6, 2008

    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.

    @scoder
    Copy link
    Contributor Author

    scoder commented Jun 10, 2008

    The change that removed the nb_divide and nb_inplace_divide members is here:

    http://svn.python.org/view?rev=43285&view=rev
    http://svn.python.org/view/python/branches/p3yk/Include/object.h?rev=43285&view=diff&r1=43285&r2=43284

    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)

    @scoder scoder added the build The build process and cross-build label Jun 10, 2008
    @gvanrossum
    Copy link
    Member

    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.

    @benjaminp benjaminp self-assigned this Jun 11, 2008
    @benjaminp
    Copy link
    Contributor

    Applied in r64149.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs) release-blocker
    Projects
    None yet
    Development

    No branches or pull requests

    6 participants