Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r62711:cfea548f0f8c
Date: 2013-03-23 15:35 -0700
http://bitbucket.org/pypy/pypy/changeset/cfea548f0f8c/
Log: (alex, fijal): removed pointless boxing/unboxing of bools
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -913,7 +913,7 @@
if self.is_w(w_exc_type, w_check_class):
return True # fast path (also here to handle string exceptions)
try:
- if self.is_true(self.isinstance(w_check_class, self.w_tuple)):
+ if self.isinstance_w(w_check_class, self.w_tuple):
for w_t in self.fixedview(w_check_class):
if self.exception_match(w_exc_type, w_t):
return True
@@ -1052,11 +1052,11 @@
def abstract_isinstance_w(self, w_obj, w_cls):
# Equivalent to 'isinstance(obj, cls)'.
- return self.is_true(self.isinstance(w_obj, w_cls))
+ return self.isinstance_w(w_obj, w_cls)
def abstract_isclass_w(self, w_obj):
# Equivalent to 'isinstance(obj, type)'.
- return self.is_true(self.isinstance(w_obj, self.w_type))
+ return self.isinstance_w(w_obj, self.w_type)
def abstract_getclass(self, w_obj):
# Equivalent to 'obj.__class__'.
@@ -1164,7 +1164,7 @@
-> (index, 0, 0) or
(start, stop, step)
"""
- if self.is_true(self.isinstance(w_index_or_slice, self.w_slice)):
+ if self.isinstance_w(w_index_or_slice, self.w_slice):
from pypy.objspace.std.sliceobject import W_SliceObject
assert isinstance(w_index_or_slice, W_SliceObject)
start, stop, step = w_index_or_slice.indices3(self, seqlength)
@@ -1184,7 +1184,7 @@
-> (index, 0, 0, 1) or
(start, stop, step, slice_length)
"""
- if self.is_true(self.isinstance(w_index_or_slice, self.w_slice)):
+ if self.isinstance_w(w_index_or_slice, self.w_slice):
from pypy.objspace.std.sliceobject import W_SliceObject
assert isinstance(w_index_or_slice, W_SliceObject)
start, stop, step, length = w_index_or_slice.indices4(self,
@@ -1326,7 +1326,7 @@
def realstr_w(self, w_obj):
# Like str_w, but only works if w_obj is really of type 'str'.
- if not self.is_true(self.isinstance(w_obj, self.w_str)):
+ if not self.isinstance_w(w_obj, self.w_str):
raise OperationError(self.w_TypeError,
self.wrap('argument must be a string'))
return self.str_w(w_obj)
@@ -1346,7 +1346,7 @@
def realunicode_w(self, w_obj):
# Like unicode_w, but only works if w_obj is really of type
# 'unicode'.
- if not self.is_true(self.isinstance(w_obj, self.w_unicode)):
+ if not self.isinstance_w(w_obj, self.w_unicode):
raise OperationError(self.w_TypeError,
self.wrap('argument must be a unicode'))
return self.unicode_w(w_obj)
@@ -1367,19 +1367,19 @@
return self.float_w(self.float(w_obj))
def gateway_r_longlong_w(self, w_obj):
- if self.is_true(self.isinstance(w_obj, self.w_float)):
+ if self.isinstance_w(w_obj, self.w_float):
raise OperationError(self.w_TypeError,
self.wrap("integer argument expected, got float"))
return self.r_longlong_w(self.int(w_obj))
def gateway_r_uint_w(self, w_obj):
- if self.is_true(self.isinstance(w_obj, self.w_float)):
+ if self.isinstance_w(w_obj, self.w_float):
raise OperationError(self.w_TypeError,
self.wrap("integer argument expected, got float"))
return self.uint_w(self.int(w_obj))
def gateway_r_ulonglong_w(self, w_obj):
- if self.is_true(self.isinstance(w_obj, self.w_float)):
+ if self.isinstance_w(w_obj, self.w_float):
raise OperationError(self.w_TypeError,
self.wrap("integer argument expected, got float"))
return self.r_ulonglong_w(self.int(w_obj))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit