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
c1e8b921
Commit
c1e8b921
authored
Jul 07, 2018
by
scoder
Committed by
GitHub
Jul 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2415 from gabrieldemarmiesse/test_language_basics_5
Added tests for "language basics" part 5
parents
6e6baf58
f6159408
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
630 deletions
+30
-630
Cython/Includes/Deprecated/python2.5.pxd
Cython/Includes/Deprecated/python2.5.pxd
+0
-622
Cython/Includes/cpython/exc.pxd
Cython/Includes/cpython/exc.pxd
+7
-0
docs/examples/tutorial/external/keyword_args_call.pyx
docs/examples/tutorial/external/keyword_args_call.pyx
+1
-1
docs/examples/userguide/language_basics/open_file.pyx
docs/examples/userguide/language_basics/open_file.pyx
+18
-0
docs/src/userguide/extension_types.rst
docs/src/userguide/extension_types.rst
+1
-1
docs/src/userguide/language_basics.rst
docs/src/userguide/language_basics.rst
+2
-5
docs/src/userguide/parallelism.rst
docs/src/userguide/parallelism.rst
+1
-1
No files found.
Cython/Includes/Deprecated/python2.5.pxd
deleted
100644 → 0
View file @
6e6baf58
This diff is collapsed.
Click to expand it.
Cython/Includes/cpython/exc.pxd
View file @
c1e8b921
...
...
@@ -153,6 +153,13 @@ cdef extern from "Python.h":
# PyErr_SetFromErrno(type);" when the system call returns an
# error.
PyObject
*
PyErr_SetFromErrnoWithFilenameObject
(
object
type
,
object
filenameObject
)
except
NULL
# Similar to PyErr_SetFromErrno(), with the additional behavior
# that if filenameObject is not NULL, it is passed to the
# constructor of type as a third parameter.
# In the case of OSError exception, this is used to define
# the filename attribute of the exception instance.
PyObject
*
PyErr_SetFromErrnoWithFilename
(
object
type
,
char
*
filename
)
except
NULL
# Return value: Always NULL. Similar to PyErr_SetFromErrno(),
# with the additional behavior that if filename is not NULL, it is
...
...
docs/examples/tutorial/external/keyword_args_call.pyx
View file @
c1e8b921
...
...
@@ -4,4 +4,4 @@ cdef extern from "string.h":
cdef
char
*
data
=
"hfvcakdfagbcffvschvxcdfgccbcfhvgcsnfxjh"
cdef
char
*
pos
=
strstr
(
needle
=
'akd'
,
haystack
=
data
)
print
(
pos
!=
NULL
)
print
(
pos
is
not
NULL
)
docs/examples/userguide/language_basics/open_file.pyx
0 → 100644
View file @
c1e8b921
from
libc.stdio
cimport
FILE
,
fopen
from
libc.stdlib
cimport
malloc
,
free
from
cpython.exc
cimport
PyErr_SetFromErrnoWithFilenameObject
def
open_file
():
cdef
FILE
*
p
p
=
fopen
(
"spam.txt"
,
"r"
)
if
p
is
NULL
:
PyErr_SetFromErrnoWithFilenameObject
(
OSError
,
"spam.txt"
)
...
def
allocating_memory
(
number
=
10
):
cdef
double
*
my_array
=
<
double
*>
malloc
(
number
*
sizeof
(
double
))
if
not
my_array
:
raise
MemoryError
()
...
free
(
my_array
)
docs/src/userguide/extension_types.rst
View file @
c1e8b921
...
...
@@ -421,7 +421,7 @@ compatible types.::
cdef void* ptr
def __dealloc__(self):
if self.ptr
!=
NULL:
if self.ptr
is not
NULL:
free(self.ptr)
@staticmethod
...
...
docs/src/userguide/language_basics.rst
View file @
c1e8b921
...
...
@@ -428,12 +428,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:
...
...
docs/src/userguide/parallelism.rst
View file @
c1e8b921
...
...
@@ -131,7 +131,7 @@ It currently supports OpenMP, but later on more backends might be supported.
with nogil, parallel():
local_buf = <int *> malloc(sizeof(int) * size)
if local_buf
==
NULL:
if local_buf
is
NULL:
abort()
# populate our local buffer in a sequential loop
...
...
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