Closed rocky closed 5 years ago
This code from 3.7 dataclasses.py is an example of where {{ gets turned into {
dataclasses.py
{{
{
def _repr_fn(fields): return _create_fn('__repr__', ('self',), ['return self.__class__.__qualname__ + f"(' + ', '.join([f"{f.name}={{self.{f.name}!r}}" for f in fields]) + ')"'])
Inside the bytecode, in the corresponding LOAD_CONST's only { or } appear. They therefore need to be doubled in decomplation.
LOAD_CONST
}
unpyc37 run on the 3.7 bytecode for the above gives:
unpyc37
def _repr_fn(fields): return _create_fn('__repr__', ('self',), ['return self.__class__.__qualname__ + f"(' + ', '.join([f'{f.name}={self.{f.name}!r}' for f in fields]) + ')"'])
This should be fixed in bd0e1bcb8f73d91775f928ecbff5ceb411ba7068.
It is - thanks.
This code from 3.7
dataclasses.py
is an example of where{{
gets turned into{
Inside the bytecode, in the corresponding
LOAD_CONST
's only{
or}
appear. They therefore need to be doubled in decomplation.unpyc37
run on the 3.7 bytecode for the above gives: