From: Philipp Stephani Date: Sat, 10 Dec 2016 14:36:11 +0000 (+0100) Subject: Treat incomplete integer literals as errors X-Git-Tag: emacs-26.0.90~1028 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6eaadcc7c821b7a8c75ce6d1d56cd7f50898f809;p=emacs.git Treat incomplete integer literals as errors See Bug#25120. * src/lread.c (read_integer): Treat incomplete integer literals as errors. * test/src/lread-tests.el (lread-empty-int-literal): New unit test for incomplete integer literals. --- diff --git a/src/lread.c b/src/lread.c index fdbf0329118..35348f1ddb8 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2536,7 +2536,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) *p = '\0'; } - if (! valid) + if (valid != 1) { sprintf (buf, "integer, radix %"pI"d", radix); invalid_syntax (buf); diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 1a82d133a44..609f82ec20b 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -104,4 +104,12 @@ (ert-deftest lread-string-char-name () (should (equal (read "\"a\\N{SYLOTI NAGRI LETTER DHO}b\"") "a\uA817b"))) +(ert-deftest lread-empty-int-literal () + "Check that Bug#25120 is fixed." + (should-error (read "#b") :type 'invalid-read-syntax) + (should-error (read "#o") :type 'invalid-read-syntax) + (should-error (read "#x") :type 'invalid-read-syntax) + (should-error (read "#24r") :type 'invalid-read-syntax) + (should-error (read "#") :type 'invalid-read-syntax)) + ;;; lread-tests.el ends here