bpo-36012: Avoid linear slot search when it's easy to know that we are not looking for a slot name by scoder · Pull Request #11907 · python/cpython

@scoder

…e not looking for a slot name.

Speeds up class attribute setting for non-slot names by 50%.

serhiy-storchaka

…ves like private attributes.

@scoder

pablogsal

pablogsal

serhiy-storchaka

@scoder

…er and less brittle way, and rename it to the more generic "is_dunder_name".

@scoder

… it repeatedly in "update_all_slots()", and also to simplify the conditions in "type_setattro()".

@scoder

…that does not require pre-declaring it.

@scoder

…", also because they become less and less likely from left to right.

rhettinger

@scoder

@scoder

@rhettinger

serhiy-storchaka

rhettinger

@rhettinger

@rhettinger

…hen possible.

Suggested by Neil Schemenauer in BPO-36012.

bcail pushed a commit to bcail/cpython that referenced this pull request

Dec 26, 2024

@scoder @bcail