diff --git a/src/error.c b/src/error.c
index d22cdc736351fc53144c95df815381a5a230bcbc..5768df6ef53cb39ce2d49974c8b8760d5d823f9d 100644
--- a/src/error.c
+++ b/src/error.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: error.c,v 1.141 2004/11/14 17:44:05 mast Exp $
+|| $Id: error.c,v 1.142 2004/12/17 16:25:03 mast Exp $
 */
 
 #define NO_PIKE_SHORTHAND
@@ -755,15 +755,28 @@ static void f_error__sprintf(INT32 args)
 static void f_error_create(INT32 args)
 {
   struct pike_string *msg;
-  get_all_args("create", args, "%W", &msg);
+  struct array *bt = NULL;
+
+  get_all_args("create", args, "%W.%A", &msg, &bt);
+
   do_free_string(GENERIC_ERROR_THIS->error_message);
   copy_shared_string(GENERIC_ERROR_THIS->error_message, msg);
-  f_backtrace(0);
-  push_int (1);
-  o_range2 (RANGE_LOW_OPEN|RANGE_HIGH_FROM_END);
-  assign_to_short_svalue ((union anything *)&GENERIC_ERROR_THIS->error_backtrace,
-			  PIKE_T_ARRAY, Pike_sp-1);
-  pop_n_elems(args+1);
+
+  if (bt) {
+    if (GENERIC_ERROR_THIS->error_backtrace)
+      free_array (GENERIC_ERROR_THIS->error_backtrace);
+    add_ref (GENERIC_ERROR_THIS->error_backtrace = bt);
+  }
+  else {
+    f_backtrace(0);
+    push_int (1);
+    o_range2 (RANGE_LOW_OPEN|RANGE_HIGH_FROM_END);
+    assign_to_short_svalue ((union anything *)&GENERIC_ERROR_THIS->error_backtrace,
+			    PIKE_T_ARRAY, Pike_sp-1);
+    pop_stack();
+  }
+
+  pop_n_elems(args);
 }
 
 /*! @endclass
diff --git a/src/errors.h b/src/errors.h
index 2cc5ce96af877922130cd427254b6d96b5230466..7abf9f64d5456e4a57ecae37347684c96f15bb61 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: errors.h,v 1.28 2004/11/05 20:03:26 nilsson Exp $
+|| $Id: errors.h,v 1.29 2004/12/17 16:25:03 mast Exp $
 */
 
 #ifdef ERR_DECLARE
@@ -87,7 +87,7 @@ DECLARE_ERROR(generic, Generic, EMPTY ,
   ERR_FUNC("message", f_error_message, tFunc(tVoid,tString), 0)
   ERR_FUNC("backtrace",f_error_backtrace,tFunc(tVoid,tArr(tMixed)),0)
   ERR_FUNC("_sprintf",f_error__sprintf,tFunc(tNone,tString),0)
-  ERR_FUNC("create",f_error_create,tFunc(tStr,tVoid),ID_STATIC)
+  ERR_FUNC("create",f_error_create,tFunc(tStr tOr(tVoid,tArr(tMixed)),tVoid),ID_STATIC)
 )
 
 #define GENERIC_ERROR_THIS ((struct generic_error_struct *)CURRENT_STORAGE)