[Python-checkins] r84265 - python/branches/py3k/Modules/readline.c

brett.cannon python-checkins at python.org
Sun Aug 22 22:36:25 CEST 2010


Author: brett.cannon
Date: Sun Aug 22 22:36:25 2010
New Revision: 84265

Log:
Under OS X, history_get from readline returns a const char *, but the local
variable the return value is assigned to is char *. Since the assigned-to
variable is never changed, simply make that a const char * and cast all calls
to get_history to const char * to silence the compiler warning (found with
LLVM).


Modified:
   python/branches/py3k/Modules/readline.c

Modified: python/branches/py3k/Modules/readline.c
==============================================================================
--- python/branches/py3k/Modules/readline.c	(original)
+++ python/branches/py3k/Modules/readline.c	Sun Aug 22 22:36:25 2010
@@ -1080,7 +1080,7 @@
     /* we have a valid line */
     n = strlen(p);
     if (n > 0) {
-        char *line;
+        const char *line;
         int length = _py_get_history_length();
         if (length > 0)
 #ifdef __APPLE__
@@ -1089,10 +1089,10 @@
                  * Libedit's emulation uses 0-based indexes,
                  * the real readline uses 1-based indexes.
                  */
-                line = history_get(length - 1)->line;
+                line = (const char *)history_get(length - 1)->line;
             } else
 #endif /* __APPLE__ */
-            line = history_get(length)->line;
+            line = (const char *)history_get(length)->line;
         else
             line = "";
         if (strcmp(p, line))


More information about the Python-checkins mailing list