Skip to content

Commit

Permalink
Drop Python 3.6 support
Browse files Browse the repository at this point in the history
The Github Actions CI doesn't seem to support 3.6 anymore on
latest Ubuntu. It's EOL-ed anyways so there's not much point in
more support.
  • Loading branch information
zhuyifei1999 committed May 13, 2023
1 parent 74b9299 commit aff42f1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 99 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
needs: build_sdist
runs-on: ${{ matrix.os }}
# https://github.com/zhuyifei1999/guppy3/issues/37
continue-on-error: ${{ matrix.os == 'windows-2019' && matrix.python-version == '3.9' }}
continue-on-error: ${{ matrix.os == 'windows-latest' && matrix.python-version == '3.9' }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
tracemalloc: [true, false]
codecov: [true, false]
sdist: [true, false]
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: cp3{[6789],10,11}-*
CIBW_BUILD: cp3{[789],10,11}-*
CIBW_ARCHS: all

- uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def doit():
"guppy.sets",
],
ext_modules=[setsc, heapyc],
python_requires='>=3.6',
python_requires='>=3.7',
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: CPython",
Expand Down
53 changes: 1 addition & 52 deletions src/heapy/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,61 +38,10 @@ static char hp_set_async_exc_doc[] =
/* _PyMem_SetDefaultAllocator */
# include <internal/pycore_pymem.h>
# undef Py_BUILD_CORE
#elif PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
#else
PyAPI_FUNC(int) _PyMem_SetDefaultAllocator(
PyMemAllocatorDomain domain,
PyMemAllocatorEx *old_alloc);
#else
// source: cpython: Objects/obmalloc.c
static void *
_PyMem_RawMalloc(void *ctx, size_t size)
{
if (size == 0)
size = 1;
return malloc(size);
}

static void *
_PyMem_RawCalloc(void *ctx, size_t nelem, size_t elsize)
{
if (nelem == 0 || elsize == 0) {
nelem = 1;
elsize = 1;
}
return calloc(nelem, elsize);
}

static void *
_PyMem_RawRealloc(void *ctx, void *ptr, size_t size)
{
if (size == 0)
size = 1;
return realloc(ptr, size);
}

static void
_PyMem_RawFree(void *ctx, void *ptr)
{
free(ptr);
}

static int _PyMem_SetDefaultAllocator(
PyMemAllocatorDomain domain,
PyMemAllocatorEx *old_alloc)
{
assert(domain == PYMEM_DOMAIN_RAW);
PyMem_GetAllocator(domain, old_alloc);

PyMemAllocatorEx alloc = {
.malloc = _PyMem_RawMalloc,
.calloc = _PyMem_RawCalloc,
.realloc = _PyMem_RawRealloc,
.free = _PyMem_RawFree,
.ctx = NULL
};
PyMem_SetAllocator(domain, &alloc);
return 0;
}
#endif

struct bootstate {
Expand Down
58 changes: 15 additions & 43 deletions src/heapy/rootstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,13 @@ static struct PyMemberDef is_members[] = {
MEMBER(builtins_copy),
MEMBER(import_func),

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
# ifdef HAVE_FORK
#ifdef HAVE_FORK
MEMBER(before_forkers),
MEMBER(after_forkers_parent),
MEMBER(after_forkers_child),
# endif
# if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
#endif
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
MEMBER(pyexitmodule),
# endif
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
Expand Down Expand Up @@ -190,14 +188,10 @@ static struct PyMemberDef ts_members[] = {

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
RENAMEMEMBER(exc_state.exc_value, exc_value),
#elif PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
#else
RENAMEMEMBER(exc_state.exc_type, exc_type),
RENAMEMEMBER(exc_state.exc_value, exc_value),
RENAMEMEMBER(exc_state.exc_traceback, exc_traceback),
#else
MEMBER(exc_type),
MEMBER(exc_value),
MEMBER(exc_traceback),
#endif

MEMBER(dict),
Expand All @@ -211,9 +205,7 @@ static struct PyMemberDef ts_members[] = {
MEMBER(async_gen_firstiter),
MEMBER(async_gen_finalizer),

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

Expand Down Expand Up @@ -293,15 +285,13 @@ rootstate_relate(NyHeapRelate *r)
ISATTR(builtins_copy);
ISATTR(import_func);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
# ifdef HAVE_FORK
#ifdef HAVE_FORK
ISATTR(before_forkers);
ISATTR(after_forkers_parent);
ISATTR(after_forkers_child);
# endif
# if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
#endif
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
ISATTR(pyexitmodule);
# endif
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
Expand Down Expand Up @@ -351,14 +341,10 @@ rootstate_relate(NyHeapRelate *r)

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
RENAMETSATTR(exc_state.exc_value, exc_value);
#elif PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
#else
RENAMETSATTR(exc_state.exc_type, exc_type);
RENAMETSATTR(exc_state.exc_value, exc_value);
RENAMETSATTR(exc_state.exc_traceback, exc_traceback);
#else
TSATTR(exc_type);
TSATTR(exc_value);
TSATTR(exc_traceback);
#endif

TSATTR(dict);
Expand All @@ -371,9 +357,7 @@ rootstate_relate(NyHeapRelate *r)
TSATTR(async_gen_firstiter);
TSATTR(async_gen_finalizer);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
TSATTR(context);
#endif
}
}
return 0;
Expand Down Expand Up @@ -415,15 +399,13 @@ rootstate_traverse(NyHeapTraverse *ta)
Py_VISIT(is->builtins_copy);
Py_VISIT(is->import_func);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
# ifdef HAVE_FORK
#ifdef HAVE_FORK
Py_VISIT(is->before_forkers);
Py_VISIT(is->after_forkers_parent);
Py_VISIT(is->after_forkers_child);
# endif
# if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
#endif
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
Py_VISIT(is->pyexitmodule);
# endif
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
Expand Down Expand Up @@ -456,14 +438,10 @@ rootstate_traverse(NyHeapTraverse *ta)

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
Py_VISIT(ts->exc_state.exc_value);
#elif PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
#else
Py_VISIT(ts->exc_state.exc_type);
Py_VISIT(ts->exc_state.exc_value);
Py_VISIT(ts->exc_state.exc_traceback);
#else
Py_VISIT(ts->exc_type);
Py_VISIT(ts->exc_value);
Py_VISIT(ts->exc_traceback);
#endif

Py_VISIT(ts->dict);
Expand All @@ -476,9 +454,7 @@ rootstate_traverse(NyHeapTraverse *ta)
Py_VISIT(ts->async_gen_firstiter);
Py_VISIT(ts->async_gen_finalizer);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
Py_VISIT(ts->context);
#endif
}
}
return 0;
Expand Down Expand Up @@ -706,15 +682,13 @@ rootstate_dir(PyObject *self, PyObject *args)
ISATTR_DIR(builtins_copy);
ISATTR_DIR(import_func);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
# ifdef HAVE_FORK
#ifdef HAVE_FORK
ISATTR_DIR(before_forkers);
ISATTR_DIR(after_forkers_parent);
ISATTR_DIR(after_forkers_child);
# endif
# if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
#endif
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 10
ISATTR_DIR(pyexitmodule);
# endif
#endif

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
Expand Down Expand Up @@ -775,9 +749,7 @@ rootstate_dir(PyObject *self, PyObject *args)
TSATTR_DIR(async_gen_firstiter);
TSATTR_DIR(async_gen_finalizer);

#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
TSATTR_DIR(context);
#endif
}
}

Expand Down

0 comments on commit aff42f1

Please sign in to comment.