Remove the topmost item from the stack. Note: Will return the old value or `None` if the stack was already empty.
(self)
| 267 | return rv |
| 268 | |
| 269 | def pop(self): |
| 270 | """Remove the topmost item from the stack. |
| 271 | |
| 272 | Note: |
| 273 | Will return the old value or `None` if the stack was already empty. |
| 274 | """ |
| 275 | stack = getattr(self._local, 'stack', None) |
| 276 | if stack is None: |
| 277 | return None |
| 278 | elif len(stack) == 1: |
| 279 | release_local(self._local) |
| 280 | return stack[-1] |
| 281 | else: |
| 282 | return stack.pop() |
| 283 | |
| 284 | __class_getitem__ = classmethod(types.GenericAlias) |
| 285 |