db-move: moved seahorse from [testing] to [extra] (x86_64)
[arch-packages.git] / libieee1284 / trunk / python3.patch
blobbed2be23046c6474fb6d8a5fbd30e20ee790ca55
1 diff --git a/src/ieee1284module.c b/src/ieee1284module.c
2 index 23c1f29..c6d6928 100644
3 --- a/src/ieee1284module.c
4 +++ b/src/ieee1284module.c
5 @@ -52,33 +52,32 @@ Parport_dealloc (ParportObject *self)
7 if (self->port)
8 ieee1284_unref (self->port);
10 - self->ob_type->tp_free ((PyObject *) self);
11 + Py_TYPE(self)->tp_free((PyObject *) self);
14 static PyObject *
15 Parport_getname (ParportObject *self, void *closure)
17 - return PyString_FromString (self->port->name);
18 + return PyBytes_FromString (self->port->name);
21 static PyObject *
22 Parport_getbase_addr (ParportObject *self, void *closure)
24 - return PyInt_FromLong (self->port->base_addr);
25 + return PyLong_FromLong (self->port->base_addr);
28 static PyObject *
29 Parport_gethibase_addr (ParportObject *self, void *closure)
31 - return PyInt_FromLong (self->port->hibase_addr);
32 + return PyLong_FromLong (self->port->hibase_addr);
35 static PyObject *
36 Parport_getfilename (ParportObject *self, void *closure)
38 if (self->port->filename)
39 - return PyString_FromString (self->port->filename);
40 + return PyBytes_FromString (self->port->filename);
42 Py_INCREF (Py_None);
43 return Py_None;
44 @@ -168,7 +167,7 @@ Parport_get_deviceid (ParportObject *self, PyObject *args)
45 return NULL;
48 - return PyString_FromStringAndSize (buffer, r);
49 + return PyBytes_FromStringAndSize (buffer, r);
52 static PyObject *
53 @@ -186,7 +185,7 @@ Parport_open (ParportObject *self, PyObject *args)
54 return NULL;
57 - return PyInt_FromLong (capabilities);
58 + return PyLong_FromLong (capabilities);
61 static PyObject *
62 @@ -198,7 +197,7 @@ Parport_get_irq_fd (ParportObject *self)
63 return NULL;
66 - return PyInt_FromLong (fd);
67 + return PyLong_FromLong (fd);
70 static PyObject *
71 @@ -213,7 +212,7 @@ Parport_clear_irq (ParportObject *self)
72 return NULL;
75 - return PyInt_FromLong (portcount);
76 + return PyLong_FromLong (portcount);
79 static PyObject *
80 @@ -259,7 +258,7 @@ Parport_read_data (ParportObject *self)
81 return NULL;
84 - return PyInt_FromLong (r);
85 + return PyLong_FromLong (r);
88 static PyObject *
89 @@ -301,7 +300,7 @@ Parport_read_status (ParportObject *self)
90 return NULL;
93 - return PyInt_FromLong (r);
94 + return PyLong_FromLong (r);
97 static PyObject *
98 @@ -335,7 +334,7 @@ Parport_read_control (ParportObject *self)
99 return NULL;
102 - return PyInt_FromLong (r);
103 + return PyLong_FromLong (r);
106 static PyObject *
107 @@ -452,7 +451,7 @@ Parport_##x (ParportObject *self, PyObject *args) \
108 return NULL; \
111 - ret = PyString_FromStringAndSize (buffer, got); \
112 + ret = PyBytes_FromStringAndSize (buffer, got); \
113 free (buffer); \
114 return ret; \
116 @@ -480,7 +479,7 @@ Parport_##x (ParportObject *self, PyObject *args) \
117 return NULL; \
120 - return PyInt_FromLong (wrote); \
121 + return PyLong_FromLong (wrote); \
124 #define WRITE_METHOD(x) \
125 @@ -581,44 +580,53 @@ WRITE_METHOD(ecp_write_addr)
127 static PyTypeObject ParportType = {
128 PyObject_HEAD_INIT(NULL)
129 - 0, /* ob_size */
130 - "ieee1284.Parport", /* tp_name */
131 - sizeof (ParportObject), /* tp_basicsize */
132 - 0, /* tp_itemsize */
133 - (destructor)Parport_dealloc, /* tp_dealloc */
134 - 0, /* tp_print */
135 - 0, /* tp_getattr */
136 - 0, /* tp_setattr */
137 - 0, /* tp_compare */
138 - 0, /* tp_repr */
139 - 0, /* tp_as_number */
140 - 0, /* tp_as_sequence */
141 - 0, /* tp_as_mapping */
142 - 0, /* tp_hash */
143 - 0, /* tp_call */
144 - 0, /* tp_str */
145 - 0, /* tp_getattro */
146 - 0, /* tp_setattro */
147 - 0, /* tp_as_buffer */
148 - Py_TPFLAGS_DEFAULT, /* tp_flags */
149 - "parallel port object", /* tp_doc */
150 - 0, /* tp_traverse */
151 - 0, /* tp_clear */
152 - 0, /* tp_richcompare */
153 - 0, /* tp_weaklistoffset */
154 - 0, /* tp_iter */
155 - 0, /* tp_iternext */
156 - Parport_methods, /* tp_methods */
157 - 0, /* tp_members */
158 - Parport_getseters, /* tp_getset */
159 - 0, /* tp_base */
160 - 0, /* tp_dict */
161 - 0, /* tp_descr_get */
162 - 0, /* tp_descr_set */
163 - 0, /* tp_dictoffset */
164 - (initproc)Parport_init, /* tp_init */
165 - 0, /* tp_alloc */
166 - Parport_new, /* tp_new */
167 + "ieee1284.Parport", /* const char *tp_name; */
168 + sizeof (ParportObject), /* Py_ssize_t tp_basicsize */
169 + 0, /* Py_ssize_t tp_itemsize; */
170 + (destructor)Parport_dealloc, /* destructor tp_dealloc; */
171 + 0, /* printfunc tp_print; */
172 + 0, /* getattrfunc tp_getattr; */
173 + 0, /* setattrfunc tp_setattr; */
174 + 0, /* PyAsyncMethods *tp_as_async; */
175 + 0, /* reprfunc tp_repr; */
176 + 0, /* PyNumberMethods *tp_as_number; */
177 + 0, /* PySequenceMethods *tp_as_sequence; */
178 + 0, /* PyMappingMethods *tp_as_mapping; */
179 + 0, /* hashfunc tp_hash; */
180 + 0, /* ternaryfunc tp_call; */
181 + 0, /* reprfunc tp_str; */
182 + 0, /* getattrofunc tp_getattro; */
183 + 0, /* setattrofunc tp_setattro; */
184 + 0, /* PyBufferProcs *tp_as_buffer; */
185 + Py_TPFLAGS_DEFAULT, /* unsigned long tp_flags; */
186 + "parallel port object", /* const char *tp_doc; */
187 + 0, /* traverseproc tp_traverse; */
188 + 0, /* inquiry tp_clear; */
189 + 0, /* richcmpfunc tp_richcompare; */
190 + 0, /* Py_ssize_t tp_weaklistoffset; */
191 + 0, /* getiterfunc tp_iter; */
192 + 0, /* iternextfunc tp_iternext; */
193 + Parport_methods, /* struct PyMethodDef *tp_methods; */
194 + 0, /* struct PyMemberDef *tp_members; */
195 + Parport_getseters, /* struct PyGetSetDef *tp_getset; */
196 + 0, /* struct _typeobject *tp_base; */
197 + 0, /* PyObject *tp_dict; */
198 + 0, /* descrgetfunc tp_descr_get; */
199 + 0, /* descrsetfunc tp_descr_set; */
200 + 0, /* Py_ssize_t tp_dictoffset; */
201 + (initproc)Parport_init, /* initproc tp_init; */
202 + 0, /* allocfunc tp_alloc; */
203 + Parport_new, /* newfunc tp_new; */
204 + 0, /* freefunc tp_free; */
205 + 0, /* inquiry tp_is_gc; */
206 + 0, /* PyObject *tp_bases; */
207 + 0, /* PyObject *tp_mro; */
208 + 0, /* PyObject *tp_cache; */
209 + 0, /* PyObject *tp_subclasses; */
210 + 0, /* PyObject *tp_weaklist; */
211 + 0, /* destructor tp_del; */
212 + 0, /* unsigned int tp_version_tag; */
213 + 0 /* destructor tp_finalize; */
216 static PyObject *
217 @@ -672,18 +680,30 @@ static PyMethodDef Ieee1284Methods[] = {
218 {NULL, NULL, 0, NULL}
221 +static struct PyModuleDef Ieee1284Module = {
222 + PyModuleDef_HEAD_INIT,
223 + "ieee1284",
224 + NULL, /* documentation */
225 + -1,
226 + Ieee1284Methods,
227 + NULL,
228 + NULL,
229 + NULL,
230 + NULL
233 #ifndef PyMODINIT_FUNC
234 #define PyMODINIT_FUNC void
235 #endif
236 PyMODINIT_FUNC
237 -initieee1284 (void)
238 +PyInit_ieee1284module (void)
240 - PyObject *m = Py_InitModule ("ieee1284", Ieee1284Methods);
241 + PyObject *m = PyModule_Create (&Ieee1284Module);
242 PyObject *d = PyModule_GetDict (m);
243 PyObject *c;
245 if (PyType_Ready (&ParportType) < 0)
246 - return;
247 + return NULL;
249 PyModule_AddObject (m, "Parport", (PyObject *) &ParportType);
251 @@ -693,7 +713,7 @@ initieee1284 (void)
253 #define CONSTANT(x) \
254 do { \
255 - c = PyInt_FromLong (x); \
256 + c = PyLong_FromLong (x); \
257 PyDict_SetItemString (d, #x, c); \
258 Py_DECREF (c); \
259 } while (0)
260 @@ -740,4 +760,6 @@ initieee1284 (void)
261 CONSTANT (F1284_SWE);
262 CONSTANT (F1284_RLE);
263 CONSTANT (F1284_FASTEPP);
265 + return m;