-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi,
The private _PyDict_NewPresized(size) function is used by 11 projects of the PyPI top 15,000 projects. The problem is that it miss the unicode_keys parameter which is a hint to announce if keys are Unicode or not. @methane analyzed how _PyDict_NewPresized(size) is used in various projects and suggests adding a public PyDict_NewPresized(size, unicode_keys) function. See python/cpython#139772 for the discussion.
API: PyObject* PyDict_NewPresized(Py_ssize_t size, int unicode_keys)
- Return a new empty dictionary with preallocated items, or
NULLon failure. - size is a hint to preallocate items.
- If unicode_keys is non-zero, optimize lookup for Unicode keys.
Since unicode_keys is an implementation detail, I hesitate to put the function in the PyUnstable category: PyUnstable_Dict_NewPresized(). What do you think?
Vote:
Metadata
Metadata
Assignees
Labels
No labels