justin
|
656273bf3d
|
[ty] synthesize `__replace__` for dataclasses (>=3.13) (#19545)
## Summary
https://github.com/astral-sh/ty/issues/111
adds support for the new `copy.replace` and `__replace__` protocol
[added in 3.13](https://docs.python.org/3/whatsnew/3.13.html#copy)
- docs: https://docs.python.org/3/library/copy.html#object.__replace__
- some discussion on pyright/mypy implementations:
https://discuss.python.org/t/dataclass-transform-and-replace/69067
### Burndown
- [x] add tests
- [x] implement `__replace__`
- [ ]
[collections.namedtuple()](https://docs.python.org/3/library/collections.html#collections.namedtuple)
- [x]
[dataclasses.dataclass](https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass)
## Test Plan
new mdtests
---------
Co-authored-by: David Peter <mail@david-peter.de>
|
2025-07-29 17:32:01 +02:00 |