Skip to content

Commit f933736

Browse files
committed
Break the rest of the code.
1 parent c2da1c6 commit f933736

File tree

6 files changed

+22
-62
lines changed

6 files changed

+22
-62
lines changed

hatch.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ experimental = true
1919

2020
[build.targets.wheel.hooks.scikit-build.cmake]
2121
source-dir = "."
22-
build-type = "RelWithDebInfo"
22+
build-type = "Debug"
2323
verbose = true
2424

2525
[build.targets.wheel.hooks.scikit-build.install]

include/view/app.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,28 @@ extern PyTypeObject ViewAppType;
1515
#define PyErr_BadASGI() view_PyErr_BadASGI("<unknown>.c", 0)
1616
#endif
1717

18-
int view_PyErr_BadASGI(char* file, int lineno);
18+
int view_PyErr_BadASGI(char *file, int lineno);
1919

20-
typedef struct _ViewApp {
20+
typedef struct _ViewApp
21+
{
2122
PyObject_HEAD
22-
PyObject* startup;
23-
PyObject* cleanup;
24-
map* get;
25-
map* post;
26-
map* put;
27-
map* patch;
28-
map* delete;
29-
map* options;
30-
map* websocket;
31-
map* all_routes;
32-
PyObject* client_errors[28];
33-
PyObject* server_errors[11];
23+
PyObject *startup;
24+
PyObject *cleanup;
25+
map *get;
26+
map *post;
27+
map *put;
28+
map *patch;
29+
map *delete;
30+
map *options;
31+
map *websocket;
32+
map *all_routes;
33+
PyObject *client_errors[28];
34+
PyObject *server_errors[11];
3435
bool dev;
35-
PyObject* exceptions;
36+
PyObject *exceptions;
3637
app_parsers parsers;
3738
bool has_path_params;
38-
PyObject* error_type;
39+
PyObject *error_type;
3940
} ViewApp;
4041

4142
#endif

include/view/view.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ void view_fatal(
1010
int lineno
1111
);
1212

13-
extern PyObject *ip_address;
14-
extern PyObject *invalid_status_error;
15-
extern PyObject *route_log;
16-
extern PyObject *route_warn;
17-
extern PyObject *default_headers;
18-
1913
#if defined(__LINE__) && defined(__FILE__)
2014
#define VIEW_FATAL(msg) view_fatal(msg, __FILE__, __func__, __LINE__)
2115
#else

src/_view/app.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,6 @@ app(
923923
return awaitable;
924924
} else
925925
{
926-
PyErr_SetString(PyExc_RuntimeError, "not right now");
927-
return NULL;
928926
// If there are no inputs, we can skip parsing!
929927
if (!is_http) VIEW_FATAL("got a websocket without an input!");
930928

@@ -1169,36 +1167,6 @@ supply_parsers(ViewApp *self, PyObject *args)
11691167
Py_RETURN_NONE;
11701168
}
11711169

1172-
/*
1173-
* Register the base class to be recognized as an HTTP error.
1174-
*/
1175-
static PyObject *
1176-
register_error(ViewApp *self, PyObject *args)
1177-
{
1178-
PyObject *type;
1179-
1180-
if (
1181-
!PyArg_ParseTuple(
1182-
args,
1183-
"O",
1184-
&type
1185-
)
1186-
)
1187-
return NULL;
1188-
1189-
if (Py_TYPE(type) != &PyType_Type)
1190-
{
1191-
PyErr_SetString(
1192-
PyExc_RuntimeError,
1193-
"_register_error got an object that is not a type"
1194-
);
1195-
return NULL;
1196-
}
1197-
1198-
self->error_type = Py_NewRef(type);
1199-
Py_RETURN_NONE;
1200-
}
1201-
12021170
static PyMethodDef methods[] =
12031171
{
12041172
{"asgi_app_entry", (PyCFunction) app, METH_FASTCALL, NULL},
@@ -1212,7 +1180,6 @@ static PyMethodDef methods[] =
12121180
{"_set_dev_state", (PyCFunction) set_dev_state, METH_VARARGS, NULL},
12131181
{"_err", (PyCFunction) err_handler, METH_VARARGS, NULL},
12141182
{"_supply_parsers", (PyCFunction) supply_parsers, METH_VARARGS, NULL},
1215-
{"_register_error", (PyCFunction) register_error, METH_VARARGS, NULL},
12161183
{NULL, NULL, 0, NULL}
12171184
};
12181185

src/_view/errors.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ hash_client_error(int status)
111111
}
112112

113113
PyErr_Format(
114-
invalid_status_error,
114+
PyExc_RuntimeError,
115115
"%d is not a valid status code",
116116
status
117117
);
@@ -128,7 +128,7 @@ hash_server_error(int status)
128128
if ((index < 0) || (index > 10))
129129
{
130130
PyErr_Format(
131-
invalid_status_error,
131+
PyExc_RuntimeError,
132132
"%d is not a valid status code",
133133
status
134134
);
@@ -309,7 +309,7 @@ get_err_str(int status)
309309
}
310310

311311
PyErr_Format(
312-
invalid_status_error,
312+
PyExc_RuntimeError,
313313
"invalid status code: %d",
314314
status
315315
);
@@ -972,7 +972,7 @@ load_errors(route *r, PyObject *dict)
972972
if (index == 600)
973973
{
974974
PyErr_Format(
975-
invalid_status_error,
975+
PyExc_RuntimeError,
976976
"%d is not a valid status code",
977977
status_code
978978
);

src/view/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
InvalidCustomLoaderError,
7070
ViewError,
7171
ViewInternalError,
72-
WebSocketDisconnectError,
7372
)
7473
from .response import HTML
7574
from .routing import Path as _RouteDeco
@@ -548,7 +547,6 @@ def __init__(self, config: Config) -> None:
548547
self.templaters: dict[str, Any] = {}
549548
"""Dictionary containing template engine instances."""
550549
self._reactive_sessions: dict[str, ReactPyComponent] = {}
551-
self._register_error(HTTPError)
552550
self._user_loader: CustomLoader | None = None
553551
self._run_called = False
554552

0 commit comments

Comments
 (0)