22#define LIBRT_INTERNAL_H
33
44#define LIBRT_INTERNAL_ABI_VERSION 1
5- #define LIBRT_INTERNAL_API_LEN 17
5+ #define LIBRT_INTERNAL_API_LEN 19
66
77#ifdef LIBRT_INTERNAL_MODULE
88
@@ -25,6 +25,8 @@ static int NativeInternal_ABI_Version(void);
2525static char write_bytes_internal (PyObject * data , PyObject * value );
2626static PyObject * read_bytes_internal (PyObject * data );
2727static uint8_t cache_version_internal (void );
28+ static PyTypeObject * ReadBuffer_type_internal (void );
29+ static PyTypeObject * WriteBuffer_type_internal (void );
2830
2931#else
3032
@@ -47,6 +49,8 @@ static void *NativeInternal_API[LIBRT_INTERNAL_API_LEN];
4749#define write_bytes_internal (*(char (*)(PyObject *source, PyObject *value)) NativeInternal_API[14])
4850#define read_bytes_internal (*(PyObject* (*)(PyObject *source)) NativeInternal_API[15])
4951#define cache_version_internal (*(uint8_t (*)(void)) NativeInternal_API[16])
52+ #define ReadBuffer_type_internal (*(PyTypeObject* (*)(void)) NativeInternal_API[17])
53+ #define WriteBuffer_type_internal (*(PyTypeObject* (*)(void)) NativeInternal_API[18])
5054
5155static int
5256import_librt_internal (void )
@@ -67,4 +71,13 @@ import_librt_internal(void)
6771}
6872
6973#endif
74+
75+ static inline bool CPyReadBuffer_Check (PyObject * obj ) {
76+ return Py_TYPE (obj ) == ReadBuffer_type_internal ();
77+ }
78+
79+ static inline bool CPyWriteBuffer_Check (PyObject * obj ) {
80+ return Py_TYPE (obj ) == WriteBuffer_type_internal ();
81+ }
82+
7083#endif // LIBRT_INTERNAL_H
0 commit comments