Anonymous avatar Anonymous committed ac7ae1a

String literal warning.

Comments (0)

Files changed (2)

Cython/Compiler/Errors.py

         echo_file.write(line)
     return warn
 
+_warn_once_seen = {}
+def warn_once(position, message, level=0):
+    if level < LEVEL or message in _warn_once_seen:
+        return
+    warn = CompileWarning(position, message)
+    line = "warning: %s\n" % warn
+    if listing_file:
+        listing_file.write(line)
+    if echo_file:
+        echo_file.write(line)
+    _warn_once_seen[message] = True
+    return warn
+
+
 # These functions can be used to momentarily suppress errors. 
 
 error_stack = []

Cython/Compiler/ExprNodes.py

 
 import operator
 
-from Errors import error, warning, InternalError
+from Errors import error, warning, warn_once, InternalError
 from Errors import hold_errors, release_errors, held_errors, report_error
 from Cython.Utils import UtilityCode
 import StringEncoding
         # Arrange for a Python version of the string to be pre-allocated
         # when coercing to a Python type.
         if dst_type.is_pyobject and not self.type.is_pyobject:
+            warn_once(self.pos, "String literals will no longer be Py3 bytes in Cython 0.12.", 1)
             node = self.as_py_string_node(env)
         else:
             node = self
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.