-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance magic methods on XComArg for UX #21882
Conversation
Implementing Python's magic methods for purposes not matching their original design can have unwanted consequences due to default interactions between those methods. This implements a custom __iter__ so the custom __getitem__ does not trigger the default __iter__ behavior and result in bad run-time behavior.
>>> class A:
... def __getitem__(self, name): print name; return repr(name)
...
>>> a = A()
>>> next(iter(a))
0
'0' OK that is surprising. Unexpected Python magic! |
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
8550636
to
6937ca5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add tests?
Actually two short tests generating the exceptions would be nice :) |
Tests added |
random ci failure. Merging |
See #21853. We can do better.