File stdlib2-stacktrace.patch of Package stdlib2

diff -Ndurp stdlib2/src/s2_maybe.erl stdlib2-stacktrace/src/s2_maybe.erl
--- stdlib2/src/s2_maybe.erl	2016-09-12 11:35:54.000000000 +0300
+++ stdlib2-stacktrace/src/s2_maybe.erl	2022-06-10 16:16:55.255300592 +0300
@@ -18,6 +18,15 @@
         , unlift/2
         ]).
 
+-ifdef(OTP_RELEASE).
+-if (?OTP_RELEASE >= 21).
+-define(WITH_STACKTRACE(T, R, S), T:R:S ->).
+-endif.
+-endif.
+-ifndef(WITH_STACKTRACE).
+-define(WITH_STACKTRACE(T, R, S), T:R -> S = erlang:get_stacktrace(),).
+-endif.
+
 %%%_* Includes =========================================================
 -include_lib("eunit/include/eunit.hrl").
 -include_lib("stdlib2/include/prelude.hrl").
@@ -57,7 +66,8 @@ lift(F) ->
     Res                -> {ok, Res}
   catch
     throw:{error, Rsn} -> {error, Rsn};
-    _:Exn              -> {error, {lifted_exn, Exn, erlang:get_stacktrace()}}
+    ?WITH_STACKTRACE(_, Exn, Stacktrace)
+                          {error, {lifted_exn, Exn, Stacktrace}}
   end.
 
 
openSUSE Build Service is sponsored by