Skip to content

Commit c56f335

Browse files
committed
Undo changes in preperation for a simpler API.
1 parent a950a1e commit c56f335

12 files changed

Lines changed: 75 additions & 820 deletions

File tree

Doc/c-api/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ document the API functions in detail.
1717
veryhigh.rst
1818
refcounting.rst
1919
exceptions.rst
20-
traceback.rst
2120
extension-modules.rst
2221
utilities.rst
2322
abstract.rst

Doc/c-api/traceback.rst

Lines changed: 0 additions & 96 deletions
This file was deleted.

Include/cpython/traceback.h

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -11,71 +11,3 @@ struct _traceback {
1111
int tb_lasti;
1212
int tb_lineno;
1313
};
14-
15-
/* Buffer size for the filename and name fields in PyUnstable_FrameInfo:
16-
up to 500 content bytes plus '\0' (1). */
17-
#define Py_UNSTABLE_FRAMEINFO_STRSIZE 501
18-
19-
/* Structured, plain-data representation of a single Python frame.
20-
PyUnstable_CollectCallStack and PyUnstable_PrintCallStack() do not
21-
acquire or release the GIL or allocate heap memory, so they can be called
22-
from signal handlers and are suitable for low-overhead observability tools
23-
such as sampling profilers and tracers.
24-
25-
Populated by PyUnstable_CollectCallStack. filename and name are
26-
ASCII-encoded (non-ASCII characters are backslash-escaped) and
27-
null-terminated; they are empty strings if the corresponding code
28-
attribute is missing or not a unicode object. lineno is -1 when it
29-
cannot be determined. filename_truncated and name_truncated are 1 if
30-
the respective string was longer than Py_UNSTABLE_FRAMEINFO_STRSIZE-1
31-
bytes and was truncated. */
32-
typedef struct {
33-
int lineno;
34-
int filename_truncated;
35-
int name_truncated;
36-
char filename[Py_UNSTABLE_FRAMEINFO_STRSIZE];
37-
char name[Py_UNSTABLE_FRAMEINFO_STRSIZE];
38-
} PyUnstable_FrameInfo;
39-
40-
/* Collect up to max_frames frames from tstate into the caller-supplied
41-
frames array and return the number of frames written (0..max_frames).
42-
Returns -1 if frames is NULL, tstate is freed, or tstate has no current
43-
Python frame.
44-
45-
The filename and function names are encoded to ASCII with backslashreplace
46-
and truncated to 500 characters; when truncated, the corresponding
47-
filename_truncated or name_truncated field is set to 1.
48-
49-
In crash scenarios such as signal handlers for SIGSEGV, where the
50-
interpreter may be in an inconsistent state, the function might produce
51-
incomplete output or it may even crash itself.
52-
53-
The caller does not need to hold an attached thread state, nor does tstate
54-
need to be attached.
55-
56-
This function does not acquire or release the GIL, modify reference counts,
57-
or allocate heap memory. */
58-
PyAPI_FUNC(int) PyUnstable_CollectCallStack(
59-
PyThreadState *tstate,
60-
PyUnstable_FrameInfo *frames,
61-
int max_frames);
62-
63-
/* Write a traceback collected by PyUnstable_CollectCallStack to fd.
64-
The format looks like:
65-
66-
Stack (most recent call first):
67-
File "foo/bar.py", line 42 in myfunc
68-
File "foo/bar.py", line 99 in caller
69-
70-
Pass write_header=1 to emit the "Stack (most recent call first):" header
71-
line, or write_header=0 to omit it.
72-
73-
This function only reads the caller-supplied frames array and does not
74-
access interpreter state. It is async-signal-safe: it does not acquire or
75-
release the GIL, modify reference counts, or allocate heap memory, and its
76-
only I/O is via write(2). */
77-
PyAPI_FUNC(void) PyUnstable_PrintCallStack(
78-
int fd,
79-
const PyUnstable_FrameInfo *frames,
80-
int n_frames,
81-
int write_header);

Include/internal/pycore_traceback.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int, int *, P
1414
// Export for 'pyexact' shared extension
1515
PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int);
1616

17-
#include "traceback.h" /* PyUnstable_FrameInfo, PyUnstable_CollectCallStack,
18-
PyUnstable_PrintCallStack */
19-
2017
/* Write the Python traceback into the file 'fd'. For example:
2118
2219
Traceback (most recent call first):

0 commit comments

Comments
 (0)