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
14d0d75e
Commit
14d0d75e
authored
Sep 10, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#286, make sure cdef classes fully defined in pxd
parent
25a506e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+2
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+4
-0
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+19
-2
No files found.
Cython/Compiler/Main.py
View file @
14d0d75e
...
...
@@ -85,7 +85,7 @@ class Context(object):
from
Optimize
import
FlattenInListTransform
,
SwitchTransform
,
IterationTransform
from
Optimize
import
FlattenBuiltinTypeCreation
,
ConstantFolding
,
FinalOptimizePhase
from
Buffer
import
IntroduceBufferAuxiliaryVars
from
ModuleNode
import
check_c_declarations
from
ModuleNode
import
check_c_declarations
,
check_c_declarations_pxd
# Temporary hack that can be used to ensure that all result_code's
# are generated at code generation time.
...
...
@@ -97,7 +97,7 @@ class Context(object):
return
node
if
pxd
:
_check_c_declarations
=
None
_check_c_declarations
=
check_c_declarations_pxd
_specific_post_parse
=
PxdPostParse
(
self
)
else
:
_check_c_declarations
=
check_c_declarations
...
...
Cython/Compiler/ModuleNode.py
View file @
14d0d75e
...
...
@@ -27,6 +27,10 @@ from Cython.Utils import open_new_file, replace_suffix, UtilityCode
from
StringEncoding
import
escape_byte_string
,
EncodedString
def
check_c_declarations_pxd
(
module_node
):
module_node
.
scope
.
check_c_classes_pxd
()
return
module_node
def
check_c_declarations
(
module_node
):
module_node
.
scope
.
check_c_classes
()
module_node
.
scope
.
check_c_functions
()
...
...
Cython/Compiler/Symtab.py
View file @
14d0d75e
...
...
@@ -1114,6 +1114,22 @@ class ModuleScope(Scope):
type.vtabstruct_cname = self.mangle(Naming.vtabstruct_prefix, entry.name)
type.vtabptr_cname = self.mangle(Naming.vtabptr_prefix, entry.name)
def check_c_classes_pxd(self):
# Performs post-analysis checking and finishing up of extension types
# being implemented in this module. This is called only for the .pxd.
#
# Checks all extension types declared in this scope to
# make sure that:
#
# * The extension type is fully declared
#
# Also allocates a name for the vtable if needed.
#
for entry in self.c_class_entries:
# Check defined
if not entry.type.scope:
error(entry.pos, "C class '
%
s
' is declared but not defined" % entry.name)
def check_c_classes(self):
# Performs post-analysis checking and finishing up of extension types
# being implemented in this module. This is called only for the main
...
...
@@ -1389,7 +1405,8 @@ class CClassScope(ClassScope):
# If the type or any of its base types have Python-valued
# C attributes, then it needs to participate in GC.
return
self
.
has_pyobject_attrs
or
\
(
self
.
parent_type
.
base_type
and
\
(
self
.
parent_type
.
base_type
and
self
.
parent_type
.
base_type
.
scope
is
not
None
and
self
.
parent_type
.
base_type
.
scope
.
needs_gc
())
def
declare_var
(
self
,
name
,
type
,
pos
,
...
...
@@ -1399,7 +1416,7 @@ class CClassScope(ClassScope):
if
self
.
defined
:
error
(
pos
,
"C attributes cannot be added in implementation part of"
" extension type"
)
" extension type
defined in a pxd
"
)
if
get_special_method_signature
(
name
):
error
(
pos
,
"The name '%s' is reserved for a special method."
...
...
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