Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
2c1b7967
Commit
2c1b7967
authored
Apr 20, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unify None indexing exception message
parent
b3048e1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
11 deletions
+6
-11
Cython/Utility/ObjectHandling.c
Cython/Utility/ObjectHandling.c
+1
-1
tests/run/index.pyx
tests/run/index.pyx
+3
-3
tests/run/nonecheck.pyx
tests/run/nonecheck.pyx
+2
-7
No files found.
Cython/Utility/ObjectHandling.c
View file @
2c1b7967
...
...
@@ -16,7 +16,7 @@ static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
/////////////// RaiseNoneIndexingError ///////////////
static
CYTHON_INLINE
void
__Pyx_RaiseNoneIndexingError
(
void
)
{
PyErr_SetString
(
PyExc_TypeError
,
"'NoneType' object is
un
subscriptable"
);
PyErr_SetString
(
PyExc_TypeError
,
"'NoneType' object is
not
subscriptable"
);
}
/////////////// RaiseNoneIterError.proto ///////////////
...
...
tests/run/index.pyx
View file @
2c1b7967
...
...
@@ -24,7 +24,7 @@ def index_tuple(tuple t, int i):
IndexError: tuple index out of range
>>> index_tuple(None, 0)
Traceback (most recent call last):
TypeError: 'NoneType' object is
un
subscriptable
TypeError: 'NoneType' object is
not
subscriptable
"""
return
t
[
i
]
...
...
@@ -41,7 +41,7 @@ def index_list(list L, int i):
IndexError: list index out of range
>>> index_list(None, 0)
Traceback (most recent call last):
TypeError: 'NoneType' object is
un
subscriptable
TypeError: 'NoneType' object is
not
subscriptable
"""
return
L
[
i
]
...
...
@@ -65,7 +65,7 @@ def index_object(object o, int i):
IndexError: string index out of range
>>> index_object(None, 0)
Traceback (most recent call last):
TypeError: 'NoneType' object is
un
subscriptable
TypeError: 'NoneType' object is
not
subscriptable
"""
return
o
[
i
]
...
...
tests/run/nonecheck.pyx
View file @
2c1b7967
...
...
@@ -19,7 +19,6 @@ def getattr_(MyClass var):
2
>>> getattr_(None)
Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'a'
>>> setattr_(obj)
>>> getattr_(obj)
...
...
@@ -34,7 +33,6 @@ def setattr_(MyClass var):
>>> setattr_(obj)
>>> setattr_(None)
Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'a'
"""
var
.
a
=
10
...
...
@@ -66,7 +64,6 @@ def check_and_assign(MyClass var):
>>> obj = MyClass(2, 3)
>>> check_and_assign(obj)
Traceback (most recent call last):
...
AttributeError: 'NoneType' object has no attribute 'a'
"""
if
var
is
not
None
:
...
...
@@ -79,8 +76,7 @@ def check_buffer_get(object[int] buf):
"""
>>> check_buffer_get(None)
Traceback (most recent call last):
...
TypeError: 'NoneType' object is unsubscriptable
TypeError: 'NoneType' object is not subscriptable
"""
return
buf
[
0
]
...
...
@@ -89,7 +85,6 @@ def check_buffer_set(object[int] buf):
"""
>>> check_buffer_set(None)
Traceback (most recent call last):
...
TypeError: 'NoneType' object is unsubscriptable
TypeError: 'NoneType' object is not subscriptable
"""
buf
[
0
]
=
1
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment