summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-12 19:33:08 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-12 19:33:08 -0800
commit71a0bb70a3b104646ba984f40bf0d6c996a58bc5 (patch)
tree3494d1cd4ec81d1a4674cd90f2bc22d7e7970361
parent3038f6b7ea60599058251339773412e2d02eb5c8 (diff)
downloadtxr-71a0bb70a3b104646ba984f40bf0d6c996a58bc5.tar.gz
txr-71a0bb70a3b104646ba984f40bf0d6c996a58bc5.tar.bz2
txr-71a0bb70a3b104646ba984f40bf0d6c996a58bc5.zip
printer: lambda bugfix.
* lib.c (obj_print_impl): Don't pass non-symbols to fboundp. This causes a problem in the case where we are printing an object like ((lambda ...) ...). The car of this object is the (lambda ...) form. When when pass this to fboundp, the underlying function lookup mechanism wants to turn it into a function object and tries to expand it. This can error out if the lambda has bad syntax, which can happen because it's just data that we are trying to print.
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 1abd6b83..f6c57552 100644
--- a/lib.c
+++ b/lib.c
@@ -12486,7 +12486,7 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx)
} else if (special_operator_p(sym) || macro_form_p(obj, nil)) {
indent = one;
test_neq_set_indent_mode(out, num_fast(indent_foff), num_fast(indent_code));
- } else if (fboundp(sym)) {
+ } else if (symbolp(sym) && fboundp(sym)) {
obj_print_impl(sym, out, pretty, ctx);
indent = one;
save_indent = inc_indent(out, indent);