Files
workinf_Blender_Wasm/tools/web/patches/cpython-3.13-webengine-unraisable.patch
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

33 lines
1.1 KiB
Diff

--- a/Python/errors.c
+++ b/Python/errors.c
@@ -1584,6 +1584,15 @@
An exception must be set when calling this function. */
+#ifdef __EMSCRIPTEN__
+/* Optional native embedder notification, before allocation, exception
+ * normalization, audit hooks or sys.unraisablehook. The embedder must not call
+ * Python or retain the exception. Standalone CPython keeps its usual behavior.
+ * This also covers a deleted sys.unraisablehook and hook-argument OOM. */
+extern void web_engine_python_unraisable(const char *exception_type)
+ __attribute__((weak));
+#endif
+
static void
format_unraisable_v(const char *format, va_list va, PyObject *obj)
{
@@ -1598,6 +1607,13 @@
PyObject *exc_type, *exc_value, *exc_tb;
_PyErr_Fetch(tstate, &exc_type, &exc_value, &exc_tb);
+#ifdef __EMSCRIPTEN__
+ if (web_engine_python_unraisable != NULL) {
+ web_engine_python_unraisable(
+ exc_type != NULL && PyType_Check(exc_type)
+ ? ((PyTypeObject *)exc_type)->tp_name : NULL);
+ }
+#endif
assert(exc_type != NULL);
if (exc_type == NULL) {