summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-09-29 19:39:22 -0400
committerJason R. Coombs <jaraco@jaraco.com>2022-09-29 19:39:22 -0400
commitfb62784d242fdeb38d06c4d1d8277c25775e7fca (patch)
tree12ea844298b43c9af4fdb241b7bba6420fa1bf37 /setuptools
parentb35394aca15a51ff6fb44943c9f9530c68e685c4 (diff)
downloadpython-setuptools-git-fb62784d242fdeb38d06c4d1d8277c25775e7fca.tar.gz
Use pathlib to open the file
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/config/expand.py5
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