Nuitka
The Python compiler
Loading...
Searching...
No Matches
checkers.h
1
// Copyright 2025, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
3
#ifndef __NUITKA_CHECKERS_H__
4
#define __NUITKA_CHECKERS_H__
5
6
// Helper to check that an object is valid and has positive reference count.
7
#define CHECK_OBJECT(value) (assert((value) != NULL), assert(Py_REFCNT(value) > 0))
8
#define CHECK_OBJECT_X(value) (assert((value) == NULL || Py_REFCNT(value) > 0))
9
10
// Helper to check an array of objects with CHECK_OBJECT
11
#ifndef __NUITKA_NO_ASSERT__
12
#define CHECK_OBJECTS(values, count) \
13
{ \
14
for (int i = 0; i < count; i++) { \
15
CHECK_OBJECT((values)[i]); \
16
} \
17
}
18
#else
19
#define CHECK_OBJECTS(values, count)
20
#endif
21
22
extern
void
CHECK_OBJECT_DEEP(PyObject *value);
23
extern
void
CHECK_OBJECTS_DEEP(PyObject *
const
*values, Py_ssize_t size);
24
25
#endif
26
// Part of "Nuitka", an optimizing Python compiler that is compatible and
27
// integrates with CPython, but also works on its own.
28
//
29
// Licensed under the Apache License, Version 2.0 (the "License");
30
// you may not use this file except in compliance with the License.
31
// You may obtain a copy of the License at
32
//
33
// http://www.apache.org/licenses/LICENSE-2.0
34
//
35
// Unless required by applicable law or agreed to in writing, software
36
// distributed under the License is distributed on an "AS IS" BASIS,
37
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
// See the License for the specific language governing permissions and
39
// limitations under the License.
nuitka
build
include
nuitka
checkers.h
Generated by
1.9.8