diff options
author | Mark H Weaver <mhw@netris.org> | 2018-05-28 12:19:41 -0400 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2018-08-07 12:05:31 +0200 |
commit | 9fd1dc2fcce421f6b044398f3735b6e37459baa0 (patch) | |
tree | 26150e95ad77bb09b7c3f142b66fee584027f47e /module/oop | |
parent | fe92bc26a67c3092b64851cef06ab5a072bd705b (diff) | |
download | guile-9fd1dc2fcce421f6b044398f3735b6e37459baa0.tar.gz |
goops: Fix 'instance?' to work on objects that aren't structs.
Fixes <https://bugs.gnu.org/31606>
Reported by Tommi Höynälänmaa <tommi.hoynalanmaa@gmail.com>
* module/oop/goops.scm (instance?): Check that OBJ is a struct
before applying 'struct-vtable' to it.
Diffstat (limited to 'module/oop')
-rw-r--r-- | module/oop/goops.scm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/module/oop/goops.scm b/module/oop/goops.scm index 4bde684e7..df6df4f7b 100644 --- a/module/oop/goops.scm +++ b/module/oop/goops.scm @@ -1,6 +1,7 @@ ;;;; goops.scm -- The Guile Object-Oriented Programming System ;;;; -;;;; Copyright (C) 1998-2003,2006,2009-2011,2013-2015,2017 Free Software Foundation, Inc. +;;;; Copyright (C) 1998-2003,2006,2009-2011,2013-2015,2017-2018 +;;;; Free Software Foundation, Inc. ;;;; Copyright (C) 1993-1998 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr> ;;;; ;;;; This library is free software; you can redistribute it and/or @@ -285,7 +286,8 @@ (class-has-flags? (struct-vtable obj) vtable-flag-goops-slot))) (define-inlinable (instance? obj) - (class-has-flags? (struct-vtable obj) vtable-flag-goops-class)) + (and (struct? obj) + (class-has-flags? (struct-vtable obj) vtable-flag-goops-class))) (define (class-has-statically-allocated-slots? class) (class-has-flags? class vtable-flag-goops-static-slot-allocation)) |