mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-07-03 11:12:30 +08:00
Give the functions for creating various objects unique names so they are easily recognized in macOS's non-fully-symolicated crash reports
This commit is contained in:
@@ -153,7 +153,7 @@ mask_kitty_signals_process_wide(PyObject *self UNUSED, PyObject *a UNUSED) {
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
new_childmonitor_object(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
ChildMonitor *self;
|
||||
PyObject *dump_callback, *death_notify;
|
||||
int talk_fd = -1, listen_fd = -1;
|
||||
@@ -1933,7 +1933,7 @@ PyTypeObject ChildMonitor_Type = {
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_doc = "ChildMonitor",
|
||||
.tp_methods = methods,
|
||||
.tp_new = new,
|
||||
.tp_new = new_childmonitor_object,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <structmember.h>
|
||||
|
||||
static PyObject *
|
||||
new(PyTypeObject *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
new_cursor_object(PyTypeObject *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
Cursor *self;
|
||||
|
||||
self = (Cursor *)type->tp_alloc(type, 0);
|
||||
@@ -310,7 +310,7 @@ PyTypeObject Cursor_Type = {
|
||||
.tp_methods = methods,
|
||||
.tp_members = members,
|
||||
.tp_getset = getseters,
|
||||
.tp_new = new,
|
||||
.tp_new = new_cursor_object,
|
||||
};
|
||||
|
||||
RICHCMP(Cursor)
|
||||
@@ -332,7 +332,7 @@ copy(Cursor *self, PyObject *a UNUSED) {
|
||||
}
|
||||
|
||||
Cursor *alloc_cursor(void) {
|
||||
return (Cursor*)new(&Cursor_Type, NULL, NULL);
|
||||
return (Cursor*)new_cursor_object(&Cursor_Type, NULL, NULL);
|
||||
}
|
||||
|
||||
INIT_TYPE(Cursor)
|
||||
|
||||
@@ -66,7 +66,7 @@ free_cache_entry(CacheEntry *e) {
|
||||
#define mutex(op) pthread_mutex_##op(&self->lock)
|
||||
|
||||
static PyObject*
|
||||
new(PyTypeObject *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
new_diskcache_object(PyTypeObject *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
DiskCache *self;
|
||||
self = (DiskCache*)type->tp_alloc(type, 0);
|
||||
if (self) {
|
||||
@@ -783,7 +783,7 @@ PyTypeObject DiskCache_Type = {
|
||||
.tp_doc = "A disk based secure cache",
|
||||
.tp_methods = methods,
|
||||
.tp_members = members,
|
||||
.tp_new = new,
|
||||
.tp_new = new_diskcache_object,
|
||||
};
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
@@ -792,4 +792,4 @@ static PyMethodDef module_methods[] = {
|
||||
};
|
||||
|
||||
INIT_TYPE(DiskCache)
|
||||
PyObject* create_disk_cache(void) { return new(&DiskCache_Type, NULL, NULL); }
|
||||
PyObject* create_disk_cache(void) { return new_diskcache_object(&DiskCache_Type, NULL, NULL); }
|
||||
|
||||
@@ -2210,7 +2210,7 @@ grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint
|
||||
|
||||
// Boilerplate {{{
|
||||
static PyObject *
|
||||
new(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
new_graphicsmanager_object(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
PyObject *ans = (PyObject*)grman_alloc(false);
|
||||
if (ans == NULL) PyErr_NoMemory();
|
||||
return ans;
|
||||
@@ -2343,7 +2343,7 @@ PyTypeObject GraphicsManager_Type = {
|
||||
.tp_dealloc = (destructor)dealloc,
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_doc = "GraphicsManager",
|
||||
.tp_new = new,
|
||||
.tp_new = new_graphicsmanager_object,
|
||||
.tp_methods = methods,
|
||||
.tp_members = members,
|
||||
.tp_getset = getsets,
|
||||
|
||||
@@ -133,7 +133,7 @@ create_historybuf(PyTypeObject *type, unsigned int xnum, unsigned int ynum, unsi
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
new_history_object(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
unsigned int xnum = 1, ynum = 1, pagerhist_sz = 0;
|
||||
if (!PyArg_ParseTuple(args, "II|I", &ynum, &xnum, &pagerhist_sz)) return NULL;
|
||||
HistoryBuf *ans = create_historybuf(type, xnum, ynum, pagerhist_sz);
|
||||
@@ -569,7 +569,7 @@ PyTypeObject HistoryBuf_Type = {
|
||||
.tp_methods = methods,
|
||||
.tp_members = members,
|
||||
.tp_str = (reprfunc)__str__,
|
||||
.tp_new = new
|
||||
.tp_new = new_history_object
|
||||
};
|
||||
|
||||
INIT_TYPE(HistoryBuf)
|
||||
|
||||
@@ -22,7 +22,7 @@ typedef struct {
|
||||
static PyObject* convert_glfw_key_event_to_python(const GLFWkeyevent *ev);
|
||||
|
||||
static PyObject*
|
||||
new(PyTypeObject *type UNUSED, PyObject *args, PyObject *kw) {
|
||||
new_keyevent_object(PyTypeObject *type UNUSED, PyObject *args, PyObject *kw) {
|
||||
static char *kwds[] = {"key", "shifted_key", "alternate_key", "mods", "action", "native_key", "ime_state", "text", NULL};
|
||||
GLFWkeyevent ev = {.action=GLFW_PRESS};
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kw, "I|IIiiiiz", kwds, &ev.key, &ev.shifted_key, &ev.alternate_key, &ev.mods, &ev.action, &ev.native_key, &ev.ime_state, &ev.text)) return NULL;
|
||||
@@ -69,7 +69,7 @@ PyTypeObject PyKeyEvent_Type = {
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_doc = "A key event",
|
||||
.tp_members = members,
|
||||
.tp_new = new,
|
||||
.tp_new = new_keyevent_object,
|
||||
};
|
||||
|
||||
static PyObject*
|
||||
|
||||
@@ -71,7 +71,7 @@ clear(LineBuf *self, PyObject *a UNUSED) {
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
new_linebuf_object(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
LineBuf *self;
|
||||
unsigned int xnum = 1, ynum = 1;
|
||||
|
||||
@@ -555,7 +555,7 @@ PyTypeObject LineBuf_Type = {
|
||||
.tp_methods = methods,
|
||||
.tp_members = members,
|
||||
.tp_str = (reprfunc)__str__,
|
||||
.tp_new = new
|
||||
.tp_new = new_linebuf_object
|
||||
};
|
||||
|
||||
INIT_TYPE(LineBuf)
|
||||
@@ -637,5 +637,5 @@ rewrap(LineBuf *self, PyObject *args) {
|
||||
}
|
||||
|
||||
LineBuf *alloc_linebuf(unsigned int lines, unsigned int columns) {
|
||||
return (LineBuf*)new(&LineBuf_Type, Py_BuildValue("II", lines, columns), NULL);
|
||||
return (LineBuf*)new_linebuf_object(&LineBuf_Type, Py_BuildValue("II", lines, columns), NULL);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
extern PyTypeObject Cursor_Type;
|
||||
|
||||
static PyObject *
|
||||
new(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
new_line_object(PyTypeObject UNUSED *type, PyObject UNUSED *args, PyObject UNUSED *kwds) {
|
||||
PyErr_SetString(PyExc_TypeError, "Line objects cannot be instantiated directly, create them using LineBuf.line()");
|
||||
return NULL;
|
||||
}
|
||||
@@ -955,7 +955,7 @@ PyTypeObject Line_Type = {
|
||||
.tp_richcompare = richcmp,
|
||||
.tp_doc = "Lines",
|
||||
.tp_methods = methods,
|
||||
.tp_new = new
|
||||
.tp_new = new_line_object
|
||||
};
|
||||
|
||||
Line *alloc_line(void) {
|
||||
|
||||
@@ -90,7 +90,7 @@ static void update_overlay_line_data(Screen *self, uint8_t *data);
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
new_screen_object(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
Screen *self;
|
||||
int ret = 0;
|
||||
PyObject *callbacks = Py_None, *test_child = Py_None;
|
||||
@@ -4770,7 +4770,7 @@ PyTypeObject Screen_Type = {
|
||||
.tp_doc = "Screen",
|
||||
.tp_methods = methods,
|
||||
.tp_members = members,
|
||||
.tp_new = new,
|
||||
.tp_new = new_screen_object,
|
||||
.tp_getset = getsetters,
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ typedef struct {
|
||||
|
||||
|
||||
static PyObject *
|
||||
new(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
new_shlex_object(PyTypeObject *type, PyObject *args, PyObject UNUSED *kwds) {
|
||||
Shlex *self;
|
||||
self = (Shlex *)type->tp_alloc(type, 0);
|
||||
if (self) {
|
||||
@@ -154,7 +154,7 @@ PyTypeObject Shlex_Type = {
|
||||
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||||
.tp_doc = "Lexing like a shell",
|
||||
.tp_methods = methods,
|
||||
.tp_new = new,
|
||||
.tp_new = new_shlex_object,
|
||||
};
|
||||
|
||||
INIT_TYPE(Shlex)
|
||||
|
||||
@@ -1470,7 +1470,7 @@ parse_worker(void *p, ParseData *pd, bool flush) { run_worker(p, pd, flush); }
|
||||
|
||||
#ifndef DUMP_COMMANDS
|
||||
static PyObject*
|
||||
new(PyTypeObject *type UNUSED, PyObject *args, PyObject UNUSED *kwds) {
|
||||
new_vtparser_object(PyTypeObject *type UNUSED, PyObject *args, PyObject UNUSED *kwds) {
|
||||
id_type window_id=0;
|
||||
if (!PyArg_ParseTuple(args, "|K", &window_id)) return NULL;
|
||||
return (PyObject*) alloc_vt_parser(window_id);
|
||||
@@ -1525,7 +1525,7 @@ PyTypeObject Parser_Type = {
|
||||
.tp_doc = "VT Escape code parser",
|
||||
.tp_methods = methods,
|
||||
.tp_getset = getsetters,
|
||||
.tp_new = new,
|
||||
.tp_new = new_vtparser_object,
|
||||
};
|
||||
|
||||
Parser*
|
||||
|
||||
Reference in New Issue
Block a user