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
commitbdd4e1c8e141e3d29cc34f16de962d96f4dd8844 (patch)
tree3494d1cd4ec81d1a4674cd90f2bc22d7e7970361
parent779754a6f5564e691041b36f350c4ad6bf5ba561 (diff)
downloadtxr-bdd4e1c8e141e3d29cc34f16de962d96f4dd8844.tar.gz
txr-bdd4e1c8e141e3d29cc34f16de962d96f4dd8844.tar.bz2
txr-bdd4e1c8e141e3d29cc34f16de962d96f4dd8844.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);