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
a96ee49b
Commit
a96ee49b
authored
Aug 09, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merged in changes from cython-release branch
parents
9255da38
35f59b76
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
6 deletions
+30
-6
Cython/Compiler/UtilNodes.py
Cython/Compiler/UtilNodes.py
+13
-2
setup.py
setup.py
+3
-4
tests/run/isinstance.pyx
tests/run/isinstance.pyx
+14
-0
No files found.
Cython/Compiler/UtilNodes.py
View file @
a96ee49b
...
...
@@ -186,8 +186,8 @@ class LetNodeMixin:
def
setup_temp_expr
(
self
,
code
):
self
.
temp_expression
.
generate_evaluation_code
(
code
)
self
.
_result_in_temp
=
self
.
temp_expression
.
result_in_temp
()
self
.
temp_type
=
self
.
temp_expression
.
type
self
.
_result_in_temp
=
self
.
temp_expression
.
result_in_temp
()
if
self
.
_result_in_temp
:
self
.
temp
=
self
.
temp_expression
.
result
()
else
:
...
...
@@ -195,10 +195,15 @@ class LetNodeMixin:
self
.
temp
=
code
.
funcstate
.
allocate_temp
(
self
.
temp_type
,
manage_ref
=
True
)
code
.
putln
(
"%s = %s;"
%
(
self
.
temp
,
self
.
temp_expression
.
result
()))
self
.
temp_expression
.
generate_disposal_code
(
code
)
self
.
temp_expression
.
free_temps
(
code
)
self
.
lazy_temp
.
result_code
=
self
.
temp
def
teardown_temp_expr
(
self
,
code
):
if
not
self
.
_result_in_temp
:
if
self
.
_result_in_temp
:
self
.
temp_expression
.
generate_disposal_code
(
code
)
self
.
temp_expression
.
free_temps
(
code
)
else
:
if
self
.
temp_type
.
is_pyobject
:
code
.
put_decref_clear
(
self
.
temp
,
self
.
temp_type
)
code
.
funcstate
.
release_temp
(
self
.
temp
)
...
...
@@ -227,6 +232,12 @@ class EvalWithTempExprNode(ExprNodes.ExprNode, LetNodeMixin):
self
.
subexpression
.
analyse_types
(
env
)
self
.
type
=
self
.
subexpression
.
type
def
free_subexpr_temps
(
self
,
code
):
self
.
subexpression
.
free_temps
(
code
)
def
generate_subexpr_disposal_code
(
self
,
code
):
self
.
subexpression
.
generate_disposal_code
(
code
)
def
generate_evaluation_code
(
self
,
code
):
self
.
setup_temp_expr
(
code
)
self
.
subexpression
.
generate_evaluation_code
(
code
)
...
...
setup.py
View file @
a96ee49b
...
...
@@ -6,10 +6,9 @@ import sys
if
'sdist'
in
sys
.
argv
and
sys
.
platform
!=
"win32"
and
sys
.
version_info
>=
(
2
,
4
):
# Record the current revision in .hgrev
import
subprocess
# os.popen is cleaner but deprecated
changset
=
subprocess
.
Popen
(
"hg log --rev tip | grep changeset"
,
shell
=
True
,
changeset
=
subprocess
.
Popen
(
"hg identify --id --rev tip"
.
split
(),
stdout
=
subprocess
.
PIPE
).
stdout
.
read
()
rev
=
chang
set
.
decode
(
'ISO-8859-1'
).
split
(
':'
)[
-
1
]
.
strip
()
rev
=
chang
eset
.
decode
(
'ISO-8859-1'
)
.
strip
()
hgrev
=
open
(
'.hgrev'
,
'w'
)
hgrev
.
write
(
rev
)
hgrev
.
close
()
...
...
tests/run/isinstance.pyx
View file @
a96ee49b
...
...
@@ -73,3 +73,17 @@ def test_custom():
"""
assert
isinstance
(
A
(),
A
)
return
True
def
test_nested
(
x
):
"""
>>> test_nested(1)
True
>>> test_nested(1.5)
True
>>> test_nested("a")
False
"""
cdef
object
a
=
(
x
,
None
)
if
isinstance
(
a
[
0
],
(
int
,
float
)):
return
True
return
False
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