python-hyper / h2

HTTP/2 State-Machine based protocol implementation
https://h2.readthedocs.io/en/stable
MIT License
963 stars 151 forks source link

Fix repr() checks for Python 3.10 #1254

Closed eclipseo closed 3 years ago

eclipseo commented 3 years ago

Stating Python 3.10 alpha 7, repr() was modified as follow:

bpo-40066: Enum: adjust repr() to show only enum and member name (not value, nor angle brackets) and str() to show only member name. Update and improve documentation to match.

bpo-40066: Enum’s repr() and str() have changed: repr() is now EnumClass.MemberName and str() is MemberName. Additionally, stdlib Enum’s whose contents are available as module attributes, such as RegexFlag.IGNORECASE, have their repr() as module.name, e.g. re.IGNORECASE.

See https://bugs.python.org/issue40066

This commit fixes the assertions to match the new repr() behavior.

Fix #1253

Kriechi commented 3 years ago

Thanks for sending this PR and trying to fix this new backward-incompatible change in the upcoming Python 3.10.

Unfortunately - since it is backward-incompatible - we can't merge this as it would break on all older versions as well. The tests in CI already fail, so we need a smarter approach to get this right. Assuming this change to py3.10 doesn't get reverted - I see there are already quite a few complaints on the bug tracker. If they really move forward with this change, we might need to introduce such an ugly workaround as in https://github.com/pytest-dev/pytest/pull/8540, but I want to "wait and see" first.

hroncok commented 3 years ago

Assuming this change to py3.10 doesn't get reverted

It got reverted.