Skip to content

Commit 18287f4

Browse files
committed
Add Python bindings for binary writer and reader
Exposes BinaryWriter and BinaryReader as Python types in _remote_debugging module. BinaryWriter wraps the C writer with write_sample() and finalize() methods. BinaryReader provides replay() to feed samples through any collector. Also adds zstd_available() function to let Python code check whether compression support was compiled in.
1 parent 8931b4a commit 18287f4

File tree

3 files changed

+1198
-5
lines changed

3 files changed

+1198
-5
lines changed

Modules/_remote_debugging/_remote_debugging.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
extern "C" {
1313
#endif
1414

15+
#ifndef _GNU_SOURCE
1516
#define _GNU_SOURCE
17+
#endif
1618

1719
#ifndef Py_BUILD_CORE_BUILTIN
20+
# ifndef Py_BUILD_CORE_MODULE
1821
# define Py_BUILD_CORE_MODULE 1
22+
# endif
1923
#endif
2024

2125
#include "Python.h"
@@ -197,6 +201,8 @@ typedef struct {
197201
PyTypeObject *ThreadInfo_Type;
198202
PyTypeObject *InterpreterInfo_Type;
199203
PyTypeObject *AwaitedInfo_Type;
204+
PyTypeObject *BinaryWriter_Type;
205+
PyTypeObject *BinaryReader_Type;
200206
} RemoteDebuggingState;
201207

202208
enum _ThreadState {

0 commit comments

Comments
 (0)