cython: raise error when accessing irrelevant data in diet mode
diff --git a/bindings/python/pyx/ccapstone.pyx b/bindings/python/pyx/ccapstone.pyx
index b4e6d9b..69036f9 100644
--- a/bindings/python/pyx/ccapstone.pyx
+++ b/bindings/python/pyx/ccapstone.pyx
@@ -4,6 +4,8 @@
 import capstone, ctypes
 from capstone import arm, x86, mips, ppc, arm64, CsError
 
+_diet = cc.cs_support(capstone.CS_SUPPORT_DIET)
+
 class CsDetail:
 
     def __init__(self, arch, raw_detail = None):
@@ -69,14 +71,26 @@
 
     @property
     def mnemonic(self):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return self._raw.mnemonic
 
     @property
     def op_str(self):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return self._raw.op_str
 
     @property
     def regs_read(self):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         if self._detail:
             detail = self._detail
             return detail.regs_read[:detail.regs_read_count]
@@ -85,6 +99,10 @@
 
     @property
     def regs_write(self):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         if self._detail:
             detail = self._detail
             return detail.regs_write[:detail.regs_write_count]
@@ -93,6 +111,10 @@
 
     @property
     def groups(self):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         if self._detail:
             detail = self._detail
             return detail.groups[:detail.groups_count]
@@ -105,22 +127,42 @@
 
     # get the register name, given the register ID
     def reg_name(self, reg_id):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return cc.cs_reg_name(self._csh, reg_id)
 
     # get the instruction string
     def insn_name(self):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return cc.cs_insn_name(self._csh, self.id)
 
     # verify if this insn belong to group with id as @group_id
     def group(self, group_id):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return group_id in self._detail.groups
 
     # verify if this instruction implicitly read register @reg_id
     def reg_read(self, reg_id):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return reg_id in self._detail.regs_read
 
     # verify if this instruction implicitly modified register @reg_id
     def reg_write(self, reg_id):
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         return reg_id in self._detail.regs_write
 
     # return number of operands having same operand type @op_type
@@ -179,6 +221,10 @@
         # TODO: dont need detail, so we might turn off detail, then turn on again when done
         cdef cc.cs_insn *allinsn
 
+        if _diet:
+            # Diet engine cannot provide @mnemonic & @op_str
+            raise CsError(capstone.CS_ERR_DIET)
+
         cdef res = cc.cs_disasm_ex(self.csh, code, len(code), addr, count, &allinsn)
 
         for i from 0 <= i < res: