ephraimbuddy commented on PR #63871:
URL: https://github.com/apache/airflow/pull/63871#issuecomment-4439698483
The fix works for callables, but the same bug still exists for any object
that lacks a custom __repr__.
The PR's promise is "no memory addresses in the serialized output." It
achieves that for callables by replacing them with `<callable qualname>`. But
the final fallback at `airflow-core/src/airflow/serialization/helpers.py:93` is
return `str(obj)` — and `str()` on any plain Python object hits the default
`<ClassName object at 0x...>` repr.
So:
```python
class Opaque: pass
serialize_template_field({Opaque(), Opaque()}, "f")
# → ['<__main__.Opaque object at 0x10abc>', '<__main__.Opaque object at
0x10def>']
```
Two parses → different addresses → different output → DAG hash flips.
Exactly the bug the PR is meant to fix, one type of object over.
Why the tests don't catch it: every "no address leak" test in the PR uses
either a callable (covered by the qualname branch) or an object with a custom
`__str__` (covered by user-provided text). Nothing exercises the plain-object
`str()` fallback.
Fix options:
Replace `str(obj)` with an address-free form like `qualname(type(obj),
True)`, or
Add a test with a vanilla class Foo: pass and assert "at 0x" not in result.
--
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]