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
29676ce1
Commit
29676ce1
authored
Mar 27, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove internal dependancy on included .pxd files
parent
2826c424
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
Cython/Compiler/CythonScope.py
Cython/Compiler/CythonScope.py
+24
-1
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+3
-5
No files found.
Cython/Compiler/CythonScope.py
View file @
29676ce1
...
...
@@ -15,7 +15,7 @@ class CythonScope(ModuleScope):
pos
=
None
,
defining
=
1
,
cname
=
'<error>'
)
def
lookup_type
(
self
,
name
):
# This function should go away when types are all first-level objects.
type
=
parse_basic_type
(
name
)
...
...
@@ -23,4 +23,27 @@ class CythonScope(ModuleScope):
return
type
def
create_cython_scope
(
context
):
create_utility_scope
(
context
)
return
CythonScope
(
context
)
def
create_utility_scope
(
context
):
global
utility_scope
utility_scope
=
ModuleScope
(
u'utility'
,
None
,
context
)
# These are used to optimize isinstance in FinalOptimizePhase
type_object
=
utility_scope
.
declare_typedef
(
'PyTypeObject'
,
base_type
=
c_void_type
,
pos
=
None
,
cname
=
'PyTypeObject'
)
type_object
.
is_void
=
True
utility_scope
.
declare_cfunction
(
'PyObject_TypeCheck'
,
CFuncType
(
c_bint_type
,
[
CFuncTypeArg
(
"o"
,
py_object_type
,
None
),
CFuncTypeArg
(
"t"
,
c_ptr_type
(
type_object
),
None
)]),
pos
=
None
,
defining
=
1
,
cname
=
'PyObject_TypeCheck'
)
return
utility_scope
Cython/Compiler/Optimize.py
View file @
29676ce1
...
...
@@ -640,11 +640,9 @@ class FinalOptimizePhase(Visitor.CythonTransform):
if
node
.
function
.
name
==
'isinstance'
:
type_arg
=
node
.
args
[
1
]
if
type_arg
.
type
.
is_builtin_type
and
type_arg
.
type
.
name
==
'type'
:
object_module
=
self
.
context
.
find_module
(
'python_object'
)
node
.
function
.
entry
=
object_module
.
lookup
(
'PyObject_TypeCheck'
)
if
node
.
function
.
entry
is
None
:
return
node
# only happens when there was an error earlier
from
CythonScope
import
utility_scope
node
.
function
.
entry
=
utility_scope
.
lookup
(
'PyObject_TypeCheck'
)
node
.
function
.
type
=
node
.
function
.
entry
.
type
PyTypeObjectPtr
=
PyrexTypes
.
CPtrType
(
object_modul
e
.
lookup
(
'PyTypeObject'
).
type
)
PyTypeObjectPtr
=
PyrexTypes
.
CPtrType
(
utility_scop
e
.
lookup
(
'PyTypeObject'
).
type
)
node
.
args
[
1
]
=
ExprNodes
.
CastNode
(
node
.
args
[
1
],
PyTypeObjectPtr
)
return
node
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