Avoid occasional failure to detect closing paren properly.
Patch 1407280 Tal Einat

M    ParenMatch.py
M    NEWS.txt
M    CREDITS.txt
diff --git a/Lib/idlelib/CREDITS.txt b/Lib/idlelib/CREDITS.txt
index 6f4e95d..d524405 100644
--- a/Lib/idlelib/CREDITS.txt
+++ b/Lib/idlelib/CREDITS.txt
@@ -19,17 +19,18 @@
 subprocess, and made a number of usability enhancements.
 
 Other contributors include Raymond Hettinger, Tony Lownds (Mac integration),
-Neal Norwitz (code check and clean-up), and Chui Tey (RPC integration, debugger
-integration and persistent breakpoints).
+Neal Norwitz (code check and clean-up), Noam Raphael (Code Context, Call Tips,
+many other patches), and Chui Tey (RPC integration, debugger integration and
+persistent breakpoints).
 
-Scott David Daniels, Hernan Foffani, Christos Georgiou, Martin v. Löwis, 
-Jason Orendorff, Noam Raphael, Josh Robb, Nigel Rowe, Bruce Sherwood, and
-Jeff Shute have submitted useful patches.  Thanks, guys!
+Scott David Daniels, Tal Einat, Hernan Foffani, Christos Georgiou,
+Martin v. Löwis, Jason Orendorff, Josh Robb, Nigel Rowe, Bruce Sherwood,
+and Jeff Shute have submitted useful patches.  Thanks, guys!
 
 For additional details refer to NEWS.txt and Changelog.
 
-Please contact the IDLE maintainer to have yourself included here if you
-are one of those we missed! 
+Please contact the IDLE maintainer (kbk@shore.net) to have yourself included
+here if you are one of those we missed!
 
 
 
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index fb77e13..4dc2505 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,6 +3,9 @@
 
 *Release date: XX-XXX-2006*
 
+- Avoid occasional failure to detect closing paren properly.
+  Patch 1407280 Tal Einat
+
 - Rebinding Tab key was inserting 'tab' instead of 'Tab'.  Bug 1179168.
 
 - Colorizer now handles #<builtin> correctly, also unicode strings and
diff --git a/Lib/idlelib/ParenMatch.py b/Lib/idlelib/ParenMatch.py
index 673aee2..250ae8b 100644
--- a/Lib/idlelib/ParenMatch.py
+++ b/Lib/idlelib/ParenMatch.py
@@ -8,7 +8,7 @@
 from HyperParser import HyperParser
 from configHandler import idleConf
 
-keysym_opener = {"parenright":'(', "bracketright":'[', "braceright":'{'}
+_openers = {')':'(',']':'[','}':'{'}
 CHECK_DELAY = 100 # miliseconds
 
 class ParenMatch:
@@ -100,12 +100,13 @@
 
     def paren_closed_event(self, event):
         # If it was a shortcut and not really a closing paren, quit.
-        if self.text.get("insert-1c") not in (')',']','}'):
+        closer = self.text.get("insert-1c")
+        if closer not in _openers:
             return
         hp = HyperParser(self.editwin, "insert-1c")
         if not hp.is_in_code():
             return
-        indices = hp.get_surrounding_brackets(keysym_opener[event.keysym], True)
+        indices = hp.get_surrounding_brackets(_openers[closer], True)
         if indices is None:
             self.warn_mismatched()
             return