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
fc537c18
Commit
fc537c18
authored
Jul 27, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'typetype'
parents
702f1f4d
62c275f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+13
-2
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+2
-2
No files found.
Cython/Compiler/Nodes.py
View file @
fc537c18
...
...
@@ -8691,7 +8691,7 @@ class CnameDecoratorNode(StatNode):
e
.
type
.
typeptr_cname
=
self
.
cname
+
'_type'
e
.
type
.
scope
.
namespace_cname
=
e
.
type
.
typeptr_cname
e
.
as_variable
.
cname
=
py_object_type
.
cast_code
(
e
.
type
.
typeptr_cname
)
e
.
as_variable
.
cname
=
e
.
type
.
typeptr_cname
scope
.
scope_prefix
=
self
.
cname
+
"_"
...
...
Cython/Compiler/PyrexTypes.py
View file @
fc537c18
...
...
@@ -985,6 +985,7 @@ class BuiltinObjectType(PyObjectType):
vtabptr_cname
=
None
typedef_flag
=
True
is_external
=
True
decl_type
=
'PyObject'
def
__init__
(
self
,
name
,
cname
,
objstruct_cname
=
None
):
self
.
name
=
name
...
...
@@ -992,6 +993,10 @@ class BuiltinObjectType(PyObjectType):
self
.
typeptr_cname
=
"(&%s)"
%
cname
self
.
objstruct_cname
=
objstruct_cname
self
.
is_gc_simple
=
name
in
builtin_types_that_cannot_create_refcycles
if
name
==
'type'
:
# Special case the type type, as many C API calls (and other
# libraries) actually expect a PyTypeObject* for type arguments.
self
.
decl_type
=
objstruct_cname
def
set_scope
(
self
,
scope
):
self
.
scope
=
scope
...
...
@@ -1079,13 +1084,19 @@ class BuiltinObjectType(PyObjectType):
if
pyrex
or
for_display
:
base_code
=
self
.
name
else
:
base_code
=
public_decl
(
"PyObject"
,
dll_linkage
)
base_code
=
public_decl
(
self
.
decl_type
,
dll_linkage
)
entity_code
=
"*%s"
%
entity_code
return
self
.
base_declaration_code
(
base_code
,
entity_code
)
def
as_pyobject
(
self
,
cname
):
if
self
.
decl_type
==
'PyObject'
:
return
cname
else
:
return
"(PyObject *)"
+
cname
def
cast_code
(
self
,
expr_code
,
to_object_struct
=
False
):
return
"((%s*)%s)"
%
(
to_object_struct
and
self
.
objstruct_cname
or
"PyObject"
,
# self.objstruct_cname may be None
to_object_struct
and
self
.
objstruct_cname
or
self
.
decl_type
,
# self.objstruct_cname may be None
expr_code
)
def
py_type_name
(
self
):
...
...
Cython/Compiler/Symtab.py
View file @
fc537c18
...
...
@@ -948,7 +948,7 @@ class BuiltinScope(Scope):
var_entry
=
Entry
(
name
=
entry
.
name
,
type
=
self
.
lookup
(
'type'
).
type
,
# make sure "type" is the first type declared...
pos
=
entry
.
pos
,
cname
=
"((PyObject*)%s)"
%
entry
.
type
.
typeptr_cname
)
cname
=
entry
.
type
.
typeptr_cname
)
var_entry
.
is_variable
=
1
var_entry
.
is_cglobal
=
1
var_entry
.
is_readonly
=
1
...
...
@@ -1525,7 +1525,7 @@ class ModuleScope(Scope):
var_entry
=
Entry
(
name
=
entry
.
name
,
type
=
Builtin
.
type_type
,
pos
=
entry
.
pos
,
cname
=
"((PyObject*)%s)"
%
entry
.
type
.
typeptr_cname
)
cname
=
entry
.
type
.
typeptr_cname
)
var_entry
.
is_variable
=
1
var_entry
.
is_cglobal
=
1
var_entry
.
is_readonly
=
1
...
...
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