| 1 | | Thanks for the great catch, Jacob! Indeed, after running a quick test locally, I confirmed exactly what you pointed out—modifying kwargs inside __new__ doesn't actually take effect for the initialization. |
| 2 | | |
| 3 | | Given this, would introducing a classmethod factory be a viable alternative to solve the original memory issue?Replying to [comment:6 Jacob Walls]: |
| 4 | | > I think the bench incorrectly implements `__new__()`. It looks like the `kwargs` are mutated in place, but they're actually re-bound and discarded: |
| 5 | | > |
| 6 | | > {{{#!py |
| 7 | | > >>> def a(**kwargs): return kwargs |
| 8 | | > ... |
| 9 | | > >>> kw = {} |
| 10 | | > >>> inner = a(**kw) |
| 11 | | > >>> inner is kw |
| 12 | | > False |
| 13 | | > }}} |