1 /* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */
2 /* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */
3 
4 #include "util.h"
5 #include "filedisp.h"
6 
7 void
CFileDisposition_dealloc(CFileDisposition * self)8 CFileDisposition_dealloc(CFileDisposition *self)
9 {
10     Py_XDECREF(self->original_filename);
11     Py_XDECREF(self->canonical_filename);
12     Py_XDECREF(self->source_filename);
13     Py_XDECREF(self->trace);
14     Py_XDECREF(self->reason);
15     Py_XDECREF(self->file_tracer);
16     Py_XDECREF(self->has_dynamic_filename);
17 }
18 
19 static PyMemberDef
20 CFileDisposition_members[] = {
21     { "original_filename",      T_OBJECT, offsetof(CFileDisposition, original_filename), 0,
22             PyDoc_STR("") },
23 
24     { "canonical_filename",     T_OBJECT, offsetof(CFileDisposition, canonical_filename), 0,
25             PyDoc_STR("") },
26 
27     { "source_filename",        T_OBJECT, offsetof(CFileDisposition, source_filename), 0,
28             PyDoc_STR("") },
29 
30     { "trace",                  T_OBJECT, offsetof(CFileDisposition, trace), 0,
31             PyDoc_STR("") },
32 
33     { "reason",                 T_OBJECT, offsetof(CFileDisposition, reason), 0,
34             PyDoc_STR("") },
35 
36     { "file_tracer",            T_OBJECT, offsetof(CFileDisposition, file_tracer), 0,
37             PyDoc_STR("") },
38 
39     { "has_dynamic_filename",   T_OBJECT, offsetof(CFileDisposition, has_dynamic_filename), 0,
40             PyDoc_STR("") },
41 
42     { NULL }
43 };
44 
45 PyTypeObject
46 CFileDispositionType = {
47     MyType_HEAD_INIT
48     "coverage.CFileDispositionType",        /*tp_name*/
49     sizeof(CFileDisposition),  /*tp_basicsize*/
50     0,                         /*tp_itemsize*/
51     (destructor)CFileDisposition_dealloc, /*tp_dealloc*/
52     0,                         /*tp_print*/
53     0,                         /*tp_getattr*/
54     0,                         /*tp_setattr*/
55     0,                         /*tp_compare*/
56     0,                         /*tp_repr*/
57     0,                         /*tp_as_number*/
58     0,                         /*tp_as_sequence*/
59     0,                         /*tp_as_mapping*/
60     0,                         /*tp_hash */
61     0,                         /*tp_call*/
62     0,                         /*tp_str*/
63     0,                         /*tp_getattro*/
64     0,                         /*tp_setattro*/
65     0,                         /*tp_as_buffer*/
66     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
67     "CFileDisposition objects", /* tp_doc */
68     0,                         /* tp_traverse */
69     0,                         /* tp_clear */
70     0,                         /* tp_richcompare */
71     0,                         /* tp_weaklistoffset */
72     0,                         /* tp_iter */
73     0,                         /* tp_iternext */
74     0,                         /* tp_methods */
75     CFileDisposition_members,  /* tp_members */
76     0,                         /* tp_getset */
77     0,                         /* tp_base */
78     0,                         /* tp_dict */
79     0,                         /* tp_descr_get */
80     0,                         /* tp_descr_set */
81     0,                         /* tp_dictoffset */
82     0,                         /* tp_init */
83     0,                         /* tp_alloc */
84     0,                         /* tp_new */
85 };
86