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
Xavier Thompson
cython
Commits
128eb184
Commit
128eb184
authored
Sep 04, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move final type flag from directives to PyrexType.is_final_type
parent
38e9cde5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
7 deletions
+13
-7
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+2
-2
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+2
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+7
-3
Cython/Compiler/TypeSlots.py
Cython/Compiler/TypeSlots.py
+1
-1
No files found.
Cython/Compiler/Nodes.py
View file @
128eb184
...
...
@@ -3504,7 +3504,7 @@ class CClassDefNode(ClassDefNode):
error
(
self
.
pos
,
"Base class '%s' of type '%s' is incomplete"
%
(
self
.
base_class_name
,
self
.
class_name
))
elif
base_class_entry
.
type
.
scope
and
base_class_entry
.
type
.
scope
.
directives
and
\
base_class_entry
.
type
.
scope
.
directives
[
'final'
]
:
base_class_entry
.
type
.
is_final_type
:
error
(
self
.
pos
,
"Base class '%s' of type '%s' is final"
%
(
self
.
base_class_name
,
self
.
class_name
))
elif
base_class_entry
.
type
.
is_builtin_type
and
\
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
128eb184
...
...
@@ -1944,9 +1944,9 @@ class CreateClosureClasses(CythonTransform):
objstruct_cname
=
'__pyx_Generator_object'
,
typeobj_cname
=
'__pyx_Generator_type'
,
pos
=
pos
,
defining
=
True
,
implementing
=
True
)
entry
.
type
.
is_final_type
=
True
klass
=
entry
.
type
.
scope
klass
.
is_internal
=
True
klass
.
directives
=
{
'final'
:
True
}
body_type
=
PyrexTypes
.
create_typedef_type
(
'generator_body'
,
PyrexTypes
.
c_void_ptr_type
,
...
...
@@ -2042,11 +2042,11 @@ class CreateClosureClasses(CythonTransform):
entry
=
target_module_scope
.
declare_c_class
(
name
=
as_name
,
pos
=
node
.
pos
,
defining
=
True
,
implementing
=
True
,
base_type
=
base_type
)
entry
.
type
.
is_final_type
=
True
func_scope
.
scope_class
=
entry
class_scope
=
entry
.
type
.
scope
class_scope
.
is_internal
=
True
class_scope
.
directives
=
{
'final'
:
True
}
if
from_closure
:
assert
cscope
.
is_closure_scope
...
...
Cython/Compiler/PyrexTypes.py
View file @
128eb184
...
...
@@ -39,6 +39,7 @@ class PyrexType(BaseType):
#
# is_pyobject boolean Is a Python object type
# is_extension_type boolean Is a Python extension type
# is_final_type boolean Is a final extension type
# is_numeric boolean Is a C numeric type
# is_int boolean Is a C integer type
# is_float boolean Is a C floating point type
...
...
@@ -90,6 +91,7 @@ class PyrexType(BaseType):
is_pyobject
=
0
is_unspecified
=
0
is_extension_type
=
0
is_final_type
=
0
is_builtin_type
=
0
is_numeric
=
0
is_int
=
0
...
...
Cython/Compiler/Symtab.py
View file @
128eb184
...
...
@@ -834,7 +834,7 @@ class BuiltinScope(Scope):
scope = CClassScope(name, outer_scope=None, visibility='extern')
scope.directives = {}
if name == 'bool':
scope.directives['final']
= True
type.is_final_type
= True
type.set_scope(scope)
self.type_names[name] = 1
entry = self.declare_type(name, type, None, visibility='extern')
...
...
@@ -1250,6 +1250,9 @@ class ModuleScope(Scope):
error(pos, "Type object name differs from previous declaration")
type.typeobj_cname = typeobj_cname
if self.directives.get('
final
'):
entry.type.is_final_type = True
# cdef classes are always exported, but we need to set it to
# distinguish between unused Cython utility code extension classes
entry.used = True
...
...
@@ -1780,7 +1783,7 @@ class CClassScope(ClassScope):
# Otherwise, subtypes may choose to override the
# method, but the optimisation would prevent the
# subtype method from being called.
if
not
self
.
directives
[
'final'
]
:
if
not
self
.
parent_type
.
is_final_type
:
return
None
return
entry
...
...
@@ -1825,7 +1828,8 @@ class CClassScope(ClassScope):
entry
.
utility_code
=
utility_code
if
u'inline'
in
modifiers
:
entry
.
is_inline_cmethod
=
True
if
self
.
directives
.
get
(
'final'
)
or
entry
.
is_inline_cmethod
:
if
(
self
.
parent_type
.
is_final_type
or
entry
.
is_inline_cmethod
or
self
.
directives
.
get
(
'final'
)):
entry
.
is_final_cmethod
=
True
entry
.
final_func_cname
=
entry
.
func_cname
return
entry
...
...
Cython/Compiler/TypeSlots.py
View file @
128eb184
...
...
@@ -343,7 +343,7 @@ class TypeFlagsSlot(SlotDescriptor):
def
slot_code
(
self
,
scope
):
value
=
"Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER"
if
not
scope
.
directives
[
'final'
]
:
if
not
scope
.
parent_type
.
is_final_type
:
value
+=
"|Py_TPFLAGS_BASETYPE"
if
scope
.
needs_gc
():
value
+=
"|Py_TPFLAGS_HAVE_GC"
...
...
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