@@ -261,11 +261,16 @@ def _write_atomic(path, data, mode=0o666):
261
261
# Python 3.7a2 3391 (update GET_AITER #31709)
262
262
# Python 3.7a4 3392 (PEP 552: Deterministic pycs #31650)
263
263
# 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;
265
265
# this might affected the first line number #32911)
266
266
# Python 3.8a1 3400 (move frame block handling to compiler #17611)
267
267
# Python 3.8a1 3401 (add END_ASYNC_FOR #33041)
268
268
# 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)
269
274
#
270
275
# MAGIC must change whenever the bytecode emitted by the compiler may no
271
276
# longer be understood by older implementations of the eval loop (usually
@@ -963,8 +968,12 @@ def get_filename(self, fullname):
963
968
964
969
def get_data (self , path ):
965
970
"""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 ()
968
977
969
978
# ResourceReader ABC API.
970
979
@@ -1359,6 +1368,19 @@ def find_module(cls, fullname, path=None):
1359
1368
return None
1360
1369
return spec .loader
1361
1370
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
+
1362
1384
1363
1385
class FileFinder :
1364
1386
0 commit comments