12061 make twisted.internet.test.test_inlinecb.py compatible with Python 3.13#12092
12061 make twisted.internet.test.test_inlinecb.py compatible with Python 3.13#12092eevelweezel wants to merge 29 commits intotwisted:trunkfrom
Conversation
|
please review |
|
Thansk for the PR. Do you have time to help reviewing this PR first #12059 ? In that PR, python 3.13 automated tests are introduced, so that in future PR we can not only apply changes, but make sure they work on 3.13. Thanks! |
|
Sure, I can take a look this evening.
…On Tue, Jan 30, 2024, 08:31 Adi Roiban ***@***.***> wrote:
Thansk for the PR.
Do you have time to help reviewing this PR first #12059
<#12059> ?
In that PR, python 3.13 automated tests are introduced, so that in future
PR we can not only apply changes, but make sure they work on 3.13.
Thanks!
—
Reply to this email directly, view it on GitHub
<#12092 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHKYUAMZVOBDYC33KZKILDYRD73HAVCNFSM6AAAAABCJ3A3SGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJXGAYDCNBVGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Thanks Heather for the PR. I will give it try. As part of this PT, we will also need to update the set of tests we run on Python 3.13 I see there is a FIXME for this Issue to enable more tests It looks like with this change, we should be able to run all the internet tests. https://github.com/twisted/twisted/blob/trunk/.github/workflows/test.yaml#L146-L150 |
|
Please call me Weezel. :) |
6cc34a2 to
14df00b
Compare
|
Thanks Weezel for the update and your help with Python 3.13 support. Which test is failing on your local dev system? Do you use tox or you run For the GitHub Actions job, we use tox, as a way of "standardised" run environment. It's important to have the test pass on local dev environments, but some test are harder to write to account for all the local variations. |
adiroiban
left a comment
There was a problem hiding this comment.
Many thanks for the changes.
It looks much better.
Can you please check what happended with the trace for calling3 on Python 3.13.
I don't see any assertion for it.
If this is somehow a "feature", please add a comment in the test to explain why calling3 is not in the stacktrace...also, add an explicit assertion to check that calling3 is missing.... if calling3 is expected to be missing.
Thanks again.
|
needs-review |
|
I am not sure what is going on here... Not sure if this is a Twisted bug for 3.13 ...or Python 3.13... or something else. i can see the full stack for non-generators |
|
There is also another issue. On 3.12, all tests are skipped we need something like this ... so that we have the negation of the exact same condition. diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py
index e730e3daf7..36d4b620cf 100644
--- a/src/twisted/internet/test/test_inlinecb.py
+++ b/src/twisted/internet/test/test_inlinecb.py
@@ -127,7 +127,7 @@ class NonLocalExitTests(TestCase):
class ForwardTraceBackTests(SynchronousTestCase):
- @skipIf(sys.version_info > (3, 12), "Needs Python 3.12 or older")
+ @skipIf(not sys.version_info < (3, 13), "Needs Python 3.12 or older")
def test_forwardTracebacks_312(self):
"""
Chained inlineCallbacks are forwarding the traceback information
@@ -177,7 +177,7 @@ class ForwardTraceBackTests(SynchronousTestCase):
self.assertIn("in calling", tb)
self.assertIn("Error Marker", tb)
- @skipIf(sys.version_info > (3, 12), "Needs Python 3.12 or older")
+ @skipIf(not sys.version_info < (3, 13), "Needs Python 3.12 or older")
def test_forwardLotsOfTracebacks_312(self): |
|
Something even better +
+HAVE_PY3_12_OR_OLDER = sys.version_info < (3, 13)
class ForwardTraceBackTests(SynchronousTestCase):
- @skipIf(sys.version_info > (3, 12), "Needs Python 3.12 or older")
+ @skipIf(not HAVE_PY3_12_OR_OLDER, "Needs Python 3.12 or older")
def test_forwardTracebacks_312(self):
"""
Chained inlineCallbacks are forwarding the traceback information
@@ -152,7 +154,7 @@ class ForwardTraceBackTests(SynchronousTestCase):
self.assertIn("in calling", tb)
self.assertIn("Error Marker", tb)
- @skipIf(sys.version_info < (3, 13), "Needs Python 3.13 or newer")
+ @skipIf(HAVE_PY3_12_OR_OLDER, "Needs Python 3.13 or newer")
def test_forwardTracebacks_313(self):
"""
Chained inlineCallbacks are forwarding the traceback information
@@ -177,7 +179,7 @@ class ForwardTraceBackTests(SynchronousTestCase):
self.assertIn("in calling", tb)
self.assertIn("Error Marker", tb)
- @skipIf(sys.version_info > (3, 12), "Needs Python 3.12 or older")
+ @skipIf(not HAVE_PY3_12_OR_OLDER, "Needs Python 3.12 or older")
def test_forwardLotsOfTracebacks_312(self):
"""
Several Chained inlineCallbacks gives information about all generators.
@@ -225,7 +227,7 @@ class ForwardTraceBackTests(SynchronousTestCase):
self.assertIn("Error Marker", tb)
self.assertIn("in erroring", f.getTraceback())
- @skipIf(sys.version_info < (3, 13), "Needs Python 3.13 or newer")
+ @skipIf(HAVE_PY3_12_OR_OLDER, "Needs Python 3.13 or newer") |
|
@eevelweezel Thanks for working on this! Is it ready for review again? |
|
Yes, it is.
…On Mon, Mar 4, 2024, 09:14 Itamar Turner-Trauring ***@***.***> wrote:
@eevelweezel <https://github.com/eevelweezel> Thanks for working on this!
Is it ready for review again?
—
Reply to this email directly, view it on GitHub
<#12092 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHKYUBGSIT7MQHEPZAJEG3YWSFU3AVCNFSM6AAAAABCJ3A3SGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZWHAYTGNBUGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
|
I just tried to test this branch in Gentoo with Python 3.13.0b2 and I see similar failure for This does not happen with Python 3.12. For completeness, the |
|
I have pushed an update to get the test pass. I think that is OK to ignore COLUMNS and LINES for these tests. We still need to check the missing coverage |
|
I think that this is ready for review. As I have also made a few changes to this PR, @itamarst can you please double-check the changes and see if we can merge them. This enables the tests for the whole needs-review |
adiroiban
left a comment
There was a problem hiding this comment.
I am happy with the changes.
This PR is only updating the tests for the python 3.13 changes
|
needs-review |
This is py3.13 enabled snapshot from the PR-12092 [1], which resolves most of py3.13 issues. The remaining test failure [2] is skipped by patch in similar fashion like Fedora does [3]. [1] twisted/twisted#12092 [2] twisted/twisted#12099 [3] https://src.fedoraproject.org/rpms/python-twisted/blob/c8c63fe475594326f50fd748b40ae65f925c1325/f/0010-Skip-failing-tests.patch Signed-off-by: Petr Vaněk <arkamar@gentoo.org>
|
Before we commit this, worth seeing how things do in 3.13b3. It's possible the issues will go away. |
|
I'm inclined to agree with @itamarst, I'm still having difficulty believing the changes to expected opcodes are deliberate. |
|
Which issue will go away ? The LINES/COLUMNS environment variables or the formating of the traceback ? Are there any upstream reports for these issues? I did a quick search on https://github.com/python/cpython/issues?q=is%3Aissue and I was not able to identify any upstream report. Thanks |
Few tests are skipped by a patch based on changes made in upstream PR twisted/twisted#12092. Some tests fail with openssh-9.8, therefore, this test dependency is restricted to <net-misc/openssh-9.8. See twisted/twisted#12273 Signed-off-by: Petr Vaněk <arkamar@gentoo.org>
Few tests are skipped by a patch based on changes made in upstream PR twisted/twisted#12092. Some tests fail with openssh-9.8, therefore, this test dependency is restricted to <net-misc/openssh-9.8. See twisted/twisted#12273 Signed-off-by: Petr Vaněk <arkamar@gentoo.org>
|
Going to merge this forward and see if I can get it in finished state. |
|
I am unhappy with the 3.13 alternative tests; it's not showing |
|
The following code in |
|
That's where the opcodes don't match. In 3.12 and below, tb_lasti is the
expected value. In 3.13, it's a different instruction, hence the return.
…On Tue, Aug 13, 2024, 13:30 Itamar Turner-Trauring ***@***.***> wrote:
The following code in _findFailure in failure.py appears to be why the
tests fails, it returns on 3.13 but not earlier versions. If I comment it
out it fixes the 3.13 failures (but adds a bunch of other failures that
match across 3.13 and 3.11):
if (not lastFrame.f_code.co_code) or lastFrame.f_code.co_code[
lastTb.tb_lasti
] != cls._yieldOpcode:
return
—
Reply to this email directly, view it on GitHub
<#12092 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHKYUGFSMWZY5VXAWJVGN3ZRJGDNAVCNFSM6AAAAABCJ3A3SGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBWHA3TAMJUGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Specifically, it's not the opcode for yield.
…On Tue, Aug 13, 2024, 14:21 eevelweezel ***@***.***> wrote:
That's where the opcodes don't match. In 3.12 and below, tb_lasti is the
expected value. In 3.13, it's a different instruction, hence the return.
On Tue, Aug 13, 2024, 13:30 Itamar Turner-Trauring <
***@***.***> wrote:
> The following code in _findFailure in failure.py appears to be why the
> tests fails, it returns on 3.13 but not earlier versions. If I comment it
> out it fixes the 3.13 failures (but adds a bunch of other failures that
> match across 3.13 and 3.11):
>
> if (not lastFrame.f_code.co_code) or lastFrame.f_code.co_code[
> lastTb.tb_lasti
> ] != cls._yieldOpcode:
> return
>
> —
> Reply to this email directly, view it on GitHub
> <#12092 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABHKYUGFSMWZY5VXAWJVGN3ZRJGDNAVCNFSM6AAAAABCJ3A3SGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBWHA3TAMJUGU>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
|
I think I've come up with a fix to failure.py hat just makes the current tests pass, unchanged. I can't tell if it's actually a correct fix or it's hardcoded to the specific test. Basically it looks like Python 3.13 has different pattern of bytecode for returns. Maybe? This whole approach in failure.py is going to be a problem as we switch to a JIT-based world, since bytecode not might even be a thing... |
|
Anyway I'm going to close this because the correct solution is almost certainly to fix |
Scope and purpose
Fixes #12061 - make twisted.internet.test.test_inlinecb.py compatible with Python 3.13
Fixes #12062
Contributor Checklist:
This process applies to all pull requests - no matter how small.
Have a look at our developer documentation before submitting your Pull Request.
Below is a non-exhaustive list (as a reminder):
please review.Our bot will trigger the review process, by applying the pending review label
and requesting a review from the Twisted dev team.