Skip to content

Commit 25cdbbf

Browse files
committed
Remove _conv_pyobject_to_ulong
No longer needed with modern Python
1 parent 35f5884 commit 25cdbbf

3 files changed

Lines changed: 2 additions & 32 deletions

File tree

cairo/glyph.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ glyph_new (PyTypeObject *type, PyObject *args, PyObject *kwds) {
181181
KWDS, &pyindex, &x, &y))
182182
return NULL;
183183

184-
if (_conv_pyobject_to_ulong (pyindex, &index) < 0)
184+
index = PyLong_AsUnsignedLong (pyindex);
185+
if (index == (unsigned long)-1 && PyErr_Occurred ())
185186
return NULL;
186187

187188
tuple_args = Py_BuildValue ("((kdd))", index, x, y);

cairo/misc.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -176,32 +176,3 @@ Pycairo_richcompare (void* a, void *b, int op)
176176
Py_INCREF (res);
177177
return res;
178178
}
179-
180-
/* NULL on error */
181-
static PyObject *
182-
_conv_pyobject_to_pylong (PyObject *pyobj) {
183-
if (!PyLong_Check (pyobj)) {
184-
PyErr_SetString (PyExc_TypeError, "not of type int");
185-
return NULL;
186-
}
187-
Py_INCREF (pyobj);
188-
return pyobj;
189-
}
190-
191-
/* -1 on error */
192-
int
193-
_conv_pyobject_to_ulong (PyObject *pyobj, unsigned long *result) {
194-
unsigned long temp;
195-
PyObject *pylong;
196-
197-
pylong = _conv_pyobject_to_pylong (pyobj);
198-
if (pylong == NULL)
199-
return -1;
200-
201-
temp = PyLong_AsUnsignedLong (pylong);
202-
if (temp == (unsigned long)-1 && PyErr_Occurred ())
203-
return -1;
204-
205-
*result = temp;
206-
return 0;
207-
}

cairo/private.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ int _PyGlyph_AsGlyph (PyObject *pyobj, cairo_glyph_t *glyph);
5959
int _PyTextCluster_AsTextCluster (PyObject *pyobj,
6060
cairo_text_cluster_t *cluster);
6161

62-
int _conv_pyobject_to_ulong (PyObject *pyobj, unsigned long *result);
63-
6462
PyObject* Pycairo_richcompare (void* a, void *b, int op);
6563

6664
extern PyTypeObject PycairoContext_Type;

0 commit comments

Comments
 (0)