Beispiel #1
0
    def testReadUIntField(self):
        data = Marshal.AllocHGlobal(Marshal.SizeOf(PyTypeObject()))
        CPyMarshal.Zero(data, Marshal.SizeOf(PyTypeObject()))

        for value in (UInt32.MaxValue, UInt32.MinValue):
            CPyMarshal.WriteUIntField(data, PyTypeObject, "tp_version_tag",
                                      value)
            self.assertEquals(
                CPyMarshal.ReadUIntField(data, PyTypeObject, "tp_version_tag"),
                value, "failed to read")

        Marshal.FreeHGlobal(data)
Beispiel #2
0
 def testFlags(self, mapper, _):
     flags = CPyMarshal.ReadUIntField(mapper.PyString_Type, PyTypeObject,
                                      "tp_flags")
     self.assertEquals(flags & UInt32(Py_TPFLAGS.HAVE_GETCHARBUFFER),
                       UInt32(Py_TPFLAGS.HAVE_GETCHARBUFFER))