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
Boxiang Sun
cython
Commits
486421f6
Commit
486421f6
authored
Feb 14, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into readonly_buffers
parents
3efa9f9a
969dbad1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
9 deletions
+27
-9
CHANGES.rst
CHANGES.rst
+4
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-4
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+4
-3
Cython/Utility/Buffer.c
Cython/Utility/Buffer.c
+2
-2
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ModuleSetupCode.c
+10
-0
Tools/cython-mode.el
Tools/cython-mode.el
+2
-0
No files found.
CHANGES.rst
View file @
486421f6
...
...
@@ -8,6 +8,10 @@ Cython Changelog
Features added
--------------
* When compiling with gcc, the module init function is now tuned for small
code size instead of whatever compile flags were provided externally.
(Github issue #2102)
* Cdef classes can now multiply inherit from ordinary Python classes.
(The primary base must still be a c class, possibly ``object``, and
the other bases must *not* be cdef classes.)
...
...
Cython/Compiler/ExprNodes.py
View file @
486421f6
...
...
@@ -7765,10 +7765,10 @@ class TupleNode(SequenceNode):
if
self
.
mult_factor
or
not
self
.
args
:
return
tuple_type
arg_types
=
[
arg
.
infer_type
(
env
)
for
arg
in
self
.
args
]
if
any
(
type
.
is_pyobject
or
type
.
is_unspecified
or
type
.
is_fused
for
type
in
arg_types
):
if
any
(
type
.
is_pyobject
or
type
.
is_memoryviewslice
or
type
.
is_unspecified
or
type
.
is_fused
for
type
in
arg_types
):
return
tuple_type
else
:
return
env
.
declare_tuple_type
(
self
.
pos
,
arg_types
).
type
return
env
.
declare_tuple_type
(
self
.
pos
,
arg_types
).
type
def
analyse_types
(
self
,
env
,
skip_children
=
False
):
if
len
(
self
.
args
)
==
0
:
...
...
@@ -7782,7 +7782,8 @@ class TupleNode(SequenceNode):
arg
.
starred_expr_allowed_here
=
True
self
.
args
[
i
]
=
arg
.
analyse_types
(
env
)
if
(
not
self
.
mult_factor
and
not
any
((
arg
.
is_starred
or
arg
.
type
.
is_pyobject
or
arg
.
type
.
is_fused
)
for
arg
in
self
.
args
)):
not
any
((
arg
.
is_starred
or
arg
.
type
.
is_pyobject
or
arg
.
type
.
is_memoryviewslice
or
arg
.
type
.
is_fused
)
for
arg
in
self
.
args
)):
self
.
type
=
env
.
declare_tuple_type
(
self
.
pos
,
(
arg
.
type
for
arg
in
self
.
args
)).
type
self
.
is_temp
=
1
return
self
...
...
Cython/Compiler/ModuleNode.py
View file @
486421f6
...
...
@@ -2279,10 +2279,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
header2
=
"__Pyx_PyMODINIT_FUNC init%s(void)"
%
env
.
module_name
header3
=
"__Pyx_PyMODINIT_FUNC %s(void)"
%
self
.
mod_init_func_cname
(
'PyInit'
,
env
)
code
.
putln
(
"#if PY_MAJOR_VERSION < 3"
)
code
.
putln
(
"%s; /*proto*/"
%
header2
)
# Optimise for small code size as the module init function is only executed once.
code
.
putln
(
"%s CYTHON_SMALL_CODE; /*proto*/"
%
header2
)
code
.
putln
(
header2
)
code
.
putln
(
"#else"
)
code
.
putln
(
"%s; /*proto*/"
%
header3
)
code
.
putln
(
"%s
CYTHON_SMALL_CODE
; /*proto*/"
%
header3
)
code
.
putln
(
header3
)
# CPython 3.5+ supports multi-phase module initialisation (gives access to __spec__, __file__, etc.)
...
...
@@ -2296,7 +2297,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
""
)
# main module init code lives in Py_mod_exec function, not in PyInit function
code
.
putln
(
"static int %s(PyObject *%s)"
%
(
code
.
putln
(
"static int %s(PyObject *%s)
CYTHON_SMALL_CODE
"
%
(
self
.
mod_init_func_cname
(
Naming
.
pymodule_exec_func_cname
,
env
),
Naming
.
pymodinit_module_arg
))
code
.
putln
(
"#endif"
)
# PEP489
...
...
Cython/Utility/Buffer.c
View file @
486421f6
...
...
@@ -751,7 +751,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
__Pyx_BufFmt_RaiseUnexpectedChar
(
'Z'
);
return
NULL
;
}
/* fall through */
CYTHON_FALLTHROUGH
;
case
'c'
:
case
'b'
:
case
'B'
:
case
'h'
:
case
'H'
:
case
'i'
:
case
'I'
:
case
'l'
:
case
'L'
:
case
'q'
:
case
'Q'
:
case
'f'
:
case
'd'
:
case
'g'
:
...
...
@@ -765,7 +765,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha
++
ts
;
break
;
}
/* fall through */
CYTHON_FALLTHROUGH
;
case
's'
:
/* 's' or new type (cannot be added to current pool) */
if
(
__Pyx_BufFmt_ProcessTypeChunk
(
ctx
)
==
-
1
)
return
NULL
;
...
...
Cython/Utility/ModuleSetupCode.c
View file @
486421f6
...
...
@@ -665,6 +665,16 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
#endif
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
#define CYTHON_SMALL_CODE
#elif defined(__GNUC__)
#define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
#else
#define CYTHON_SMALL_CODE
#endif
#endif
/////////////// FastTypeChecks.proto ///////////////
...
...
Tools/cython-mode.el
View file @
486421f6
;;; cython-mode.el --- Major mode for editing Cython files
;; License: Apache-2.0
;;; Commentary:
;; This should work with python-mode.el as well as either the new
...
...
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