diff --git a/guppy/heapy/Use.py b/guppy/heapy/Use.py index 0789a6d..94a0701 100644 --- a/guppy/heapy/Use.py +++ b/guppy/heapy/Use.py @@ -117,10 +117,6 @@ def _get_doc(self): Use eg: %sdoc. for info on .""" % 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. " diff --git a/src/heapy/classifier.c b/src/heapy/classifier.c index fba664c..0125d96 100644 --- a/src/heapy/classifier.c +++ b/src/heapy/classifier.c @@ -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 diff --git a/src/heapy/hv.c b/src/heapy/hv.c index fda50c1..04ace0c 100644 --- a/src/heapy/hv.c +++ b/src/heapy/hv.c @@ -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, diff --git a/src/heapy/hv_cli_rel.c b/src/heapy/hv_cli_rel.c index 5b7725f..8e67f94 100644 --- a/src/heapy/hv_cli_rel.c +++ b/src/heapy/hv_cli_rel.c @@ -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 * diff --git a/src/heapy/interpreter.c b/src/heapy/interpreter.c index eb2e862..b124708 100644 --- a/src/heapy/interpreter.c +++ b/src/heapy/interpreter.c @@ -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 -# undef Py_BUILD_CORE -#else -PyAPI_FUNC(int) _PyMem_SetDefaultAllocator( - PyMemAllocatorDomain domain, - PyMemAllocatorEx *old_alloc); -#endif +# include +#undef Py_BUILD_CORE struct bootstate { PyObject *cmd; diff --git a/src/heapy/nodegraph.c b/src/heapy/nodegraph.c index f57afa4..a7ea193 100644 --- a/src/heapy/nodegraph.c +++ b/src/heapy/nodegraph.c @@ -112,7 +112,7 @@ 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); @@ -120,7 +120,7 @@ ng_dealloc(PyObject *v) } PyMem_FREE(ng->edges); Py_TYPE(ng)->tp_free(v); - Ny_TRASHCAN_END(v) + Py_TRASHCAN_END } static int diff --git a/src/heapy/rootstate.c b/src/heapy/rootstate.c index 014836b..cfc73c2 100644 --- a/src/heapy/rootstate.c +++ b/src/heapy/rootstate.c @@ -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 @@ -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 */ }; @@ -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), @@ -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 @@ -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; @@ -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); @@ -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 @@ -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; @@ -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); @@ -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 @@ -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; @@ -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); diff --git a/src/include/guppy.h b/src/include/guppy.h index afca472..9aeb9e2 100644 --- a/src/include/guppy.h +++ b/src/include/guppy.h @@ -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 */ diff --git a/src/sets/immnodeset.c b/src/sets/immnodeset.c index d1f8b58..3842f52 100644 --- a/src/sets/immnodeset.c +++ b/src/sets/immnodeset.c @@ -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 * @@ -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 } diff --git a/src/sets/nodeset.c b/src/sets/nodeset.c index 4ae121e..de1c2a3 100644 --- a/src/sets/nodeset.c +++ b/src/sets/nodeset.c @@ -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