对象协议

PyObject * Py_GetConstant ( unsigned int constant_id )
属于 稳定 ABI (应用程序二进制接口) since version 3.13.

Get a 强引用 to a constant.

Set an exception and return NULL if constant_id 无效。

constant_id must be one of these constant identifiers:

Constant Identifier

Returned object

Py_CONSTANT_NONE

0

None

Py_CONSTANT_FALSE

1

False

Py_CONSTANT_TRUE

2

True

Py_CONSTANT_ELLIPSIS

3

Ellipsis

Py_CONSTANT_NOT_IMPLEMENTED

4

NotImplemented

Py_CONSTANT_ZERO

5

0

Py_CONSTANT_ONE

6

1

Py_CONSTANT_EMPTY_STR

7

''

Py_CONSTANT_EMPTY_BYTES

8

b''

Py_CONSTANT_EMPTY_TUPLE

9

()

Numeric values are only given for projects which cannot use the constant identifiers.

3.13 版添加。