bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)


Reported by Svace static analyzer.
(cherry picked from commit 28853a249b1d0c890b7e9ca345290bb8c1756446)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
diff --git a/Python/ast.c b/Python/ast.c
index 6e1793d..5001ad5 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3252,6 +3252,8 @@
             break;
         case STAR:
             str = PyUnicode_InternFromString("*");
+            if (!str)
+                return NULL;
             if (PyArena_AddPyObject(c->c_arena, str) < 0) {
                 Py_DECREF(str);
                 return NULL;