]> git.eshelyaron.com Git - emacs.git/commit
Don't overwrite non-local exit symbol and data (Bug#65796).
authorPhilipp Stephani <p.stephani2@gmail.com>
Thu, 30 Jan 2025 15:12:49 +0000 (16:12 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 28 Feb 2025 11:19:57 +0000 (12:19 +0100)
commit9b7e83dee592c24d81288087b8722d485d01d617
tree5c02c3d6079db3255b604ea4bde61d6be98b265d
parentceba71e365772d571e189d59f027b6a93461141a
Don't overwrite non-local exit symbol and data (Bug#65796).

The previous approach would incorrectly invalidate the returned module
values if another non-local exit occurred while dealing with a non-local
exit.  See Bug#65796.  Instead, allocate the values from the usual
environment storage, and return statically-allocated objects if that
fails.

* src/emacs-module.c (struct emacs_env_private): Turn non-local exit
symbol and data into normal Lisp objects.
(initialize_environment): Initialize them.
(mark_module_environment): Prevent them from being garbage-collected.
(module_signal_or_throw, module_non_local_exit_signal_1)
(module_non_local_exit_throw_1): Adapt uses.
(value_to_lisp): No longer scan for them with module assertions enabled.
(module_out_of_memory_signal, module_out_of_memory_data): New
statically-allocated module values to return in case of allocation
failure.
(syms_of_module): Initialize them.
(module_non_local_exit_get): Allocate module values normally.  If that
fails, return statically-allocated values.

* doc/lispref/internals.texi (Module Nonlocal): Document new behavior.

(cherry picked from commit 32da093e524d5e28945557701f7c50d7c4a898cd)
doc/lispref/internals.texi
src/emacs-module.c