diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2022-09-29 19:39:22 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2022-09-29 19:39:22 -0400 |
| commit | fb62784d242fdeb38d06c4d1d8277c25775e7fca (patch) | |
| tree | 12ea844298b43c9af4fdb241b7bba6420fa1bf37 /setuptools | |
| parent | b35394aca15a51ff6fb44943c9f9530c68e685c4 (diff) | |
| download | python-setuptools-git-fb62784d242fdeb38d06c4d1d8277c25775e7fca.tar.gz | |
Use pathlib to open the file
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/config/expand.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/setuptools/config/expand.py b/setuptools/config/expand.py index 693b2dbc..38eb3db7 100644 --- a/setuptools/config/expand.py +++ b/setuptools/config/expand.py @@ -21,6 +21,7 @@ import ast import importlib import io import os +import pathlib import sys import warnings from glob import iglob @@ -62,9 +63,7 @@ class StaticModule: """Proxy to a module object that avoids executing arbitrary code.""" def __init__(self, name: str, spec: ModuleSpec): - with open(spec.origin, mode='rb') as strm: # type: ignore - src = strm.read() - module = ast.parse(src) + module = ast.parse(pathlib.Path(spec.origin).read_bytes()) vars(self).update(locals()) del self.self |
