Commit 75aab8fb authored by Stefan Behnel's avatar Stefan Behnel

Correct the source character position of name nodes to improve error reporting...

Correct the source character position of name nodes to improve error reporting (previously reported the character position *behind* the name).
parent 7f9c0dca
......@@ -33,6 +33,9 @@ Bugs fixed
* Loops over ``range(enum)`` were not converted into C for-loops.
* Error positions of names (e.g. variables) were incorrectly reported after the
name and not at the beginning of the name.
* Compile time ``DEF`` assignments were evaluated even when they occur inside of
falsy ``IF`` blocks. (Github issue #1796)
......
......@@ -703,17 +703,18 @@ def p_atom(s):
s.error("invalid string kind '%s'" % kind)
elif sy == 'IDENT':
name = s.systring
s.next()
if name == "None":
return ExprNodes.NoneNode(pos)
result = ExprNodes.NoneNode(pos)
elif name == "True":
return ExprNodes.BoolNode(pos, value=True)
result = ExprNodes.BoolNode(pos, value=True)
elif name == "False":
return ExprNodes.BoolNode(pos, value=False)
result = ExprNodes.BoolNode(pos, value=False)
elif name == "NULL" and not s.in_python_file:
return ExprNodes.NullNode(pos)
result = ExprNodes.NullNode(pos)
else:
return p_name(s, name)
result = p_name(s, name)
s.next()
return result
else:
s.error("Expected an identifier or literal")
......
......@@ -6,5 +6,5 @@ def test():
not_assigned_to[2] = 3
_ERRORS = """
6:20: local variable 'not_assigned_to' referenced before assignment
6:5: local variable 'not_assigned_to' referenced before assignment
"""
......@@ -4,5 +4,5 @@
nonexisting(3, with_kw_arg=4)
_ERRORS = u"""
4:11: undeclared name not builtin: nonexisting
4:0: undeclared name not builtin: nonexisting
"""
......@@ -53,13 +53,13 @@ cptr = s + b'x' if boolval else s + b'y'
_ERRORS = """
16:8: Obtaining 'char *' from externally modifiable global Python value
16:7: Obtaining 'char *' from externally modifiable global Python value
19:9: Storing unsafe C derivative of temporary Python reference
#22:8: Storing unsafe C derivative of temporary Python reference
#23:5: Storing unsafe C derivative of temporary Python reference
#23:15: Casting temporary Python object to non-numeric non-Python type
26:8: Storing unsafe C derivative of temporary Python reference
41:9: Obtaining 'Py_UNICODE *' from externally modifiable global Python value
41:8: Obtaining 'Py_UNICODE *' from externally modifiable global Python value
44:10: Storing unsafe C derivative of temporary Python reference
52:7: Storing unsafe C derivative of temporary Python reference
52:7: Unsafe C derivative of temporary Python reference used in conditional expression
......
......@@ -19,13 +19,14 @@ cdef func(const int a, const int* b, const (int*) c, const S s, int *const d,
d = NULL
t = &s
_ERRORS = """
3:5: Const base type cannot be a Python object
8:5: Assignment to const 'x'
15:6: Assignment to const 'a'
16:6: Assignment to const 'c'
15:4: Assignment to const 'a'
16:4: Assignment to const 'c'
17:5: Assignment to const dereference
18:5: Assignment to const attribute 'member'
19:6: Assignment to const 'd'
20:6: Assignment to const 't'
19:4: Assignment to const 'd'
20:4: Assignment to const 't'
"""
......@@ -30,6 +30,6 @@ d = z # not an error
_ERRORS = u"""
20:2: Assignment to slice of wrong length, expected 2, got 1
21:2: Assignment to slice of wrong length, expected 1, got 2
20:0: Assignment to slice of wrong length, expected 2, got 1
21:0: Assignment to slice of wrong length, expected 1, got 2
"""
......@@ -11,7 +11,7 @@ cdef void foo(obj):
_ERRORS = u"""
7:19: Cannot assign type 'char *' to 'int'
8:20: Cannot convert Python object to 'int *'
10:20: Cannot convert 'int *' to Python object
7:9: Cannot assign type 'char *' to 'int'
8:9: Cannot convert Python object to 'int *'
10:10: Cannot convert 'int *' to Python object
"""
......@@ -30,15 +30,15 @@ if union_not_boolean:
_ERRORS = u"""
7:26: 'struct_type_not_boolean' is not a constant, variable or function identifier
7:26: Type 'struct_type_not_boolean' not acceptable as a boolean
7:3: 'struct_type_not_boolean' is not a constant, variable or function identifier
7:3: Type 'struct_type_not_boolean' not acceptable as a boolean
14:21: 'struct_not_boolean' is not a constant, variable or function identifier
14:21: Type 'struct_not_boolean' not acceptable as a boolean
14:3: 'struct_not_boolean' is not a constant, variable or function identifier
14:3: Type 'struct_not_boolean' not acceptable as a boolean
21:25: 'union_type_not_boolean' is not a constant, variable or function identifier
21:25: Type 'union_type_not_boolean' not acceptable as a boolean
21:3: 'union_type_not_boolean' is not a constant, variable or function identifier
21:3: Type 'union_type_not_boolean' not acceptable as a boolean
28:20: 'union_not_boolean' is not a constant, variable or function identifier
28:20: Type 'union_not_boolean' not acceptable as a boolean
28:3: 'union_not_boolean' is not a constant, variable or function identifier
28:3: Type 'union_not_boolean' not acceptable as a boolean
"""
......@@ -32,5 +32,5 @@ _ERRORS = u"""
3: 9: 'nothing' is not a type identifier
24:11: Cannot access buffer with object dtype without gil
24:11: Assignment of Python object not allowed without gil
29:12: Assignment of Python object not allowed without gil
29:8: Assignment of Python object not allowed without gil
"""
......@@ -5,5 +5,5 @@ def func():
_ERRORS = """
4:9: The 'cdef' keyword is only allowed in Cython files (pyx/pxi/pxd)
4:4: The 'cdef' keyword is only allowed in Cython files (pyx/pxi/pxd)
"""
......@@ -69,35 +69,35 @@ strstr("abc", "abcdef", char="xyz")
_ERRORS = u"""
22:18: argument 'x' passed twice
23:18: argument 'x' passed twice
24:23: C function got unexpected keyword argument 'z'
25:18: C function got unexpected keyword argument 'z'
26:21: C function got unexpected keyword argument 'z'
27:25: C function got unexpected keyword argument 'z'
28:25: argument 'x' passed twice
29:25: argument 'x' passed twice
29:30: C function got unexpected keyword argument 'z'
39:18: argument 'x' passed twice
40:21: argument 'x' passed twice
41:21: argument 'y' passed twice
42:21: argument 'x' passed twice
42:26: argument 'y' passed twice
43:21: argument 'y' passed twice
43:26: argument 'x' passed twice
44:23: argument 'x' passed twice
45:21: C function got unexpected keyword argument 'z'
46:23: C function got unexpected keyword argument 'z'
47:20: argument 'x' passed twice
48:20: argument 'x' passed twice
49:25: argument 'x' passed twice
58:16: argument 's1' passed twice
59:26: argument 's1' passed twice
60:29: argument 's1' passed twice
61:29: argument 's2' passed twice
67:18: C function got unexpected keyword argument 'char'
68:28: C function got unexpected keyword argument 'char'
22:17: argument 'x' passed twice
23:17: argument 'x' passed twice
24:22: C function got unexpected keyword argument 'z'
25:17: C function got unexpected keyword argument 'z'
26:20: C function got unexpected keyword argument 'z'
27:24: C function got unexpected keyword argument 'z'
28:24: argument 'x' passed twice
29:24: argument 'x' passed twice
29:29: C function got unexpected keyword argument 'z'
39:17: argument 'x' passed twice
40:20: argument 'x' passed twice
41:20: argument 'y' passed twice
42:20: argument 'x' passed twice
42:25: argument 'y' passed twice
43:20: argument 'y' passed twice
43:25: argument 'x' passed twice
44:22: argument 'x' passed twice
45:20: C function got unexpected keyword argument 'z'
46:22: C function got unexpected keyword argument 'z'
47:19: argument 'x' passed twice
48:19: argument 'x' passed twice
49:24: argument 'x' passed twice
58:14: argument 's1' passed twice
59:24: argument 's1' passed twice
60:27: argument 's1' passed twice
61:27: argument 's2' passed twice
67:14: C function got unexpected keyword argument 'char'
68:24: C function got unexpected keyword argument 'char'
"""
......@@ -8,5 +8,5 @@ cdef void f():
a = 42 # assignment to non-lvalue
_ERRORS = u"""
8:3: Assignment to non-lvalue 'a'
8:1: Assignment to non-lvalue 'a'
"""
......@@ -27,7 +27,7 @@ _ERRORS = u"""
7:39: C struct/union member cannot be a Python object
17:9: Object of type 'Spam' has no attribute 'k'
18:9: Cannot assign type 'float (*)[42]' to 'int'
19:24: Cannot assign type 'int' to 'float (*)[42]'
19:10: Cannot assign type 'int' to 'float (*)[42]'
22:10: Cannot select attribute of incomplete type 'Grail'
23:6: Cannot select attribute of incomplete type 'Grail'
"""
......@@ -25,5 +25,5 @@ def convert_nok():
_ERRORS = """
24:12: Cannot convert 'IllegalMix' to Python object
24:11: Cannot convert 'IllegalMix' to Python object
"""
......@@ -150,37 +150,37 @@ with nogil, cython.parallel.parallel():
pass
_ERRORS = u"""
e_cython_parallel.pyx:3:8: cython.parallel.parallel is not a module
e_cython_parallel.pyx:4:0: No such directive: cython.parallel.something
e_cython_parallel.pyx:6:7: cython.parallel.parallel is not a module
e_cython_parallel.pyx:7:0: No such directive: cython.parallel.something
e_cython_parallel.pyx:13:6: prange() can only be used as part of a for loop
e_cython_parallel.pyx:13:6: prange() can only be used without the GIL
e_cython_parallel.pyx:18:19: Invalid schedule argument to prange: invalid_schedule
c_cython_parallel.pyx:21:29: The parallel section may only be used without the GIL
e_cython_parallel.pyx:27:10: target may not be a Python object as we don't have the GIL
e_cython_parallel.pyx:30:9: Can only iterate over an iteration variable
e_cython_parallel.pyx:33:10: Must be of numeric type, not int *
e_cython_parallel.pyx:36:33: Nested parallel with blocks are disallowed
e_cython_parallel.pyx:39:12: The parallel directive must be called
e_cython_parallel.pyx:45:10: local variable 'y' referenced before assignment
e_cython_parallel.pyx:55:9: local variable 'y' referenced before assignment
e_cython_parallel.pyx:60:6: Reduction operator '*' is inconsistent with previous reduction operator '+'
e_cython_parallel.pyx:62:36: cython.parallel.parallel() does not take positional arguments
e_cython_parallel.pyx:65:36: Invalid keyword argument: invalid
e_cython_parallel.pyx:73:12: 'yield' not allowed in parallel sections
e_cython_parallel.pyx:77:16: 'yield' not allowed in parallel sections
e_cython_parallel.pyx:97:19: Cannot assign to private of outer parallel block
e_cython_parallel.pyx:98:19: Cannot assign to private of outer parallel block
e_cython_parallel.pyx:104:6: Reductions not allowed for parallel blocks
e_cython_parallel.pyx:110:7: local variable 'i' referenced before assignment
e_cython_parallel.pyx:119:17: Cannot read reduction variable in loop body
e_cython_parallel.pyx:121:20: stop argument must be numeric
e_cython_parallel.pyx:121:19: prange() can only be used without the GIL
e_cython_parallel.pyx:131:8: Memoryview slices can only be shared in parallel sections
e_cython_parallel.pyx:133:42: Must provide schedule with chunksize
e_cython_parallel.pyx:136:62: Chunksize must not be negative
e_cython_parallel.pyx:139:62: Chunksize not valid for the schedule runtime
e_cython_parallel.pyx:145:70: Calling gil-requiring function not allowed without gil
e_cython_parallel.pyx:149:33: Nested parallel with blocks are disallowed
3:8: cython.parallel.parallel is not a module
4:0: No such directive: cython.parallel.something
6:7: cython.parallel.parallel is not a module
7:0: No such directive: cython.parallel.something
13:6: prange() can only be used as part of a for loop
13:6: prange() can only be used without the GIL
18:19: Invalid schedule argument to prange: invalid_schedule
21:29: The parallel section may only be used without the GIL
27:8: target may not be a Python object as we don't have the GIL
30:9: Can only iterate over an iteration variable
33:8: Must be of numeric type, not int *
36:33: Nested parallel with blocks are disallowed
39:12: The parallel directive must be called
45:8: local variable 'y' referenced before assignment
55:8: local variable 'y' referenced before assignment
60:4: Reduction operator '*' is inconsistent with previous reduction operator '+'
62:36: cython.parallel.parallel() does not take positional arguments
65:36: Invalid keyword argument: invalid
73:12: 'yield' not allowed in parallel sections
77:16: 'yield' not allowed in parallel sections
97:8: Cannot assign to private of outer parallel block
98:8: Cannot assign to private of outer parallel block
104:4: Reductions not allowed for parallel blocks
110:6: local variable 'i' referenced before assignment
119:14: Cannot read reduction variable in loop body
121:19: prange() can only be used without the GIL
121:20: stop argument must be numeric
131:4: Memoryview slices can only be shared in parallel sections
133:42: Must provide schedule with chunksize
136:62: Chunksize must not be negative
139:62: Chunksize not valid for the schedule runtime
145:70: Calling gil-requiring function not allowed without gil
149:33: Nested parallel with blocks are disallowed
"""
......@@ -25,9 +25,9 @@ del g
_ERRORS = u"""
10:9: Cannot assign to or delete this
11:48: Deletion of non-Python, non-C++ object
11:8: Deletion of non-Python, non-C++ object
13:9: Deletion of non-Python, non-C++ object
14:9: Deletion of non-Python, non-C++ object
19:9: can not delete variable 'a' referenced in nested scope
23:5: Deletion of global C variable
19:8: can not delete variable 'a' referenced in nested scope
23:4: Deletion of global C variable
"""
......@@ -8,7 +8,9 @@ cdef spamfunc spam
grail = spam # type mismatch
spam = grail # type mismatch
_ERRORS = u"""
9:28: Cannot assign type 'spamfunc' to 'grailfunc'
10:28: Cannot assign type 'grailfunc' to 'spamfunc'
9:8: Cannot assign type 'spamfunc' to 'grailfunc'
10:7: Cannot assign type 'grailfunc' to 'spamfunc'
"""
......@@ -8,9 +8,11 @@ def f(obj1, obj2):
int1 = array1[ptr1] # error
int1 = int2[int3] # error
obj1 = obj2[ptr1] # error
_ERRORS = u"""
7:14: Invalid index type 'float'
8:14: Invalid index type 'float *'
9:12: Attempting to index non-array type 'int'
10:17: Cannot convert 'float *' to Python object
10:13: Cannot convert 'float *' to Python object
"""
......@@ -4,6 +4,8 @@ def f(obj1a, obj1b):
cdef int int1, int2, int3
cdef int *ptr2
int1, int3, obj1a = int2, ptr2, obj1b # error
_ERRORS = u"""
6:31: Cannot assign type 'int *' to 'int'
6:27: Cannot assign type 'int *' to 'int'
"""
......@@ -5,6 +5,8 @@ cdef extern from *:
cdef void (*fp)() nogil
fp = f
_ERRORS = u"""
7:6: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
7:5: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
"""
......@@ -9,8 +9,10 @@ cdef int h():
cdef int *p
return # error
return p # error
_ERRORS = u"""
6:17: Return with value in void function
6:8: Return with value in void function
10:1: Return value required
11:17: Cannot assign type 'int *' to 'int'
11:8: Cannot assign type 'int *' to 'int'
"""
......@@ -17,10 +17,10 @@ for a in int_ptr[2:2:a]:
pass
_ERRORS = u"""
5:20: Cannot convert 'int *' to Python object
6:21: Cannot convert 'int *' to Python object
7:22: Cannot convert 'int *' to Python object
12:16: C array iteration requires known end index
5:16: Cannot convert 'int *' to Python object
6:17: Cannot convert 'int *' to Python object
7:18: Cannot convert 'int *' to Python object
12:9: C array iteration requires known end index
14:16: C array iteration requires known end index
16:22: C array iteration requires known step size and end index
16:21: C array iteration requires known step size and end index
"""
......@@ -10,5 +10,5 @@ elif x == 4:
print 34
_ERRORS = u"""
5:19: undeclared name not builtin: NONEXISTING
5:8: undeclared name not builtin: NONEXISTING
"""
......@@ -6,7 +6,7 @@ def func((a, b)):
_ERRORS = u"""
4:9: Missing argument name
5:13: undeclared name not builtin: a
5:16: undeclared name not builtin: b
5:11: undeclared name not builtin: a
5:15: undeclared name not builtin: b
"""
......@@ -45,5 +45,5 @@ _ERRORS = u"""
# types()
32:15: Cannot coerce list to type 'int'
33:10: starred target must have Python object (list) type
33:8: starred target must have Python object (list) type
"""
......@@ -66,10 +66,10 @@ func(x, y)
_ERRORS = u"""
10:15: fused_type does not take keyword arguments
15:38: Type specified multiple times
26:4: Invalid use of fused types, type cannot be specialized
15:33: Type specified multiple times
26:0: Invalid use of fused types, type cannot be specialized
26:4: Not enough types specified to specialize the function, int2_t is still fused
27:4: Invalid use of fused types, type cannot be specialized
27:0: Invalid use of fused types, type cannot be specialized
27:4: Not enough types specified to specialize the function, int2_t is still fused
28:16: Call with wrong number of arguments (expected 2, got 1)
29:16: Call with wrong number of arguments (expected 2, got 3)
......
......@@ -9,5 +9,5 @@ def false():
return False
_ERRORS = u"""
6:10: Literal list must be assigned to pointer at time of declaration
6:8: Literal list must be assigned to pointer at time of declaration
"""
......@@ -96,14 +96,14 @@ def bare_pyvar_name(object x):
_ERRORS = u"""
4:5: Function with Python return type cannot be declared nogil
7:5: Function declared nogil has Python locals or temporaries
9:6: Assignment of Python object not allowed without gil
9:4: Assignment of Python object not allowed without gil
12:5: Discarding owned Python object not allowed without gil
14:5: Function with Python return type cannot be declared nogil
18:5: Calling gil-requiring function not allowed without gil
27:9: Calling gil-requiring function not allowed without gil
29:12: Assignment of Python object not allowed without gil
29:8: Assignment of Python object not allowed without gil
31:16: Constructing complex number not allowed without gil
33:12: Assignment of Python object not allowed without gil
33:8: Assignment of Python object not allowed without gil
33:14: Backquote expression not allowed without gil
33:15: Operation not allowed without gil
34:15: Assignment of Python object not allowed without gil
......@@ -121,32 +121,32 @@ _ERRORS = u"""
40:11: Constructing Python slice object not allowed without gil
40:11: Discarding owned Python object not allowed without gil
40:11: Indexing Python object not allowed without gil
40:13: Converting to Python object not allowed without gil
40:15: Converting to Python object not allowed without gil
40:17: Converting to Python object not allowed without gil
40:12: Converting to Python object not allowed without gil
40:14: Converting to Python object not allowed without gil
40:16: Converting to Python object not allowed without gil
41:11: Accessing Python attribute not allowed without gil
41:11: Discarding owned Python object not allowed without gil
42:9: Constructing Python tuple not allowed without gil
42:9: Discarding owned Python object not allowed without gil
43:8: Constructing Python list not allowed without gil
43:8: Discarding owned Python object not allowed without gil
44:10: Constructing Python dict not allowed without gil
44:10: Discarding owned Python object not allowed without gil
45:10: Constructing Python set not allowed without gil
45:10: Discarding owned Python object not allowed without gil
44:9: Constructing Python dict not allowed without gil
44:9: Discarding owned Python object not allowed without gil
45:9: Constructing Python set not allowed without gil
45:9: Discarding owned Python object not allowed without gil
46:12: Discarding owned Python object not allowed without gil
46:12: Truth-testing Python object not allowed without gil
47:13: Python type test not allowed without gil
47:10: Python type test not allowed without gil
49:10: Discarding owned Python object not allowed without gil
49:10: Operation not allowed without gil
50:8: Discarding owned Python object not allowed without gil
50:8: Operation not allowed without gil
51:10: Assignment of Python object not allowed without gil
51:14: Assignment of Python object not allowed without gil
52:9: Assignment of Python object not allowed without gil
52:13: Assignment of Python object not allowed without gil
52:16: Creating temporary Python reference not allowed without gil
52:19: Creating temporary Python reference not allowed without gil
51:8: Assignment of Python object not allowed without gil
51:12: Assignment of Python object not allowed without gil
52:8: Assignment of Python object not allowed without gil
52:11: Assignment of Python object not allowed without gil
52:15: Creating temporary Python reference not allowed without gil
52:18: Creating temporary Python reference not allowed without gil
53:11: Assignment of Python object not allowed without gil
53:11: Indexing Python object not allowed without gil
54:11: Accessing Python attribute not allowed without gil
......@@ -156,11 +156,11 @@ _ERRORS = u"""
56:8: Deleting Python object not allowed without gil
57:8: Returning Python object not allowed without gil
58:8: Raising exception not allowed without gil
59:14: Truth-testing Python object not allowed without gil
61:17: Truth-testing Python object not allowed without gil
59:11: Truth-testing Python object not allowed without gil
61:14: Truth-testing Python object not allowed without gil
63:8: For-loop using object bounds or target not allowed without gil
63:14: Coercion from Python not allowed without the GIL
63:25: Coercion from Python not allowed without the GIL
63:12: Coercion from Python not allowed without the GIL
63:24: Coercion from Python not allowed without the GIL
65:8: Try-except statement not allowed without gil
86:8: For-loop using object bounds or target not allowed without gil
"""
......@@ -12,5 +12,5 @@ gp = g
fp = f
_ERRORS = u"""
12:6: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
12:5: Cannot assign type 'void (void)' to 'void (*)(void) nogil'
"""
......@@ -4,6 +4,6 @@ import os
DEF ospath = os.path
_ERRORS = u"""
4:15: Compile-time name 'os' not defined
4:13: Compile-time name 'os' not defined
4:15: Error in compile-time expression: AttributeError: 'NoneType' object has no attribute 'path'
"""
......@@ -8,5 +8,5 @@ x = t_non_const
_ERRORS = u"""
5:32: Error in compile-time expression: IndexError: tuple index out of range
7:15: Invalid type for compile-time constant: [1, 2, 3] (type list)
7:4: Invalid type for compile-time constant: [1, 2, 3] (type list)
"""
......@@ -76,39 +76,39 @@ print <unicode>c1[1:2]
_ERRORS = u"""
36:20: Unicode literals do not support coercion to C types other than Py_UNICODE/Py_UCS4 (for characters) or Py_UNICODE* (for strings).
37:22: Unicode objects only support coercion to Py_UNICODE*.
38:22: 'str' objects do not support coercion to C types (use 'bytes'?).
37:20: Unicode objects only support coercion to Py_UNICODE*.
38:20: 'str' objects do not support coercion to C types (use 'bytes'?).
40:27: Cannot assign type 'char *' to 'Py_UNICODE *'
41:27: Cannot convert 'bytes' object to Py_UNICODE*, use 'unicode'.
42:27: 'str' objects do not support coercion to C types (use 'unicode'?).
40:25: Cannot assign type 'char *' to 'Py_UNICODE *'
41:25: Cannot convert 'bytes' object to Py_UNICODE*, use 'unicode'.
42:25: 'str' objects do not support coercion to C types (use 'unicode'?).
43:25: Cannot convert 'bytes' object to Py_UNICODE*, use 'unicode'.
45:20: Cannot convert Unicode string to 'bytes' implicitly, encoding required.
46:22: Cannot convert Unicode string to 'bytes' implicitly, encoding required.
47:22: Cannot convert 'str' to 'bytes' implicitly. This is not portable.
48:23: Cannot convert 'basestring' object to bytes implicitly. This is not portable.
46:20: Cannot convert Unicode string to 'bytes' implicitly, encoding required.
47:20: Cannot convert 'str' to 'bytes' implicitly. This is not portable.
48:20: Cannot convert 'basestring' object to bytes implicitly. This is not portable.
50:17: Cannot convert 'bytes' object to str implicitly. This is not portable to Py3.
51:19: Cannot convert 'bytes' object to str implicitly. This is not portable to Py3.
51:17: Cannot convert 'bytes' object to str implicitly. This is not portable to Py3.
52:17: Cannot convert Unicode string to 'str' implicitly. This is not portable and requires explicit encoding.
53:19: Cannot convert Unicode string to 'str' implicitly. This is not portable and requires explicit encoding.
53:17: Cannot convert Unicode string to 'str' implicitly. This is not portable and requires explicit encoding.
55:20: str objects do not support coercion to unicode, use a unicode string literal instead (u'')
56:22: str objects do not support coercion to unicode, use a unicode string literal instead (u'')
56:20: str objects do not support coercion to unicode, use a unicode string literal instead (u'')
57:20: Cannot convert 'bytes' object to unicode implicitly, decoding required
58:22: Cannot convert 'bytes' object to unicode implicitly, decoding required
59:22: Cannot convert 'char*' to unicode implicitly, decoding required
58:20: Cannot convert 'bytes' object to unicode implicitly, decoding required
59:20: Cannot convert 'char*' to unicode implicitly, decoding required
61:24: Cannot convert 'bytes' object to basestring implicitly. This is not portable to Py3.
62:26: Cannot convert 'bytes' object to basestring implicitly. This is not portable to Py3.
62:24: Cannot convert 'bytes' object to basestring implicitly. This is not portable to Py3.
64:19: Cannot assign type 'str object' to 'tuple object'
65:18: Cannot assign type 'unicode object' to 'tuple object'
66:18: Cannot assign type 'bytes object' to 'tuple object'
72:13: default encoding required for conversion from 'char *' to 'str object'
72:11: default encoding required for conversion from 'char *' to 'str object'
73:13: default encoding required for conversion from 'char *' to 'str object'
74:17: Cannot convert 'char*' to unicode implicitly, decoding required
74:15: Cannot convert 'char*' to unicode implicitly, decoding required
75:17: default encoding required for conversion from 'char *' to 'unicode object'
"""
......@@ -6,6 +6,6 @@ def test(i):
return _this_local_name_does_not_exist_
_ERRORS = u"""
3:37:undeclared name not builtin: _this_global_name_does_not_exist_
6:43:undeclared name not builtin: _this_local_name_does_not_exist_
3:4:undeclared name not builtin: _this_global_name_does_not_exist_
6:11:undeclared name not builtin: _this_local_name_does_not_exist_
"""
......@@ -12,6 +12,6 @@ def slice_lhs(a):
a[:idx] = 1
_ERRORS = """
8:9: local variable 'idx' referenced before assignment
12:10: local variable 'idx' referenced before assignment
8:6: local variable 'idx' referenced before assignment
12:7: local variable 'idx' referenced before assignment
"""
......@@ -113,21 +113,21 @@ def class_py3k_args():
kwargs = {}
_ERRORS = """
6:11: local variable 'a' referenced before assignment
12:12: local variable 'a' might be referenced before assignment
29:12: local variable 'a' might be referenced before assignment
35:15: local variable 'b' might be referenced before assignment
58:11: local variable 'a' referenced before assignment
58:14: local variable 'b' referenced before assignment
62:13: local variable 'bar' referenced before assignment
66:13: local variable 'foo' referenced before assignment
71:17: local variable 'exc' referenced before assignment
71:22: local variable 'msg' referenced before assignment
6:10: local variable 'a' referenced before assignment
12:11: local variable 'a' might be referenced before assignment
29:11: local variable 'a' might be referenced before assignment
35:14: local variable 'b' might be referenced before assignment
58:10: local variable 'a' referenced before assignment
58:13: local variable 'b' referenced before assignment
62:10: local variable 'bar' referenced before assignment
66:10: local variable 'foo' referenced before assignment
71:14: local variable 'exc' referenced before assignment
71:19: local variable 'msg' referenced before assignment
78:4: local variable 'decorator' referenced before assignment
85:23: local variable 'default' referenced before assignment
91:17: local variable 'bar' referenced before assignment
85:16: local variable 'default' referenced before assignment
91:14: local variable 'bar' referenced before assignment
97:4: local variable 'decorator' referenced before assignment
104:28: local variable 'Meta' referenced before assignment
110:19: local variable 'args' referenced before assignment
110:29: local variable 'kwargs' referenced before assignment
104:24: local variable 'Meta' referenced before assignment
110:15: local variable 'args' referenced before assignment
110:23: local variable 'kwargs' referenced before assignment
"""
......@@ -9,6 +9,6 @@ def foo(x):
return a, b
_ERRORS = """
7:12: local variable 'b' referenced before assignment
9:12: local variable 'a' referenced before assignment
7:11: local variable 'b' referenced before assignment
9:11: local variable 'a' referenced before assignment
"""
......@@ -113,13 +113,13 @@ def try_finally_nested(m):
print f
_ERRORS = """
12:12: local variable 'e' might be referenced before assignment
12:15: local variable 'i' might be referenced before assignment
19:12: local variable 'a' might be referenced before assignment
63:16: local variable 'x' might be referenced before assignment
69:16: local variable 'x' might be referenced before assignment
77:14: local variable 'oops' might be referenced before assignment
93:16: local variable 'x' might be referenced before assignment
101:16: local variable 'x' might be referenced before assignment
113:15: local variable 'f' might be referenced before assignment
12:11: local variable 'e' might be referenced before assignment
12:14: local variable 'i' might be referenced before assignment
19:11: local variable 'a' might be referenced before assignment
63:15: local variable 'x' might be referenced before assignment
69:15: local variable 'x' might be referenced before assignment
77:10: local variable 'oops' might be referenced before assignment
93:15: local variable 'x' might be referenced before assignment
101:15: local variable 'x' might be referenced before assignment
113:14: local variable 'f' might be referenced before assignment
"""
......@@ -81,13 +81,13 @@ def for_finally_outer(p, f):
_ERRORS = """
8:12: local variable 'a' might be referenced before assignment
14:12: local variable 'a' might be referenced before assignment
26:12: local variable 'i' might be referenced before assignment
31:12: local variable 'i' might be referenced before assignment
37:16: local variable 'x' might be referenced before assignment
44:11: local variable 'x' might be referenced before assignment
51:11: local variable 'x' might be referenced before assignment
58:19: local variable 'x' might be referenced before assignment
66:19: local variable 'x' might be referenced before assignment
8:11: local variable 'a' might be referenced before assignment
14:11: local variable 'a' might be referenced before assignment
26:11: local variable 'i' might be referenced before assignment
31:11: local variable 'i' might be referenced before assignment
37:15: local variable 'x' might be referenced before assignment
44:10: local variable 'x' might be referenced before assignment
51:10: local variable 'x' might be referenced before assignment
58:18: local variable 'x' might be referenced before assignment
66:18: local variable 'x' might be referenced before assignment
"""
......@@ -8,5 +8,5 @@ def unbound_inside_generator(*args):
x = i + i
_ERRORS = """
7:15: local variable 'x' might be referenced before assignment
7:14: local variable 'x' might be referenced before assignment
"""
......@@ -18,9 +18,9 @@ def dict_comp2(a):
_ERRORS = """
7:12: local variable 'i' might be referenced before assignment
12:12: undeclared name not builtin: i
12:15: undeclared name not builtin: j
16:11: local variable 'i' referenced before assignment