GrahamDumpleton / wrapt

A Python module for decorators, wrappers and monkey patching.
BSD 2-Clause "Simplified" License
2.04k stars 230 forks source link

compatibility with python 3.11 #205

Closed jouve closed 2 years ago

GrahamDumpleton commented 2 years ago

There is a competing PR for this at:

which uses a different way.

Do you want to compare the two approaches and see if your way is easier.

I haven't had a chance to look deeply at all this yet as was on holidays for most of the past month.

jouve commented 2 years ago

I re-implemented formatargspec to use Signature.

this PR keep compat with py2, I think it fixes more tests cases for py3.11 and also enable the CI with py3.11-dev

brandtbucher commented 2 years ago

Any chance this PR could be merged and a new release cut soon? We'd like to use wrapt in our benchmark suite for measuring CPython performance improvements, but it currently doesn't work on 3.11.

GrahamDumpleton commented 2 years ago

Sorry, been busy with work stuff as usual. I will try and look at this weekend.

brandtbucher commented 2 years ago

Awesome, thanks. Please let me know if there's anything I can help with.

GrahamDumpleton commented 2 years ago

Not sure what is going on with GitHub, but this PR doesn't give me the option of triggering GitHub actions on it to build, verify and test the changes like is possible with https://github.com/GrahamDumpleton/wrapt/pull/203. So I can't tell if this passes all the automated tests.

GrahamDumpleton commented 2 years ago

Why in some tests was code like:

args = inspect.formatargspec(*argspec)

changed to use a literal string? Eg:

args = '(cls, arg1, arg2, arg3=None, *args, **kwargs)'

https://github.com/GrahamDumpleton/wrapt/pull/205/files#diff-690566594799e4e8f81d40dd838237afec99f3eb110d48ea5352621e3d00232dL189

jouve commented 2 years ago

I was not sure about using formatargspec here in since wrapt.decorator calls it already if argspec is not a string (which is the test above with _wrapper_1 .

jouve commented 2 years ago

Not sure what is going on with GitHub, but this PR doesn't give me the option of triggering GitHub actions on it to build, verify and test the changes like is possible with #203. So I can't tell if this passes all the automated tests.

I'll force push, maybe it will unlock the CI :)

GrahamDumpleton commented 2 years ago

Still not helping. I will try and check out your branch, do some changes I want to make and push and see what happens with CI.

brandtbucher commented 2 years ago

Closing and reopening the PR might work.

jouve commented 2 years ago

I have the following message :

1 workflow awaiting approval First-time contributors need a maintainer to approve running workflows. Learn more.

GrahamDumpleton commented 2 years ago

You can try with:

pip install wrapt==1.14.0rc1

and see if everything is okay.