Skip to content

Commit 572b8ea

Browse files
author
root
committed
trigger GHA
1 parent bb1ad90 commit 572b8ea

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,19 @@ jobs:
4949
if: runner.os == 'Linux'
5050
run: |
5151
sudo apt-get update
52-
sudo apt-get install -y cppcheck
52+
sudo apt-get install -y cppcheck clang-format
5353
5454
- name: Install system dependencies (macOS)
5555
if: runner.os == 'macOS'
5656
run: |
5757
brew install cppcheck
58+
brew install clang-format
5859
5960
- name: Install system dependencies (Windows)
6061
if: runner.os == 'Windows'
6162
run: |
6263
choco install cppcheck
64+
choco install llvm --yes # This includes clang-format
6365
6466
- name: Cache $HOME/.local # Significantly speeds up Poetry Install
6567
uses: actions/cache@v4

newtype/extensions/newtype_init.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static void NewTypeInit_dealloc(NewTypeInitObject* self)
206206
static PyMethodDef NewTypeInit_methods[] = {{NULL, NULL, 0, NULL}};
207207

208208
static PyTypeObject NewTypeInitType = {
209-
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "NewTypeInit.NewTypeInit",
209+
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "newtypeinit.NewTypeInit",
210210
.tp_doc = "Descriptor class that wraps methods for instantiating subtypes.",
211211
.tp_basicsize = sizeof(NewTypeInitObject),
212212
.tp_itemsize = 0,
@@ -223,18 +223,18 @@ static PyTypeObject NewTypeInitType = {
223223

224224
static struct PyModuleDef NewTypeInitmodule = {
225225
PyModuleDef_HEAD_INIT,
226-
.m_name = "NewTypeInit",
226+
.m_name = "newtypeinit",
227227
.m_doc = "A module containing `NewTypeInit` descriptor class.",
228228
.m_size = -1,
229+
.m_methods = NewTypeInit_methods,
229230
};
230231

231232
PyMODINIT_FUNC PyInit_newtypeinit(void)
232233
{
233-
PyObject* m;
234234
if (PyType_Ready(&NewTypeInitType) < 0)
235235
return NULL;
236236

237-
m = PyModule_Create(&NewTypeInitmodule);
237+
PyObject* m = PyModule_Create(&NewTypeInitmodule);
238238
if (m == NULL)
239239
return NULL;
240240

@@ -244,15 +244,28 @@ PyMODINIT_FUNC PyInit_newtypeinit(void)
244244
Py_DECREF(m);
245245
return NULL;
246246
}
247-
PyModule_AddObject(m, "NEWTYPE_INIT_KWARGS_STR", PY_NEWTYPE_INIT_KWARGS_STR);
247+
if (PyModule_AddObject(
248+
m, "NEWTYPE_INIT_KWARGS_STR", PY_NEWTYPE_INIT_KWARGS_STR)
249+
< 0)
250+
{
251+
Py_DECREF(PY_NEWTYPE_INIT_KWARGS_STR);
252+
Py_DECREF(m);
253+
return NULL;
254+
}
248255

249256
PyObject* PY_NEWTYPE_INIT_ARGS_STR =
250257
PyUnicode_FromString(NEWTYPE_INIT_ARGS_STR);
251258
if (PY_NEWTYPE_INIT_ARGS_STR == NULL) {
252259
Py_DECREF(m);
253260
return NULL;
254261
}
255-
PyModule_AddObject(m, "NEWTYPE_INIT_ARGS_STR", PY_NEWTYPE_INIT_ARGS_STR);
262+
if (PyModule_AddObject(m, "NEWTYPE_INIT_ARGS_STR", PY_NEWTYPE_INIT_ARGS_STR)
263+
< 0)
264+
{
265+
Py_DECREF(PY_NEWTYPE_INIT_ARGS_STR);
266+
Py_DECREF(m);
267+
return NULL;
268+
}
256269

257270
Py_INCREF(&NewTypeInitType);
258271
if (PyModule_AddObject(m, "NewTypeInit", (PyObject*)&NewTypeInitType) < 0) {

newtype/extensions/newtype_meth.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ static PyMemberDef newtypemethodobject_members[] = {
262262

263263
// Type definition
264264
PyTypeObject NewTypeMethodType = {
265-
PyVarObject_HEAD_INIT(&PyType_Type, 0).tp_name =
266-
"newtypemethod.NewTypeMethod",
265+
PyVarObject_HEAD_INIT(NULL, 0).tp_name = "newtypemethod.NewTypeMethod",
267266
.tp_doc =
268267
"A descriptor class that wraps around regular methods of a class "
269268
"to allow instantiation of the subtype if the method returns an "
@@ -292,16 +291,16 @@ static struct PyModuleDef newtypemethodmodule = {
292291
"that wraps around regular methods of a class to allow instantiation "
293292
"of the subtype if the method returns an instance of the supertype.",
294293
.m_size = -1,
294+
.m_methods = NewTypeMethod_methods,
295295
};
296296

297297
// Module initialization function
298298
PyMODINIT_FUNC PyInit_newtypemethod(void)
299299
{
300-
PyObject* m;
301300
if (PyType_Ready(&NewTypeMethodType) < 0)
302301
return NULL;
303302

304-
m = PyModule_Create(&newtypemethodmodule);
303+
PyObject* m = PyModule_Create(&newtypemethodmodule);
305304
if (m == NULL)
306305
return NULL;
307306

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ optional = true
6565

6666
[tool.poetry.group.profiling.dependencies]
6767
memray = { version = "^1.11.0", markers = "sys_platform != 'win32'" }
68+
pytest-memray = { version = "*", markers = "sys_platform != 'win32'" }
6869

6970
[tool.poetry.group.debug]
7071
optional = true
@@ -74,7 +75,6 @@ line_profiler = "*"
7475

7576
[tool.poetry.group.tests.dependencies]
7677
coverage = { extras = ["toml"], version = "*" }
77-
pytest-memray = "*"
7878
pytest = "*"
7979
pytest-cov = "*"
8080
pytest-mock = "*"

0 commit comments

Comments
 (0)