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
351c1bcd
Commit
351c1bcd
authored
Jul 18, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix type in wrapping tutorial.
parent
81c1140b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
src/tutorial/clibraries.rst
src/tutorial/clibraries.rst
+5
-5
No files found.
src/tutorial/clibraries.rst
View file @
351c1bcd
...
...
@@ -45,7 +45,7 @@ file, say, ``cqueue.pxd``::
pass
ctypedef void* QueueValue
Queue*
new_queue
()
Queue*
queue_new
()
void queue_free(Queue* queue)
int queue_push_head(Queue* queue, QueueValue data)
...
...
@@ -88,7 +88,7 @@ Here is a first start for the Queue class::
cdef class Queue:
cdef cqueue.Queue _c_queue
def __cinit__(self):
self._c_queue = cqueue.
new_queue
()
self._c_queue = cqueue.
queue_new
()
Note that it says ``__cinit__`` rather than ``__init__``. While
``__init__`` is available as well, it is not guaranteed to be run (for
...
...
@@ -110,9 +110,9 @@ method.
Before we continue implementing the other methods, it is important to
understand that the above implementation is not safe. In case
anything goes wrong in the call to ``
new_queue
()``, this code will
anything goes wrong in the call to ``
queue_new
()``, this code will
simply swallow the error, so we will likely run into a crash later on.
According to the documentation of the ``
new_queue
()`` function, the
According to the documentation of the ``
queue_new
()`` function, the
only reason why the above can fail is due to insufficient memory. In
that case, it will return ``NULL``, whereas it would normally return a
pointer to the new queue.
...
...
@@ -124,7 +124,7 @@ running out of memory. Luckily, CPython provides a function
thus change the init function as follows::
def __cinit__(self):
self._c_queue = cqueue.
new_queue
()
self._c_queue = cqueue.
queue_new
()
if self._c_queue is NULL:
python_exc.PyErr_NoMemory()
...
...
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