Commit 29bb8d51 authored by Robert Bradshaw's avatar Robert Bradshaw

String literal warning.

parent 48a54961
......@@ -145,6 +145,20 @@ def warning(position, message, level=0):
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 = []
......
......@@ -4,7 +4,7 @@
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
......@@ -942,6 +942,7 @@ class StringNode(ConstNode):
# 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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment