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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
