sf #1009373, #1005936. fix underscores in index entries in PDF files.
I couldn't test this, but it didn't break anything and the patch
reported fixed the problem.

Bugfix candidate.
diff --git a/Doc/texinputs/python.sty b/Doc/texinputs/python.sty
index 5e1ea2b..dd043e1 100644
--- a/Doc/texinputs/python.sty
+++ b/Doc/texinputs/python.sty
@@ -72,6 +72,7 @@
     \py@OldContentsline{#1}{\py@linkToName{page\my@pageno}{#2}}{#3}%
   }
   \AtEndDocument{
+    \def\_{\string_}
     \InputIfFileExists{\jobname.bkm}{\pdfcatalog{/PageMode /UseOutlines}}{}
   }
   \newcommand{\py@target}[1]{%