Content-Length: 265919 | pFad | https://github.com/certifi/python-certifi/commit/de0eae12a6d5794a4c1e33052af6717707ce1fcc

50 Only use importlib.resources's new files() / Traversable API on Pytho… · certifi/python-certifi@de0eae1 · GitHub
Skip to content

Commit de0eae1

Browse files
authored
Only use importlib.resources's new files() / Traversable API on Python ≥3.11 (#204)
Using importlib.resource's files() API on 3.9 and 3.10 causes a TypeError on 3.9 and a ValueError on 3.10 when running under a third-party meta path importer (like PyOxidizer's OxidizedImporter) that doesn't support the relatively-new API. This is because the full adapter layer (importlib.resources._adapters) for the older importlib resources API doesn't exist until Python 3.11. The older resources API is now used by 3.7–3.10, as it was prior to the certifi 2022.06.15.1 release. This codepath has existed in certifi since April 2020 (3fc8fec). An alternative to this change would be testing the actual importer in use at runtime (e.g. certifi.__loader__) for files() support, but that seemed more complex than reverting to the previous codepath here. Resolves: #203 Related-to: #199 Related-to: #123
1 parent b8eb5e9 commit de0eae1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

certifi/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88

99

10-
if sys.version_info >= (3, 9):
10+
if sys.version_info >= (3, 11):
1111

1212
from importlib.resources import as_file, files
1313

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/certifi/python-certifi/commit/de0eae12a6d5794a4c1e33052af6717707ce1fcc

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy