You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Eason09053360 (via GitHub)" <gi...@apache.org> on 2026/01/28 19:50:24 UTC
[PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Eason09053360 opened a new pull request, #61182:
URL: https://github.com/apache/airflow/pull/61182
This PR fixes a flaky unit test `test_serde_serialize_recursion_limit` in `task-sdk`.
The test was previously using `sys.getrecursionlimit() - 1` to simulate the recursion depth. However, this system limit (often 1000) does not match the internal `MAX_RECURSION_DEPTH` constant (which is 10) used in the `serialize` function.
Because of this mismatch, the `depth` check in `serialize` passed (since 999 != 10), causing the function to attempt to serialize the empty `object()`, resulting in a `TypeError` instead of the expected `RecursionError`.
### Verification
Ran the test locally with `pytest` and it passed:
<img width="1037" height="211" alt="截圖 2026-01-29 凌晨3 17 53" src="https://github.com/user-attachments/assets/21a6c7f1-b0ad-4dcf-b079-d5bd0d3a77a0" />
Changes:
- Imported `MAX_RECURSION_DEPTH` from `airflow.sdk.serde.serde`.
- Updated the test to use this constant for the `depth` parameter to correctly trigger the `RecursionError`.
closes: #51915
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "Eason09053360 (via GitHub)" <gi...@apache.org>.
Eason09053360 commented on PR #61182:
URL: https://github.com/apache/airflow/pull/61182#issuecomment-3841037429
Thanks for the approval! @amoghrajesh Is there anything else required from my end to get this merged?
Happy to address any other feedback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "henry3260 (via GitHub)" <gi...@apache.org>.
henry3260 commented on code in PR #61182:
URL: https://github.com/apache/airflow/pull/61182#discussion_r2741138743
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -679,3 +675,7 @@ def test_uuid_roundtrip(self, uuid_value):
deserialized = deserialize(serialized)
assert isinstance(deserialized, uuid.UUID)
assert uuid_value == deserialized
+ def test_serde_serialize_recursion_limit(self):
+ depth = MAX_RECURSION_DEPTH
+ with pytest.raises(RecursionError, match="maximum recursion depth reached for serialization"):
+ serialize(object(), depth=depth)
Review Comment:
@amoghrajesh It’s more like a fix, I think, because someone found this test was flaky and just deleted it.
FYI https://github.com/apache/airflow/pull/51737
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "nailo2c (via GitHub)" <gi...@apache.org>.
nailo2c commented on PR #61182:
URL: https://github.com/apache/airflow/pull/61182#issuecomment-3953332699
Nice fix, Thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #61182:
URL: https://github.com/apache/airflow/pull/61182#discussion_r2744747034
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -679,3 +675,7 @@ def test_uuid_roundtrip(self, uuid_value):
deserialized = deserialize(serialized)
assert isinstance(deserialized, uuid.UUID)
assert uuid_value == deserialized
+ def test_serde_serialize_recursion_limit(self):
+ depth = MAX_RECURSION_DEPTH
+ with pytest.raises(RecursionError, match="maximum recursion depth reached for serialization"):
+ serialize(object(), depth=depth)
Review Comment:
Thanks, yes it shouldnt have been deleted!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "henry3260 (via GitHub)" <gi...@apache.org>.
henry3260 commented on code in PR #61182:
URL: https://github.com/apache/airflow/pull/61182#discussion_r2741138743
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -679,3 +675,7 @@ def test_uuid_roundtrip(self, uuid_value):
deserialized = deserialize(serialized)
assert isinstance(deserialized, uuid.UUID)
assert uuid_value == deserialized
+ def test_serde_serialize_recursion_limit(self):
+ depth = MAX_RECURSION_DEPTH
+ with pytest.raises(RecursionError, match="maximum recursion depth reached for serialization"):
+ serialize(object(), depth=depth)
Review Comment:
It’s more like a fix, I think, because someone found this test was flaky and just deleted it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on code in PR #61182:
URL: https://github.com/apache/airflow/pull/61182#discussion_r2741087925
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -679,3 +675,7 @@ def test_uuid_roundtrip(self, uuid_value):
deserialized = deserialize(serialized)
assert isinstance(deserialized, uuid.UUID)
assert uuid_value == deserialized
+ def test_serde_serialize_recursion_limit(self):
+ depth = MAX_RECURSION_DEPTH
+ with pytest.raises(RecursionError, match="maximum recursion depth reached for serialization"):
+ serialize(object(), depth=depth)
Review Comment:
Are you fixing a test or adding a new one?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "henry3260 (via GitHub)" <gi...@apache.org>.
henry3260 commented on code in PR #61182:
URL: https://github.com/apache/airflow/pull/61182#discussion_r2741138743
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -679,3 +675,7 @@ def test_uuid_roundtrip(self, uuid_value):
deserialized = deserialize(serialized)
assert isinstance(deserialized, uuid.UUID)
assert uuid_value == deserialized
+ def test_serde_serialize_recursion_limit(self):
+ depth = MAX_RECURSION_DEPTH
+ with pytest.raises(RecursionError, match="maximum recursion depth reached for serialization"):
+ serialize(object(), depth=depth)
Review Comment:
It’s more like a fix, I think, because someone found this test was flaky and just deleted it.
FYI https://github.com/apache/airflow/pull/51737
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "Eason09053360 (via GitHub)" <gi...@apache.org>.
Eason09053360 commented on code in PR #61182:
URL: https://github.com/apache/airflow/pull/61182#discussion_r2741138629
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -679,3 +675,7 @@ def test_uuid_roundtrip(self, uuid_value):
deserialized = deserialize(serialized)
assert isinstance(deserialized, uuid.UUID)
assert uuid_value == deserialized
+ def test_serde_serialize_recursion_limit(self):
+ depth = MAX_RECURSION_DEPTH
+ with pytest.raises(RecursionError, match="maximum recursion depth reached for serialization"):
+ serialize(object(), depth=depth)
Review Comment:
I am fixing a test (readding a previously removed flaky test with a fix)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix serde recursion limit test by using correct MAX_RECURSION_DEPTH [airflow]
Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh merged PR #61182:
URL: https://github.com/apache/airflow/pull/61182
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org