python / cpython

The Python programming language
https://www.python.org/
Other
60.06k stars 29.08k forks source link

simple 64-bit fixes in Parser/ dir #32445

Closed bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 closed 23 years ago

bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago
BPO 400523
Nosy @gvanrossum
Files
  • None: None
  • 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: ```python assignee = 'https://github.com/gvanrossum' closed_at = created_at = labels = [] title = 'simple 64-bit fixes in Parser/ dir' updated_at = user = 'https://bugs.python.org/tmick' ``` bugs.python.org fields: ```python activity = actor = 'tmick' assignee = 'gvanrossum' closed = True closed_date = None closer = None components = ['None'] creation = creator = 'tmick' dependencies = [] files = ['2453'] hgrepos = [] issue_num = 400523 keywords = ['patch'] message_count = 4.0 messages = ['32779', '32780', '32781', '32782'] nosy_count = 2.0 nosy_names = ['gvanrossum', 'tmick'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue400523' versions = [] ```

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago
    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago

    I confirm that, to the best of my knowledge and belief, this contribution is free of any claims of third parties under copyright, patent or other rights or interests ("claims"). To the extent that I have any such claims, I hereby grant to CNRI a nonexclusive, irrevocable, royalty-free, worldwide license to reproduce, distribute, perform and/or display publicly, prepare derivative versions, and otherwise use this contribution as part of the Python software and its related documentation, or any derivative versions thereof, at no cost to CNRI or its licensed users, and to authorize others to do so.

    I acknowledge that CNRI may, at its sole discretion, decide whether or not to incorporate this contribution in the Python software and its related documentation. I further grant CNRI permission to use my name and other identifying information provided to CNRI by me for use in connection with the Python software and its related documentation.

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago

    This patch is one of a set of five (one per python/dist/src/* directory). They have been broken up to keep the patches small such that people might spend the time to review them. If one single patch would be prefered I can provide that.

    This patch makes some simple changes for the benefit of 64-bit platforms (to avoid possible overflows where C data types have changed sizes and to eliminate unnecessary warnings). Each change fits into one of the following categories:

    bdaf8532-ded6-4d4c-9bb3-51fd76040dc1 commented 23 years ago

    [Tim Peters]

    [Trent Mick] > ... > On 64-bit platforms sizeof(int) \< sizeof(size_t), so > using size_t avoids a downcast warning (or overflow).

    I suppose we should be more careful about explaining the need for these changes. For example, the claim above isn't true, as there are 64-bit platforms where sizeof(int) == sizeof(size_t) too (the Cray J90 is one such platform Python kind of \<wink> runs on today, and indeed even shorts are 64 bits on that one).

    The problems here are that Python implicitly assumes sizeof(int) == sizeof(size_t), because at the time Python was written size_t didn't exist and the long K&R tradition preceding ANSI C was that strlen returned an int-sized thing and malloc took one. So they're all in the nature of cleaning up after the C committee a decade later \<wink>.