Skip to content

[C API] Make _PyList_FromArraySteal() function public #111489

Closed
@vstinner

Description

@vstinner

I dislike PyList_New() + PyList_SET_ITEM() API since the list is immediately tracked by the GC and so calling gc.get_objects() can expose an invalid list object (ex: calling repr(list) can crash). See:

The internal PyObject * _PyList_FromArraySteal(PyObject *const *src, Py_ssize_t n) function should be made public. But it should be renamed to avoid misleading "Steal" term: ownership is "moved" or "transfered", not "stolen".

cc @erlend-aasland

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions