Skip to content

Commit 1e968c6

Browse files
committed
Resync inlined files
1 parent 0d72f6b commit 1e968c6

File tree

8 files changed

+8316
-3201
lines changed

8 files changed

+8316
-3201
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
2+
/* Generator object interface */
3+
4+
#ifndef Py_LIMITED_API
5+
#ifndef Py_GENOBJECT_H
6+
#define Py_GENOBJECT_H
7+
#ifdef __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
#include "pystate.h" /* _PyErr_StackItem */
12+
13+
struct _frame; /* Avoid including frameobject.h */
14+
15+
/* _PyGenObject_HEAD defines the initial segment of generator
16+
and coroutine objects. */
17+
#define _PyGenObject_HEAD(prefix) \
18+
PyObject_HEAD \
19+
/* Note: gi_frame can be NULL if the generator is "finished" */ \
20+
struct _frame *prefix##_frame; \
21+
/* True if generator is being executed. */ \
22+
char prefix##_running; \
23+
/* The code object backing the generator */ \
24+
PyObject *prefix##_code; \
25+
/* List of weak reference. */ \
26+
PyObject *prefix##_weakreflist; \
27+
/* Name of the generator. */ \
28+
PyObject *prefix##_name; \
29+
/* Qualified name of the generator. */ \
30+
PyObject *prefix##_qualname; \
31+
_PyErr_StackItem prefix##_exc_state;
32+
33+
typedef struct {
34+
/* The gi_ prefix is intended to remind of generator-iterator. */
35+
_PyGenObject_HEAD(gi)
36+
} PyGenObject;
37+
38+
PyAPI_DATA(PyTypeObject) PyGen_Type;
39+
40+
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
41+
#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type)
42+
43+
PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *);
44+
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(struct _frame *,
45+
PyObject *name, PyObject *qualname);
46+
PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *);
47+
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
48+
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
49+
PyAPI_FUNC(PyObject *) _PyGen_Send(PyGenObject *, PyObject *);
50+
PyObject *_PyGen_yf(PyGenObject *);
51+
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
52+
53+
#ifndef Py_LIMITED_API
54+
typedef struct {
55+
_PyGenObject_HEAD(cr)
56+
PyObject *cr_origin;
57+
} PyCoroObject;
58+
59+
PyAPI_DATA(PyTypeObject) PyCoro_Type;
60+
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
61+
62+
PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type;
63+
64+
#define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type)
65+
PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
66+
PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *,
67+
PyObject *name, PyObject *qualname);
68+
69+
/* Asynchronous Generators */
70+
71+
typedef struct {
72+
_PyGenObject_HEAD(ag)
73+
PyObject *ag_finalizer;
74+
75+
/* Flag is set to 1 when hooks set up by sys.set_asyncgen_hooks
76+
were called on the generator, to avoid calling them more
77+
than once. */
78+
int ag_hooks_inited;
79+
80+
/* Flag is set to 1 when aclose() is called for the first time, or
81+
when a StopAsyncIteration exception is raised. */
82+
int ag_closed;
83+
84+
int ag_running_async;
85+
} PyAsyncGenObject;
86+
87+
PyAPI_DATA(PyTypeObject) PyAsyncGen_Type;
88+
PyAPI_DATA(PyTypeObject) _PyAsyncGenASend_Type;
89+
PyAPI_DATA(PyTypeObject) _PyAsyncGenWrappedValue_Type;
90+
PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
91+
92+
PyAPI_FUNC(PyObject *) PyAsyncGen_New(struct _frame *,
93+
PyObject *name, PyObject *qualname);
94+
95+
#define PyAsyncGen_CheckExact(op) (Py_TYPE(op) == &PyAsyncGen_Type)
96+
97+
PyObject *_PyAsyncGenValueWrapperNew(PyObject *);
98+
99+
int PyAsyncGen_ClearFreeLists(void);
100+
101+
#endif
102+
103+
#undef _PyGenObject_HEAD
104+
105+
#ifdef __cplusplus
106+
}
107+
#endif
108+
#endif /* !Py_GENOBJECT_H */
109+
#endif /* Py_LIMITED_API */
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
/* simple namespace object interface */
3+
4+
#ifndef NAMESPACEOBJECT_H
5+
#define NAMESPACEOBJECT_H
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
#ifndef Py_LIMITED_API
11+
PyAPI_DATA(PyTypeObject) _PyNamespace_Type;
12+
13+
PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds);
14+
#endif /* !Py_LIMITED_API */
15+
16+
#ifdef __cplusplus
17+
}
18+
#endif
19+
#endif /* !NAMESPACEOBJECT_H */
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#ifndef Py_TRACEMALLOC_H
2+
#define Py_TRACEMALLOC_H
3+
4+
#ifndef Py_LIMITED_API
5+
/* Track an allocated memory block in the tracemalloc module.
6+
Return 0 on success, return -1 on error (failed to allocate memory to store
7+
the trace).
8+
9+
Return -2 if tracemalloc is disabled.
10+
11+
If memory block is already tracked, update the existing trace. */
12+
PyAPI_FUNC(int) PyTraceMalloc_Track(
13+
unsigned int domain,
14+
uintptr_t ptr,
15+
size_t size);
16+
17+
/* Untrack an allocated memory block in the tracemalloc module.
18+
Do nothing if the block was not tracked.
19+
20+
Return -2 if tracemalloc is disabled, otherwise return 0. */
21+
PyAPI_FUNC(int) PyTraceMalloc_Untrack(
22+
unsigned int domain,
23+
uintptr_t ptr);
24+
25+
/* Get the traceback where a memory block was allocated.
26+
27+
Return a tuple of (filename: str, lineno: int) tuples.
28+
29+
Return None if the tracemalloc module is disabled or if the memory block
30+
is not tracked by tracemalloc.
31+
32+
Raise an exception and return NULL on error. */
33+
PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback(
34+
unsigned int domain,
35+
uintptr_t ptr);
36+
#endif
37+
38+
#endif /* !Py_TRACEMALLOC_H */

0 commit comments

Comments
 (0)