Commits

Brian Kearns committed 750ec15
  • Participants
  • Parent commits fbcabd2

Comments (0)

Files changed (2)

File pypy/module/micronumpy/interp_flagsobj.py

     def descr_get_writeable(self, space):
         return space.w_True
 
+    def descr_get_fnc(self, space):
+        return space.wrap(
+            space.is_true(self.descr_get_fortran(space)) and not
+            space.is_true(self.descr_get_contiguous(space)))
+
+    def descr_get_forc(self, space):
+        return space.wrap(
+            space.is_true(self.descr_get_fortran(space)) or
+            space.is_true(self.descr_get_contiguous(space)))
+
     def descr_getitem(self, space, w_item):
         key = space.str_w(w_item)
         if key == "C" or key == "CONTIGUOUS" or key == "C_CONTIGUOUS":
             return self.descr_get_fortran(space)
         if key == "W" or key == "WRITEABLE":
             return self.descr_get_writeable(space)
+        if key == "FNC":
+            return self.descr_get_fnc(space)
+        if key == "FORC":
+            return self.descr_get_forc(space)
         raise OperationError(space.w_KeyError, space.wrap(
             "Unknown flag"))
 
     f_contiguous = GetSetProperty(W_FlagsObject.descr_get_fortran),
     fortran = GetSetProperty(W_FlagsObject.descr_get_fortran),
     writeable = GetSetProperty(W_FlagsObject.descr_get_writeable),
+    fnc = GetSetProperty(W_FlagsObject.descr_get_fnc),
+    forc = GetSetProperty(W_FlagsObject.descr_get_forc),
 )

File pypy/module/micronumpy/test/test_flagsobj.py

         a = np.array([1,2,3])
         assert a.flags.c_contiguous == True
         assert a.flags['W'] == True
+        assert a.flags.fnc == False
+        assert a.flags.forc == True
+        assert a.flags['FNC'] == False
+        assert a.flags['FORC'] == True
         raises(KeyError, "a.flags['blah']")
         raises(KeyError, "a.flags['C_CONTIGUOUS'] = False")
         raises((TypeError, AttributeError), "a.flags.c_contiguous = False")