62
The -J switch has been reserved for use by Jython for Jython-specific options, such as
switches that are passed to the underlying JVM. -X has been reserved for options
specific to a particular implementation of Python such as CPython, Jython, or IronPython.
If either option is used with Python 2.6, the interpreter will report that the option isn’t
currently used.
Python can now be prevented from writing
.pyc
or
.pyo
files by supplying the -B switch to
the Python interpreter, or by setting the
PYTHONDONTWRITEBYTECODE
environment variable
before running the interpreter. This setting is available to Python programs as the
sys.dont_write_bytecode
variable, and Python code can change the value to modify the
interpreter’s behaviour. (Contributed by Neal Norwitz and Georg Brandl.)
The encoding used for standard input, output, and standard error can be specified by
setting the
PYTHONIOENCODING
environment variable before running the interpreter. The
value should be a string in the form
<encoding>
or
<encoding>:<errorhandler>
. The
encoding part specifies the encoding’s name, e.g.
utf-8
or
latin-1
; the optional
errorhandler part specifies what to do with characters that can’t be handled by the
encoding, and should be one of “error”, “ignore”, or “replace”. (Contributed by Martin von
Loewis.)
New and Improved Modules
As in every release, Python’s standard library received a number of enhancements and
bug fixes. Here’s a partial list of the most notable changes, sorted alphabetically by
module name. Consult the
Misc/NEWS
file in the source tree for a more complete list of
changes, or look through the Subversion logs for all the details.
The
asyncore
and
asynchat
modules are being actively maintained again, and a
number of patches and bugfixes were applied. (Maintained by Josiah Carlson; see
issue 1736190 for one patch.)
The
bsddb
module also has a new maintainer, Jesús Cea Avion, and the package is
now available as a standalone package. The web page for the package is
www.jcea.es/programacion/pybsddb.htm. The plan is to remove the package from
the standard library in Python 3.0, because its pace of releases is much more
frequent than Python’s.
The
bsddb.dbshelve
module now uses the highest pickling protocol available, instead
of restricting itself to protocol 1. (Contributed by W. Barnes.)
The
cgi
module will now read variables from the query string of an HTTP POST