pypa / installer

A low-level library for installing from a Python wheel distribution.
https://installer.readthedocs.io/
MIT License
126 stars 51 forks source link

Explicitly use policy=compat32 #163

Closed hauntsaninja closed 1 year ago

hauntsaninja commented 1 year ago

The documentation in https://packaging.python.org/en/latest/specifications/core-metadata/ claims that metadata should be parsed with compat32 policy.

The documentation in https://docs.python.org/3/library/email.parser.html#feedparser-api claims that policy should always be specified and that the default will change at some point. When CPython changes the default, that would presumably introduce a bug here.

abravalheri commented 1 year ago

@hauntsaninja, do you know if compat32 is compatible with UTF-8?

hauntsaninja commented 1 year ago

I'm not sure, although given that FeedParser takes a str, not bytes, I think it might have to do something weird to not handle UTF-8 (and from a glance at the CPython code I'm not seeing anything weird).

Note that this PR doesn't change the policy, it just makes it explicit (as recommended by the Python documentation, due to future change of default).

hauntsaninja commented 1 year ago

@takluyver added the mention of compat32 to the core metadata spec docs I linked (in https://github.com/pypa/packaging.python.org/commit/3c855a61bc095fab8d75daabc5a00be38f60b2df ), so would probably be best placed to answer questions about it

pradyunsg commented 1 year ago

Thanks @hauntsaninja! ^>^