Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals(). Add test that verifies that the class namespace is not
polluted. Also clarify the behavior in the library docs.
Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 26bffcc..8125963 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -607,6 +607,11 @@
\warning{The contents of this dictionary should not be modified;
changes may not affect the values of local variables used by the
interpreter.}
+
+ Free variables are returned by \var{locals} when it is called in
+ a function block. Modifications of free variables may not affect
+ the values used by the interpreter. Free variables are not
+ returned in class blocks.
\end{funcdesc}
\begin{funcdesc}{long}{\optional{x\optional{, radix}}}