diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2021-11-22 14:29:36 +0000 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2021-11-22 14:29:36 +0000 |
| commit | 46dbfa8711871421d12b4eacc32d9ee5425de218 (patch) | |
| tree | 395ef119b028b577e686c002465af444f35d8ac9 | |
| parent | a3dab5f330c7a0473ceb73d5a889087318003407 (diff) | |
| download | python-setuptools-git-46dbfa8711871421d12b4eacc32d9ee5425de218.tar.gz | |
Use tokenize.open directly (available on Python>= 3.2)
| -rw-r--r-- | distutils/core.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/distutils/core.py b/distutils/core.py index 6be58b26..15ddcf80 100644 --- a/distutils/core.py +++ b/distutils/core.py @@ -224,9 +224,8 @@ def run_setup (script_name, script_args=None, stop_after="run"): sys.argv[0] = script_name if script_args is not None: sys.argv[1:] = script_args - _open = getattr(tokenize, 'open', open) - # ^-- tokenize.open supports automatic encoding detection - with _open(script_name) as f: + # tokenize.open supports automatic encoding detection + with tokenize.open(script_name) as f: code = f.read().replace(r'\r\n', r'\n') exec(code, g) finally: |
