summaryrefslogtreecommitdiff
path: root/www/py-cherrypy/files/patch-cherrypy_lib_sessions.py
blob: 8130d1130c5c7a4cfa5c474fdcb4df6fa87c32de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Remove contextlib2 and use contextlib from the standard library.

* Contextlib has been in the Python standard library since Python 3.2.
* Contextlib2 is a backport to Python 2 (and is supported through Python 3.7).

Obtained from: https://github.com/cherrypy/cherrypy/commit/2fc78dc9af3e

--- cherrypy/lib/sessions.py.orig	2021-04-22 13:06:39 UTC
+++ cherrypy/lib/sessions.py
@@ -109,7 +109,7 @@ import binascii

 import six
 from six.moves import cPickle as pickle
-import contextlib2
+import contextlib

 import zc.lockfile

@@ -572,7 +572,7 @@ class FileSession(Session):
     def release_lock(self, path=None):
         """Release the lock on the currently-loaded session data."""
         self.lock.close()
-        with contextlib2.suppress(FileNotFoundError):
+        with contextlib.suppress(FileNotFoundError):
             os.remove(self.lock._path)
         self.locked = False