[pypy-commit] pypy default: fix not_const(s_None)
rlamy
noreply at buildbot.pypy.org
Mon Jun 2 17:28:41 CEST 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch:
Changeset: r71871:6954e1607695
Date: 2014-06-02 16:27 +0100
http://bitbucket.org/pypy/pypy/changeset/6954e1607695/
Log: fix not_const(s_None)
diff --git a/rpython/annotator/model.py b/rpython/annotator/model.py
--- a/rpython/annotator/model.py
+++ b/rpython/annotator/model.py
@@ -675,7 +675,7 @@
def not_const(s_obj):
- if s_obj.is_constant() and not isinstance(s_obj, SomePBC):
+ if s_obj.is_constant() and not isinstance(s_obj, (SomePBC, SomeNone)):
new_s_obj = SomeObject.__new__(s_obj.__class__)
dic = new_s_obj.__dict__ = s_obj.__dict__.copy()
if 'const' in dic:
diff --git a/rpython/annotator/test/test_model.py b/rpython/annotator/test/test_model.py
--- a/rpython/annotator/test/test_model.py
+++ b/rpython/annotator/test/test_model.py
@@ -130,8 +130,9 @@
py.test.raises(AnnotatorError, compile_function, blocked_inference)
-if __name__ == '__main__':
- for name, value in globals().items():
- if name.startswith('test_'):
- value()
-
+def test_not_const():
+ s_int = SomeInteger()
+ s_int.const = 2
+ assert s_int != SomeInteger()
+ assert not_const(s_int) == SomeInteger()
+ assert not_const(s_None) == s_None
More information about the pypy-commit
mailing list