#26520: SessionBase.pop() no longer raises a KeyError
----------------------------------+------------------------------------
     Reporter:  tuky              |                    Owner:  nobody
         Type:  Bug               |                   Status:  new
    Component:  contrib.sessions  |                  Version:  1.9
     Severity:  Release blocker   |               Resolution:
     Keywords:                    |             Triage Stage:  Accepted
    Has patch:  1                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  1
Easy pickings:  1                 |                    UI/UX:  0
----------------------------------+------------------------------------
Changes (by timgraham):

 * needs_better_patch:  0 => 1
 * stage:  Unreviewed => Accepted
 * severity:  Normal => Release blocker


Comment:

 How about using a pattern borrowed from cpython?
 {{{ #!python
 __marker = object()

 def pop(self, key, default=__marker):
     self.modified = self.modified or key in self._session
     args = () if default is self.__marker else (default,)
     return self._session.pop(key, *args)
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26520#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.cdc6c6c1568613a497a0de0c4cfe2cd8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to