projects
/
platform
/
upstream
/
python-cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8aa091c
)
make CallNode a little smarter about when the return value can be None
author
Stefan Behnel
<stefan_ml@behnel.de>
Mon, 16 Dec 2013 18:08:53 +0000
(19:08 +0100)
committer
Stefan Behnel
<stefan_ml@behnel.de>
Mon, 16 Dec 2013 18:08:53 +0000
(19:08 +0100)
Cython/Compiler/ExprNodes.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/ExprNodes.py
b/Cython/Compiler/ExprNodes.py
index
4f75668
..
0185019
100644
(file)
--- a/
Cython/Compiler/ExprNodes.py
+++ b/
Cython/Compiler/ExprNodes.py
@@
-4230,6
+4230,14
@@
class CallNode(ExprNode):
def may_be_none(self):
if self.may_return_none is not None:
return self.may_return_none
+ func_type = self.function.type
+ if func_type is type_type and self.function.is_name:
+ entry = self.function.entry
+ if entry.type.is_extension_type:
+ return False
+ if (entry.type.is_builtin_type and
+ entry.name in Builtin.types_that_construct_their_instance):
+ return False
return ExprNode.may_be_none(self)
def analyse_as_type_constructor(self, env):