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
c711c46a
Commit
c711c46a
authored
Mar 29, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix T767 - template specialization leaks into builtin types
parent
058a5e89
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+8
-5
tests/compile/cpp_templates.pyx
tests/compile/cpp_templates.pyx
+4
-0
No files found.
Cython/Compiler/Symtab.py
View file @
c711c46a
...
@@ -412,7 +412,8 @@ class Scope(object):
...
@@ -412,7 +412,8 @@ class Scope(object):
return entry
return entry
def declare_type(self, name, type, pos,
def declare_type(self, name, type, pos,
cname = None, visibility = 'private', api = 0, defining = 1, shadow = 0):
cname = None, visibility = 'private', api = 0, defining = 1,
shadow = 0, template = 0):
# Add an entry for a type definition.
# Add an entry for a type definition.
if not cname:
if not cname:
cname = name
cname = name
...
@@ -422,6 +423,7 @@ class Scope(object):
...
@@ -422,6 +423,7 @@ class Scope(object):
if defining:
if defining:
self.type_entries.append(entry)
self.type_entries.append(entry)
if not template:
type.entry = entry
type.entry = entry
# here we would set as_variable to an object representing this type
# here we would set as_variable to an object representing this type
...
@@ -2054,7 +2056,8 @@ class CppClassScope(Scope):
...
@@ -2054,7 +2056,8 @@ class CppClassScope(Scope):
scope
.
declare_type
(
entry
.
name
,
scope
.
declare_type
(
entry
.
name
,
entry
.
type
.
specialize
(
values
),
entry
.
type
.
specialize
(
values
),
entry
.
pos
,
entry
.
pos
,
entry
.
cname
)
entry
.
cname
,
template
=
1
)
else
:
else
:
# scope.declare_var(entry.name,
# scope.declare_var(entry.name,
# entry.type.specialize(values),
# entry.type.specialize(values),
...
...
tests/compile/cpp_templates.pyx
View file @
c711c46a
# tag: cpp
# tag: cpp
# mode: compile
# mode: compile
# ticket: 767
cdef
extern
from
"templates.h"
:
cdef
extern
from
"templates.h"
:
cdef
cppclass
TemplateTest1
[
T
]:
cdef
cppclass
TemplateTest1
[
T
]:
...
@@ -35,3 +36,6 @@ del b, e
...
@@ -35,3 +36,6 @@ del b, e
ctypedef
TemplateTest1
[
int
]
TemplateTest1_int
ctypedef
TemplateTest1
[
int
]
TemplateTest1_int
cdef
TemplateTest1_int
aa
cdef
TemplateTest1_int
aa
# Verify that T767 is fixed.
cdef
public
int
func
(
int
arg
):
return
arg
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