Skip to content

distutils/setuptools: Don't use wildcards for allowlist entries - #9900

Merged
hauntsaninja merged 1 commit into
python:mainfrom
AlexWaygood:no-regex-allowlist
Mar 17, 2023
Merged

hauntsaninja merged 1 commit into
python:mainfrom
AlexWaygood:no-regex-allowlist

Conversation

@AlexWaygood

Copy link
Copy Markdown
Member

These entries are causing more functions to be allowlisted than was intended: for example, none of these methods are generated methods, but they're all currently included by the distutils.dist.Distribution.get_.* entry:

def get_command_list(self): ...
def get_command_packages(self): ...
def get_command_class(self, command: str) -> type[Command]: ...

This caused a bit of confusion for me, as I was fiddling around with a stubtest patch, and expected stubtest to emit an error if I deleted this allowlist entry:

distutils.dist.Distribution.get_command_obj # 1 used for True

...But stubtest didn't emit an error, because distutils.dist.Distribution.get_command_obj was still allowlisted, even with that entry deleted, due to these regex entries here.

@AlexWaygood AlexWaygood changed the title distutils: Don't use wildcards for allowlist entries Mar 17, 2023

@hauntsaninja hauntsaninja left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@hauntsaninja
hauntsaninja merged commit ca55889 into python:main Mar 17, 2023
@AlexWaygood
AlexWaygood deleted the no-regex-allowlist branch March 18, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants