diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90eaa38..498a5ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,14 +8,18 @@ on: - master paths: - 'src/**' + pull_request: + branches: + - master + paths: + - '.github/workflows/build.yml' concurrency: group: build-${{ github.head_ref }} cancel-in-progress: true env: - CIBW_SKIP: > - pp* + CIBW_BUILD: cp3{9,10,11,12,13}-* PYAWAITABLE_OPTIMIZED: 1 jobs: diff --git a/pyproject.toml b/pyproject.toml index 8b17f0a..8a2a18f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ ] dependencies = [] dynamic = ["version"] +requires-python = ">=3.9" [project.urls] Documentation = "https://awaitable.zintensity.dev" diff --git a/setup.py b/setup.py index ee2e1cb..5b6b99b 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,11 @@ from setuptools import Extension, setup import os +DEBUG_SYMBOLS = "/DEBUG" if os.name == "nt" else "-g" +_OPTIMIZED = "/O3" if os.name == "nt" else "-O3" +_NO_OPTIMIZATION = "" if os.name == "nt" else "-O0" +OPTIMIZATION = _OPTIMIZED if os.environ.get("PYAWAITABLE_OPTIMIZED") else _NO_OPTIMIZATION + if __name__ == "__main__": setup( name="pyawaitable", @@ -13,7 +18,7 @@ "_pyawaitable", glob("./src/_pyawaitable/*.c"), include_dirs=["./include/", "./src/pyawaitable/"], - extra_compile_args=["-g", "-O3" if os.environ.get("PYAWAITABLE_OPTIMIZED") else "-O0"], + extra_compile_args=[DEBUG_SYMBOLS, OPTIMIZATION], ) ], package_dir={"": "src"}, diff --git a/src/_pyawaitable/coro.c b/src/_pyawaitable/coro.c index d597797..e569b1b 100644 --- a/src/_pyawaitable/coro.c +++ b/src/_pyawaitable/coro.c @@ -53,16 +53,13 @@ awaitable_throw(PyObject *self, PyObject *args) PyObject *traceback = NULL; if (!PyArg_ParseTuple(args, "O|OO", &type, &value, &traceback)) + { return NULL; + } if (PyType_Check(type)) { - PyObject *err = PyObject_Vectorcall( - type, - (PyObject *[]){value}, - 1, - NULL - ); + PyObject *err = PyObject_CallOneArg(type, value); if (err == NULL) { return NULL; @@ -107,7 +104,8 @@ awaitable_throw(PyObject *self, PyObject *args) return NULL; } - Py_UNREACHABLE(); + assert(PyErr_Occurred()); + return NULL; } #if PY_MINOR_VERSION > 9