]> code.delx.au - gnu-emacs/commitdiff
Fix bug#21762
authorJuanma Barranquero <lekktu@gmail.com>
Sun, 1 Nov 2015 01:55:16 +0000 (02:55 +0100)
committerJuanma Barranquero <lekktu@gmail.com>
Sun, 1 Nov 2015 01:55:16 +0000 (02:55 +0100)
* lisp/progmodes/python.el (python-syntax-closing-paren-p): Check with
`eql' instead of `=' to accommodate the case that (syntax-after (point))
returns nil.

* test/automated/python-tests.el (python-indent-inside-paren-7):
New test.

lisp/progmodes/python.el
test/automated/python-tests.el

index 6ff12b5497623ffc66a59fc25521fb0a7b9ab25b..b6f7da6575283b778b76f6c78c00ae04b8574af8 100644 (file)
@@ -490,8 +490,8 @@ The type returned can be `comment', `string' or `paren'."
 
 (defsubst python-syntax-closing-paren-p ()
   "Return non-nil if char after point is a closing paren."
-  (= (syntax-class (syntax-after (point)))
-     (syntax-class (string-to-syntax ")"))))
+  (eql (syntax-class (syntax-after (point)))
+       (syntax-class (string-to-syntax ")"))))
 
 (define-obsolete-function-alias
   'python-info-ppss-context #'python-syntax-context "24.3")
index f930ffba302704d23444431d93d450490afef611..9da6807c144b84d2bfe2614cd6153f21fe8295d1 100644 (file)
@@ -563,6 +563,14 @@ CHOICES = (('some', 'choice'),
    (should (eq (car (python-indent-context)) :inside-paren))
    (should (= (python-indent-calculate-indentation) 11))))
 
+(ert-deftest python-indent-inside-paren-7 ()
+  "Test for Bug#21762."
+  (python-tests-with-temp-buffer
+   "import re as myre\nvar = [\n"
+   (goto-char (point-max))
+   ;; This signals an error if the test fails
+   (should (eq (car (python-indent-context)) :inside-paren-newline-start))))
+
 (ert-deftest python-indent-after-block-1 ()
   "The most simple after-block case that shouldn't fail."
   (python-tests-with-temp-buffer