I stumbled on another small nasty thing I'd like to draw your attention to: if I'm not mistaken, when a caller passes a context to a function, this function receives the context's "pointer", not a distinct copy of the data.
As a consequence, functions that modify or added keys to the context must do so on a copy of the context, otherwise they may change the behavior of the caller.
That step is still missing in a good number of places I think: I suggest we do this at the same time as testing for None contexts in case it may be modified, in a test like this:
if context is None:
context = {}
else: context=context.copy()
Lionel Sausin.
I stumbled on another small nasty thing I'd like to draw your attention to: if I'm not mistaken, when a caller passes a context to a function, this function receives the context's "pointer", not a distinct copy of the data.
context= context. copy()
As a consequence, functions that modify or added keys to the context must do so on a copy of the context, otherwise they may change the behavior of the caller.
That step is still missing in a good number of places I think: I suggest we do this at the same time as testing for None contexts in case it may be modified, in a test like this:
if context is None:
context = {}
else:
Lionel Sausin.