parameters: (oldtype, newtype)
return_statement: return
docstring: Checks safety of a view involving object arrays, for example when
      doing::
  
          np.zeros(10, dtype=oldtype).view(newtype)
  
      Parameters
      ----------
      oldtype : data-type
          Data type of original ndarray
      newtype : data-type
          Data type of the view
  
      Raises
      ------
      TypeError
          If the new type is incompatible with the old type.
docstring_summary: Checks safety of a view involving object arrays, for example when
      doing::
docstring_tokens: Checks safety of a view involving object arrays for example when doing ::
function: def _view_is_safe(oldtype, newtype):
      """ Checks safety of a view involving object arrays, for example when
      doing::
  
          np.zeros(10, dtype=oldtype).view(newtype)
  
      Parameters
      ----------
      oldtype : data-type
          Data type of original ndarray
      newtype : data-type
          Data type of the view
  
      Raises
      ------
      TypeError
          If the new type is incompatible with the old type.
  
      """
  
      # if the types are equivalent, there is no problem.
      # for example: dtype((np.record, 'i4,i4')) == dtype((np.void, 'i4,i4'))
      if oldtype == newtype:
          return
  
      if newtype.hasobject or oldtype.hasobject:
          raise TypeError("Cannot change data-type for object array.")
      return
function_tokens: def _view_is_safe ( oldtype , newtype ) : # if the types are equivalent, there is no problem. # for example: dtype((np.record, 'i4,i4')) == dtype((np.void, 'i4,i4')) if oldtype == newtype : return if newtype . hasobject or oldtype . hasobject : raise TypeError ( "Cannot change data-type for object array." ) return