Skip to content

Commit

Permalink
Drop Python 3.7 support
Browse files Browse the repository at this point in the history
3.7 is EOL
  • Loading branch information
zhuyifei1999 committed Oct 18, 2023
1 parent 125a9fb commit b52cad0
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 72 deletions.
4 changes: 0 additions & 4 deletions guppy/heapy/Use.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ def _get_doc(self):
Use eg: %sdoc.<attribute> for info on <attribute>.""" % self.reprefix)

def _check_tracemalloc(self):
if self.sys.version_info < (3, 8):
self.warnings.warn(
"Python 3.7 and below tracemalloc may not record accurate "
"producer trace. See https://bugs.python.org/issue35053")
if not self.tracemalloc.is_tracing():
raise RuntimeError(
"Tracemalloc is not tracing. No producer profile available. "
Expand Down
4 changes: 2 additions & 2 deletions src/heapy/classifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ static void
cli_dealloc(NyObjectClassifierObject *op)
{
PyObject_GC_UnTrack(op);
Ny_TRASHCAN_BEGIN(op, cli_dealloc)
Py_TRASHCAN_BEGIN(op, cli_dealloc)
Py_XDECREF(op->self);
PyObject_GC_Del(op);
Ny_TRASHCAN_END(op)
Py_TRASHCAN_END
}

static int
Expand Down
4 changes: 2 additions & 2 deletions src/heapy/hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,10 @@ static void
hv_dealloc(PyObject *v)
{
PyObject_GC_UnTrack(v);
Ny_TRASHCAN_BEGIN(v, hv_dealloc)
Py_TRASHCAN_BEGIN(v, hv_dealloc)
hv_gc_clear((NyHeapViewObject *)v);
Py_TYPE(v)->tp_free(v);
Ny_TRASHCAN_END(v)
Py_TRASHCAN_END
}

PyDoc_STRVAR(hv_delete_extra_type_doc,
Expand Down
4 changes: 2 additions & 2 deletions src/heapy/hv_cli_rel.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ static void
rel_dealloc(NyRelationObject *op)
{
PyObject_GC_UnTrack(op);
Ny_TRASHCAN_BEGIN(op, rel_dealloc)
Py_TRASHCAN_BEGIN(op, rel_dealloc)
Py_XDECREF(op->relator);
Py_TYPE(op)->tp_free(op);
Ny_TRASHCAN_END(op)
Py_TRASHCAN_END
}

PyObject *
Expand Down
12 changes: 3 additions & 9 deletions src/heapy/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,10 @@ static char hp_set_async_exc_doc[] =
#include "pythread.h"
#include "eval.h"

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
# define Py_BUILD_CORE
#define Py_BUILD_CORE
/* _PyMem_SetDefaultAllocator */
# include <internal/pycore_pymem.h>
# undef Py_BUILD_CORE
#else
PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
PyMemAllocatorDomain domain,
PyMemAllocatorEx *old_alloc);
#endif
# include <internal/pycore_pymem.h>
#undef Py_BUILD_CORE

struct bootstate {
PyObject *cmd;
Expand Down
4 changes: 2 additions & 2 deletions src/heapy/nodegraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ ng_dealloc(PyObject *v)
NyNodeGraphObject *ng = (void *)v;
Py_ssize_t i;
PyObject_GC_UnTrack(v);
Ny_TRASHCAN_BEGIN(v, ng_dealloc)
Py_TRASHCAN_BEGIN(v, ng_dealloc)
ng_gc_clear(ng);
for (i = 0; i < ng->used_size; i++) {
Py_DECREF(ng->edges[i].src);
Py_DECREF(ng->edges[i].tgt);
}
PyMem_FREE(ng->edges);
Py_TYPE(ng)->tp_free(v);
Ny_TRASHCAN_END(v)
Py_TRASHCAN_END
}

static int
Expand Down
37 changes: 0 additions & 37 deletions src/heapy/rootstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ static struct PyMemberDef is_members[] = {
MEMBER(codec_search_cache),
MEMBER(codec_error_registry),

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
MEMBER(dict),
#endif

MEMBER(builtins_copy),

#ifdef HAVE_FORK
Expand All @@ -172,9 +169,7 @@ static struct PyMemberDef is_members[] = {
MEMBER(pyexitmodule),
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
MEMBER(audit_hooks),
#endif
{0} /* Sentinel */
};

Expand Down Expand Up @@ -212,10 +207,6 @@ static struct PyMemberDef ts_members[] = {
MEMBER(async_exc),
// trash_delete_later not included

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 8
MEMBER(coroutine_wrapper),
#endif

MEMBER(async_gen_firstiter),
MEMBER(async_gen_finalizer),

Expand Down Expand Up @@ -308,10 +299,7 @@ rootstate_relate(NyHeapRelate *r)
ISATTR(codec_search_cache);
ISATTR(codec_error_registry);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
ISATTR(dict);
#endif

ISATTR(builtins_copy);

#ifdef HAVE_FORK
Expand All @@ -323,9 +311,7 @@ rootstate_relate(NyHeapRelate *r)
ISATTR(pyexitmodule);
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
ISATTR(audit_hooks);
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
ts = is->threads.head;
Expand Down Expand Up @@ -383,10 +369,6 @@ rootstate_relate(NyHeapRelate *r)
TSATTR(dict);
TSATTR(async_exc);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 8
TSATTR(coroutine_wrapper);
#endif

TSATTR(async_gen_firstiter);
TSATTR(async_gen_finalizer);

Expand Down Expand Up @@ -434,10 +416,7 @@ rootstate_traverse(NyHeapTraverse *ta)
Py_VISIT(is->codec_search_cache);
Py_VISIT(is->codec_error_registry);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
Py_VISIT(is->dict);
#endif

Py_VISIT(is->builtins_copy);

#ifdef HAVE_FORK
Expand All @@ -449,9 +428,7 @@ rootstate_traverse(NyHeapTraverse *ta)
Py_VISIT(is->pyexitmodule);
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
Py_VISIT(is->audit_hooks);
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
ts = is->threads.head;
Expand Down Expand Up @@ -492,10 +469,6 @@ rootstate_traverse(NyHeapTraverse *ta)
Py_VISIT(ts->dict);
Py_VISIT(ts->async_exc);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 8
Py_VISIT(ts->coroutine_wrapper);
#endif

Py_VISIT(ts->async_gen_firstiter);
Py_VISIT(ts->async_gen_finalizer);

Expand Down Expand Up @@ -722,10 +695,7 @@ rootstate_dir(PyObject *self, PyObject *args)
ISATTR_DIR(codec_search_cache);
ISATTR_DIR(codec_error_registry);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
ISATTR_DIR(dict);
#endif

ISATTR_DIR(builtins_copy);

#ifdef HAVE_FORK
Expand All @@ -737,10 +707,7 @@ rootstate_dir(PyObject *self, PyObject *args)
ISATTR_DIR(pyexitmodule);
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
ISATTR_DIR(audit_hooks);
#endif


#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
ts = is->threads.head;
Expand Down Expand Up @@ -796,10 +763,6 @@ rootstate_dir(PyObject *self, PyObject *args)
TSATTR_DIR(dict);
TSATTR_DIR(async_exc);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 8
TSATTR_DIR(coroutine_wrapper);
#endif

TSATTR_DIR(async_gen_firstiter);
TSATTR_DIR(async_gen_finalizer);

Expand Down
8 changes: 0 additions & 8 deletions src/include/guppy.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,4 @@
if (PyType_Ready(&t) < 0) return -1; \
}

#if PY_VERSION_HEX >= 0x03080000
# define Ny_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)
# define Ny_TRASHCAN_END(op) Py_TRASHCAN_END
#else
# define Ny_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_SAFE_BEGIN(op)
# define Ny_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op)
#endif

#endif /* GUPPY_H_INCLUDED */
8 changes: 4 additions & 4 deletions src/sets/immnodeset.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ static void
immnsiter_dealloc(NyImmNodeSetIterObject *it)
{
PyObject_GC_UnTrack(it);
Ny_TRASHCAN_BEGIN(it, immnsiter_dealloc)
Py_TRASHCAN_BEGIN(it, immnsiter_dealloc)
Py_XDECREF(it->nodeset);
PyObject_GC_Del(it);
Ny_TRASHCAN_END(it)
Py_TRASHCAN_END
}

static PyObject *
Expand Down Expand Up @@ -222,10 +222,10 @@ static void
immnodeset_dealloc(NyNodeSetObject *v)
{
PyObject_GC_UnTrack(v);
Ny_TRASHCAN_BEGIN(v, immnodeset_dealloc)
Py_TRASHCAN_BEGIN(v, immnodeset_dealloc)
immnodeset_gc_clear(v);
Py_TYPE(v)->tp_free((PyObject *)v);
Ny_TRASHCAN_END(v)
Py_TRASHCAN_END
}


Expand Down
4 changes: 2 additions & 2 deletions src/sets/nodeset.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,10 @@ static void
mutnodeset_dealloc(NyNodeSetObject *v)
{
PyObject_GC_UnTrack(v);
Ny_TRASHCAN_BEGIN(v, mutnodeset_dealloc)
Py_TRASHCAN_BEGIN(v, mutnodeset_dealloc)
mutnodeset_gc_clear(v);
Py_TYPE(v)->tp_free((PyObject *)v);
Ny_TRASHCAN_END(v)
Py_TRASHCAN_END
}

size_t
Expand Down

0 comments on commit b52cad0

Please sign in to comment.