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
0f6e78a7
Commit
0f6e78a7
authored
Oct 03, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
undo last commit
parent
f65206a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
26 deletions
+8
-26
CHANGES.rst
CHANGES.rst
+0
-4
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+2
-14
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+3
-7
tests/build/cpp_cythonize.srctree
tests/build/cpp_cythonize.srctree
+3
-1
No files found.
CHANGES.rst
View file @
0f6e78a7
...
@@ -8,10 +8,6 @@ Latest
...
@@ -8,10 +8,6 @@ Latest
Features added
Features added
--------------
--------------
* Passing ``language='c++'`` into cythonize() globally enables C++ mode for
all modules that were not passed as Extension objects (i.e. only source
files and file patterns).
* ``Py_hash_t`` is a known type (used in CPython for hash values).
* ``Py_hash_t`` is a known type (used in CPython for hash values).
* ``PySlice_*()`` C-API functions are available from the ``cpython.slice``
* ``PySlice_*()`` C-API functions are available from the ``cpython.slice``
...
...
Cython/Build/Dependencies.py
View file @
0f6e78a7
...
@@ -586,8 +586,7 @@ def create_dependency_tree(ctx=None, quiet=False):
...
@@ -586,8 +586,7 @@ def create_dependency_tree(ctx=None, quiet=False):
# This may be useful for advanced users?
# This may be useful for advanced users?
def
create_extension_list
(
patterns
,
exclude
=
[],
ctx
=
None
,
aliases
=
None
,
quiet
=
False
,
language
=
None
,
def
create_extension_list
(
patterns
,
exclude
=
[],
ctx
=
None
,
aliases
=
None
,
quiet
=
False
,
exclude_failures
=
False
):
exclude_failures
=
False
):
if
not
isinstance
(
patterns
,
(
list
,
tuple
)):
if
not
isinstance
(
patterns
,
(
list
,
tuple
)):
patterns
=
[
patterns
]
patterns
=
[
patterns
]
explicit_modules
=
set
([
m
.
name
for
m
in
patterns
if
isinstance
(
m
,
Extension
)])
explicit_modules
=
set
([
m
.
name
for
m
in
patterns
if
isinstance
(
m
,
Extension
)])
...
@@ -607,7 +606,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
...
@@ -607,7 +606,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
name
=
'*'
name
=
'*'
base
=
None
base
=
None
exn_type
=
Extension
exn_type
=
Extension
ext_language
=
language
elif
isinstance
(
pattern
,
Extension
):
elif
isinstance
(
pattern
,
Extension
):
for
filepattern
in
pattern
.
sources
:
for
filepattern
in
pattern
.
sources
:
if
os
.
path
.
splitext
(
filepattern
)[
1
]
in
(
'.py'
,
'.pyx'
):
if
os
.
path
.
splitext
(
filepattern
)[
1
]
in
(
'.py'
,
'.pyx'
):
...
@@ -620,7 +618,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
...
@@ -620,7 +618,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
name
=
template
.
name
name
=
template
.
name
base
=
DistutilsInfo
(
exn
=
template
)
base
=
DistutilsInfo
(
exn
=
template
)
exn_type
=
template
.
__class__
exn_type
=
template
.
__class__
ext_language
=
None
# do not override whatever the Extension says
else
:
else
:
raise
TypeError
(
pattern
)
raise
TypeError
(
pattern
)
...
@@ -664,9 +661,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
...
@@ -664,9 +661,6 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
depends
=
list
(
set
(
template
.
depends
).
union
(
set
(
depends
)))
depends
=
list
(
set
(
template
.
depends
).
union
(
set
(
depends
)))
kwds
[
'depends'
]
=
depends
kwds
[
'depends'
]
=
depends
if
ext_language
and
'language'
not
in
kwds
:
kwds
[
'language'
]
=
ext_language
module_list
.
append
(
exn_type
(
module_list
.
append
(
exn_type
(
name
=
module_name
,
name
=
module_name
,
sources
=
sources
,
sources
=
sources
,
...
@@ -677,7 +671,7 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
...
@@ -677,7 +671,7 @@ def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=Fa
# This is the user-exposed entry point.
# This is the user-exposed entry point.
def
cythonize
(
module_list
,
exclude
=
[],
nthreads
=
0
,
aliases
=
None
,
quiet
=
False
,
force
=
False
,
language
=
None
,
def
cythonize
(
module_list
,
exclude
=
[],
nthreads
=
0
,
aliases
=
None
,
quiet
=
False
,
force
=
False
,
exclude_failures
=
False
,
**
options
):
exclude_failures
=
False
,
**
options
):
"""
"""
Compile a set of source modules into C/C++ files and return a list of distutils
Compile a set of source modules into C/C++ files and return a list of distutils
...
@@ -690,11 +684,6 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
...
@@ -690,11 +684,6 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
When using glob patterns, you can exclude certain module names explicitly
When using glob patterns, you can exclude certain module names explicitly
by passing them into the 'exclude' option.
by passing them into the 'exclude' option.
To globally enable C++ mode, you can pass language='c++'. Otherwise, this
will be determined at a per-file level based on compiler directives. This
affects only modules found based on file names. Extension instances passed
into cythonize() will not be changed.
For parallel compilation, set the 'nthreads' option to the number of
For parallel compilation, set the 'nthreads' option to the number of
concurrent builds.
concurrent builds.
...
@@ -722,7 +711,6 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
...
@@ -722,7 +711,6 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
ctx
=
ctx
,
ctx
=
ctx
,
quiet
=
quiet
,
quiet
=
quiet
,
exclude_failures
=
exclude_failures
,
exclude_failures
=
exclude_failures
,
language
=
language
,
aliases
=
aliases
)
aliases
=
aliases
)
deps
=
create_dependency_tree
(
ctx
,
quiet
=
quiet
)
deps
=
create_dependency_tree
(
ctx
,
quiet
=
quiet
)
build_dir
=
getattr
(
options
,
'build_dir'
,
None
)
build_dir
=
getattr
(
options
,
'build_dir'
,
None
)
...
...
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
0f6e78a7
...
@@ -137,14 +137,10 @@ together into :file:`rect.so`, which you can then import in Python using
...
@@ -137,14 +137,10 @@ together into :file:`rect.so`, which you can then import in Python using
``import rect`` (if you forget to link the :file:`Rectangle.o`, you will
``import rect`` (if you forget to link the :file:`Rectangle.o`, you will
get missing symbols while importing the library in Python).
get missing symbols while importing the library in Python).
Note that the ``language`` option has no effect on user provided Extension
objects that are passed into ``cythonize()``. It is only used for modules
found by file name (as in the example above).
The options can also be passed directly from the source file, which is
The options can also be passed directly from the source file, which is
often preferable
(and overrides any global option). Starting with
often preferable
. Starting with version 0.17, Cython also allows to
version 0.17, Cython also allows to pass external source files into the
pass external source files into the ``cythonize()`` command this way.
``cythonize()`` command this way.
Here is a simplified setup.py file::
Here is a simplified setup.py file::
from distutils.core import setup
from distutils.core import setup
from Cython.Build import cythonize
from Cython.Build import cythonize
...
...
tests/build/cpp_cythonize.srctree
View file @
0f6e78a7
...
@@ -10,11 +10,13 @@ from Cython.Build.Dependencies import cythonize
...
@@ -10,11 +10,13 @@ from Cython.Build.Dependencies import cythonize
from distutils.core import setup
from distutils.core import setup
setup(
setup(
ext_modules = cythonize("*.pyx", language='c++'
),
ext_modules = cythonize("*.pyx"
),
)
)
######## a.pyx ########
######## a.pyx ########
# distutils: language = c++
from libcpp.vector cimport vector
from libcpp.vector cimport vector
def use_vector(L):
def use_vector(L):
...
...
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