[pypy-svn] r28777 - in pypy/dist/pypy/rpython: lltypesystem ootypesystem test
arigo at codespeak.net
arigo at codespeak.net
Wed Jun 14 17:37:19 CEST 2006
Author: arigo
Date: Wed Jun 14 17:37:18 2006
New Revision: 28777
Modified:
pypy/dist/pypy/rpython/lltypesystem/rpbc.py
pypy/dist/pypy/rpython/ootypesystem/rpbc.py
pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
Fix and test for 'rtype_is_None(none_frozen_pbc_repr)'.
Modified: pypy/dist/pypy/rpython/lltypesystem/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rpbc.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/rpbc.py Wed Jun 14 17:37:18 2006
@@ -12,7 +12,7 @@
AbstractClassesPBCRepr, AbstractMethodsPBCRepr, OverriddenFunctionPBCRepr, \
AbstractMultipleFrozenPBCRepr, MethodOfFrozenPBCRepr, \
AbstractFunctionsPBCRepr, AbstractMultipleUnrelatedFrozenPBCRepr, \
- SingleFrozenPBCRepr
+ SingleFrozenPBCRepr, none_frozen_pbc_repr
from pypy.rpython.lltypesystem import rclass, llmemory
from pypy.tool.sourcetools import has_varargs
@@ -26,6 +26,8 @@
v1 = hop.inputarg(robj1, pos)
cnull = hop.inputconst(llmemory.Address, robj1.null_instance())
return hop.genop('adr_eq', [v1, cnull], resulttype=Bool)
+ elif robj1 == none_frozen_pbc_repr:
+ return hop.inputconst(Bool, True)
else:
raise TyperError('rtype_is_None of %r' % (robj1))
Modified: pypy/dist/pypy/rpython/ootypesystem/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rpbc.py (original)
+++ pypy/dist/pypy/rpython/ootypesystem/rpbc.py Wed Jun 14 17:37:18 2006
@@ -1,7 +1,8 @@
from pypy.rpython.rmodel import CanBeNull, Repr, inputconst
from pypy.rpython.rpbc import AbstractClassesPBCRepr, AbstractMethodsPBCRepr, \
AbstractMultipleFrozenPBCRepr, MethodOfFrozenPBCRepr, \
- AbstractFunctionsPBCRepr, AbstractMultipleUnrelatedFrozenPBCRepr
+ AbstractFunctionsPBCRepr, AbstractMultipleUnrelatedFrozenPBCRepr, \
+ none_frozen_pbc_repr
from pypy.rpython.rclass import rtype_new_instance, getinstancerepr
from pypy.rpython.rpbc import get_concrete_calltable
from pypy.rpython import callparse
@@ -16,6 +17,8 @@
def rtype_is_None(robj1, rnone2, hop, pos=0):
+ if robj1 == none_frozen_pbc_repr:
+ return hop.inputconst(ootype.Bool, True)
v1 = hop.inputarg(robj1, pos)
v2 = hop.genop('oononnull', [v1], resulttype=ootype.Bool)
v3 = hop.genop('bool_not', [v2], resulttype=ootype.Bool)
Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py (original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py Wed Jun 14 17:37:18 2006
@@ -1323,6 +1323,14 @@
res = self.interpret(f, [i, 1000])
assert res == f(i, 1000)
+ def test_None_is_None(self):
+ def g():
+ return None
+ def f():
+ return g() is None
+ res = self.interpret(f, [])
+ assert res == True
+
# We don't care about the following test_hlinvoke tests working on
# ootype. Maybe later. This kind of thing is only used in rdict
More information about the Pypy-commit
mailing list