Skip to content

Unnecessary PyFrozenSet_Check calls in ast_opt.c? #111133

Closed
@Eclips4

Description

@Eclips4

This code looks strange:

cpython/Python/ast_opt.c

Lines 177 to 178 in 37e4e20

else if (PyLong_Check(v) && (PyTuple_Check(w) || PyFrozenSet_Check(w))) {
Py_ssize_t size = PyTuple_Check(w) ? PyTuple_GET_SIZE(w) :

Function above intended as safe mutiply, but set (and frozenset) doesn't have tp_as_number->nb_multiply field, so it cannot be used with * operator.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions