Changes between Initial Version and Version 1 of Ticket #37125, comment 10


Ignore:
Timestamp:
May 29, 2026, 9:49:02 AM (3 weeks ago)
Author:
zky

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37125, comment 10

    initial v1  
    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 > }}}
Back to Top