Commit 2c1b7967 authored by Stefan Behnel's avatar Stefan Behnel

unify None indexing exception message

parent b3048e1a
...@@ -16,7 +16,7 @@ static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void); ...@@ -16,7 +16,7 @@ static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
/////////////// RaiseNoneIndexingError /////////////// /////////////// RaiseNoneIndexingError ///////////////
static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) { static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable"); PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
} }
/////////////// RaiseNoneIterError.proto /////////////// /////////////// RaiseNoneIterError.proto ///////////////
......
...@@ -24,7 +24,7 @@ def index_tuple(tuple t, int i): ...@@ -24,7 +24,7 @@ def index_tuple(tuple t, int i):
IndexError: tuple index out of range IndexError: tuple index out of range
>>> index_tuple(None, 0) >>> index_tuple(None, 0)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: 'NoneType' object is unsubscriptable TypeError: 'NoneType' object is not subscriptable
""" """
return t[i] return t[i]
...@@ -41,7 +41,7 @@ def index_list(list L, int i): ...@@ -41,7 +41,7 @@ def index_list(list L, int i):
IndexError: list index out of range IndexError: list index out of range
>>> index_list(None, 0) >>> index_list(None, 0)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: 'NoneType' object is unsubscriptable TypeError: 'NoneType' object is not subscriptable
""" """
return L[i] return L[i]
...@@ -65,7 +65,7 @@ def index_object(object o, int i): ...@@ -65,7 +65,7 @@ def index_object(object o, int i):
IndexError: string index out of range IndexError: string index out of range
>>> index_object(None, 0) >>> index_object(None, 0)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: 'NoneType' object is unsubscriptable TypeError: 'NoneType' object is not subscriptable
""" """
return o[i] return o[i]
......
...@@ -19,7 +19,6 @@ def getattr_(MyClass var): ...@@ -19,7 +19,6 @@ def getattr_(MyClass var):
2 2
>>> getattr_(None) >>> getattr_(None)
Traceback (most recent call last): Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'a' AttributeError: 'NoneType' object has no attribute 'a'
>>> setattr_(obj) >>> setattr_(obj)
>>> getattr_(obj) >>> getattr_(obj)
...@@ -34,7 +33,6 @@ def setattr_(MyClass var): ...@@ -34,7 +33,6 @@ def setattr_(MyClass var):
>>> setattr_(obj) >>> setattr_(obj)
>>> setattr_(None) >>> setattr_(None)
Traceback (most recent call last): Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'a' AttributeError: 'NoneType' object has no attribute 'a'
""" """
var.a = 10 var.a = 10
...@@ -66,7 +64,6 @@ def check_and_assign(MyClass var): ...@@ -66,7 +64,6 @@ def check_and_assign(MyClass var):
>>> obj = MyClass(2, 3) >>> obj = MyClass(2, 3)
>>> check_and_assign(obj) >>> check_and_assign(obj)
Traceback (most recent call last): Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'a' AttributeError: 'NoneType' object has no attribute 'a'
""" """
if var is not None: if var is not None:
...@@ -79,8 +76,7 @@ def check_buffer_get(object[int] buf): ...@@ -79,8 +76,7 @@ def check_buffer_get(object[int] buf):
""" """
>>> check_buffer_get(None) >>> check_buffer_get(None)
Traceback (most recent call last): Traceback (most recent call last):
... TypeError: 'NoneType' object is not subscriptable
TypeError: 'NoneType' object is unsubscriptable
""" """
return buf[0] return buf[0]
...@@ -89,7 +85,6 @@ def check_buffer_set(object[int] buf): ...@@ -89,7 +85,6 @@ def check_buffer_set(object[int] buf):
""" """
>>> check_buffer_set(None) >>> check_buffer_set(None)
Traceback (most recent call last): Traceback (most recent call last):
... TypeError: 'NoneType' object is not subscriptable
TypeError: 'NoneType' object is unsubscriptable
""" """
buf[0] = 1 buf[0] = 1
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