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

Move Modules/hashtable.h to Include/internal/pycore_hashtable.h #84782

Closed
vstinner opened this issue May 12, 2020 · 9 comments
Closed

Move Modules/hashtable.h to Include/internal/pycore_hashtable.h #84782

vstinner opened this issue May 12, 2020 · 9 comments
Labels
3.9 only security fixes topic-C-API

Comments

@vstinner
Copy link
Member

BPO 40602
Nosy @vstinner
PRs
  • bpo-40602: Rename hashtable.h to pycore_hashtable.h #20044
  • bpo-40602: _Py_hashtable_new() uses PyMem_Malloc() #20046
  • bpo-40602: Optimize _Py_hashtable for pointer keys #20051
  • bpo-40602: Add _Py_HashPointerRaw() function #20056
  • bpo-40602: Optimize _Py_hashtable_get_ptr() #20066
  • bpo-40602: _Py_hashtable_set() reports rehash failure #20077
  • bpo-40602: Write unit tests for _Py_hashtable_t #20091
  • 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 = None
    closed_at = <Date 2020-05-14.20:52:38.500>
    created_at = <Date 2020-05-12.00:01:24.785>
    labels = ['expert-C-API', '3.9']
    title = 'Move Modules/hashtable.h to Include/internal/pycore_hashtable.h'
    updated_at = <Date 2020-05-14.20:52:38.499>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-05-14.20:52:38.499>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-14.20:52:38.500>
    closer = 'vstinner'
    components = ['C API']
    creation = <Date 2020-05-12.00:01:24.785>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40602
    keywords = ['patch']
    message_count = 9.0
    messages = ['368685', '368689', '368690', '368722', '368737', '368756', '368758', '368864', '368867']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['20044', '20046', '20051', '20056', '20066', '20077', '20091']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40602'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    Python/mashal.c uses Modules/hashtable.h.

    Python/mashal.c indirectly gets Modules/hashtable.c implementation via Modules/_tracemalloc.c which is built as a builtin module.

    I propose to make the "hashtable" more standard:

    Attached PR implements this change but also changes the default memory allocator to PyMem_Malloc/PyMem_Free which is faster than PyMem_RawMalloc/PyMem_RawFree (current default) for memory blocks <= 512 bytes.

    It remains an internal C API which cannot be used outside CPython.

    @vstinner vstinner added 3.9 only security fixes topic-C-API labels May 12, 2020
    @vstinner
    Copy link
    Member Author

    New changeset b617993 by Victor Stinner in branch 'master':
    bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)
    b617993

    @vstinner
    Copy link
    Member Author

    New changeset d0919f0 by Victor Stinner in branch 'master':
    bpo-40602: _Py_hashtable_new() uses PyMem_Malloc() (GH-20046)
    d0919f0

    @vstinner
    Copy link
    Member Author

    New changeset 7c6e970 by Victor Stinner in branch 'master':
    bpo-40602: Optimize _Py_hashtable for pointer keys (GH-20051)
    7c6e970

    @vstinner
    Copy link
    Member Author

    New changeset f453221 by Victor Stinner in branch 'master':
    bpo-40602: Add _Py_HashPointerRaw() function (GH-20056)
    f453221

    @vstinner
    Copy link
    Member Author

    See also bpo-40609: "_tracemalloc: remove pointer_t type".

    @vstinner
    Copy link
    Member Author

    New changeset 42bae3a by Victor Stinner in branch 'master':
    bpo-40602: Optimize _Py_hashtable_get_ptr() (GH-20066)
    42bae3a

    @vstinner
    Copy link
    Member Author

    New changeset a482dc5 by Victor Stinner in branch 'master':
    bpo-40602: Write unit tests for _Py_hashtable_t (GH-20091)
    a482dc5

    @vstinner
    Copy link
    Member Author

    New changeset d2dc827 by Victor Stinner in branch 'master':
    bpo-40602: _Py_hashtable_set() reports rehash failure (GH-20077)
    d2dc827

    @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
    3.9 only security fixes topic-C-API
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant