-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compat: create separate importlib, tarfile and tomllib shims
- Loading branch information
Showing
12 changed files
with
73 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
import tarfile | ||
import typing | ||
|
||
|
||
if typing.TYPE_CHECKING: | ||
TarFile = tarfile.TarFile | ||
|
||
else: | ||
# Per https://peps.python.org/pep-0706/, the "data" filter will become | ||
# the default in Python 3.14. The first series of releases with the filter | ||
# had a broken filter that could not process symlinks correctly. | ||
if ( | ||
(3, 8, 18) <= sys.version_info < (3, 9) | ||
or (3, 9, 18) <= sys.version_info < (3, 10) | ||
or (3, 10, 13) <= sys.version_info < (3, 11) | ||
or (3, 11, 5) <= sys.version_info < (3, 12) | ||
or (3, 12) <= sys.version_info < (3, 14) | ||
): | ||
|
||
class TarFile(tarfile.TarFile): | ||
extraction_filter = staticmethod(tarfile.data_filter) | ||
|
||
else: | ||
TarFile = tarfile.TarFile | ||
|
||
|
||
__all__ = [ | ||
'TarFile', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
|
||
|
||
if sys.version_info >= (3, 11): | ||
from tomllib import TOMLDecodeError, load, loads | ||
else: | ||
from tomli import TOMLDecodeError, load, loads | ||
|
||
|
||
__all__ = [ | ||
'TOMLDecodeError', | ||
'load', | ||
'loads', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters