Skip to content

Don't use Py_BuildValue("(OO...)", a, b, ...) #118379

@nineteendo

Description

@nineteendo

Feature or enhancement

Proposal:

This is an inefficient way to build a tuple:

Py_BuildValue("(OO)", a, b)

This is faster, and more readable:

PyTuple_Pack(2, a, b)

And if #118222 lands, we could use this even faster variant for length 1 & 2:

PyTuple_Pack2( a, b)

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance or resource usagetype-featureA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions