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
e88a3f0a
Commit
e88a3f0a
authored
Dec 14, 2018
by
Boxiang Sun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test 1
parent
be208c84
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
13 deletions
+21
-13
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-2
test.pyx
test.pyx
+4
-9
test_1.pyx
test_1.pyx
+10
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
e88a3f0a
...
@@ -8778,7 +8778,10 @@ class DictNode(ExprNode):
...
@@ -8778,7 +8778,10 @@ class DictNode(ExprNode):
# pairs are evaluated and used one at a time.
# pairs are evaluated and used one at a time.
code
.
mark_pos
(
self
.
pos
)
code
.
mark_pos
(
self
.
pos
)
import
pdb
;
pdb
.
set_trace
()
import
pdb
;
pdb
.
set_trace
()
self
.
allocate_temp_result
(
code
)
self
.
allocate_temp_result
(
code
)
if
hasattr
(
self
.
type
,
'nogil'
)
and
self
.
type
.
nogil
:
code
.
putln
(
"%s = (struct %s *)malloc(sizeof(struct %s));"
%
(
self
.
result
(),
self
.
type
.
objstruct_cname
,
self
.
type
.
objstruct_cname
))
is_dict
=
self
.
type
.
is_pyobject
is_dict
=
self
.
type
.
is_pyobject
if
is_dict
:
if
is_dict
:
...
...
Cython/Compiler/Nodes.py
View file @
e88a3f0a
...
@@ -5279,7 +5279,7 @@ class SingleAssignmentNode(AssignmentNode):
...
@@ -5279,7 +5279,7 @@ class SingleAssignmentNode(AssignmentNode):
def
analyse_types
(
self
,
env
,
use_temp
=
0
):
def
analyse_types
(
self
,
env
,
use_temp
=
0
):
from
.
import
ExprNodes
from
.
import
ExprNodes
import
pdb
;
pdb
.
set_trace
()
self
.
rhs
=
self
.
rhs
.
analyse_types
(
env
)
self
.
rhs
=
self
.
rhs
.
analyse_types
(
env
)
unrolled_assignment
=
self
.
unroll_rhs
(
env
)
unrolled_assignment
=
self
.
unroll_rhs
(
env
)
...
...
Cython/Compiler/Parsing.py
View file @
e88a3f0a
...
@@ -520,7 +520,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args):
...
@@ -520,7 +520,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args):
]
]
# TODO: implement a faster way to join tuples than creating each one and adding them
# TODO: implement a faster way to join tuples than creating each one and adding them
arg_tuple
=
reduce
(
partial
(
ExprNodes
.
binop_node
,
pos
,
'+'
),
subtuples
)
arg_tuple
=
reduce
(
partial
(
ExprNodes
.
binop_node
,
pos
,
'+'
),
subtuples
)
import
pdb
;
pdb
.
set_trace
()
if
keyword_args
:
if
keyword_args
:
kwargs
=
[]
kwargs
=
[]
dict_items
=
[]
dict_items
=
[]
...
...
Cython/Compiler/PyrexTypes.py
View file @
e88a3f0a
...
@@ -1364,8 +1364,8 @@ class CythonExtensionType(CythonObjectType):
...
@@ -1364,8 +1364,8 @@ class CythonExtensionType(CythonObjectType):
entity_code
=
"*%s"
%
entity_code
entity_code
=
"*%s"
%
entity_code
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
def
literal_code
(
self
,
value
):
#
def literal_code(self, value):
return
'(struct %s *)malloc(sizeof(struct %s))'
%
(
self
.
objstruct_cname
,
self
.
objstruct_cname
)
#
return '(struct %s *)malloc(sizeof(struct %s))' % (self.objstruct_cname, self.objstruct_cname)
def
type_test_code
(
self
,
py_arg
,
notnone
=
False
):
def
type_test_code
(
self
,
py_arg
,
notnone
=
False
):
...
...
test.pyx
View file @
e88a3f0a
...
@@ -53,15 +53,9 @@ cdef class SomeMemory nogil:
...
@@ -53,15 +53,9 @@ cdef class SomeMemory nogil:
It is possible to define native C/Cython methods
It is possible to define native C/Cython methods
that release the GIL (cool...)
that release the GIL (cool...)
"""
"""
self
.
a
=
self
.
b
pass
# self.a = self.b
cdef
void
foo1
(
self
,
double
a
)
nogil
:
"""
It is possible to define native C/Cython methods
that release the GIL (cool...)
"""
self
.
a
=
a
# Not allowed to define pure Python function in the extension type with nogil option now
# Not allowed to define pure Python function in the extension type with nogil option now
# since we want this extension type is CPython free
# since we want this extension type is CPython free
# def baz(self):
# def baz(self):
...
@@ -80,7 +74,8 @@ cdef double bar() nogil: # yet this is what we would like to
...
@@ -80,7 +74,8 @@ cdef double bar() nogil: # yet this is what we would like to
to first introduce the concept of nogil in cdef class
to first introduce the concept of nogil in cdef class
"""
"""
# cdef SomeMemory o = SomeMemory(42.0, 3.14) # for this we need class allocation to handle memory without libpython
# cdef SomeMemory o = SomeMemory(42.0, 3.14) # for this we need class allocation to handle memory without libpython
cdef
SomeMemory
o1
=
SomeMemory
(
1
,
1.0
),
o2
=
SomeMemory
(
2
,
2.0
)
cdef
SomeMemory
o1
=
SomeMemory
(
1
,
1.0
)
cdef
SomeMemory
o2
=
SomeMemory
(
2
,
2.0
)
o1
.
foo
()
o1
.
foo
()
o2
.
foo
()
o2
.
foo
()
# o.foo() # and we need method selection to be independent of libpython
# o.foo() # and we need method selection to be independent of libpython
...
...
test_1.pyx
0 → 100644
View file @
e88a3f0a
cdef
class
Bar
:
cdef
double
a
cdef
double
b
cdef
double
foo
(
self
):
pass
cdef
double
baz
():
cdef
Bar
o1
=
Bar
(
1.0
,
1.0
)
cdef
Bar
o2
=
Bar
(
2.0
,
2.0
)
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