mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Make _load_testfile() use its encoding argument when __loader__ is defined.
This commit is contained in:
parent
5c5f1703e5
commit
e9fd23165c
2 changed files with 10 additions and 1 deletions
|
@ -209,7 +209,8 @@ def _load_testfile(filename, package, module_relative, encoding):
|
|||
filename = _module_relative_path(package, filename)
|
||||
if hasattr(package, '__loader__'):
|
||||
if hasattr(package.__loader__, 'get_data'):
|
||||
return package.__loader__.get_data(filename).decode('utf-8'), filename
|
||||
return (package.__loader__.get_data(filename).decode(encoding),
|
||||
filename)
|
||||
return open(filename, encoding=encoding).read(), filename
|
||||
|
||||
def _indent(s, indent=4):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue