python / cpython

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

Python/hamt.c warnings #76888

Closed vstinner closed 6 years ago

vstinner commented 6 years ago
BPO 32707
Nosy @vstinner, @asvetlov, @1st1
PRs
  • python/cpython#5430
  • 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 = None closed_at = created_at = labels = ['interpreter-core', '3.7'] title = 'Python/hamt.c warnings' updated_at = user = 'https://github.com/vstinner' ``` bugs.python.org fields: ```python activity = actor = 'yselivanov' assignee = 'none' closed = True closed_date = closer = 'yselivanov' components = ['Interpreter Core'] creation = creator = 'vstinner' dependencies = [] files = [] hgrepos = [] issue_num = 32707 keywords = ['patch'] message_count = 4.0 messages = ['311112', '311153', '311155', '311156'] nosy_count = 3.0 nosy_names = ['vstinner', 'asvetlov', 'yselivanov'] pr_nums = ['5430'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue32707' versions = ['Python 3.7'] ```

    vstinner commented 6 years ago

    https://ci.appveyor.com/project/python/cpython/build/3.7build11469

    ..\Python\hamt.c(623): warning C4018: '\<': signed/unsigned mismatch [C:\projects\cpython\PCbuild\pythoncore.vcxproj] ..\Python\hamt.c(937): warning C4018: '\<': signed/unsigned mismatch [C:\projects\cpython\PCbuild\pythoncore.vcxproj]

    IMHO it's a real bug, the warning must not be made quiet. HAMT doesn't support sizes larger than UINT32_MAX. HAMT must either fail to create if size is larger than UINT32_MAX, or the code should be fixed to use wider C types (larger than uint32_t, like uint64_t).

    1st1 commented 6 years ago

    IMHO it's a real bug,

    No. HAMT bitmap and array nodes can only store up to 32 pointers, so we use Py_ssize_t & Py_SIZE only because those nodes are PyObject_VAR_HEAD objects.

    1st1 commented 6 years ago

    New changeset b647d7039d396b1da71ab33b101a78b53d4e6834 by Yury Selivanov in branch 'master': bpo-32707: Fix warnings in hamt.c (bpo-5430) https://github.com/python/cpython/commit/b647d7039d396b1da71ab33b101a78b53d4e6834

    1st1 commented 6 years ago

    Hopefully the warnings will be fixed.