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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
c2c1a2ad
Commit
c2c1a2ad
authored
May 22, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test for cdef attribute access on type checked variable
parent
6853d59e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
tests/run/typetest_T417.pyx
tests/run/typetest_T417.pyx
+22
-1
No files found.
tests/run/typetest_T417.pyx
View file @
c2c1a2ad
...
...
@@ -2,7 +2,9 @@
#cython: autotestdict=True
cdef
class
Foo
:
pass
cdef
int
i
def
__cinit__
(
self
):
self
.
i
=
1
cdef
class
SubFoo
(
Foo
):
pass
...
...
@@ -55,6 +57,25 @@ def foo3(arg):
"""
cdef
val
=
<
Foo
?
>
arg
def
attribute_access
(
arg
):
"""
>>> attribute_access(Foo())
>>> attribute_access(SubFoo())
>>> attribute_access(None)
Traceback (most recent call last):
...
TypeError: Cannot convert NoneType to typetest_T417.Foo
>>> attribute_access(123)
Traceback (most recent call last):
...
TypeError: Cannot convert int to typetest_T417.Foo
>>> attribute_access(Bar())
Traceback (most recent call last):
...
TypeError: Cannot convert typetest_T417.Bar to typetest_T417.Foo
"""
cdef
val
=
(
<
Foo
?
>
arg
).
i
cdef
int
count
=
0
...
...
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