Skip to content

Commit

Permalink
Use pathlib to open the file
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 29, 2022
1 parent b35394a commit fb62784
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions setuptools/config/expand.py
Expand Up @@ -21,6 +21,7 @@
import importlib
import io
import os
import pathlib
import sys
import warnings
from glob import iglob
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit fb62784

Please sign in to comment.