diff -Naur a/Python-2.7.10/Python/compile.c b/Python-2.7.10/Python/compile.c --- a/Python-2.7.10/Python/compile.c 2015-05-23 21:39:24.000000000 +0530 +++ b/Python-2.7.10/Python/compile.c 2015-07-27 16:07:51.494142099 +0530 @@ -1979,9 +1979,12 @@ identifier tmp = alias->name; const char *base = PyString_AS_STRING(alias->name); char *dot = strchr(base, '.'); - if (dot) + if (dot) { tmp = PyString_FromStringAndSize(base, dot - base); + if (tmp == NULL) + return 0; + } r = compiler_nameop(c, tmp, Store); if (dot) { Py_DECREF(tmp);