edgewall / genshi

Python toolkit for generation of output for the web
http://genshi.edgewall.org
Other
86 stars 35 forks source link

Python 3.9 compatibility #27

Closed FelixSchwarz closed 4 years ago

FelixSchwarz commented 4 years ago

This is my attempt to provide Python 3.9 compatibility (see #23). The test suite passes and I added a few extra tests which were only present in doctest. This pull request is based on top of PR #24.

The main AST changes are in commit 7f4e56e .

Please note that I'm totally out of my depth here. I never interacted so closely with Python's AST and this is mostly based on trial and error.

FelixSchwarz commented 4 years ago

Python 3.9 has been released. Would you mind merging #24 and this PR?

cedk commented 4 years ago

LGTM

hodgestar commented 4 years ago

Python 3.9 has been released. Would you mind merging #24 and this PR?

@FelixSchwarz Thank you! I've merged #24. Would you mind merging master into this PR and then I can review it?

FelixSchwarz commented 4 years ago

sure, will try to do this later this evening

FelixSchwarz commented 4 years ago

I rebased the commits on top of the current master so I hope they are easier to review now :-)

rleigh-codelibre commented 4 years ago

Hi folks, I just wanted to ask if you're considering tagging a 0.7.3 release once this (and any other needed PRs) are merged and Python 3.9 is fully supported?

FelixSchwarz commented 4 years ago

Yeah, a new release would be helpful also for me (so Fedora can stop shipping these patches on top of the last release). But we need to fix the AST changes first.

hodgestar commented 4 years ago

Hi folks, I just wanted to ask if you're considering tagging a 0.7.3 release once this (and any other needed PRs) are merged and Python 3.9 is fully supported?

Definitely. Making a new release is not hard these days, so it should be able to happen as soon as this PR lands.

FelixSchwarz commented 4 years ago

I think I didn't mention the relevant pieces from the Python 3.9 Release Notes regarding the AST changes:

Simplified AST for subscription. Simple indices will be represented by their value, extended slices will be represented as tuples. Index(value) will return a value itself, ExtSlice(slices) will return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in bpo-34822.)

ast classes slice, Index and ExtSlice are considered deprecated and will be removed in future Python versions. value itself should be used instead of Index(value). Tuple(slices, Load()) should be used instead of ExtSlice(slices). (Contributed by Serhiy Storchaka in bpo-34822.)

I plan on extending the commit message once we have a nice changeset as I think this might provide some valuable context for the commit contents. Again - feel free to improve the code as I don't have any experience working with the AST (and the little bit I gained vanished in the months since I first created this PR).

FelixSchwarz commented 4 years ago

I added a few commits but it still feels a bit "clumsy" (maybe a more able person might understand the actual meaning of Python's AST changes better). Feedback welcome.