diff -u -r Tcl-0.97.orig/Tcl.xs Tcl-0.97/Tcl.xs
--- Tcl-0.97.orig/Tcl.xs 2008-09-07 09:21:59.000000000 +0900
+++ Tcl-0.97/Tcl.xs 2009-08-13 12:55:48.000000000 +0900
@@ -650,7 +650,7 @@
/* XXX: Is this handling refcount on NewObj right? */
Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewObj());
} else {
- if ((AV *) SvRV(*svp) == av) {
+ if (SvROK(*svp) && ((AV *) SvRV(*svp) == av)) {
/* XXX: Is this a proper check for cyclical reference? */
croak("cyclical array reference found");
abort();
diff -u -r Tcl-0.97.orig/t/result.t Tcl-0.97/t/result.t
--- Tcl-0.97.orig/t/result.t 2008-09-07 09:21:59.000000000 +0900
+++ Tcl-0.97/t/result.t 2009-08-13 12:55:53.000000000 +0900
@@ -2,7 +2,7 @@
$| = 1;
-print "1..5\n";
+print "1..7\n";
sub foo {
my $interp = $_[1];
@@ -49,3 +49,21 @@
} else {
print "ok 5\n";
}
+
+$i->ResetResult();
+
+eval {
+ $i->AppendResult([[0..3], [4..7]]);
+};
+
+if ($@) {
+ print "Not ok 6\n";
+} else {
+ print "ok 6\n";
+}
+
+if ($i->result eq q{{0 1 2 3} {4 5 6 7}}) {
+ print "ok 7\n";
+} else {
+ print "Not ok 7\n";
+}