diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c index c124d5a1d8f..f39e81ae2cf 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2974,6 +2974,21 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2974 | vec = XVECTOR (tmp); | 2974 | vec = XVECTOR (tmp); |
| 2975 | if (vec->header.size == 0) | 2975 | if (vec->header.size == 0) |
| 2976 | invalid_syntax ("Empty byte-code object"); | 2976 | invalid_syntax ("Empty byte-code object"); |
| 2977 | |||
| 2978 | if (COMPILED_DOC_STRING < vec->header.size | ||
| 2979 | && AREF (tmp, COMPILED_DOC_STRING) == make_fixnum (0)) | ||
| 2980 | { | ||
| 2981 | /* read_list found a docstring like '(#$ . 5521)' and treated it | ||
| 2982 | as 0. This placeholder 0 would lead to accidental sharing in | ||
| 2983 | purecopy's hash-consing, so replace it with a (hopefully) | ||
| 2984 | unique integer placeholder, which is negative so that it is | ||
| 2985 | not confused with a DOC file offset. Eventually | ||
| 2986 | Snarf-documentation should replace the placeholder with the | ||
| 2987 | actual docstring. */ | ||
| 2988 | EMACS_UINT hash = XHASH (tmp) | (INTMASK - INTMASK / 2); | ||
| 2989 | ASET (tmp, COMPILED_DOC_STRING, make_ufixnum (hash)); | ||
| 2990 | } | ||
| 2991 | |||
| 2977 | make_byte_code (vec); | 2992 | make_byte_code (vec); |
| 2978 | return tmp; | 2993 | return tmp; |
| 2979 | } | 2994 | } |