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
Gwenaël Samain
cython
Commits
7f3987e0
Commit
7f3987e0
authored
Jun 25, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved an example for the rst file to the examples directory.
parent
084a25f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
docs/examples/userguide/language_basics/open_file.pyx
docs/examples/userguide/language_basics/open_file.pyx
+9
-0
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+2
-5
No files found.
docs/examples/userguide/language_basics/open_file.pyx
0 → 100644
View file @
7f3987e0
from
libc.stdio
cimport
FILE
,
fopen
def
main
():
cdef
FILE
*
p
p
=
fopen
(
"spam.txt"
,
"r"
)
if
p
==
NULL
:
raise
OSError
(
"Couldn't open the spam file"
)
# ...
docs/src/userguide/language_basics.rst
View file @
7f3987e0
...
...
@@ -479,12 +479,9 @@ returns ``NULL``. The except clause doesn't work that way; its only purpose is
for propagating Python exceptions that have already been raised, either by a Cython
function or a C function that calls Python/C API routines. To get an exception
from a non-Python-aware function such as :func:`fopen`, you will have to check the
return value and raise it yourself, for example
,:
:
return value and raise it yourself, for example:
cdef FILE* p
p = fopen("spam.txt", "r")
if p == NULL:
raise SpamError("Couldn't open the spam file")
.. literalinclude:: ../../examples/userguide/language_basics/open_file.pyx
.. _overriding_in_extension_types:
...
...
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