Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
- Dropped support for Python 3.9 and 3.10 as they have reached their end of
life. The minimum supported Python version is now 3.11.

- The `abi3` wheels now target the stable ABI of Python 3.11 and are tagged
`cp311-abi3` instead of `cp39-abi3`.

### Fixed

- Errors raised while converting a boolean argument to a boolean (e.g. when
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,19 +907,19 @@ class bdist_wheel_abi3(bdist_wheel):
def get_tag(self):
python, abi, plat = super().get_tag()
if python.startswith("cp"):
# on CPython, our wheels are abi3 and compatible back to 3.9
return "cp39", "abi3", plat
# on CPython, our wheels are abi3 and compatible back to 3.11
return "cp311", "abi3", plat

return python, abi, plat

else:
bdist_wheel_abi3 = None

# We are going to build an abi3 wheel if we are at least on CPython 3.9.
# We are going to build an abi3 wheel if we are at least on CPython 3.11.
should_build_abi3_wheel = (
bdist_wheel_abi3
and platform.python_implementation() == "CPython"
and sys.version_info >= (3, 9)
and sys.version_info >= (3, 11)
)

###########################################################################
Expand All @@ -939,7 +939,7 @@ def get_tag(self):
sources.append(os.path.join("src", "_igraph", "force_cpp_linker.cpp"))
macros = []
if should_build_abi3_wheel:
macros.append(("Py_LIMITED_API", "0x03090000"))
macros.append(("Py_LIMITED_API", "0x030B0000"))
igraph_extension = Extension(
"igraph._igraph",
sources=sources,
Expand Down
6 changes: 3 additions & 3 deletions src/_igraph/bfsiter.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PyObject* igraphmodule_BFSIter_new(igraphmodule_GraphObject *g, PyObject *root,
return NULL;
}

Py_INCREF(g);
Py_INCREF((PyObject*)g);
self->gref = g;
self->graph = &g->g;

Expand Down Expand Up @@ -121,7 +121,7 @@ static int igraphmodule_BFSIter_traverse(igraphmodule_BFSIterObject *self,
visitproc visit, void *arg) {
RC_TRAVERSE("BFSIter", self);
Py_VISIT(self->gref);
Py_VISIT(Py_TYPE(self));
Py_VISIT(Py_TYPE((PyObject*)self));
return 0;
}

Expand Down Expand Up @@ -156,7 +156,7 @@ static void igraphmodule_BFSIter_dealloc(igraphmodule_BFSIterObject* self) {
}

static PyObject* igraphmodule_BFSIter_iter(igraphmodule_BFSIterObject* self) {
Py_INCREF(self);
Py_INCREF((PyObject*)self);
return (PyObject*)self;
}

Expand Down
4 changes: 2 additions & 2 deletions src/_igraph/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#ifndef IGRAPHMODULE_COMMON_H
#define IGRAPHMODULE_COMMON_H

#include <stdbool.h>

#include "preamble.h"

#include <stdbool.h>

#ifdef RC_DEBUG
# define RC_ALLOC(T, P) fprintf(stderr, "[ alloc ] " T " @ %p\n", P)
# define RC_DECREF(T, P) fprintf(stderr, "[ ref - ] " T " @ %p (was: %d)\n", P, (int)P->ob_refcnt);
Expand Down
5 changes: 4 additions & 1 deletion src/_igraph/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@

/************************ Conversion functions *************************/

#include <limits.h>
#include "preamble.h"

#include <ctype.h>
#include <limits.h>

#include "attributes.h"
#include "convert.h"
#include "edgeseqobject.h"
Expand Down
6 changes: 3 additions & 3 deletions src/_igraph/dfsiter.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PyObject* igraphmodule_DFSIter_new(igraphmodule_GraphObject *g, PyObject *root,
return NULL;
}

Py_INCREF(g);
Py_INCREF((PyObject*)g);
self->gref = g;
self->graph = &g->g;

Expand Down Expand Up @@ -122,7 +122,7 @@ static int igraphmodule_DFSIter_traverse(igraphmodule_DFSIterObject *self,
visitproc visit, void *arg) {
RC_TRAVERSE("DFSIter", self);
Py_VISIT(self->gref);
Py_VISIT(Py_TYPE(self));
Py_VISIT(Py_TYPE((PyObject*)self));
return 0;
}

Expand Down Expand Up @@ -155,7 +155,7 @@ static void igraphmodule_DFSIter_dealloc(igraphmodule_DFSIterObject* self) {
}

static PyObject* igraphmodule_DFSIter_iter(igraphmodule_DFSIterObject* self) {
Py_INCREF(self);
Py_INCREF((PyObject*)self);
return (PyObject*)self;
}

Expand Down
4 changes: 2 additions & 2 deletions src/_igraph/edgeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ PyObject* igraphmodule_Edge_get_vertex_tuple(igraphmodule_EdgeObject* self, void
* Returns the graph where the edge belongs
*/
PyObject* igraphmodule_Edge_get_graph(igraphmodule_EdgeObject* self, void* closure) {
Py_INCREF(self->gref);
Py_INCREF((PyObject*)self->gref);
return (PyObject*)self->gref;
}

Expand All @@ -598,7 +598,7 @@ PyObject* igraphmodule_Edge_get_graph(igraphmodule_EdgeObject* self, void* closu
\
/* Prepend ourselves to args */ \
new_args = PyTuple_New(num_args); \
Py_INCREF(self); \
Py_INCREF((PyObject*)self); \
PyTuple_SetItem(new_args, 0, (PyObject*)self); \
for (i = 1; i < num_args; i++) { \
item = PyTuple_GetItem(args, i - 1); \
Expand Down
6 changes: 3 additions & 3 deletions src/_igraph/edgeseqobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ igraphmodule_EdgeSeqObject*
igraphmodule_EdgeSeq_copy(igraphmodule_EdgeSeqObject* o) {
igraphmodule_EdgeSeqObject *copy;

copy = (igraphmodule_EdgeSeqObject*) PyType_GenericNew(Py_TYPE(o), 0, 0);
copy = (igraphmodule_EdgeSeqObject*) PyType_GenericNew(Py_TYPE((PyObject*)o), 0, 0);
if (copy == NULL) {
return NULL;
}
Expand All @@ -81,7 +81,7 @@ igraphmodule_EdgeSeq_copy(igraphmodule_EdgeSeqObject* o) {

copy->gref = o->gref;
if (o->gref) {
Py_INCREF(o->gref);
Py_INCREF((PyObject*)o->gref);
}

RC_ALLOC("EdgeSeq(copy)", copy);
Expand Down Expand Up @@ -1015,7 +1015,7 @@ PyMethodDef igraphmodule_EdgeSeq_methods[] = {
*/
PyObject* igraphmodule_EdgeSeq_get_graph(igraphmodule_EdgeSeqObject* self,
void* closure) {
Py_INCREF(self->gref);
Py_INCREF((PyObject*)self->gref);
return (PyObject*)self->gref;
}

Expand Down
10 changes: 5 additions & 5 deletions src/_igraph/graphobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ PyTypeObject* igraphmodule_GraphType;

#define CREATE_GRAPH(py_graph, c_graph) { \
py_graph = (igraphmodule_GraphObject*) igraphmodule_Graph_subclass_from_igraph_t( \
Py_TYPE(self), &c_graph \
Py_TYPE((PyObject*)self), &c_graph \
); \
if (py_graph == NULL) { igraph_destroy(&c_graph); } \
}
Expand Down Expand Up @@ -140,7 +140,7 @@ int igraphmodule_Graph_traverse(igraphmodule_GraphObject * self,
}
}

Py_VISIT(Py_TYPE(self));
Py_VISIT(Py_TYPE((PyObject*)self));

return 0;
}
Expand Down Expand Up @@ -4600,7 +4600,7 @@ PyObject *igraphmodule_Graph_bipartite_projection(igraphmodule_GraphObject * sel
if (p_g2) {
CREATE_GRAPH(result2, g2);
if (result2 == NULL) {
Py_XDECREF(result1);
Py_XDECREF((PyObject*)result1);
return NULL;
}
}
Expand Down Expand Up @@ -5172,7 +5172,7 @@ PyObject *igraphmodule_Graph_decompose(igraphmodule_GraphObject * self,
/* We have to create a Python igraph object for every graph returned. During
* the conversion, the graph list will be emptied as the Python list we return
* from the conversion function takes ownership of all the graphs */
list = igraphmodule_graph_list_t_to_PyList(&components, Py_TYPE(self));
list = igraphmodule_graph_list_t_to_PyList(&components, Py_TYPE((PyObject*)self));
if (!list) {
igraph_graph_list_destroy(&components);
return 0;
Expand Down Expand Up @@ -7080,7 +7080,7 @@ PyObject *igraphmodule_Graph_simplify(igraphmodule_GraphObject * self,
}

igraph_attribute_combination_destroy(&comb);
Py_INCREF(self);
Py_INCREF((PyObject*)self);

return (PyObject *) self;
}
Expand Down
12 changes: 11 additions & 1 deletion src/_igraph/preamble.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@

#ifndef PY_IGRAPH_ALLOW_ENTIRE_PYTHON_API
# ifndef Py_LIMITED_API
# define Py_LIMITED_API 0x03090000
# define Py_LIMITED_API 0x030B0000
# endif
#endif

#define PY_SSIZE_T_CLEAN
#include <Python.h>

/* Python.h stops including these standard headers when Py_LIMITED_API is
* 3.11 (<stddef.h>: 3.13) or later, but the extension relies on them.
* Python.h must be included before any standard header, so include them
* here instead of at the top of individual source files. */
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#endif /* PYTHON_IGRAPH_PREAMBLE_H */
2 changes: 1 addition & 1 deletion src/_igraph/pyhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ char* igraphmodule_PyUnicode_CopyAsString(PyObject* string);
/* Calling Py_DECREF() on heap-allocated types in tp_dealloc was not needed
* before Python 3.8 (see Python issue 35810) */
#define PY_FREE_AND_DECREF_TYPE(obj, base_type) { \
PyTypeObject* _tp = Py_TYPE(obj); \
PyTypeObject* _tp = Py_TYPE((PyObject*)(obj)); \
((freefunc)PyType_GetSlot(_tp, Py_tp_free))(obj); \
Py_DECREF(_tp); \
}
Expand Down
4 changes: 2 additions & 2 deletions src/_igraph/vertexobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ igraph_int_t igraphmodule_Vertex_get_index_igraph_integer(igraphmodule_VertexObj
*/
PyObject* igraphmodule_Vertex_get_graph(igraphmodule_VertexObject* self,
void* closure) {
Py_INCREF(self->gref);
Py_INCREF((PyObject*)self->gref);
return (PyObject*)self->gref;
}

Expand Down Expand Up @@ -695,7 +695,7 @@ static PyObject* _convert_to_vertex_list(igraphmodule_VertexObject* vertex, PyOb
\
/* Prepend ourselves to args */ \
new_args = PyTuple_New(num_args); \
Py_INCREF(self); \
Py_INCREF((PyObject*)self); \
PyTuple_SetItem(new_args, 0, (PyObject*)self); \
for (i = 1; i < num_args; i++) { \
item = PyTuple_GetItem(args, i - 1); \
Expand Down
6 changes: 3 additions & 3 deletions src/_igraph/vertexseqobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ igraphmodule_VertexSeqObject*
igraphmodule_VertexSeq_copy(igraphmodule_VertexSeqObject* o) {
igraphmodule_VertexSeqObject *copy;

copy = (igraphmodule_VertexSeqObject*) PyType_GenericNew(Py_TYPE(o), 0, 0);
copy = (igraphmodule_VertexSeqObject*) PyType_GenericNew(Py_TYPE((PyObject*)o), 0, 0);
if (copy == NULL) {
return NULL;
}
Expand All @@ -80,7 +80,7 @@ igraphmodule_VertexSeq_copy(igraphmodule_VertexSeqObject* o) {
}

copy->gref = o->gref;
if (o->gref) Py_INCREF(o->gref);
if (o->gref) Py_INCREF((PyObject*)o->gref);
RC_ALLOC("VertexSeq(copy)", copy);

return copy;
Expand Down Expand Up @@ -981,7 +981,7 @@ int igraphmodule_VertexSeq_to_vector_t(igraphmodule_VertexSeqObject *self,
*/
PyObject* igraphmodule_VertexSeq_get_graph(igraphmodule_VertexSeqObject* self,
void* closure) {
Py_INCREF(self->gref);
Py_INCREF((PyObject*)self->gref);
return (PyObject*)self->gref;
}

Expand Down
Loading