diff Python/future.c @ 75872:1729ec440bb6 2.7

check by equality for __future__ not identity (closes #14378)
author Benjamin Peterson <benjamin@python.org>
date Thu, 22 Mar 2012 08:19:04 -0400
parents b36cb4602e21
children ad5e93ae22ef
line wrap: on
line diff
--- a/Python/future.c	Tue Mar 20 10:40:55 2012 -0400
+++ b/Python/future.c	Thu Mar 22 08:19:04 2012 -0400
@@ -59,13 +59,6 @@
 {
     int i, found_docstring = 0, done = 0, prev_line = 0;
 
-    static PyObject *future;
-    if (!future) {
-        future = PyString_InternFromString("__future__");
-        if (!future)
-            return 0;
-    }
-
     if (!(mod->kind == Module_kind || mod->kind == Interactive_kind))
         return 1;
 
@@ -92,7 +85,9 @@
         */
 
         if (s->kind == ImportFrom_kind) {
-            if (s->v.ImportFrom.module == future) {
+            PyObject *modname = s->v.ImportFrom.module;
+            if (PyString_GET_SIZE(modname) == 10 &&
+                !strcmp(PyString_AS_STRING(modname), "__future__")) {
                 if (done) {
                     PyErr_SetString(PyExc_SyntaxError,
                                     ERR_LATE_FUTURE);