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
0d37e44c
Commit
0d37e44c
authored
May 18, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Intern some identifier names that are likely to be otherwise interned anyway.
parent
b5bafb96
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+3
-4
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
No files found.
Cython/Compiler/ModuleNode.py
View file @
0d37e44c
...
@@ -2375,12 +2375,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2375,12 +2375,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
put_error_if_neg
(
self
.
pos
,
"__Pyx_init_sys_getdefaultencoding_params()"
)
code
.
put_error_if_neg
(
self
.
pos
,
"__Pyx_init_sys_getdefaultencoding_params()"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
__main__name
=
code
.
globalstate
.
get_py_string_const
(
EncodedString
(
"__main__"
),
identifier
=
True
)
code
.
putln
(
"if (%s%s) {"
%
(
Naming
.
module_is_main
,
self
.
full_module_name
.
replace
(
'.'
,
'__'
)))
code
.
putln
(
"if (%s%s) {"
%
(
Naming
.
module_is_main
,
self
.
full_module_name
.
replace
(
'.'
,
'__'
)))
code
.
put_error_if_neg
(
self
.
pos
,
'PyObject_SetAttr
String(%s, "__name__"
, %s)'
%
(
code
.
put_error_if_neg
(
self
.
pos
,
'PyObject_SetAttr
(%s, %s
, %s)'
%
(
env
.
module_cname
,
env
.
module_cname
,
__main__name
.
cname
))
code
.
intern_identifier
(
EncodedString
(
"__name__"
)),
code
.
intern_identifier
(
EncodedString
(
"__main__"
))))
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
# set up __file__ and __path__, then add the module to sys.modules
# set up __file__ and __path__, then add the module to sys.modules
...
...
Cython/Compiler/Nodes.py
View file @
0d37e44c
...
@@ -4908,9 +4908,9 @@ class CClassDefNode(ClassDefNode):
...
@@ -4908,9 +4908,9 @@ class CClassDefNode(ClassDefNode):
# Cython (such as closures), the 'internal'
# Cython (such as closures), the 'internal'
# directive is set by users
# directive is set by users
code
.
putln
(
code
.
putln
(
'if (PyObject_SetAttr
String(%s, "%s"
, (PyObject *)&%s) < 0) %s'
%
(
'if (PyObject_SetAttr
(%s, %s
, (PyObject *)&%s) < 0) %s'
%
(
Naming
.
module_cname
,
Naming
.
module_cname
,
scope
.
class_name
,
code
.
intern_identifier
(
scope
.
class_name
)
,
typeobj_cname
,
typeobj_cname
,
code
.
error_goto
(
entry
.
pos
)))
code
.
error_goto
(
entry
.
pos
)))
weakref_entry
=
scope
.
lookup_here
(
"__weakref__"
)
if
not
scope
.
is_closure_class_scope
else
None
weakref_entry
=
scope
.
lookup_here
(
"__weakref__"
)
if
not
scope
.
is_closure_class_scope
else
None
...
...
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