Skip to content

Commit dbeb0f3

Browse files
CI: Fix platform compatibility (#50)
Apparently, #48 broke some builds. - Fixes compiler flags used on Windows. - Removes usage of `Py_UNREACHABLE`, which apparently only works on Linux.
1 parent f4d1e60 commit dbeb0f3

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ on:
88
- master
99
paths:
1010
- 'src/**'
11+
pull_request:
12+
branches:
13+
- master
14+
paths:
15+
- '.github/workflows/build.yml'
1116

1217
concurrency:
1318
group: build-${{ github.head_ref }}
1419
cancel-in-progress: true
1520

1621
env:
17-
CIBW_SKIP: >
18-
pp*
22+
CIBW_BUILD: cp3{9,10,11,12,13}-*
1923
PYAWAITABLE_OPTIMIZED: 1
2024

2125
jobs:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
]
2222
dependencies = []
2323
dynamic = ["version"]
24+
requires-python = ">=3.9"
2425

2526
[project.urls]
2627
Documentation = "https://awaitable.zintensity.dev"

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
from setuptools import Extension, setup
44
import os
55

6+
DEBUG_SYMBOLS = "/DEBUG" if os.name == "nt" else "-g"
7+
_OPTIMIZED = "/O3" if os.name == "nt" else "-O3"
8+
_NO_OPTIMIZATION = "" if os.name == "nt" else "-O0"
9+
OPTIMIZATION = _OPTIMIZED if os.environ.get("PYAWAITABLE_OPTIMIZED") else _NO_OPTIMIZATION
10+
611
if __name__ == "__main__":
712
setup(
813
name="pyawaitable",
@@ -13,7 +18,7 @@
1318
"_pyawaitable",
1419
glob("./src/_pyawaitable/*.c"),
1520
include_dirs=["./include/", "./src/pyawaitable/"],
16-
extra_compile_args=["-g", "-O3" if os.environ.get("PYAWAITABLE_OPTIMIZED") else "-O0"],
21+
extra_compile_args=[DEBUG_SYMBOLS, OPTIMIZATION],
1722
)
1823
],
1924
package_dir={"": "src"},

src/_pyawaitable/coro.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,13 @@ awaitable_throw(PyObject *self, PyObject *args)
5353
PyObject *traceback = NULL;
5454

5555
if (!PyArg_ParseTuple(args, "O|OO", &type, &value, &traceback))
56+
{
5657
return NULL;
58+
}
5759

5860
if (PyType_Check(type))
5961
{
60-
PyObject *err = PyObject_Vectorcall(
61-
type,
62-
(PyObject *[]){value},
63-
1,
64-
NULL
65-
);
62+
PyObject *err = PyObject_CallOneArg(type, value);
6663
if (err == NULL)
6764
{
6865
return NULL;
@@ -107,7 +104,8 @@ awaitable_throw(PyObject *self, PyObject *args)
107104
return NULL;
108105
}
109106

110-
Py_UNREACHABLE();
107+
assert(PyErr_Occurred());
108+
return NULL;
111109
}
112110

113111
#if PY_MINOR_VERSION > 9

0 commit comments

Comments
 (0)