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
24194ab3
Commit
24194ab3
authored
Jun 18, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: always use EncodedString for entry names
parent
1ecd2151
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+17
-17
No files found.
Cython/Compiler/Symtab.py
View file @
24194ab3
...
@@ -796,7 +796,7 @@ class Scope(object):
...
@@ -796,7 +796,7 @@ class Scope(object):
# Declare a shadow default constructor
# Declare a shadow default constructor
wrapper_type
=
PyrexTypes
.
CFuncType
(
entry
.
type
,
[],
nogil
=
1
)
wrapper_type
=
PyrexTypes
.
CFuncType
(
entry
.
type
,
[],
nogil
=
1
)
wrapper_cname
=
"%s__constructor__%s"
%
(
Naming
.
func_prefix
,
name
)
wrapper_cname
=
"%s__constructor__%s"
%
(
Naming
.
func_prefix
,
name
)
wrapper_name
=
"<constructor>"
wrapper_name
=
EncodedString
(
"<constructor>"
)
wrapper_entry
=
scope
.
declare
(
wrapper_name
,
wrapper_cname
,
wrapper_type
,
pos
,
visibility
)
wrapper_entry
=
scope
.
declare
(
wrapper_name
,
wrapper_cname
,
wrapper_type
,
pos
,
visibility
)
wrapper_type
.
entry
=
wrapper_entry
wrapper_type
.
entry
=
wrapper_entry
wrapper_entry
.
is_default
=
1
wrapper_entry
.
is_default
=
1
...
@@ -806,7 +806,7 @@ class Scope(object):
...
@@ -806,7 +806,7 @@ class Scope(object):
# Declare the default __alloc__ method
# Declare the default __alloc__ method
alloc_type
=
PyrexTypes
.
CFuncType
(
entry
.
type
,
[],
nogil
=
1
)
alloc_type
=
PyrexTypes
.
CFuncType
(
entry
.
type
,
[],
nogil
=
1
)
alloc_cname
=
"%s__alloc__%s"
%
(
Naming
.
func_prefix
,
name
)
alloc_cname
=
"%s__alloc__%s"
%
(
Naming
.
func_prefix
,
name
)
alloc_name
=
"<alloc>"
alloc_name
=
EncodedString
(
"<alloc>"
)
alloc_entry
=
scope
.
declare
(
alloc_name
,
alloc_cname
,
alloc_type
,
pos
,
visibility
)
alloc_entry
=
scope
.
declare
(
alloc_name
,
alloc_cname
,
alloc_type
,
pos
,
visibility
)
alloc_type
.
entry
=
alloc_entry
alloc_type
.
entry
=
alloc_entry
# alloc_entry.is_inherited = 1
# alloc_entry.is_inherited = 1
...
@@ -820,27 +820,27 @@ class Scope(object):
...
@@ -820,27 +820,27 @@ class Scope(object):
# Declare activated class
# Declare activated class
act_scope
=
CppClassScope
(
"Activated"
,
scope
)
act_scope
=
CppClassScope
(
"Activated"
,
scope
)
act_type
=
PyrexTypes
.
CypClassType
(
act_type
=
PyrexTypes
.
CypClassType
(
"Activated"
,
act_scope
,
"Activated"
,
None
,
templates
=
templates
,
lock_mode
=
entry
.
type
.
lock_mode
)
EncodedString
(
"Activated"
)
,
act_scope
,
"Activated"
,
None
,
templates
=
templates
,
lock_mode
=
entry
.
type
.
lock_mode
)
act_type
.
set_scope
(
act_scope
)
act_type
.
set_scope
(
act_scope
)
act_type
.
namespace
=
entry
.
type
act_type
.
namespace
=
entry
.
type
#scope.declare_cpp_class("Activated", act_scope, pos)
#scope.declare_cpp_class("Activated", act_scope, pos)
act_entry
=
scope
.
declare
(
"Activated"
,
"Activated"
,
act_type
,
pos
,
visibility
)
act_entry
=
scope
.
declare
(
EncodedString
(
"Activated"
)
,
"Activated"
,
act_type
,
pos
,
visibility
)
act_entry
.
is_type
=
1
act_entry
.
is_type
=
1
# Declaring active_self member and activate function (its definition is generated automatically)
# Declaring active_self member and activate function (its definition is generated automatically)
act_attr_name
=
Naming
.
builtin_prefix
+
"_active_self"
act_attr_name
=
EncodedString
(
Naming
.
builtin_prefix
+
"_active_self"
)
scope
.
declare_var
(
"<active_self>"
,
act_type
,
pos
,
cname
=
act_attr_name
)
scope
.
declare_var
(
EncodedString
(
"<active_self>"
)
,
act_type
,
pos
,
cname
=
act_attr_name
)
from
.
import
Builtin
from
.
import
Builtin
queue_type
=
Builtin
.
acthon_queue_type
queue_type
=
Builtin
.
acthon_queue_type
result_type
=
Builtin
.
acthon_result_type
result_type
=
Builtin
.
acthon_result_type
queue_arg
=
PyrexTypes
.
CFuncTypeArg
(
"queue"
,
queue_type
,
pos
)
queue_arg
=
PyrexTypes
.
CFuncTypeArg
(
EncodedString
(
"queue"
)
,
queue_type
,
pos
)
result_type
=
PyrexTypes
.
CPtrType
(
PyrexTypes
.
CFuncType
(
result_type
,
[],
nogil
=
1
))
result_type
=
PyrexTypes
.
CPtrType
(
PyrexTypes
.
CFuncType
(
result_type
,
[],
nogil
=
1
))
result_arg
=
PyrexTypes
.
CFuncTypeArg
(
"result"
,
result_type
,
pos
)
result_arg
=
PyrexTypes
.
CFuncTypeArg
(
EncodedString
(
"result"
)
,
result_type
,
pos
)
activate_type
=
PyrexTypes
.
CFuncType
(
act_type
,
[
queue_arg
,
result_arg
],
nogil
=
1
,
optional_arg_count
=
2
)
activate_type
=
PyrexTypes
.
CFuncType
(
act_type
,
[
queue_arg
,
result_arg
],
nogil
=
1
,
optional_arg_count
=
2
)
# HACK !!! This is a dirty duplication of Nodes.CFuncDeclaratorNode.declare_optional_arg_struct
# HACK !!! This is a dirty duplication of Nodes.CFuncDeclaratorNode.declare_optional_arg_struct
def
declare_opt_arg_struct
(
func_type
,
name
,
env
,
pos
):
def
declare_opt_arg_struct
(
func_type
,
name
,
env
,
pos
):
scope
=
StructOrUnionScope
()
scope
=
StructOrUnionScope
()
arg_count_member
=
'%sn'
%
Naming
.
pyrex_prefix
arg_count_member
=
EncodedString
(
'%sn'
%
Naming
.
pyrex_prefix
)
scope
.
declare_var
(
arg_count_member
,
PyrexTypes
.
c_int_type
,
pos
)
scope
.
declare_var
(
arg_count_member
,
PyrexTypes
.
c_int_type
,
pos
)
for
arg
in
func_type
.
args
[
len
(
func_type
.
args
)
-
func_type
.
optional_arg_count
:]:
for
arg
in
func_type
.
args
[
len
(
func_type
.
args
)
-
func_type
.
optional_arg_count
:]:
...
@@ -849,7 +849,7 @@ class Scope(object):
...
@@ -849,7 +849,7 @@ class Scope(object):
struct_cname
=
env
.
mangle
(
Naming
.
opt_arg_prefix
,
name
)
struct_cname
=
env
.
mangle
(
Naming
.
opt_arg_prefix
,
name
)
op_args_struct
=
env
.
global_scope
().
declare_struct_or_union
(
op_args_struct
=
env
.
global_scope
().
declare_struct_or_union
(
name
=
struct_cname
,
name
=
EncodedString
(
struct_cname
)
,
kind
=
'struct'
,
kind
=
'struct'
,
scope
=
scope
,
scope
=
scope
,
typedef_flag
=
0
,
typedef_flag
=
0
,
...
@@ -863,7 +863,7 @@ class Scope(object):
...
@@ -863,7 +863,7 @@ class Scope(object):
declare_opt_arg_struct
(
activate_type
,
name
,
self
,
pos
)
declare_opt_arg_struct
(
activate_type
,
name
,
self
,
pos
)
activate_entry
=
scope
.
declare
(
"__activate__"
,
"__activate__"
,
activate_type
,
None
,
'extern'
)
activate_entry
=
scope
.
declare
(
EncodedString
(
"__activate__"
)
,
"__activate__"
,
activate_type
,
None
,
'extern'
)
activate_entry
.
is_variable
=
activate_entry
.
is_cfunction
=
1
activate_entry
.
is_variable
=
activate_entry
.
is_cfunction
=
1
activate_entry
.
func_cname
=
"%s::%s"
%
(
entry
.
type
.
empty_declaration_code
(),
"__activate__"
)
activate_entry
.
func_cname
=
"%s::%s"
%
(
entry
.
type
.
empty_declaration_code
(),
"__activate__"
)
...
@@ -2789,9 +2789,9 @@ class CppClassScope(Scope):
...
@@ -2789,9 +2789,9 @@ class CppClassScope(Scope):
if
not
return_type
:
if
not
return_type
:
return_type
=
self
.
type
return_type
=
self
.
type
class_type
=
self
.
parent_type
class_type
=
self
.
parent_type
class_name
=
self
.
name
.
split
(
'::'
)[
-
1
]
class_name
=
EncodedString
(
self
.
name
.
split
(
'::'
)[
-
1
])
wrapper_cname
=
"%s__constructor__%s"
%
(
Naming
.
func_prefix
,
class_name
)
wrapper_cname
=
"%s__constructor__%s"
%
(
Naming
.
func_prefix
,
class_name
)
wrapper_name
=
"<constructor>"
wrapper_name
=
EncodedString
(
"<constructor>"
)
wrapper_type
=
PyrexTypes
.
CFuncType
(
return_type
,
args
,
nogil
=
1
,
wrapper_type
=
PyrexTypes
.
CFuncType
(
return_type
,
args
,
nogil
=
1
,
has_varargs
=
has_varargs
,
has_varargs
=
has_varargs
,
optional_arg_count
=
optional_arg_count
)
optional_arg_count
=
optional_arg_count
)
...
@@ -2808,7 +2808,7 @@ class CppClassScope(Scope):
...
@@ -2808,7 +2808,7 @@ class CppClassScope(Scope):
if
entry
.
type
.
has_varargs
:
if
entry
.
type
.
has_varargs
:
error
(
entry
.
pos
,
"Could not reify method with ellipsis (you can use optional arguments)"
)
error
(
entry
.
pos
,
"Could not reify method with ellipsis (you can use optional arguments)"
)
# Create the reifying class
# Create the reifying class
reified_name
=
"reified_"
+
entry
.
name
reified_name
=
EncodedString
(
"reified_"
+
entry
.
name
)
reified_cname
=
Naming
.
builtin_prefix
+
reified_name
reified_cname
=
Naming
.
builtin_prefix
+
reified_name
scope
=
CppClassScope
(
reified_name
,
self
)
scope
=
CppClassScope
(
reified_name
,
self
)
reified_type
=
PyrexTypes
.
CypClassType
(
reified_name
,
scope
,
reified_cname
,
None
,
templates
=
None
,
lock_mode
=
"nolock"
)
reified_type
=
PyrexTypes
.
CypClassType
(
reified_name
,
scope
,
reified_cname
,
None
,
templates
=
None
,
lock_mode
=
"nolock"
)
...
@@ -2911,7 +2911,7 @@ class CppClassScope(Scope):
...
@@ -2911,7 +2911,7 @@ class CppClassScope(Scope):
elif
name
==
'__alloc__'
and
self
.
type
.
is_cyp_class
:
elif
name
==
'__alloc__'
and
self
.
type
.
is_cyp_class
:
reify
=
False
reify
=
False
cname
=
"%s__alloc__%s"
%
(
Naming
.
func_prefix
,
class_name
)
cname
=
"%s__alloc__%s"
%
(
Naming
.
func_prefix
,
class_name
)
name
=
'<alloc>'
name
=
EncodedString
(
'<alloc>'
)
elif
name
==
'__new__'
and
self
.
type
.
is_cyp_class
:
elif
name
==
'__new__'
and
self
.
type
.
is_cyp_class
:
reify
=
False
reify
=
False
if
name
in
self
.
entries
:
if
name
in
self
.
entries
:
...
@@ -2931,13 +2931,13 @@ class CppClassScope(Scope):
...
@@ -2931,13 +2931,13 @@ class CppClassScope(Scope):
operator
=
self
.
operator_table
.
get
(
name
,
None
)
operator
=
self
.
operator_table
.
get
(
name
,
None
)
if
operator
:
if
operator
:
reify
=
False
reify
=
False
name
=
'operator'
+
operator
name
=
EncodedString
(
'operator'
+
operator
)
elif
name
.
startswith
(
'__'
)
and
name
.
endswith
(
'__'
):
elif
name
.
startswith
(
'__'
)
and
name
.
endswith
(
'__'
):
stripped_name
=
name
[
2
:
-
2
]
stripped_name
=
name
[
2
:
-
2
]
as_operator_name
=
self
.
_as_type_operator
(
stripped_name
)
as_operator_name
=
self
.
_as_type_operator
(
stripped_name
)
if
as_operator_name
:
if
as_operator_name
:
reify
=
False
reify
=
False
name
=
'operator '
+
as_operator_name
name
=
EncodedString
(
'operator '
+
as_operator_name
)
type
.
args
=
[]
type
.
args
=
[]
if
name
in
(
'<init>'
,
'<del>'
)
and
type
.
nogil
:
if
name
in
(
'<init>'
,
'<del>'
)
and
type
.
nogil
:
...
...
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