classification
Title: Move Modules/hashtable.h to Include/internal/pycore_hashtable.h
Type: Stage: resolved
Components: C API Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2020-05-12 00:01 by vstinner, last changed 2020-05-14 20:52 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20044 merged vstinner, 2020-05-12 00:21
PR 20046 merged vstinner, 2020-05-12 00:43
PR 20051 merged vstinner, 2020-05-12 03:45
PR 20056 merged vstinner, 2020-05-12 16:10
PR 20066 merged vstinner, 2020-05-13 02:46
PR 20077 merged vstinner, 2020-05-13 22:30
PR 20091 merged vstinner, 2020-05-14 17:34
Messages (9)
msg368685 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-12 00:01
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:

* Move Modules/hashtable.h to Include/internal/pycore_hashtable.h
* Move Modules/hashtable.c to Python/hashtable.c

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.
msg368689 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-12 00:42
New changeset b617993b7c0b0f6f679ef7003a62d0318b6d6af9 by Victor Stinner in branch 'master':
bpo-40602: Rename hashtable.h to pycore_hashtable.h (GH-20044)
https://github.com/python/cpython/commit/b617993b7c0b0f6f679ef7003a62d0318b6d6af9
msg368690 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-12 01:07
New changeset d0919f0d6bb757b6bcfd7b2e15656d318c9d5cd9 by Victor Stinner in branch 'master':
bpo-40602: _Py_hashtable_new() uses PyMem_Malloc() (GH-20046)
https://github.com/python/cpython/commit/d0919f0d6bb757b6bcfd7b2e15656d318c9d5cd9
msg368722 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-12 11:32
New changeset 7c6e97077525f0ad3cfa0971028313b9079449fd by Victor Stinner in branch 'master':
bpo-40602: Optimize _Py_hashtable for pointer keys (GH-20051)
https://github.com/python/cpython/commit/7c6e97077525f0ad3cfa0971028313b9079449fd
msg368737 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-12 16:46
New changeset f453221c8b80e0570066a9375337f208d50e6406 by Victor Stinner in branch 'master':
bpo-40602: Add _Py_HashPointerRaw() function (GH-20056)
https://github.com/python/cpython/commit/f453221c8b80e0570066a9375337f208d50e6406
msg368756 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-13 02:29
See also bpo-40609: "_tracemalloc: remove pointer_t type".
msg368758 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-13 03:36
New changeset 42bae3a3d9d79f28e6b3b619bd27296d125c4c2c by Victor Stinner in branch 'master':
bpo-40602: Optimize _Py_hashtable_get_ptr() (GH-20066)
https://github.com/python/cpython/commit/42bae3a3d9d79f28e6b3b619bd27296d125c4c2c
msg368864 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-14 19:55
New changeset a482dc500b6ec4889f6a126ba08cbad6c11e37bc by Victor Stinner in branch 'master':
bpo-40602: Write unit tests for _Py_hashtable_t (GH-20091)
https://github.com/python/cpython/commit/a482dc500b6ec4889f6a126ba08cbad6c11e37bc
msg368867 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-05-14 20:44
New changeset d2dc827d16479d99927a6923a0347199d7c694fb by Victor Stinner in branch 'master':
bpo-40602: _Py_hashtable_set() reports rehash failure (GH-20077)
https://github.com/python/cpython/commit/d2dc827d16479d99927a6923a0347199d7c694fb
History
Date User Action Args
2020-05-14 20:52:38vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-05-14 20:44:38vstinnersetmessages: + msg368867
2020-05-14 19:55:54vstinnersetmessages: + msg368864
2020-05-14 17:34:40vstinnersetpull_requests: + pull_request19396
2020-05-13 22:30:50vstinnersetpull_requests: + pull_request19383
2020-05-13 03:36:30vstinnersetmessages: + msg368758
2020-05-13 02:46:28vstinnersetpull_requests: + pull_request19375
2020-05-13 02:29:27vstinnersetmessages: + msg368756
2020-05-12 16:46:27vstinnersetmessages: + msg368737
2020-05-12 16:10:14vstinnersetpull_requests: + pull_request19365
2020-05-12 11:32:10vstinnersetmessages: + msg368722
2020-05-12 03:45:24vstinnersetpull_requests: + pull_request19360
2020-05-12 01:07:44vstinnersetmessages: + msg368690
2020-05-12 00:43:13vstinnersetpull_requests: + pull_request19355
2020-05-12 00:42:23vstinnersetmessages: + msg368689
2020-05-12 00:21:15vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request19353
2020-05-12 00:01:24vstinnercreate