> On 25 Mar 2016, at 15:04, Jason Madden <[email protected]> wrote: > > >> On Mar 25, 2016, at 05:01, Cory Benfield <[email protected]> wrote: >> >> Given that gevent is keeping hold of its own reference to the environ, why >> does gevent not simply wrap the environ dict in a class that implements this >> functionality directly? In that manner, gevent can expose its own error >> handling behaviour as desired, and continue to follow PEP-3333. > > I did consider that, but didn't want to do that unless there were actual > practical problems passing the same object that gevent references. Making a > copy just to pass to the application adds additional time and memory > requirements that are always nice to avoid in a server.
For what it’s worth, I’m not advocating a copy. I’m advocating a class like
this:
class SecureDictWrapper(collections.MutableMapping):
def __init__(self, environ):
self._environ = environ
That class would then implement the MutableMapping API and delegate its calls
through to the dictionary itself. There would still only be one dictionary: the
only new allocation is for the wrapper class. The overhead is small. =)
Cory
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Web-SIG mailing list [email protected] Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: https://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
