File tree 1 file changed +6
-0
lines changed 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 5
5
This module returns the installation location of cacert.pem or its contents.
6
6
"""
7
7
import sys
8
+ import atexit
9
+
10
+ def exit_cacert_ctx () -> None :
11
+ _CACERT_CTX .__exit__ (None , None , None ) # type: ignore[union-attr]
8
12
9
13
10
14
if sys .version_info >= (3 , 11 ):
@@ -35,6 +39,7 @@ def where() -> str:
35
39
# we will also store that at the global level as well.
36
40
_CACERT_CTX = as_file (files ("certifi" ).joinpath ("cacert.pem" ))
37
41
_CACERT_PATH = str (_CACERT_CTX .__enter__ ())
42
+ atexit .register (exit_cacert_ctx )
38
43
39
44
return _CACERT_PATH
40
45
@@ -70,6 +75,7 @@ def where() -> str:
70
75
# we will also store that at the global level as well.
71
76
_CACERT_CTX = get_path ("certifi" , "cacert.pem" )
72
77
_CACERT_PATH = str (_CACERT_CTX .__enter__ ())
78
+ atexit .register (exit_cacert_ctx )
73
79
74
80
return _CACERT_PATH
75
81
You can’t perform that action at this time.
0 commit comments