Ejemplo n.º 1
0
    def finditem_str(self, w_obj, key):
        """ Perform a getitem on w_obj with key (string). Returns found
        element or None on element not found.

        performance shortcut to avoid creating the OperationError(KeyError)
        and allocating W_BytesObject
        """
        if isinstance(w_obj, W_DictMultiObject) and not w_obj.user_overridden_class:
            return w_obj.getitem_str(key)
        return ObjSpace.finditem_str(self, w_obj, key)
Ejemplo n.º 2
0
    def finditem_str(self, w_obj, key):
        """ Perform a getitem on w_obj with key (string). Returns found
        element or None on element not found.

        performance shortcut to avoid creating the OperationError(KeyError)
        and allocating W_BytesObject
        """
        if (isinstance(w_obj, W_DictMultiObject)
                and not w_obj.user_overridden_class):
            return w_obj.getitem_str(key)
        return ObjSpace.finditem_str(self, w_obj, key)
Ejemplo n.º 3
0
 def finditem_str(self, w_obj, key):
     # performance shortcut to avoid creating the OperationError(KeyError)
     if (isinstance(w_obj, self.DictObjectCls)
             and not w_obj.user_overridden_class):
         return w_obj.getitem_str(key)
     return ObjSpace.finditem_str(self, w_obj, key)
Ejemplo n.º 4
0
 def finditem_str(self, w_obj, key):
     # performance shortcut to avoid creating the OperationError(KeyError)
     if (isinstance(w_obj, self.DictObjectCls) and
             not w_obj.user_overridden_class):
         return w_obj.getitem_str(key)
     return ObjSpace.finditem_str(self, w_obj, key)