@@ -261,11 +261,16 @@ def _write_atomic(path, data, mode=0o666):
261261# Python 3.7a2 3391 (update GET_AITER #31709)
262262# Python 3.7a4 3392 (PEP 552: Deterministic pycs #31650)
263263# Python 3.7b1 3393 (remove STORE_ANNOTATION opcode #32550)
264- # Python 3.7b5 3394 (restored docstring as the firts stmt in the body;
264+ # Python 3.7b5 3394 (restored docstring as the first stmt in the body;
265265# this might affected the first line number #32911)
266266# Python 3.8a1 3400 (move frame block handling to compiler #17611)
267267# Python 3.8a1 3401 (add END_ASYNC_FOR #33041)
268268# Python 3.8a1 3410 (PEP570 Python Positional-Only Parameters #36540)
269+ # Python 3.8b2 3411 (Reverse evaluation order of key: value in dict
270+ # comprehensions #35224)
271+ # Python 3.8b2 3412 (Swap the position of positional args and positional
272+ # only args in ast.arguments #37593)
273+ # Python 3.8b4 3413 (Fix "break" and "continue" in "finally" #37830)
269274#
270275# MAGIC must change whenever the bytecode emitted by the compiler may no
271276# longer be understood by older implementations of the eval loop (usually
@@ -963,8 +968,12 @@ def get_filename(self, fullname):
963968
964969 def get_data (self , path ):
965970 """Return the data from path as raw bytes."""
966- with _io .FileIO (path , 'r' ) as file :
967- return file .read ()
971+ if isinstance (self , (SourceLoader , ExtensionFileLoader )):
972+ with _io .open_code (str (path )) as file :
973+ return file .read ()
974+ else :
975+ with _io .FileIO (path , 'r' ) as file :
976+ return file .read ()
968977
969978 # ResourceReader ABC API.
970979
@@ -1359,6 +1368,19 @@ def find_module(cls, fullname, path=None):
13591368 return None
13601369 return spec .loader
13611370
1371+ @classmethod
1372+ def find_distributions (cls , * args , ** kwargs ):
1373+ """
1374+ Find distributions.
1375+
1376+ Return an iterable of all Distribution instances capable of
1377+ loading the metadata for packages matching ``context.name``
1378+ (or all names if ``None`` indicated) along the paths in the list
1379+ of directories ``context.path``.
1380+ """
1381+ from importlib .metadata import MetadataPathFinder
1382+ return MetadataPathFinder .find_distributions (* args , ** kwargs )
1383+
13621384
13631385class FileFinder :
13641386
0 commit comments