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
Gwenaël Samain
cython
Commits
a0a851b2
Commit
a0a851b2
authored
Nov 18, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor code cleanups for metaclass patch
parent
2f58a1f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
24 deletions
+5
-24
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-23
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+1
-1
No files found.
Cython/Compiler/ExprNodes.py
View file @
a0a851b2
...
...
@@ -4593,14 +4593,14 @@ class Py3ClassNode(ExprNode):
def
analyse_types
(
self
,
env
):
self
.
type
=
py_object_type
self
.
is_temp
=
1
env
.
use_utility_code
(
create_py3class_utility_code
);
def
may_be_none
(
self
):
return
True
gil_message
=
"Constructing Python
3+
class"
gil_message
=
"Constructing Python class"
def
generate_result_code
(
self
,
code
):
code
.
globalstate
.
use_utility_code
(
create_py3class_utility_code
)
cname
=
code
.
intern_identifier
(
self
.
name
)
code
.
putln
(
'%s = __Pyx_Py3ClassCreate(%s, %s, %s, %s, %s); %s'
%
(
...
...
@@ -4643,13 +4643,13 @@ class KeywordArgsNode(ExprNode):
if
self
.
keyword_args
:
code
.
putln
(
"%s = %s;"
%
(
self
.
result
(),
self
.
keyword_args
.
result
()))
code
.
put_incref
(
self
.
keyword_args
.
result
(),
self
.
keyword_args
.
ctype
())
code
.
put_giveref
(
self
.
keyword_args
.
result
())
elif
self
.
starstar_arg
:
code
.
putln
(
"%s = PyDict_Copy(%s); %s"
%
(
self
.
result
(),
self
.
starstar_arg
.
py_result
(),
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
code
.
put_gotref
(
self
.
py_result
())
else
:
code
.
putln
(
"%s = PyDict_New(); %s"
%
(
...
...
@@ -4657,25 +4657,6 @@ class KeywordArgsNode(ExprNode):
code
.
error_goto_if_null
(
self
.
result
(),
self
.
pos
)))
code
.
put_gotref
(
self
.
py_result
())
class
PyClassBasesNode
(
ExprNode
):
# Helper class that holds bases for python3 class
# Actually hack to make `bases` visible across other nondes
#
# bases ExprNode Base class tuple
subexprs
=
[
'bases'
]
type
=
py_object_type
is_temp
=
True
def
analyse_types
(
self
,
env
):
self
.
bases
.
analyse_types
(
env
)
def
generate_result_code
(
self
,
code
):
code
.
putln
(
"%s = %s;"
%
(
self
.
result
(),
self
.
bases
.
result
()))
code
.
put_incref
(
self
.
bases
.
result
(),
self
.
bases
.
ctype
())
code
.
put_giveref
(
self
.
bases
.
result
())
code
.
put_gotref
(
self
.
py_result
())
class
PyClassMetaclassNode
(
ExprNode
):
# Helper class holds Python3 metaclass object
#
...
...
Cython/Compiler/Nodes.py
View file @
a0a851b2
...
...
@@ -2958,7 +2958,7 @@ class PyClassDefNode(ClassDefNode):
doc_node
=
None
if
keyword_args
or
starstar_arg
:
self
.
py3_style_class
=
True
self
.
bases
=
ExprNodes
.
PyClassBasesNode
(
pos
,
bases
=
bases
)
self
.
bases
=
bases
self
.
mkw
=
ExprNodes
.
KeywordArgsNode
(
pos
,
keyword_args
=
keyword_args
,
starstar_arg
=
starstar_arg
)
self
.
metaclass
=
ExprNodes
.
PyClassMetaclassNode
(
pos
,
mkw
=
self
.
mkw
,
bases
=
self
.
bases
)
...
...
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