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

Portability fixes in longobject.c #48643

Closed
mdickinson opened this issue Nov 23, 2008 · 3 comments
Closed

Portability fixes in longobject.c #48643

mdickinson opened this issue Nov 23, 2008 · 3 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@mdickinson
Copy link
Member

BPO 4393
Nosy @mdickinson
Files
  • longobject_casts.patch
  • 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/mdickinson'
    closed_at = <Date 2009-01-24.16:01:56.622>
    created_at = <Date 2008-11-23.12:28:25.248>
    labels = ['interpreter-core', 'type-bug']
    title = 'Portability fixes in longobject.c'
    updated_at = <Date 2009-01-24.16:01:56.621>
    user = 'https://github.com/mdickinson'

    bugs.python.org fields:

    activity = <Date 2009-01-24.16:01:56.621>
    actor = 'mark.dickinson'
    assignee = 'mark.dickinson'
    closed = True
    closed_date = <Date 2009-01-24.16:01:56.622>
    closer = 'mark.dickinson'
    components = ['Interpreter Core']
    creation = <Date 2008-11-23.12:28:25.248>
    creator = 'mark.dickinson'
    dependencies = []
    files = ['12109']
    hgrepos = []
    issue_num = 4393
    keywords = ['patch']
    message_count = 3.0
    messages = ['76267', '76821', '80456']
    nosy_count = 1.0
    nosy_names = ['mark.dickinson']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue4393'
    versions = ['Python 2.6', 'Python 3.0', 'Python 3.1', 'Python 2.7']

    @mdickinson
    Copy link
    Member Author

    This patch fixes 3 classes of bugs in Objects/longobject.c:

    (1) declarations of a variable (usually a counter into the digits of
    a PyLong) as int instead of Py_ssize_t.
    (2) missing (twodigits) casts from multiplies and shifts.
    (3) use of '<<' on negative values in _PyLong_AsByteArray. This
    may lead to undefined behaviour, according to the C standards. (See C99,
    section 6.5.7, paragraph 4).

    These bugs haven't manifested themselves in practice. For (1), there's
    only a problem when dealing with huge integers (more than 2**31 digits).
    The bugs in (2) can only affect platform where the C 'int' type has fewer
    than 32 bits. (3) could potentially conflict with future compiler
    optimizations, but doesn't seem to be a problem right now.

    For these reasons I don't think these fixes should be backported to 2.5.3.

    @mdickinson mdickinson added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels Nov 23, 2008
    @mdickinson
    Copy link
    Member Author

    See also bpo-4497 for some compiler warnings that need to be silenced.

    @mdickinson mdickinson self-assigned this Dec 3, 2008
    @mdickinson
    Copy link
    Member Author

    Fixed in r68890, r68891, r68895 and r68896

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant