Author: christian.heimes
Date: Mon Jan 28 03:38:20 2008
New Revision: 60383

Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Modules/_ctypes/_ctypes.c
   python/branches/py3k/Modules/_ctypes/callbacks.c
   python/branches/py3k/Modules/mathmodule.c
   python/branches/py3k/Objects/abstract.c
   python/branches/py3k/Objects/complexobject.c
   python/branches/py3k/Python/bltinmodule.c
   python/branches/py3k/Python/compile.c
Log:
Merged revisions 60379-60382 via svnmerge from 
svn+ssh://[EMAIL PROTECTED]/python/trunk

........
  r60381 | christian.heimes | 2008-01-28 03:07:53 +0100 (Mon, 28 Jan 2008) | 1 
line
  
  static PyObject* variables should use PyString_InternFromString() instead of 
PyObject_FromString() to store a python string in a function level static var.
........


Modified: python/branches/py3k/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes.c      (original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes.c      Mon Jan 28 03:38:20 2008
@@ -1530,9 +1530,9 @@
 
        if (suffix == NULL)
 #ifdef WORDS_BIGENDIAN
-               suffix = PyUnicode_FromString("_le");
+               suffix = PyUnicode_InternFromString("_le");
 #else
-               suffix = PyUnicode_FromString("_be");
+               suffix = PyUnicode_InternFromString("_be");
 #endif
 
        newname = PyUnicode_Concat(name, suffix);
@@ -4276,7 +4276,7 @@
        }
 
        if (format == NULL) {
-               format = PyUnicode_FromString("%s(%r)");
+               format = PyUnicode_InternFromString("%s(%r)");
                if (format == NULL)
                        return NULL;
        }

Modified: python/branches/py3k/Modules/_ctypes/callbacks.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/callbacks.c    (original)
+++ python/branches/py3k/Modules/_ctypes/callbacks.c    Mon Jan 28 03:38:20 2008
@@ -365,7 +365,7 @@
        static PyObject *context;
 
        if (context == NULL)
-               context = PyUnicode_FromString("_ctypes.DllGetClassObject");
+               context = 
PyUnicode_InternFromString("_ctypes.DllGetClassObject");
 
        mod = PyImport_ImportModuleNoBlock("ctypes");
        if (!mod) {
@@ -444,7 +444,7 @@
        static PyObject *context;
 
        if (context == NULL)
-               context = PyUnicode_FromString("_ctypes.DllCanUnloadNow");
+               context = PyUnicode_InternFromString("_ctypes.DllCanUnloadNow");
 
        mod = PyImport_ImportModuleNoBlock("ctypes");
        if (!mod) {

Modified: python/branches/py3k/Modules/mathmodule.c
==============================================================================
--- python/branches/py3k/Modules/mathmodule.c   (original)
+++ python/branches/py3k/Modules/mathmodule.c   Mon Jan 28 03:38:20 2008
@@ -131,7 +131,7 @@
        PyObject *method;
 
        if (ceil_str == NULL) {
-               ceil_str = PyUnicode_FromString("__ceil__");
+               ceil_str = PyUnicode_InternFromString("__ceil__");
                if (ceil_str == NULL)
                        return NULL;
        }
@@ -171,7 +171,7 @@
        PyObject *method;
 
        if (floor_str == NULL) {
-               floor_str = PyUnicode_FromString("__floor__");
+               floor_str = PyUnicode_InternFromString("__floor__");
                if (floor_str == NULL)
                        return NULL;
        }

Modified: python/branches/py3k/Objects/abstract.c
==============================================================================
--- python/branches/py3k/Objects/abstract.c     (original)
+++ python/branches/py3k/Objects/abstract.c     Mon Jan 28 03:38:20 2008
@@ -2333,7 +2333,7 @@
        PyObject *bases;
 
        if (__bases__ == NULL) {
-               __bases__ = PyUnicode_FromString("__bases__");
+               __bases__ = PyUnicode_InternFromString("__bases__");
                if (__bases__ == NULL)
                        return NULL;
        }
@@ -2413,7 +2413,7 @@
        int retval = 0;
 
        if (__class__ == NULL) {
-               __class__ = PyUnicode_FromString("__class__");
+               __class__ = PyUnicode_InternFromString("__class__");
                if (__class__ == NULL)
                        return -1;
        }

Modified: python/branches/py3k/Objects/complexobject.c
==============================================================================
--- python/branches/py3k/Objects/complexobject.c        (original)
+++ python/branches/py3k/Objects/complexobject.c        Mon Jan 28 03:38:20 2008
@@ -265,13 +265,14 @@
        /* return -1 on failure */
        cv.real = -1.;
        cv.imag = 0.;
-       
+               
+       if (complex_str == NULL) {
+               if (!(complex_str = PyUnicode_FromString("__complex__")))
+                       return cv;
+       }
+
         {
                PyObject *complexfunc;
-               if (!complex_str) {
-                       if (!(complex_str = 
PyUnicode_FromString("__complex__")))
-                               return cv;
-               }
                complexfunc = _PyType_Lookup(op->ob_type, complex_str);
                /* complexfunc is a borrowed reference */
                if (complexfunc) {

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c   (original)
+++ python/branches/py3k/Python/bltinmodule.c   Mon Jan 28 03:38:20 2008
@@ -1463,7 +1463,7 @@
        }
 
        if (round_str == NULL) {
-               round_str = PyUnicode_FromString("__round__");
+               round_str = PyUnicode_InternFromString("__round__");
                if (round_str == NULL)
                        return NULL;
        }
@@ -1582,7 +1582,7 @@
        }
 
        if (trunc_str == NULL) {
-               trunc_str = PyUnicode_FromString("__trunc__");
+               trunc_str = PyUnicode_InternFromString("__trunc__");
                if (trunc_str == NULL)
                        return NULL;
        }

Modified: python/branches/py3k/Python/compile.c
==============================================================================
--- python/branches/py3k/Python/compile.c       (original)
+++ python/branches/py3k/Python/compile.c       Mon Jan 28 03:38:20 2008
@@ -1133,7 +1133,7 @@
        int addNone = 1;
        static PyObject *module;
        if (!module) {
-               module = PyUnicode_FromString("<module>");
+               module = PyUnicode_InternFromString("<module>");
                if (!module)
                        return NULL;
        }
@@ -1477,7 +1477,7 @@
 
        /* initialize statics */
        if (locals == NULL) {
-               locals = PyUnicode_FromString("__locals__");
+               locals = PyUnicode_InternFromString("__locals__");
                if (locals == NULL)
                        return 0;
        }
@@ -2177,7 +2177,7 @@
        if (Py_OptimizeFlag)
                return 1;
        if (assertion_error == NULL) {
-               assertion_error = PyUnicode_FromString("AssertionError");
+               assertion_error = PyUnicode_InternFromString("AssertionError");
                if (assertion_error == NULL)
                        return 0;
        }
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to