[Python-checkins] gh-104050: Don't star-import 'types' in Argument Clinic (#104543)

erlend-aasland webhook-mailer at python.org
Tue May 16 08:02:25 EDT 2023


https://github.com/python/cpython/commit/c22fced96c4d472221071d12e8e88b0a33f6bb4b
commit: c22fced96c4d472221071d12e8e88b0a33f6bb4b
branch: main
author: Erlend E. Aasland <erlend.aasland at protonmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-05-16T12:02:18Z
summary:

gh-104050: Don't star-import 'types' in Argument Clinic (#104543)

files:
M Tools/clinic/clinic.py

diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 6020935f8304..0ef5deb586d6 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -25,10 +25,9 @@
 import sys
 import textwrap
 import traceback
-import types
 
 from collections.abc import Callable
-from types import *
+from types import FunctionType, NoneType
 from typing import Any, NamedTuple
 
 # TODO:
@@ -4037,7 +4036,7 @@ def eval_ast_expr(node, globals, *, filename='-'):
 
     node = ast.Expression(node)
     co = compile(node, filename, 'eval')
-    fn = types.FunctionType(co, globals)
+    fn = FunctionType(co, globals)
     return fn()
 
 



More information about the Python-checkins mailing list