[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: likely regressions for debugging hooks x lua_resume() in 5.4
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 8 Sep 2023 13:46:14 -0300
> Maybe this corner case should be documented in the Lua documentation
> (after a yield nbargs should be set according to the number of pushed
> arguments AFTER the yield prior to calling resume() again?) given that
> this is something that "used to work by accident", or at least to not
> fail in 5.3 and now results in somewhat unexpected behavior in 5.4, and
> could lead to tricky bugs when upgrading from 5.3 from 5.4 with existing
> scripts.
The documentation of lua_resume says this:
To resume a coroutine,
you remove the @id{*nresults} yielded values from its stack,
push the values to be passed as results from @id{yield},
and then call @Lid{lua_resume}.
Isn't that not enough?
> Now for the first raised issue ("C stack overflow" errors), I still
> believe that this looks like a bug or undesired regression in lua 5.4
> implementation, because interrupting and resuming multiple times (in a
> loop manner, no recursion involved) from the same parent coroutine seems
> to be a pretty valid use-case, is it?
The documentation says that "The parameter @id{from} represents the
coroutine that is resuming @id{L}." Is seems weird (and invalid) for a
coroutine to resume itself. The documentation also says that
"If there is no such coroutine, this parameter can be @id{NULL}."
-- Roberto