summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--byterun/weak.c2
-rw-r--r--stdlib/weak.mli8
2 files changed, 6 insertions, 4 deletions
diff --git a/byterun/weak.c b/byterun/weak.c
index e85468601..c6c4a223f 100644
--- a/byterun/weak.c
+++ b/byterun/weak.c
@@ -70,7 +70,7 @@ CAMLprim value caml_weak_set (value ar, value n, value el)
if (offset < 1 || offset >= Wosize_val (ar)){
caml_invalid_argument ("Weak.set");
}
- if (el != None_val){
+ if (el != None_val && Is_block (el)){
Assert (Wosize_val (el) == 1);
do_set (ar, offset, Field (el, 0));
}else{
diff --git a/stdlib/weak.mli b/stdlib/weak.mli
index a0b794e66..70fcfa3f5 100644
--- a/stdlib/weak.mli
+++ b/stdlib/weak.mli
@@ -24,9 +24,11 @@ type 'a t
any time.
A weak pointer is said to be full if it points to a value,
empty if the value was erased by the GC.
- Note that weak arrays cannot be marshaled using
- {!Pervasives.output_value} or the functions of the {!Marshal}
- module.
+
+ Notes:
+ - Integers are not allocated and cannot be stored in weak arrays.
+ - Weak arrays cannot be marshaled using {!Pervasives.output_value}
+ nor the functions of the {!Marshal} module.
*)