Skip to content

Commit

Permalink
Fix Py_UNREACHABLE missing in 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
greshilov committed Nov 28, 2021
1 parent 0e1dc58 commit 2ca987f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ jobs:
matrix:
pyver: ['3.8', '3.9', '3.10']
os: [ubuntu, macos, windows]
include:
- pyver: '3.6'
os: ubuntu
- pyver: '3.7'
os: ubuntu
fail-fast: false
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 15
Expand Down
2 changes: 1 addition & 1 deletion pysegmenttree/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class QueryFunction(Enum):
MIN = "min"
MAX = "max"

@lru_cache
@lru_cache()
def _map(self, value: "QueryFunction"):
return {
QueryFunction.SUM: add,
Expand Down
5 changes: 5 additions & 0 deletions pysegmenttree/_extensions/common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

/* Py_UNREACHABLE was introduced only in 3.7 */
#if !defined Py_UNREACHABLE
#define Py_UNREACHABLE() Py_FatalError("Unreachable C code path reached")
#endif

enum QueryFunc {
Sum = 1,
Min,
Expand Down

0 comments on commit 2ca987f

Please sign in to comment.