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
6b8a3e9b
Commit
6b8a3e9b
authored
May 22, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduction of tristate lock mode
parent
a0c15ac2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
5 deletions
+22
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+12
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+6
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-2
No files found.
Cython/Compiler/Nodes.py
View file @
6b8a3e9b
...
...
@@ -1522,7 +1522,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
error
(
self
.
pos
,
"Required template parameters must precede optional template parameters."
)
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
None
,
self
.
pos
,
self
.
cname
,
base_classes
=
[],
visibility
=
self
.
visibility
,
templates
=
template_types
,
cypclass
=
self
.
cypclass
)
base_classes
=
[],
visibility
=
self
.
visibility
,
templates
=
template_types
,
cypclass
=
self
.
cypclass
,
lock_mode
=
self
.
lock_mode
)
def
analyse_declarations
(
self
,
env
):
if
self
.
templates
is
None
:
...
...
@@ -1549,7 +1549,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
base_class_types
=
filter
(
base_ok
,
base_types_list
)
self
.
entry
=
env
.
declare_cpp_class
(
self
.
name
,
scope
,
self
.
pos
,
self
.
cname
,
base_class_types
,
visibility
=
self
.
visibility
,
templates
=
template_types
,
cypclass
=
self
.
cypclass
)
self
.
cname
,
base_class_types
,
visibility
=
self
.
visibility
,
templates
=
template_types
,
cypclass
=
self
.
cypclass
,
lock_mode
=
self
.
lock_mode
)
if
self
.
entry
is
None
:
return
self
.
entry
.
is_cpp_class
=
1
...
...
Cython/Compiler/Parsing.py
View file @
6b8a3e9b
...
...
@@ -3797,6 +3797,9 @@ def p_cpp_class_definition(s, pos, ctx):
if
s
.
sy
==
'['
:
error
(
s
.
position
(),
"Name options not allowed for C++ class"
)
nogil
=
p_nogil
(
s
)
or
cypclass
lock_mode
=
None
if
cypclass
:
lock_mode
=
p_cypclass_lock_mode
(
s
)
if
s
.
sy
==
':'
:
s
.
next
()
s
.
expect
(
'NEWLINE'
)
...
...
@@ -3822,7 +3825,7 @@ def p_cpp_class_definition(s, pos, ctx):
visibility
=
ctx
.
visibility
,
in_pxd
=
ctx
.
level
==
'module_pxd'
,
attributes
=
attributes
,
templates
=
templates
,
cypclass
=
cypclass
)
templates
=
templates
,
cypclass
=
cypclass
,
lock_mode
=
lock_mode
)
def
p_cpp_class_attribute
(
s
,
ctx
):
decorators
=
None
...
...
@@ -3848,6 +3851,14 @@ def p_cpp_class_attribute(s, ctx):
node
.
decorators
=
decorators
return
node
def
p_cypclass_lock_mode
(
s
):
if
s
.
sy
==
'IDENT'
and
s
.
systring
in
(
'nolock'
,
'checklock'
,
'autolock'
):
mode
=
s
.
systring
s
.
next
()
return
mode
else
:
return
None
#----------------------------------------------
#
...
...
Cython/Compiler/PyrexTypes.py
View file @
6b8a3e9b
...
...
@@ -3896,8 +3896,14 @@ class CppClassType(CType):
class
CypClassType
(
CppClassType
):
# lock_mode string (tri-state: "nolock"/"checklock"/"autolock")
is_cyp_class
=
1
def
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
=
None
,
template_type
=
None
,
nogil
=
0
,
lock_mode
=
None
):
CppClassType
.
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
,
template_type
,
nogil
)
self
.
lock_mode
=
lock_mode
if
lock_mode
else
"checklock"
def
empty_declaration_code
(
self
):
if
self
.
_empty_declaration
is
None
:
self
.
_empty_declaration
=
self
.
declaration_code
(
''
,
deref
=
1
)
...
...
Cython/Compiler/Symtab.py
View file @
6b8a3e9b
...
...
@@ -600,7 +600,7 @@ class Scope(object):
def
declare_cpp_class
(
self
,
name
,
scope
,
pos
,
cname
=
None
,
base_classes
=
(),
visibility
=
'extern'
,
templates
=
None
,
cypclass
=
0
):
visibility
=
'extern'
,
templates
=
None
,
cypclass
=
0
,
lock_mode
=
None
):
if
cname
is
None
:
if
self
.
in_cinclude
or
(
visibility
!=
'private'
):
cname
=
name
...
...
@@ -611,7 +611,7 @@ class Scope(object):
if
not
entry
:
if
cypclass
:
type
=
PyrexTypes
.
CypClassType
(
name
,
scope
,
cname
,
base_classes
,
templates
=
templates
)
name
,
scope
,
cname
,
base_classes
,
templates
=
templates
,
lock_mode
=
lock_mode
)
else
:
type
=
PyrexTypes
.
CppClassType
(
name
,
scope
,
cname
,
base_classes
,
templates
=
templates
)
...
...
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