Branch merge
diff --git a/.hgeol b/.hgeol
index e1c1992..ed13171 100644
--- a/.hgeol
+++ b/.hgeol
@@ -27,6 +27,7 @@
**.zip = BIN
Lib/email/test/data/msg_26.txt = BIN
+Lib/test/cjkencodings/* = BIN
Lib/test/sndhdrdata/sndhdr.* = BIN
Lib/test/decimaltestdata/*.decTest = BIN
diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst
index 094f7f2..37866b7 100644
--- a/Doc/c-api/buffer.rst
+++ b/Doc/c-api/buffer.rst
@@ -316,7 +316,7 @@
.. cfunction:: void PyBuffer_FillContiguousStrides(int ndim, Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t itemsize, char fortran)
Fill the *strides* array with byte-strides of a contiguous (C-style if
- *fortran* is ``'C'`` or Fortran-style if *fortran* is ``'F'`` array of the
+ *fortran* is ``'C'`` or Fortran-style if *fortran* is ``'F'``) array of the
given shape with the given number of bytes per element.
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 7e9d44c..b2fa3ee 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -867,7 +867,7 @@
modules.
Also note that combining this functionality with :cfunc:`PyGILState_\*` APIs
-is delicate, become these APIs assume a bijection between Python thread states
+is delicate, because these APIs assume a bijection between Python thread states
and OS-level threads, an assumption broken by the presence of sub-interpreters.
It is highly recommended that you don't switch sub-interpreters between a pair
of matching :cfunc:`PyGILState_Ensure` and :cfunc:`PyGILState_Release` calls.
diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst
index 66789a9..d1940a8 100644
--- a/Doc/c-api/veryhigh.rst
+++ b/Doc/c-api/veryhigh.rst
@@ -34,11 +34,12 @@
according to the user's locale). It is important to note that the
argument list may be modified (but the contents of the strings
pointed to by the argument list are not). The return value will be
- the integer passed to the :func:`sys.exit` function, ``1`` if the
- interpreter exits due to an exception, or ``2`` if the parameter
- list does not represent a valid Python command line.
+ ```0``` if the interpreter exits normally (ie, without an
+ exception), ``1`` if the interpreter exits due to an exception, or
+ ``2`` if the parameter list does not represent a valid Python
+ command line.
- Note that if an otherwise unhandled :exc:`SystemError` is raised, this
+ Note that if an otherwise unhandled :exc:`SystemExit` is raised, this
function will not return ``1``, but exit the process, as long as
``Py_InspectFlag`` is not set.
@@ -84,7 +85,7 @@
there was an error, there is no way to get the exception information. For the
meaning of *flags*, see below.
- Note that if an otherwise unhandled :exc:`SystemError` is raised, this
+ Note that if an otherwise unhandled :exc:`SystemExit` is raised, this
function will not return ``-1``, but exit the process, as long as
``Py_InspectFlag`` is not set.
diff --git a/Doc/distutils/introduction.rst b/Doc/distutils/introduction.rst
index b772b01..8dc604d 100644
--- a/Doc/distutils/introduction.rst
+++ b/Doc/distutils/introduction.rst
@@ -187,7 +187,7 @@
module distribution
a collection of Python modules distributed together as a single downloadable
resource and meant to be installed *en masse*. Examples of some well-known
- module distributions are Numeric Python, PyXML, PIL (the Python Imaging
+ module distributions are NumPy, SciPy, PIL (the Python Imaging
Library), or mxBase. (This would be called a *package*, except that term is
already taken in the Python context: a single module distribution may contain
zero, one, or many Python packages.)
diff --git a/Doc/howto/sockets.rst b/Doc/howto/sockets.rst
index 3927544..04e9b98 100644
--- a/Doc/howto/sockets.rst
+++ b/Doc/howto/sockets.rst
@@ -43,10 +43,10 @@
History
-------
-Of the various forms of IPC (*Inter Process Communication*), sockets are by far
-the most popular. On any given platform, there are likely to be other forms of
-IPC that are faster, but for cross-platform communication, sockets are about the
-only game in town.
+Of the various forms of :abbr:`IPC (Inter Process Communication)`,
+sockets are by far the most popular. On any given platform, there are
+likely to be other forms of IPC that are faster, but for
+cross-platform communication, sockets are about the only game in town.
They were invented in Berkeley as part of the BSD flavor of Unix. They spread
like wildfire with the Internet. With good reason --- the combination of sockets
@@ -66,13 +66,14 @@
# - the normal http port
s.connect(("www.mcmillan-inc.com", 80))
-When the ``connect`` completes, the socket ``s`` can now be used to send in a
-request for the text of this page. The same socket will read the reply, and then
-be destroyed. That's right - destroyed. Client sockets are normally only used
-for one exchange (or a small set of sequential exchanges).
+When the ``connect`` completes, the socket ``s`` can be used to send
+in a request for the text of the page. The same socket will read the
+reply, and then be destroyed. That's right, destroyed. Client sockets
+are normally only used for one exchange (or a small set of sequential
+exchanges).
What happens in the web server is a bit more complex. First, the web server
-creates a "server socket". ::
+creates a "server socket"::
#create an INET, STREAMing socket
serversocket = socket.socket(
@@ -96,7 +97,7 @@
queue up as many as 5 connect requests (the normal max) before refusing outside
connections. If the rest of the code is written properly, that should be plenty.
-OK, now we have a "server" socket, listening on port 80. Now we enter the
+Now that we have a "server" socket, listening on port 80, we can enter the
mainloop of the web server::
while True:
@@ -145,7 +146,7 @@
Now there are two sets of verbs to use for communication. You can use ``send``
and ``recv``, or you can transform your client socket into a file-like beast and
-use ``read`` and ``write``. The latter is the way Java presents their sockets.
+use ``read`` and ``write``. The latter is the way Java presents its sockets.
I'm not going to talk about it here, except to warn you that you need to use
``flush`` on sockets. These are buffered "files", and a common mistake is to
``write`` something, and then ``read`` for a reply. Without a ``flush`` in
@@ -166,11 +167,11 @@
about that some on the next page.
A protocol like HTTP uses a socket for only one transfer. The client sends a
-request, the reads a reply. That's it. The socket is discarded. This means that
+request, then reads a reply. That's it. The socket is discarded. This means that
a client can detect the end of the reply by receiving 0 bytes.
But if you plan to reuse your socket for further transfers, you need to realize
-that *there is no "EOT" (End of Transfer) on a socket.* I repeat: if a socket
+that *there is no* :abbr:`EOT (End of Transfer)` *on a socket.* I repeat: if a socket
``send`` or ``recv`` returns after handling 0 bytes, the connection has been
broken. If the connection has *not* been broken, you may wait on a ``recv``
forever, because the socket will *not* tell you that there's nothing more to
@@ -336,7 +337,7 @@
In C, coding ``select`` is fairly complex. In Python, it's a piece of cake, but
it's close enough to the C version that if you understand ``select`` in Python,
-you'll have little trouble with it in C. ::
+you'll have little trouble with it in C::
ready_to_read, ready_to_write, in_error = \
select.select(
@@ -353,10 +354,9 @@
thing to do - give it a nice long timeout (say a minute) unless you have good
reason to do otherwise.
-In return, you will get three lists. They have the sockets that are actually
+In return, you will get three lists. They contain the sockets that are actually
readable, writable and in error. Each of these lists is a subset (possibly
-empty) of the corresponding list you passed in. And if you put a socket in more
-than one input list, it will only be (at most) in one output list.
+empty) of the corresponding list you passed in.
If a socket is in the output readable list, you can be
as-close-to-certain-as-we-ever-get-in-this-business that a ``recv`` on that
diff --git a/Doc/install/index.rst b/Doc/install/index.rst
index 43286ac..6a11c5a 100644
--- a/Doc/install/index.rst
+++ b/Doc/install/index.rst
@@ -241,7 +241,7 @@
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
| Unix (non-pure) | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1) |
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
-| Windows | :file:`{prefix}` | :file:`C:\\Python` | \(2) |
+| Windows | :file:`{prefix}\\Lib\\site-packages` | :file:`C:\\Python{XY}\\Lib\\site-packages` | \(2) |
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
Notes:
diff --git a/Doc/library/modulefinder.rst b/Doc/library/modulefinder.rst
index 41b387b..41c603c 100644
--- a/Doc/library/modulefinder.rst
+++ b/Doc/library/modulefinder.rst
@@ -22,8 +22,7 @@
.. function:: ReplacePackage(oldname, newname)
Allows specifying that the module named *oldname* is in fact the package named
- *newname*. The most common usage would be to handle how the :mod:`_xmlplus`
- package replaces the :mod:`xml` package.
+ *newname*.
.. class:: ModuleFinder(path=None, debug=0, excludes=[], replace_paths=[])
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 3f6d69d..187e44a 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -772,7 +772,26 @@
Using :func:`access` to check if a user is authorized to e.g. open a file
before actually doing so using :func:`open` creates a security hole,
because the user might exploit the short time interval between checking
- and opening the file to manipulate it.
+ and opening the file to manipulate it. It's preferable to use :term:`EAFP`
+ techniques. For example::
+
+ if os.access("myfile", os.R_OK):
+ with open("myfile") as fp:
+ return fp.read()
+ return "some default data"
+
+ is better written as::
+
+ try:
+ fp = open("myfile")
+ except IOError as e:
+ if e.errno == errno.EACCESS:
+ return "some default data"
+ # Not a permission error.
+ raise
+ else:
+ with fp:
+ return fp.read()
.. note::
diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst
index a71d533..36275ed 100644
--- a/Doc/library/platform.rst
+++ b/Doc/library/platform.rst
@@ -104,7 +104,7 @@
.. function:: python_implementation()
Returns a string identifying the Python implementation. Possible return values
- are: 'CPython', 'IronPython', 'Jython'.
+ are: 'CPython', 'IronPython', 'Jython', 'PyPy'.
.. function:: python_revision()
diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst
index d1d1bae..7bebd8c 100644
--- a/Doc/library/pprint.rst
+++ b/Doc/library/pprint.rst
@@ -188,36 +188,105 @@
.. _pprint-example:
-pprint Example
---------------
+Example
+-------
-This example demonstrates several uses of the :func:`pprint` function and its parameters.
+To demonstrate several uses of the :func:`pprint` function and its parameters,
+let's fetch information about a package from PyPI::
+ >>> import json
>>> import pprint
- >>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',
- ... ('parrot', ('fresh fruit',))))))))
- >>> stuff = ['a' * 10, tup, ['a' * 30, 'b' * 30], ['c' * 20, 'd' * 20]]
- >>> pprint.pprint(stuff)
- ['aaaaaaaaaa',
- ('spam',
- ('eggs',
- ('lumberjack',
- ('knights', ('ni', ('dead', ('parrot', ('fresh fruit',)))))))),
- ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
- ['cccccccccccccccccccc', 'dddddddddddddddddddd']]
- >>> pprint.pprint(stuff, depth=3)
- ['aaaaaaaaaa',
- ('spam', ('eggs', (...))),
- ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
- ['cccccccccccccccccccc', 'dddddddddddddddddddd']]
- >>> pprint.pprint(stuff, width=60)
- ['aaaaaaaaaa',
- ('spam',
- ('eggs',
- ('lumberjack',
- ('knights',
- ('ni', ('dead', ('parrot', ('fresh fruit',)))))))),
- ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
- 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
- ['cccccccccccccccccccc', 'dddddddddddddddddddd']]
+ >>> from urllib.request import urlopen
+ >>> with urlopen('http://pypi.python.org/pypi/configparser/json') as url:
+ ... http_info = url.info()
+ ... raw_data = url.read().decode(http_info.get_content_charset())
+ >>> package_data = json.loads(raw_data)
+ >>> result = {'headers': http_info.items(), 'body': package_data}
+In its basic form, :func:`pprint` shows the whole object::
+
+ >>> pprint.pprint(result)
+ {'body': {'info': {'_pypi_hidden': False,
+ '_pypi_ordering': 12,
+ 'classifiers': ['Development Status :: 4 - Beta',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: MIT License',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Topic :: Software Development :: Libraries',
+ 'Topic :: Software Development :: Libraries :: Python Modules'],
+ 'download_url': 'UNKNOWN',
+ 'home_page': 'http://docs.python.org/py3k/library/configparser.html',
+ 'keywords': 'configparser ini parsing conf cfg configuration file',
+ 'license': 'MIT',
+ 'name': 'configparser',
+ 'package_url': 'http://pypi.python.org/pypi/configparser',
+ 'platform': 'any',
+ 'release_url': 'http://pypi.python.org/pypi/configparser/3.2.0r3',
+ 'requires_python': None,
+ 'stable_version': None,
+ 'summary': 'This library brings the updated configparser from Python 3.2+ to Python 2.6-2.7.',
+ 'version': '3.2.0r3'},
+ 'urls': [{'comment_text': '',
+ 'downloads': 47,
+ 'filename': 'configparser-3.2.0r3.tar.gz',
+ 'has_sig': False,
+ 'md5_digest': '8500fd87c61ac0de328fc996fce69b96',
+ 'packagetype': 'sdist',
+ 'python_version': 'source',
+ 'size': 32281,
+ 'upload_time': '2011-05-10T16:28:50',
+ 'url': 'http://pypi.python.org/packages/source/c/configparser/configparser-3.2.0r3.tar.gz'}]},
+ 'headers': [('Date', 'Sat, 14 May 2011 12:48:52 GMT'),
+ ('Server', 'Apache/2.2.16 (Debian)'),
+ ('Content-Disposition', 'inline'),
+ ('Connection', 'close'),
+ ('Transfer-Encoding', 'chunked'),
+ ('Content-Type', 'application/json; charset="UTF-8"')]}
+
+The result can be limited to a certain *depth* (ellipsis is used for deeper
+contents)::
+
+ >>> pprint.pprint(result, depth=3)
+ {'body': {'info': {'_pypi_hidden': False,
+ '_pypi_ordering': 12,
+ 'classifiers': [...],
+ 'download_url': 'UNKNOWN',
+ 'home_page': 'http://docs.python.org/py3k/library/configparser.html',
+ 'keywords': 'configparser ini parsing conf cfg configuration file',
+ 'license': 'MIT',
+ 'name': 'configparser',
+ 'package_url': 'http://pypi.python.org/pypi/configparser',
+ 'platform': 'any',
+ 'release_url': 'http://pypi.python.org/pypi/configparser/3.2.0r3',
+ 'requires_python': None,
+ 'stable_version': None,
+ 'summary': 'This library brings the updated configparser from Python 3.2+ to Python 2.6-2.7.',
+ 'version': '3.2.0r3'},
+ 'urls': [{...}]},
+ 'headers': [('Date', 'Sat, 14 May 2011 12:48:52 GMT'),
+ ('Server', 'Apache/2.2.16 (Debian)'),
+ ('Content-Disposition', 'inline'),
+ ('Connection', 'close'),
+ ('Transfer-Encoding', 'chunked'),
+ ('Content-Type', 'application/json; charset="UTF-8"')]}
+
+Additionally, maximum *width* can be suggested. If a long object cannot be
+split, the specified width will be exceeded::
+
+ >>> pprint.pprint(result['headers'], width=30)
+ [('Date',
+ 'Sat, 14 May 2011 12:48:52 GMT'),
+ ('Server',
+ 'Apache/2.2.16 (Debian)'),
+ ('Content-Disposition',
+ 'inline'),
+ ('Connection', 'close'),
+ ('Transfer-Encoding',
+ 'chunked'),
+ ('Content-Type',
+ 'application/json; charset="UTF-8"')]
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index ff7a016..ca32429 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -219,6 +219,9 @@
Selects SSL version 2 as the channel encryption protocol.
+ This protocol is not available if OpenSSL is compiled with OPENSSL_NO_SSL2
+ flag.
+
.. warning::
SSL version 2 is insecure. Its use is highly discouraged.
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 7621eef..2e3e18f 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -883,6 +883,15 @@
*start* and *end* are interpreted as in slice notation. Return ``-1`` if
*sub* is not found.
+ .. note::
+
+ The :meth:`~str.find` method should be used only if you need to know the
+ position of *sub*. To check if *sub* is a substring or not, use the
+ :keyword:`in` operator::
+
+ >>> 'Py' in 'Python'
+ True
+
.. method:: str.format(*args, **kwargs)
diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst
index 8364f35..12360c0 100644
--- a/Doc/library/xml.dom.minidom.rst
+++ b/Doc/library/xml.dom.minidom.rst
@@ -57,12 +57,8 @@
You can also create a :class:`Document` by calling a method on a "DOM
Implementation" object. You can get this object either by calling the
:func:`getDOMImplementation` function in the :mod:`xml.dom` package or the
-:mod:`xml.dom.minidom` module. Using the implementation from the
-:mod:`xml.dom.minidom` module will always return a :class:`Document` instance
-from the minidom implementation, while the version from :mod:`xml.dom` may
-provide an alternate implementation (this is likely if you have the `PyXML
-package <http://pyxml.sourceforge.net/>`_ installed). Once you have a
-:class:`Document`, you can add child nodes to it to populate the DOM::
+:mod:`xml.dom.minidom` module. Once you have a :class:`Document`, you
+can add child nodes to it to populate the DOM::
from xml.dom.minidom import getDOMImplementation
diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst
index 45d30d6..a3414d7 100644
--- a/Doc/library/xml.dom.rst
+++ b/Doc/library/xml.dom.rst
@@ -30,13 +30,6 @@
their terminology. The Python mapping of the API is substantially based on the
DOM Level 2 recommendation.
-.. XXX PyXML is dead...
-.. The mapping of the Level 3 specification, currently
- only available in draft form, is being developed by the `Python XML Special
- Interest Group <http://www.python.org/sigs/xml-sig/>`_ as part of the `PyXML
- package <http://pyxml.sourceforge.net/>`_. Refer to the documentation bundled
- with that package for information on the current state of DOM Level 3 support.
-
.. What if your needs are somewhere between SAX and the DOM? Perhaps
you cannot afford to load the entire tree in memory but you find the
SAX model somewhat cumbersome and low-level. There is also a module
diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
index 8b08bfe..b3c767e 100644
--- a/Lib/distutils/command/build_scripts.py
+++ b/Lib/distutils/command/build_scripts.py
@@ -11,9 +11,11 @@
from distutils.dep_util import newer
from distutils.util import convert_path, Mixin2to3
from distutils import log
+import sys
+import tokenize
# check if Python is called on the first line with this expression
-first_line_re = re.compile('^#!.*python[0-9.]*([ \t].*)?$')
+first_line_re = re.compile(b'^#!.*python[0-9.]*([ \t].*)?$')
class build_scripts(Command):
@@ -74,12 +76,14 @@
# that way, we'll get accurate feedback if we can read the
# script.
try:
- f = open(script, "r")
+ f = open(script, "rb")
except IOError:
if not self.dry_run:
raise
f = None
else:
+ encoding, lines = tokenize.detect_encoding(f.readline)
+ f.seek(0)
first_line = f.readline()
if not first_line:
self.warn("%s is an empty file (skipping)" % script)
@@ -88,25 +92,46 @@
match = first_line_re.match(first_line)
if match:
adjust = True
- post_interp = match.group(1) or ''
+ post_interp = match.group(1) or b''
if adjust:
log.info("copying and adjusting %s -> %s", script,
self.build_dir)
updated_files.append(outfile)
if not self.dry_run:
- outf = open(outfile, "w")
if not sysconfig.python_build:
- outf.write("#!%s%s\n" %
- (self.executable,
- post_interp))
+ executable = self.executable
else:
- outf.write("#!%s%s\n" %
- (os.path.join(
+ executable = os.path.join(
sysconfig.get_config_var("BINDIR"),
"python%s%s" % (sysconfig.get_config_var("VERSION"),
- sysconfig.get_config_var("EXE"))),
- post_interp))
+ sysconfig.get_config_var("EXE")))
+ executable = executable.encode(sys.getfilesystemencoding(),
+ 'surrogateescape')
+ shebang = b"#!" + executable + post_interp + b"\n"
+ # Python parser starts to read a script using UTF-8 until
+ # it gets a #coding:xxx cookie. The shebang has to be the
+ # first line of a file, the #coding:xxx cookie cannot be
+ # written before. So the shebang has to be decodable from
+ # UTF-8.
+ try:
+ shebang.decode('utf-8')
+ except UnicodeDecodeError:
+ raise ValueError(
+ "The shebang ({!r}) is not decodable "
+ "from utf-8".format(shebang))
+ # If the script is encoded to a custom encoding (use a
+ # #coding:xxx cookie), the shebang has to be decodable from
+ # the script encoding too.
+ try:
+ shebang.decode(encoding)
+ except UnicodeDecodeError:
+ raise ValueError(
+ "The shebang ({!r}) is not decodable "
+ "from the script encoding ({})"
+ .format(shebang, encoding))
+ outf = open(outfile, "wb")
+ outf.write(shebang)
outf.writelines(f.readlines())
outf.close()
if f:
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index ea91c17..af213f3 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -232,12 +232,13 @@
This does not follow the procedure from the RFC to send Telnet
IP and Synch; that doesn't seem to work with the servers I've
tried. Instead, just send the ABOR command as OOB data.'''
- line = 'ABOR' + CRLF
+ line = b'ABOR' + B_CRLF
if self.debugging > 1: print('*put urgent*', self.sanitize(line))
self.sock.sendall(line, MSG_OOB)
resp = self.getmultiline()
if resp[:3] not in ('426', '225', '226'):
raise error_proto(resp)
+ return resp
def sendcmd(self, cmd):
'''Send a command and return the response.'''
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
index 381bb00..3f5d556 100644
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -309,17 +309,20 @@
return "yes"
message = "Do you want to save %s before closing?" % (
self.filename or "this untitled document")
- m = tkMessageBox.Message(
- title="Save On Close",
- message=message,
- icon=tkMessageBox.QUESTION,
- type=tkMessageBox.YESNOCANCEL,
- master=self.text)
- reply = m.show()
- if reply == "yes":
+ confirm = tkMessageBox.askyesnocancel(
+ title="Save On Close",
+ message=message,
+ default=tkMessageBox.YES,
+ master=self.text)
+ if confirm:
+ reply = "yes"
self.save(None)
if not self.get_saved():
reply = "cancel"
+ elif confirm is None:
+ reply = "cancel"
+ else:
+ reply = "no"
self.text.focus_set()
return reply
@@ -328,7 +331,7 @@
self.save_as(event)
else:
if self.writefile(self.filename):
- self.set_saved(1)
+ self.set_saved(True)
try:
self.editwin.store_file_breaks()
except AttributeError: # may be a PyShell
@@ -420,15 +423,12 @@
self.text.insert("end-1c", "\n")
def print_window(self, event):
- m = tkMessageBox.Message(
- title="Print",
- message="Print to Default Printer",
- icon=tkMessageBox.QUESTION,
- type=tkMessageBox.OKCANCEL,
- default=tkMessageBox.OK,
- master=self.text)
- reply = m.show()
- if reply != tkMessageBox.OK:
+ confirm = tkMessageBox.askokcancel(
+ title="Print",
+ message="Print to Default Printer",
+ default=tkMessageBox.OK,
+ master=self.text)
+ if not confirm:
self.text.focus_set()
return "break"
tempfilename = None
@@ -443,8 +443,8 @@
if not self.writefile(tempfilename):
os.unlink(tempfilename)
return "break"
- platform=os.name
- printPlatform=1
+ platform = os.name
+ printPlatform = True
if platform == 'posix': #posix platform
command = idleConf.GetOption('main','General',
'print-command-posix')
@@ -452,7 +452,7 @@
elif platform == 'nt': #win32 platform
command = idleConf.GetOption('main','General','print-command-win')
else: #no printing for this platform
- printPlatform=0
+ printPlatform = False
if printPlatform: #we can try to print for this platform
command = command % filename
pipe = os.popen(command, "r")
@@ -466,7 +466,7 @@
output = "Printing command: %s\n" % repr(command) + output
tkMessageBox.showerror("Print status", output, master=self.text)
else: #no printing for this platform
- message="Printing is not enabled for this platform: %s" % platform
+ message = "Printing is not enabled for this platform: %s" % platform
tkMessageBox.showinfo("Print status", message, master=self.text)
if tempfilename:
os.unlink(tempfilename)
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 6a031e1..2888294 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,18 +1,25 @@
What's New in IDLE 3.1.4?
=========================
-*Release date: XX-XXX-XX*
+*Release date: XX-XXX-11*
+
+- Issue #6378: Further adjust idle.bat to start associated Python
+
+- Issue #11896: Save on Close failed despite selecting "Yes" in dialog.
+
+- Issue #1028: Ctrl-space binding to show completions was causing IDLE to exit.
+ Tk < 8.5 was sending invalid Unicode null; replaced with valid null.
- <Home> toggle failing on Tk 8.5, causing IDLE exits and strange selection
behavior. Issue 4676. Improve selection extension behaviour.
-- <Home> toggle non-functional when NumLock set on Windows. Issue 3851.
+- <Home> toggle non-functional when NumLock set on Windows. Issue 3851.
What's New in IDLE 3.1b1?
=========================
-*Release date: XX-XXX-09*
+*Release date: 06-May-09*
- Use of 'filter' in keybindingDialog.py was causing custom key assignment to
fail. Patch 5707 amaury.forgeotdarc.
@@ -58,7 +65,7 @@
extract port from command line when warnings are present.
- Tk 8.5 Text widget requires 'wordprocessor' tabstyle attr to handle
- mixed space/tab properly. Issue 5120, patch by Guilherme Polo.
+ mixed space/tab properly. Issue 5129, patch by Guilherme Polo.
- Issue #3549: On MacOS the preferences menu was not present
diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py
index c42b29d..41e6a59 100644
--- a/Lib/idlelib/ScriptBinding.py
+++ b/Lib/idlelib/ScriptBinding.py
@@ -174,9 +174,9 @@
if autosave and filename:
self.editwin.io.save(None)
else:
- reply = self.ask_save_dialog()
+ confirm = self.ask_save_dialog()
self.editwin.text.focus_set()
- if reply == "ok":
+ if confirm:
self.editwin.io.save(None)
filename = self.editwin.io.filename
else:
@@ -185,13 +185,11 @@
def ask_save_dialog(self):
msg = "Source Must Be Saved\n" + 5*' ' + "OK to Save?"
- mb = tkMessageBox.Message(title="Save Before Run or Check",
- message=msg,
- icon=tkMessageBox.QUESTION,
- type=tkMessageBox.OKCANCEL,
- default=tkMessageBox.OK,
- master=self.editwin.text)
- return mb.show()
+ confirm = tkMessageBox.askokcancel(title="Save Before Run or Check",
+ message=msg,
+ default=tkMessageBox.OK,
+ master=self.editwin.text)
+ return confirm
def errorbox(self, title, message):
# XXX This should really be a function of EditorWindow...
diff --git a/Lib/idlelib/idle.bat b/Lib/idlelib/idle.bat
index cc653dc..e77b96e 100755
--- a/Lib/idlelib/idle.bat
+++ b/Lib/idlelib/idle.bat
@@ -1,4 +1,4 @@
@echo off
rem Start IDLE using the appropriate Python interpreter
set CURRDIR=%~dp0
-start "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9
+start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/Lib/importlib/test/frozen/test_loader.py b/Lib/importlib/test/frozen/test_loader.py
index fa64f30..06532f1 100644
--- a/Lib/importlib/test/frozen/test_loader.py
+++ b/Lib/importlib/test/frozen/test_loader.py
@@ -3,20 +3,21 @@
import unittest
from .. import abc
from .. import util
-
+from test.support import captured_stdout
class LoaderTests(abc.LoaderTests):
def test_module(self):
- with util.uncache('__hello__'):
+ with util.uncache('__hello__'), captured_stdout() as stdout:
module = machinery.FrozenImporter.load_module('__hello__')
check = {'__name__': '__hello__', '__file__': '<frozen>',
'__package__': '', '__loader__': machinery.FrozenImporter}
for attr, value in check.items():
self.assertEqual(getattr(module, attr), value)
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
def test_package(self):
- with util.uncache('__phello__'):
+ with util.uncache('__phello__'), captured_stdout() as stdout:
module = machinery.FrozenImporter.load_module('__phello__')
check = {'__name__': '__phello__', '__file__': '<frozen>',
'__package__': '__phello__', '__path__': ['__phello__'],
@@ -26,9 +27,11 @@
self.assertEqual(attr_value, value,
"for __phello__.%s, %r != %r" %
(attr, attr_value, value))
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
def test_lacking_parent(self):
- with util.uncache('__phello__', '__phello__.spam'):
+ with util.uncache('__phello__', '__phello__.spam'), \
+ captured_stdout() as stdout:
module = machinery.FrozenImporter.load_module('__phello__.spam')
check = {'__name__': '__phello__.spam', '__file__': '<frozen>',
'__package__': '__phello__',
@@ -38,12 +41,15 @@
self.assertEqual(attr_value, value,
"for __phello__.spam.%s, %r != %r" %
(attr, attr_value, value))
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
def test_module_reuse(self):
- with util.uncache('__hello__'):
+ with util.uncache('__hello__'), captured_stdout() as stdout:
module1 = machinery.FrozenImporter.load_module('__hello__')
module2 = machinery.FrozenImporter.load_module('__hello__')
self.assertTrue(module1 is module2)
+ self.assertEqual(stdout.getvalue(),
+ 'Hello world!\nHello world!\n')
def test_state_after_failure(self):
# No way to trigger an error in a frozen module.
@@ -62,10 +68,12 @@
def test_get_code(self):
# Make sure that the code object is good.
name = '__hello__'
- code = machinery.FrozenImporter.get_code(name)
- mod = imp.new_module(name)
- exec(code, mod.__dict__)
- self.assertTrue(hasattr(mod, 'initialized'))
+ with captured_stdout() as stdout:
+ code = machinery.FrozenImporter.get_code(name)
+ mod = imp.new_module(name)
+ exec(code, mod.__dict__)
+ self.assertTrue(hasattr(mod, 'initialized'))
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
def test_get_source(self):
# Should always return None.
diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py
index 12fa815..4658bff 100644
--- a/Lib/json/decoder.py
+++ b/Lib/json/decoder.py
@@ -5,7 +5,7 @@
import sys
import struct
-from json.scanner import make_scanner
+from json import scanner
try:
from _json import scanstring as c_scanstring
except ImportError:
@@ -334,7 +334,7 @@
self.parse_object = JSONObject
self.parse_array = JSONArray
self.parse_string = scanstring
- self.scan_once = make_scanner(self)
+ self.scan_once = scanner.make_scanner(self)
def decode(self, s, _w=WHITESPACE.match):
diff --git a/Lib/json/tests/__init__.py b/Lib/json/tests/__init__.py
index 1a1e3e6..da25a42 100644
--- a/Lib/json/tests/__init__.py
+++ b/Lib/json/tests/__init__.py
@@ -1,7 +1,46 @@
import os
import sys
-import unittest
+import json
import doctest
+import unittest
+
+from test import support
+
+# import json with and without accelerations
+cjson = support.import_fresh_module('json', fresh=['_json'])
+pyjson = support.import_fresh_module('json', blocked=['_json'])
+
+# create two base classes that will be used by the other tests
+class PyTest(unittest.TestCase):
+ json = pyjson
+ loads = staticmethod(pyjson.loads)
+ dumps = staticmethod(pyjson.dumps)
+
+@unittest.skipUnless(cjson, 'requires _json')
+class CTest(unittest.TestCase):
+ if cjson is not None:
+ json = cjson
+ loads = staticmethod(cjson.loads)
+ dumps = staticmethod(cjson.dumps)
+
+# test PyTest and CTest checking if the functions come from the right module
+class TestPyTest(PyTest):
+ def test_pyjson(self):
+ self.assertEqual(self.json.scanner.make_scanner.__module__,
+ 'json.scanner')
+ self.assertEqual(self.json.decoder.scanstring.__module__,
+ 'json.decoder')
+ self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,
+ 'json.encoder')
+
+class TestCTest(CTest):
+ def test_cjson(self):
+ self.assertEqual(self.json.scanner.make_scanner.__module__, '_json')
+ self.assertEqual(self.json.decoder.scanstring.__module__, '_json')
+ self.assertEqual(self.json.encoder.c_make_encoder.__module__, '_json')
+ self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,
+ '_json')
+
here = os.path.dirname(__file__)
@@ -17,12 +56,11 @@
return suite
def additional_tests():
- import json
- import json.encoder
- import json.decoder
suite = unittest.TestSuite()
for mod in (json, json.encoder, json.decoder):
suite.addTest(doctest.DocTestSuite(mod))
+ suite.addTest(TestPyTest('test_pyjson'))
+ suite.addTest(TestCTest('test_cjson'))
return suite
def main():
diff --git a/Lib/json/tests/test_decode.py b/Lib/json/tests/test_decode.py
index bf65e46..144ff41 100644
--- a/Lib/json/tests/test_decode.py
+++ b/Lib/json/tests/test_decode.py
@@ -1,39 +1,38 @@
import decimal
-from unittest import TestCase
from io import StringIO
-
-import json
from collections import OrderedDict
+from json.tests import PyTest, CTest
-class TestDecode(TestCase):
+
+class TestDecode:
def test_decimal(self):
- rval = json.loads('1.1', parse_float=decimal.Decimal)
+ rval = self.loads('1.1', parse_float=decimal.Decimal)
self.assertTrue(isinstance(rval, decimal.Decimal))
self.assertEqual(rval, decimal.Decimal('1.1'))
def test_float(self):
- rval = json.loads('1', parse_int=float)
+ rval = self.loads('1', parse_int=float)
self.assertTrue(isinstance(rval, float))
self.assertEqual(rval, 1.0)
def test_empty_objects(self):
- self.assertEqual(json.loads('{}'), {})
- self.assertEqual(json.loads('[]'), [])
- self.assertEqual(json.loads('""'), "")
+ self.assertEqual(self.loads('{}'), {})
+ self.assertEqual(self.loads('[]'), [])
+ self.assertEqual(self.loads('""'), "")
def test_object_pairs_hook(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
("qrt", 5), ("pad", 6), ("hoy", 7)]
- self.assertEqual(json.loads(s), eval(s))
- self.assertEqual(json.loads(s, object_pairs_hook = lambda x: x), p)
- self.assertEqual(json.load(StringIO(s),
+ self.assertEqual(self.loads(s), eval(s))
+ self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p)
+ self.assertEqual(self.json.load(StringIO(s),
object_pairs_hook=lambda x: x), p)
- od = json.loads(s, object_pairs_hook = OrderedDict)
+ od = self.loads(s, object_pairs_hook = OrderedDict)
self.assertEqual(od, OrderedDict(p))
self.assertEqual(type(od), OrderedDict)
# the object_pairs_hook takes priority over the object_hook
- self.assertEqual(json.loads(s,
+ self.assertEqual(self.loads(s,
object_pairs_hook = OrderedDict,
object_hook = lambda x: None),
OrderedDict(p))
@@ -42,5 +41,9 @@
# Several optimizations were made that skip over calls to
# the whitespace regex, so this test is designed to try and
# exercise the uncommon cases. The array cases are already covered.
- rval = json.loads('{ "key" : "value" , "k":"v" }')
+ rval = self.loads('{ "key" : "value" , "k":"v" }')
self.assertEqual(rval, {"key":"value", "k":"v"})
+
+
+class TestPyDecode(TestDecode, PyTest): pass
+class TestCDecode(TestDecode, CTest): pass
diff --git a/Lib/json/tests/test_default.py b/Lib/json/tests/test_default.py
index 6a03eeb..14dee27 100644
--- a/Lib/json/tests/test_default.py
+++ b/Lib/json/tests/test_default.py
@@ -1,9 +1,12 @@
-from unittest import TestCase
+from json.tests import PyTest, CTest
-import json
-class TestDefault(TestCase):
+class TestDefault:
def test_default(self):
self.assertEqual(
- json.dumps(type, default=repr),
- json.dumps(repr(type)))
+ self.dumps(type, default=repr),
+ self.dumps(repr(type)))
+
+
+class TestPyDefault(TestDefault, PyTest): pass
+class TestCDefault(TestDefault, CTest): pass
diff --git a/Lib/json/tests/test_dump.py b/Lib/json/tests/test_dump.py
index 8df234b..6f5262b 100644
--- a/Lib/json/tests/test_dump.py
+++ b/Lib/json/tests/test_dump.py
@@ -1,21 +1,24 @@
-from unittest import TestCase
from io import StringIO
+from json.tests import PyTest, CTest
-import json
-class TestDump(TestCase):
+class TestDump:
def test_dump(self):
sio = StringIO()
- json.dump({}, sio)
+ self.json.dump({}, sio)
self.assertEqual(sio.getvalue(), '{}')
def test_dumps(self):
- self.assertEqual(json.dumps({}), '{}')
+ self.assertEqual(self.dumps({}), '{}')
def test_encode_truefalse(self):
- self.assertEqual(json.dumps(
+ self.assertEqual(self.dumps(
{True: False, False: True}, sort_keys=True),
'{"false": true, "true": false}')
- self.assertEqual(json.dumps(
+ self.assertEqual(self.dumps(
{2: 3.0, 4.0: 5, False: 1, 6: True}, sort_keys=True),
'{"false": 1, "2": 3.0, "4.0": 5, "6": true}')
+
+
+class TestPyDump(TestDump, PyTest): pass
+class TestCDump(TestDump, CTest): pass
diff --git a/Lib/json/tests/test_encode_basestring_ascii.py b/Lib/json/tests/test_encode_basestring_ascii.py
index 4fddd12..04f33fb 100644
--- a/Lib/json/tests/test_encode_basestring_ascii.py
+++ b/Lib/json/tests/test_encode_basestring_ascii.py
@@ -1,8 +1,6 @@
-from unittest import TestCase
-
-import json.encoder
-from json import dumps
from collections import OrderedDict
+from json.tests import PyTest, CTest
+
CASES = [
('/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'),
@@ -21,19 +19,11 @@
('\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
]
-class TestEncodeBaseStringAscii(TestCase):
- def test_py_encode_basestring_ascii(self):
- self._test_encode_basestring_ascii(json.encoder.py_encode_basestring_ascii)
-
- def test_c_encode_basestring_ascii(self):
- if not json.encoder.c_encode_basestring_ascii:
- return
- self._test_encode_basestring_ascii(json.encoder.c_encode_basestring_ascii)
-
- def _test_encode_basestring_ascii(self, encode_basestring_ascii):
- fname = encode_basestring_ascii.__name__
+class TestEncodeBasestringAscii:
+ def test_encode_basestring_ascii(self):
+ fname = self.json.encoder.encode_basestring_ascii.__name__
for input_string, expect in CASES:
- result = encode_basestring_ascii(input_string)
+ result = self.json.encoder.encode_basestring_ascii(input_string)
self.assertEqual(result, expect,
'{0!r} != {1!r} for {2}({3!r})'.format(
result, expect, fname, input_string))
@@ -41,10 +31,14 @@
def test_ordered_dict(self):
# See issue 6105
items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]
- s = json.dumps(OrderedDict(items))
+ s = self.dumps(OrderedDict(items))
self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}')
def test_sorted_dict(self):
items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]
- s = json.dumps(dict(items), sort_keys=True)
+ s = self.dumps(dict(items), sort_keys=True)
self.assertEqual(s, '{"five": 5, "four": 4, "one": 1, "three": 3, "two": 2}')
+
+
+class TestPyEncodeBasestringAscii(TestEncodeBasestringAscii, PyTest): pass
+class TestCEncodeBasestringAscii(TestEncodeBasestringAscii, CTest): pass
diff --git a/Lib/json/tests/test_fail.py b/Lib/json/tests/test_fail.py
index 9768edf..e2d0789 100644
--- a/Lib/json/tests/test_fail.py
+++ b/Lib/json/tests/test_fail.py
@@ -1,6 +1,4 @@
-from unittest import TestCase
-
-import json
+from json.tests import PyTest, CTest
# Fri Dec 30 18:57:26 2005
JSONDOCS = [
@@ -61,15 +59,15 @@
18: "spec doesn't specify any nesting limitations",
}
-class TestFail(TestCase):
+class TestFail:
def test_failures(self):
for idx, doc in enumerate(JSONDOCS):
idx = idx + 1
if idx in SKIPS:
- json.loads(doc)
+ self.loads(doc)
continue
try:
- json.loads(doc)
+ self.loads(doc)
except ValueError:
pass
else:
@@ -79,7 +77,11 @@
data = {'a' : 1, (1, 2) : 2}
#This is for c encoder
- self.assertRaises(TypeError, json.dumps, data)
+ self.assertRaises(TypeError, self.dumps, data)
#This is for python encoder
- self.assertRaises(TypeError, json.dumps, data, indent=True)
+ self.assertRaises(TypeError, self.dumps, data, indent=True)
+
+
+class TestPyFail(TestFail, PyTest): pass
+class TestCFail(TestFail, CTest): pass
diff --git a/Lib/json/tests/test_float.py b/Lib/json/tests/test_float.py
index ca4a506..46fae48 100644
--- a/Lib/json/tests/test_float.py
+++ b/Lib/json/tests/test_float.py
@@ -1,15 +1,18 @@
import math
-from unittest import TestCase
+from json.tests import PyTest, CTest
-import json
-class TestFloat(TestCase):
+class TestFloat:
def test_floats(self):
for num in [1617161771.7650001, math.pi, math.pi**100, math.pi**-100, 3.1]:
- self.assertEqual(float(json.dumps(num)), num)
- self.assertEqual(json.loads(json.dumps(num)), num)
+ self.assertEqual(float(self.dumps(num)), num)
+ self.assertEqual(self.loads(self.dumps(num)), num)
def test_ints(self):
for num in [1, 1<<32, 1<<64]:
- self.assertEqual(json.dumps(num), str(num))
- self.assertEqual(int(json.dumps(num)), num)
+ self.assertEqual(self.dumps(num), str(num))
+ self.assertEqual(int(self.dumps(num)), num)
+
+
+class TestPyFloat(TestFloat, PyTest): pass
+class TestCFloat(TestFloat, CTest): pass
diff --git a/Lib/json/tests/test_indent.py b/Lib/json/tests/test_indent.py
index d45aa85..23cdd8f 100644
--- a/Lib/json/tests/test_indent.py
+++ b/Lib/json/tests/test_indent.py
@@ -1,10 +1,9 @@
-from unittest import TestCase
-
-import json
import textwrap
from io import StringIO
+from json.tests import PyTest, CTest
-class TestIndent(TestCase):
+
+class TestIndent:
def test_indent(self):
h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
{'nifty': 87}, {'field': 'yes', 'morefield': False} ]
@@ -31,11 +30,11 @@
]""")
- d1 = json.dumps(h)
- d2 = json.dumps(h, indent=2, sort_keys=True, separators=(',', ': '))
+ d1 = self.dumps(h)
+ d2 = self.dumps(h, indent=2, sort_keys=True, separators=(',', ': '))
- h1 = json.loads(d1)
- h2 = json.loads(d2)
+ h1 = self.loads(d1)
+ h2 = self.loads(d2)
self.assertEqual(h1, h)
self.assertEqual(h2, h)
@@ -44,14 +43,18 @@
def test_indent0(self):
h = {3: 1}
def check(indent, expected):
- d1 = json.dumps(h, indent=indent)
+ d1 = self.dumps(h, indent=indent)
self.assertEqual(d1, expected)
sio = StringIO()
- json.dump(h, sio, indent=indent)
+ self.json.dump(h, sio, indent=indent)
self.assertEqual(sio.getvalue(), expected)
# indent=0 should emit newlines
check(0, '{\n"3": 1\n}')
# indent=None is more compact
check(None, '{"3": 1}')
+
+
+class TestPyIndent(TestIndent, PyTest): pass
+class TestCIndent(TestIndent, CTest): pass
diff --git a/Lib/json/tests/test_pass1.py b/Lib/json/tests/test_pass1.py
index 719c113..2a0e0f7 100644
--- a/Lib/json/tests/test_pass1.py
+++ b/Lib/json/tests/test_pass1.py
@@ -1,6 +1,5 @@
-from unittest import TestCase
+from json.tests import PyTest, CTest
-import json
# from http://json.org/JSON_checker/test/pass1.json
JSON = r'''
@@ -62,15 +61,19 @@
,"rosebud"]
'''
-class TestPass1(TestCase):
+class TestPass1:
def test_parse(self):
# test in/out equivalence and parsing
- res = json.loads(JSON)
- out = json.dumps(res)
- self.assertEqual(res, json.loads(out))
+ res = self.loads(JSON)
+ out = self.dumps(res)
+ self.assertEqual(res, self.loads(out))
try:
- json.dumps(res, allow_nan=False)
+ self.dumps(res, allow_nan=False)
except ValueError:
pass
else:
self.fail("23456789012E666 should be out of range")
+
+
+class TestPyPass1(TestPass1, PyTest): pass
+class TestCPass1(TestPass1, CTest): pass
diff --git a/Lib/json/tests/test_pass2.py b/Lib/json/tests/test_pass2.py
index 379117e..14459d9 100644
--- a/Lib/json/tests/test_pass2.py
+++ b/Lib/json/tests/test_pass2.py
@@ -1,14 +1,18 @@
-from unittest import TestCase
-import json
+from json.tests import PyTest, CTest
+
# from http://json.org/JSON_checker/test/pass2.json
JSON = r'''
[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
'''
-class TestPass2(TestCase):
+class TestPass2:
def test_parse(self):
# test in/out equivalence and parsing
- res = json.loads(JSON)
- out = json.dumps(res)
- self.assertEqual(res, json.loads(out))
+ res = self.loads(JSON)
+ out = self.dumps(res)
+ self.assertEqual(res, self.loads(out))
+
+
+class TestPyPass2(TestPass2, PyTest): pass
+class TestCPass2(TestPass2, CTest): pass
diff --git a/Lib/json/tests/test_pass3.py b/Lib/json/tests/test_pass3.py
index 9151c43..6635ea5 100644
--- a/Lib/json/tests/test_pass3.py
+++ b/Lib/json/tests/test_pass3.py
@@ -1,6 +1,5 @@
-from unittest import TestCase
+from json.tests import PyTest, CTest
-import json
# from http://json.org/JSON_checker/test/pass3.json
JSON = r'''
@@ -12,9 +11,14 @@
}
'''
-class TestPass3(TestCase):
+
+class TestPass3:
def test_parse(self):
# test in/out equivalence and parsing
- res = json.loads(JSON)
- out = json.dumps(res)
- self.assertEqual(res, json.loads(out))
+ res = self.loads(JSON)
+ out = self.dumps(res)
+ self.assertEqual(res, self.loads(out))
+
+
+class TestPyPass3(TestPass3, PyTest): pass
+class TestCPass3(TestPass3, CTest): pass
diff --git a/Lib/json/tests/test_recursion.py b/Lib/json/tests/test_recursion.py
index 1e9b8ab..b61b1bc 100644
--- a/Lib/json/tests/test_recursion.py
+++ b/Lib/json/tests/test_recursion.py
@@ -1,28 +1,16 @@
-from unittest import TestCase
+from json.tests import PyTest, CTest
-import json
class JSONTestObject:
pass
-class RecursiveJSONEncoder(json.JSONEncoder):
- recurse = False
- def default(self, o):
- if o is JSONTestObject:
- if self.recurse:
- return [JSONTestObject]
- else:
- return 'JSONTestObject'
- return json.JSONEncoder.default(o)
-
-
-class TestRecursion(TestCase):
+class TestRecursion:
def test_listrecursion(self):
x = []
x.append(x)
try:
- json.dumps(x)
+ self.dumps(x)
except ValueError:
pass
else:
@@ -31,7 +19,7 @@
y = [x]
x.append(y)
try:
- json.dumps(x)
+ self.dumps(x)
except ValueError:
pass
else:
@@ -39,13 +27,13 @@
y = []
x = [y, y]
# ensure that the marker is cleared
- json.dumps(x)
+ self.dumps(x)
def test_dictrecursion(self):
x = {}
x["test"] = x
try:
- json.dumps(x)
+ self.dumps(x)
except ValueError:
pass
else:
@@ -53,9 +41,19 @@
x = {}
y = {"a": x, "b": x}
# ensure that the marker is cleared
- json.dumps(x)
+ self.dumps(x)
def test_defaultrecursion(self):
+ class RecursiveJSONEncoder(self.json.JSONEncoder):
+ recurse = False
+ def default(self, o):
+ if o is JSONTestObject:
+ if self.recurse:
+ return [JSONTestObject]
+ else:
+ return 'JSONTestObject'
+ return pyjson.JSONEncoder.default(o)
+
enc = RecursiveJSONEncoder()
self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"')
enc.recurse = True
@@ -65,3 +63,38 @@
pass
else:
self.fail("didn't raise ValueError on default recursion")
+
+
+ def test_highly_nested_objects_decoding(self):
+ # test that loading highly-nested objects doesn't segfault when C
+ # accelerations are used. See #12017
+ with self.assertRaises(RuntimeError):
+ self.loads('{"a":' * 100000 + '1' + '}' * 100000)
+ with self.assertRaises(RuntimeError):
+ self.loads('{"a":' * 100000 + '[1]' + '}' * 100000)
+ with self.assertRaises(RuntimeError):
+ self.loads('[' * 100000 + '1' + ']' * 100000)
+
+ def test_highly_nested_objects_encoding(self):
+ # See #12051
+ l, d = [], {}
+ for x in range(100000):
+ l, d = [l], {'k':d}
+ with self.assertRaises(RuntimeError):
+ self.dumps(l)
+ with self.assertRaises(RuntimeError):
+ self.dumps(d)
+
+ def test_endless_recursion(self):
+ # See #12051
+ class EndlessJSONEncoder(self.json.JSONEncoder):
+ def default(self, o):
+ """If check_circular is False, this will keep adding another list."""
+ return [o]
+
+ with self.assertRaises(RuntimeError):
+ EndlessJSONEncoder(check_circular=False).encode(5j)
+
+
+class TestPyRecursion(TestRecursion, PyTest): pass
+class TestCRecursion(TestRecursion, CTest): pass
diff --git a/Lib/json/tests/test_scanstring.py b/Lib/json/tests/test_scanstring.py
index abd3253..9c406d5 100644
--- a/Lib/json/tests/test_scanstring.py
+++ b/Lib/json/tests/test_scanstring.py
@@ -1,24 +1,10 @@
import sys
-from unittest import TestCase, skipUnless
+from json.tests import PyTest, CTest
-import json
-import json.decoder
-try:
- import _json
-except ImportError:
- _json = None
-
-class TestScanString(TestCase):
- def test_py_scanstring(self):
- self._test_scanstring(json.decoder.py_scanstring)
-
- @skipUnless(_json, 'test requires the _json module')
- def test_c_scanstring(self):
- if json.decoder.c_scanstring is not None:
- self._test_scanstring(json.decoder.c_scanstring)
-
- def _test_scanstring(self, scanstring):
+class TestScanstring:
+ def test_scanstring(self):
+ scanstring = self.json.decoder.scanstring
self.assertEqual(
scanstring('"z\\ud834\\udd20x"', 1, True),
('z\U0001d120x', 16))
@@ -109,4 +95,9 @@
('Bad value', 12))
def test_overflow(self):
- self.assertRaises(OverflowError, json.decoder.scanstring, b"xxx", sys.maxsize+1)
+ with self.assertRaises(OverflowError):
+ self.json.decoder.scanstring(b"xxx", sys.maxsize+1)
+
+
+class TestPyScanstring(TestScanstring, PyTest): pass
+class TestCScanstring(TestScanstring, CTest): pass
diff --git a/Lib/json/tests/test_separators.py b/Lib/json/tests/test_separators.py
index d5b92bd..9344cdb 100644
--- a/Lib/json/tests/test_separators.py
+++ b/Lib/json/tests/test_separators.py
@@ -1,10 +1,8 @@
import textwrap
-from unittest import TestCase
-
-import json
+from json.tests import PyTest, CTest
-class TestSeparators(TestCase):
+class TestSeparators:
def test_separators(self):
h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
{'nifty': 87}, {'field': 'yes', 'morefield': False} ]
@@ -31,12 +29,16 @@
]""")
- d1 = json.dumps(h)
- d2 = json.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : '))
+ d1 = self.dumps(h)
+ d2 = self.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : '))
- h1 = json.loads(d1)
- h2 = json.loads(d2)
+ h1 = self.loads(d1)
+ h2 = self.loads(d2)
self.assertEqual(h1, h)
self.assertEqual(h2, h)
self.assertEqual(d2, expect)
+
+
+class TestPySeparators(TestSeparators, PyTest): pass
+class TestCSeparators(TestSeparators, CTest): pass
diff --git a/Lib/json/tests/test_speedups.py b/Lib/json/tests/test_speedups.py
index b7c141f..845ca08 100644
--- a/Lib/json/tests/test_speedups.py
+++ b/Lib/json/tests/test_speedups.py
@@ -1,29 +1,24 @@
-from unittest import TestCase, skipUnless
+from json.tests import CTest
-from json import decoder, encoder, scanner
-try:
- import _json
-except ImportError:
- _json = None
-
-@skipUnless(_json, 'test requires the _json module')
-class TestSpeedups(TestCase):
+class TestSpeedups(CTest):
def test_scanstring(self):
- self.assertEqual(decoder.scanstring.__module__, "_json")
- self.assertIs(decoder.scanstring, decoder.c_scanstring)
+ self.assertEqual(self.json.decoder.scanstring.__module__, "_json")
+ self.assertIs(self.json.decoder.scanstring, self.json.decoder.c_scanstring)
def test_encode_basestring_ascii(self):
- self.assertEqual(encoder.encode_basestring_ascii.__module__, "_json")
- self.assertIs(encoder.encode_basestring_ascii,
- encoder.c_encode_basestring_ascii)
+ self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,
+ "_json")
+ self.assertIs(self.json.encoder.encode_basestring_ascii,
+ self.json.encoder.c_encode_basestring_ascii)
-class TestDecode(TestCase):
+
+class TestDecode(CTest):
def test_make_scanner(self):
- self.assertRaises(AttributeError, scanner.c_make_scanner, 1)
+ self.assertRaises(AttributeError, self.json.scanner.c_make_scanner, 1)
def test_make_encoder(self):
- self.assertRaises(TypeError, encoder.c_make_encoder,
+ self.assertRaises(TypeError, self.json.encoder.c_make_encoder,
(True, False),
b"\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",
None)
diff --git a/Lib/json/tests/test_unicode.py b/Lib/json/tests/test_unicode.py
index e336c91..5548ecb 100644
--- a/Lib/json/tests/test_unicode.py
+++ b/Lib/json/tests/test_unicode.py
@@ -1,73 +1,75 @@
-from unittest import TestCase
-
-import json
from collections import OrderedDict
+from json.tests import PyTest, CTest
-class TestUnicode(TestCase):
+
+class TestUnicode:
# test_encoding1 and test_encoding2 from 2.x are irrelevant (only str
# is supported as input, not bytes).
def test_encoding3(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps(u)
+ j = self.dumps(u)
self.assertEqual(j, '"\\u03b1\\u03a9"')
def test_encoding4(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps([u])
+ j = self.dumps([u])
self.assertEqual(j, '["\\u03b1\\u03a9"]')
def test_encoding5(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps(u, ensure_ascii=False)
+ j = self.dumps(u, ensure_ascii=False)
self.assertEqual(j, '"{0}"'.format(u))
def test_encoding6(self):
u = '\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
- j = json.dumps([u], ensure_ascii=False)
+ j = self.dumps([u], ensure_ascii=False)
self.assertEqual(j, '["{0}"]'.format(u))
def test_big_unicode_encode(self):
u = '\U0001d120'
- self.assertEqual(json.dumps(u), '"\\ud834\\udd20"')
- self.assertEqual(json.dumps(u, ensure_ascii=False), '"\U0001d120"')
+ self.assertEqual(self.dumps(u), '"\\ud834\\udd20"')
+ self.assertEqual(self.dumps(u, ensure_ascii=False), '"\U0001d120"')
def test_big_unicode_decode(self):
u = 'z\U0001d120x'
- self.assertEqual(json.loads('"' + u + '"'), u)
- self.assertEqual(json.loads('"z\\ud834\\udd20x"'), u)
+ self.assertEqual(self.loads('"' + u + '"'), u)
+ self.assertEqual(self.loads('"z\\ud834\\udd20x"'), u)
def test_unicode_decode(self):
for i in range(0, 0xd7ff):
u = chr(i)
s = '"\\u{0:04x}"'.format(i)
- self.assertEqual(json.loads(s), u)
+ self.assertEqual(self.loads(s), u)
def test_unicode_preservation(self):
- self.assertEqual(type(json.loads('""')), str)
- self.assertEqual(type(json.loads('"a"')), str)
- self.assertEqual(type(json.loads('["a"]')[0]), str)
+ self.assertEqual(type(self.loads('""')), str)
+ self.assertEqual(type(self.loads('"a"')), str)
+ self.assertEqual(type(self.loads('["a"]')[0]), str)
def test_bytes_encode(self):
- self.assertRaises(TypeError, json.dumps, b"hi")
- self.assertRaises(TypeError, json.dumps, [b"hi"])
+ self.assertRaises(TypeError, self.dumps, b"hi")
+ self.assertRaises(TypeError, self.dumps, [b"hi"])
def test_bytes_decode(self):
- self.assertRaises(TypeError, json.loads, b'"hi"')
- self.assertRaises(TypeError, json.loads, b'["hi"]')
+ self.assertRaises(TypeError, self.loads, b'"hi"')
+ self.assertRaises(TypeError, self.loads, b'["hi"]')
def test_object_pairs_hook_with_unicode(self):
s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
("qrt", 5), ("pad", 6), ("hoy", 7)]
- self.assertEqual(json.loads(s), eval(s))
- self.assertEqual(json.loads(s, object_pairs_hook = lambda x: x), p)
- od = json.loads(s, object_pairs_hook = OrderedDict)
+ self.assertEqual(self.loads(s), eval(s))
+ self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p)
+ od = self.loads(s, object_pairs_hook = OrderedDict)
self.assertEqual(od, OrderedDict(p))
self.assertEqual(type(od), OrderedDict)
# the object_pairs_hook takes priority over the object_hook
- self.assertEqual(json.loads(s,
- object_pairs_hook = OrderedDict,
+ self.assertEqual(self.loads(s, object_pairs_hook = OrderedDict,
object_hook = lambda x: None),
OrderedDict(p))
+
+
+class TestPyUnicode(TestUnicode, PyTest): pass
+class TestCUnicode(TestUnicode, CTest): pass
diff --git a/Lib/locale.py b/Lib/locale.py
index 8c44625..a1283a3 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -640,7 +640,7 @@
'tactis': 'TACTIS',
'euc_jp': 'eucJP',
'euc_kr': 'eucKR',
- 'utf_8': 'UTF8',
+ 'utf_8': 'UTF-8',
'koi8_r': 'KOI8-R',
'koi8_u': 'KOI8-U',
# XXX This list is still incomplete. If you know more
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index d9c289b..71a8e99 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -224,19 +224,24 @@
def __init__(self, dirname, factory=None, create=True):
"""Initialize a Maildir instance."""
Mailbox.__init__(self, dirname, factory, create)
+ self._paths = {
+ 'tmp': os.path.join(self._path, 'tmp'),
+ 'new': os.path.join(self._path, 'new'),
+ 'cur': os.path.join(self._path, 'cur'),
+ }
if not os.path.exists(self._path):
if create:
os.mkdir(self._path, 0o700)
- os.mkdir(os.path.join(self._path, 'tmp'), 0o700)
- os.mkdir(os.path.join(self._path, 'new'), 0o700)
- os.mkdir(os.path.join(self._path, 'cur'), 0o700)
+ for path in self._paths.values():
+ os.mkdir(path, 0o700)
else:
raise NoSuchMailboxError(self._path)
self._toc = {}
- self._last_read = None # Records last time we read cur/new
- # NOTE: we manually invalidate _last_read each time we do any
- # modifications ourselves, otherwise we might get tripped up by
- # bogus mtime behaviour on some systems (see issue #6896).
+ self._toc_mtimes = {}
+ for subdir in ('cur', 'new'):
+ self._toc_mtimes[subdir] = os.path.getmtime(self._paths[subdir])
+ self._last_read = time.time() # Records last time we read cur/new
+ self._skewfactor = 0.1 # Adjust if os/fs clocks are skewing
def add(self, message):
"""Add message and return assigned key."""
@@ -270,15 +275,11 @@
raise
if isinstance(message, MaildirMessage):
os.utime(dest, (os.path.getatime(dest), message.get_date()))
- # Invalidate cached toc
- self._last_read = None
return uniq
def remove(self, key):
"""Remove the keyed message; raise KeyError if it doesn't exist."""
os.remove(os.path.join(self._path, self._lookup(key)))
- # Invalidate cached toc (only on success)
- self._last_read = None
def discard(self, key):
"""If the keyed message exists, remove it."""
@@ -313,8 +314,6 @@
if isinstance(message, MaildirMessage):
os.utime(new_path, (os.path.getatime(new_path),
message.get_date()))
- # Invalidate cached toc
- self._last_read = None
def get_message(self, key):
"""Return a Message representation or raise a KeyError."""
@@ -370,8 +369,8 @@
def flush(self):
"""Write any pending changes to disk."""
# Maildir changes are always written immediately, so there's nothing
- # to do except invalidate our cached toc.
- self._last_read = None
+ # to do.
+ pass
def lock(self):
"""Lock the mailbox."""
@@ -469,34 +468,39 @@
def _refresh(self):
"""Update table of contents mapping."""
- new_mtime = os.path.getmtime(os.path.join(self._path, 'new'))
- cur_mtime = os.path.getmtime(os.path.join(self._path, 'cur'))
-
- if (self._last_read is not None and
- new_mtime <= self._last_read and cur_mtime <= self._last_read):
- return
-
+ # If it has been less than two seconds since the last _refresh() call,
+ # we have to unconditionally re-read the mailbox just in case it has
+ # been modified, because os.path.mtime() has a 2 sec resolution in the
+ # most common worst case (FAT) and a 1 sec resolution typically. This
+ # results in a few unnecessary re-reads when _refresh() is called
+ # multiple times in that interval, but once the clock ticks over, we
+ # will only re-read as needed. Because the filesystem might be being
+ # served by an independent system with its own clock, we record and
+ # compare with the mtimes from the filesystem. Because the other
+ # system's clock might be skewing relative to our clock, we add an
+ # extra delta to our wait. The default is one tenth second, but is an
+ # instance variable and so can be adjusted if dealing with a
+ # particularly skewed or irregular system.
+ if time.time() - self._last_read > 2 + self._skewfactor:
+ refresh = False
+ for subdir in self._toc_mtimes:
+ mtime = os.path.getmtime(self._paths[subdir])
+ if mtime > self._toc_mtimes[subdir]:
+ refresh = True
+ self._toc_mtimes[subdir] = mtime
+ if not refresh:
+ return
+ # Refresh toc
self._toc = {}
- def update_dir (subdir):
- path = os.path.join(self._path, subdir)
+ for subdir in self._toc_mtimes:
+ path = self._paths[subdir]
for entry in os.listdir(path):
p = os.path.join(path, entry)
if os.path.isdir(p):
continue
uniq = entry.split(self.colon)[0]
self._toc[uniq] = os.path.join(subdir, entry)
-
- update_dir('new')
- update_dir('cur')
-
- # We record the current time - 1sec so that, if _refresh() is called
- # again in the same second, we will always re-read the mailbox
- # just in case it's been modified. (os.path.mtime() only has
- # 1sec resolution.) This results in a few unnecessary re-reads
- # when _refresh() is called multiple times in the same second,
- # but once the clock ticks over, we will only re-read as needed.
- now = int(time.time() - 1)
- self._last_read = time.time() - 1
+ self._last_read = time.time()
def _lookup(self, key):
"""Use TOC to return subpath for given key, or raise a KeyError."""
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py
index 478c749..5a8942a 100644
--- a/Lib/modulefinder.py
+++ b/Lib/modulefinder.py
@@ -35,9 +35,10 @@
replacePackageMap = {}
-# This ReplacePackage mechanism allows modulefinder to work around the
-# way the _xmlplus package injects itself under the name "xml" into
-# sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml")
+# This ReplacePackage mechanism allows modulefinder to work around
+# situations in which a package injects itself under the name
+# of another package into sys.modules at runtime by calling
+# ReplacePackage("real_package_name", "faked_package_name")
# before running ModuleFinder.
def ReplacePackage(oldname, newname):
diff --git a/Lib/optparse.py b/Lib/optparse.py
index 3eb652a..cbd019a 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -1120,6 +1120,11 @@
prog : string
the name of the current program (to override
os.path.basename(sys.argv[0])).
+ description : string
+ A paragraph of text giving a brief overview of your program.
+ optparse reformats this paragraph to fit the current terminal
+ width and prints it when the user requests help (after usage,
+ but before the list of options).
epilog : string
paragraph of help text to print after option help
diff --git a/Lib/platform.py b/Lib/platform.py
index dd09460..5ad1012 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -1398,9 +1398,10 @@
""" Returns a string identifying the Python implementation.
Currently, the following implementations are identified:
- 'CPython' (C implementation of Python),
- 'IronPython' (.NET implementation of Python),
- 'Jython' (Java implementation of Python).
+ 'CPython' (C implementation of Python),
+ 'IronPython' (.NET implementation of Python),
+ 'Jython' (Java implementation of Python),
+ 'PyPy' (Python implementation of Python).
"""
return _sys_version()[0]
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 4862ae6..781840d 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -260,12 +260,18 @@
"""
real_dst = dst
if os.path.isdir(dst):
+ if _samefile(src, dst):
+ # We might be on a case insensitive filesystem,
+ # perform the rename anyway.
+ os.rename(src, dst)
+ return
+
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error("Destination path '%s' already exists" % real_dst)
try:
os.rename(src, real_dst)
- except OSError:
+ except OSError as exc:
if os.path.isdir(src):
if _destinsrc(src, dst):
raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst))
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index a01a184..2c2141b 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -219,6 +219,7 @@
ehlo_msg = "ehlo"
ehlo_resp = None
does_esmtp = 0
+ default_port = SMTP_PORT
def __init__(self, host='', port=0, local_hostname=None,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
@@ -234,7 +235,6 @@
"""
self.timeout = timeout
self.esmtp_features = {}
- self.default_port = SMTP_PORT
if host:
(code, msg) = self.connect(host, port)
if code != 220:
@@ -749,13 +749,15 @@
are also optional - they can contain a PEM formatted private key and
certificate chain file for the SSL connection.
"""
+
+ default_port = SMTP_SSL_PORT
+
def __init__(self, host='', port=0, local_hostname=None,
keyfile=None, certfile=None,
timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
self.keyfile = keyfile
self.certfile = certfile
SMTP.__init__(self, host, port, local_hostname, timeout)
- self.default_port = SMTP_SSL_PORT
def _get_socket(self, host, port, timeout):
if self.debuglevel > 0: print('connect:', (host, port), file=stderr)
diff --git a/Lib/ssl.py b/Lib/ssl.py
index f98bd73..bbb8111 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -60,8 +60,6 @@
from _ssl import SSLError
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
-from _ssl import (PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23,
- PROTOCOL_TLSv1)
from _ssl import RAND_status, RAND_egd, RAND_add
from _ssl import (
SSL_ERROR_ZERO_RETURN,
@@ -74,6 +72,18 @@
SSL_ERROR_EOF,
SSL_ERROR_INVALID_ERROR_CODE,
)
+from _ssl import PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
+_PROTOCOL_NAMES = {
+ PROTOCOL_TLSv1: "TLSv1",
+ PROTOCOL_SSLv23: "SSLv23",
+ PROTOCOL_SSLv3: "SSLv3",
+}
+try:
+ from _ssl import PROTOCOL_SSLv2
+except ImportError:
+ pass
+else:
+ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2"
from socket import getnameinfo as _getnameinfo
from socket import error as socket_error
@@ -427,13 +437,4 @@
return DER_cert_to_PEM_cert(dercert)
def get_protocol_name(protocol_code):
- if protocol_code == PROTOCOL_TLSv1:
- return "TLSv1"
- elif protocol_code == PROTOCOL_SSLv23:
- return "SSLv23"
- elif protocol_code == PROTOCOL_SSLv2:
- return "SSLv2"
- elif protocol_code == PROTOCOL_SSLv3:
- return "SSLv3"
- else:
- return "<unknown>"
+ return _PROTOCOL_NAMES.get(protocol_code, '<unknown>')
diff --git a/Lib/test/cjkencodings/big5-utf8.txt b/Lib/test/cjkencodings/big5-utf8.txt
new file mode 100644
index 0000000..a0a534a
--- /dev/null
+++ b/Lib/test/cjkencodings/big5-utf8.txt
@@ -0,0 +1,9 @@
+如何在 Python 中使用既有的 C library?
+ 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
+課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
+library, 並有一個 fast prototyping 的 programming language 可
+供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
+fast prototyping 的 programming language. 故我們希望能將既有的
+C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
+要討論的問題就是:
+
diff --git a/Lib/test/cjkencodings/big5.txt b/Lib/test/cjkencodings/big5.txt
new file mode 100644
index 0000000..f442495
--- /dev/null
+++ b/Lib/test/cjkencodings/big5.txt
@@ -0,0 +1,9 @@
+¦p¦ó¦b Python ¤¤¨Ï¥Î¬J¦³ªº C library?
+¡@¦b¸ê°T¬ì§Þ§Ö³tµo®iªº¤µ¤Ñ, ¶}µo¤Î´ú¸Õ³nÅ骺³t«×¬O¤£®e©¿µøªº
+½ÒÃD. ¬°¥[§Ö¶}µo¤Î´ú¸Õªº³t«×, §ÚÌ«K±`§Æ±æ¯à§Q¥Î¤@¨Ç¤w¶}µo¦nªº
+library, ¨Ã¦³¤@Ó fast prototyping ªº programming language ¥i
+¨Ñ¨Ï¥Î. ¥Ø«e¦³³\³\¦h¦hªº library ¬O¥H C ¼g¦¨, ¦Ó Python ¬O¤@Ó
+fast prototyping ªº programming language. ¬G§Ú̧Ʊæ¯à±N¬J¦³ªº
+C library ®³¨ì Python ªºÀô¹Ò¤¤´ú¸Õ¤Î¾ã¦X. ¨ä¤¤³Ì¥Dn¤]¬O§ÚÌ©Ò
+n°Q½×ªº°ÝÃD´N¬O:
+
diff --git a/Lib/test/cjkencodings/big5hkscs-utf8.txt b/Lib/test/cjkencodings/big5hkscs-utf8.txt
new file mode 100644
index 0000000..f744ce9
--- /dev/null
+++ b/Lib/test/cjkencodings/big5hkscs-utf8.txt
@@ -0,0 +1,2 @@
+𠄌Ě鵮罓洆
+ÊÊ̄ê êê̄
diff --git a/Lib/test/cjkencodings/big5hkscs.txt b/Lib/test/cjkencodings/big5hkscs.txt
new file mode 100644
index 0000000..81c42b3
--- /dev/null
+++ b/Lib/test/cjkencodings/big5hkscs.txt
@@ -0,0 +1,2 @@
+E\sÚØ
+fb§ §£
diff --git a/Lib/test/cjkencodings/cp949-utf8.txt b/Lib/test/cjkencodings/cp949-utf8.txt
new file mode 100644
index 0000000..5655e38
--- /dev/null
+++ b/Lib/test/cjkencodings/cp949-utf8.txt
@@ -0,0 +1,9 @@
+똠방각하 펲시콜라
+
+㉯㉯납!! 因九月패믤릔궈 ⓡⓖ훀¿¿¿ 긍뒙 ⓔ뎨 ㉯. .
+亞영ⓔ능횹 . . . . 서울뤄 뎐학乙 家훀 ! ! !ㅠ.ㅠ
+흐흐흐 ㄱㄱㄱ☆ㅠ_ㅠ 어릨 탸콰긐 뎌응 칑九들乙 ㉯드긐
+설릌 家훀 . . . . 굴애쉌 ⓔ궈 ⓡ릘㉱긐 因仁川女中까즼
+와쒀훀 ! ! 亞영ⓔ 家능궈 ☆上관 없능궈능 亞능뒈훀 글애듴
+ⓡ려듀九 싀풔숴훀 어릨 因仁川女中싁⑨들앜!! ㉯㉯납♡ ⌒⌒*
+
diff --git a/Lib/test/cjkencodings/cp949.txt b/Lib/test/cjkencodings/cp949.txt
new file mode 100644
index 0000000..16549aa
--- /dev/null
+++ b/Lib/test/cjkencodings/cp949.txt
@@ -0,0 +1,9 @@
+c¹æ°¢ÇÏ ¼½ÃÄݶó
+
+¨À¨À³³!! ì×ÎúêÅÆÐæp±Å ¨Þ¨ÓÄR¢¯¢¯¢¯ ±à ¨Ñµ³ ¨À. .
+䬿µ¨Ñ´ÉÈ . . . . ¼¿ï·ï µ¯ÇÐëà Ê«ÄR ! ! !¤Ð.¤Ð
+ÈåÈåÈå ¤¡¤¡¤¡¡Ù¤Ð_¤Ð ¾î ÅËÄâO µ®ÀÀ ¯hÎúµéëà ¨ÀµåO
+¼³j Ê«ÄR . . . . ±¼¾Öf ¨Ñ±Å ¨Þt¨ÂO ì×ìÒô¹åüñé±î£
+¿Í¾¬ÄR ! ! 䬿µ¨Ñ Ê«´É±Å ¡Ùß¾°ü ¾ø´É±Å´É 䬴ɵØÄR ±Û¾ÖÛ
+¨Þ·ÁµàÎú ÃÇ´½¤ÄR ¾î ì×ìÒô¹åüñéĨïµéÚ!! ¨À¨À³³¢½ ¡Ò¡Ò*
+
diff --git a/Lib/test/cjkencodings/euc_jisx0213-utf8.txt b/Lib/test/cjkencodings/euc_jisx0213-utf8.txt
new file mode 100644
index 0000000..9a56a2e
--- /dev/null
+++ b/Lib/test/cjkencodings/euc_jisx0213-utf8.txt
@@ -0,0 +1,8 @@
+Python の開発は、1990 年ごろから開始されています。
+開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
+このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
+このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
+多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
+言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
+
+ノか゚ ト゚ トキ喝塀 𡚴𪎌 麀齁𩛰
diff --git a/Lib/test/cjkencodings/euc_jisx0213.txt b/Lib/test/cjkencodings/euc_jisx0213.txt
new file mode 100644
index 0000000..51e9268
--- /dev/null
+++ b/Lib/test/cjkencodings/euc_jisx0213.txt
@@ -0,0 +1,8 @@
+Python ¤Î³«È¯¤Ï¡¢1990 ǯ¤´¤í¤«¤é³«»Ï¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+³«È¯¼Ô¤Î Guido van Rossum ¤Ï¶µ°éÍÑ¤Î¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¡ÖABC¡×¤Î³«È¯¤Ë»²²Ã¤·¤Æ¤¤¤Þ¤·¤¿¤¬¡¢ABC ¤Ï¼ÂÍѾå¤ÎÌÜŪ¤Ë¤Ï¤¢¤Þ¤êŬ¤·¤Æ¤¤¤Þ¤»¤ó¤Ç¤·¤¿¡£
+¤³¤Î¤¿¤á¡¢Guido ¤Ï¤è¤ê¼ÂÍÑŪ¤Ê¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¤Î³«È¯¤ò³«»Ï¤·¡¢±Ñ¹ñ BBS ÊüÁ÷¤Î¥³¥á¥Ç¥£ÈÖÁÈ¡Ö¥â¥ó¥Æ¥£ ¥Ñ¥¤¥½¥ó¡×¤Î¥Õ¥¡¥ó¤Ç¤¢¤ë Guido ¤Ï¤³¤Î¸À¸ì¤ò¡ÖPython¡×¤È̾¤Å¤±¤Þ¤·¤¿¡£
+¤³¤Î¤è¤¦¤ÊÇطʤ«¤éÀ¸¤Þ¤ì¤¿ Python ¤Î¸À¸ìÀ߷פϡ¢¡Ö¥·¥ó¥×¥ë¡×¤Ç¡Ö½¬ÆÀ¤¬ÍưספȤ¤¤¦ÌÜɸ¤Ë½ÅÅÀ¤¬ÃÖ¤«¤ì¤Æ¤¤¤Þ¤¹¡£
+¿¤¯¤Î¥¹¥¯¥ê¥×¥È·Ï¸À¸ì¤Ç¤Ï¥æ¡¼¥¶¤ÎÌÜÀè¤ÎÍøÊØÀ¤òÍ¥À褷¤Æ¿§¡¹¤Êµ¡Ç½¤ò¸À¸ìÍ×ÁǤȤ·¤Æ¼è¤êÆþ¤ì¤ë¾ì¹ç¤¬Â¿¤¤¤Î¤Ç¤¹¤¬¡¢Python ¤Ç¤Ï¤½¤¦¤¤¤Ã¤¿¾®ºÙ¹©¤¬Äɲ䵤ì¤ë¤³¤È¤Ï¤¢¤Þ¤ê¤¢¤ê¤Þ¤»¤ó¡£
+¸À¸ì¼«ÂΤε¡Ç½¤ÏºÇ¾®¸Â¤Ë²¡¤µ¤¨¡¢É¬Íפʵ¡Ç½¤Ï³ÈÄ¥¥â¥¸¥å¡¼¥ë¤È¤·¤ÆÄɲ乤롢¤È¤¤¤¦¤Î¤¬ Python ¤Î¥Ý¥ê¥·¡¼¤Ç¤¹¡£
+
+¥Î¤÷ ¥þ ¥È¥¯¬¯Ú ÏãþØ þÔþèüÖ
diff --git a/Lib/test/cjkencodings/euc_jp-utf8.txt b/Lib/test/cjkencodings/euc_jp-utf8.txt
new file mode 100644
index 0000000..7763250
--- /dev/null
+++ b/Lib/test/cjkencodings/euc_jp-utf8.txt
@@ -0,0 +1,7 @@
+Python の開発は、1990 年ごろから開始されています。
+開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
+このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
+このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
+多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
+言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
+
diff --git a/Lib/test/cjkencodings/euc_jp.txt b/Lib/test/cjkencodings/euc_jp.txt
new file mode 100644
index 0000000..9da6b5d
--- /dev/null
+++ b/Lib/test/cjkencodings/euc_jp.txt
@@ -0,0 +1,7 @@
+Python ¤Î³«È¯¤Ï¡¢1990 ǯ¤´¤í¤«¤é³«»Ï¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
+³«È¯¼Ô¤Î Guido van Rossum ¤Ï¶µ°éÍÑ¤Î¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¡ÖABC¡×¤Î³«È¯¤Ë»²²Ã¤·¤Æ¤¤¤Þ¤·¤¿¤¬¡¢ABC ¤Ï¼ÂÍѾå¤ÎÌÜŪ¤Ë¤Ï¤¢¤Þ¤êŬ¤·¤Æ¤¤¤Þ¤»¤ó¤Ç¤·¤¿¡£
+¤³¤Î¤¿¤á¡¢Guido ¤Ï¤è¤ê¼ÂÍÑŪ¤Ê¥×¥í¥°¥é¥ß¥ó¥°¸À¸ì¤Î³«È¯¤ò³«»Ï¤·¡¢±Ñ¹ñ BBS ÊüÁ÷¤Î¥³¥á¥Ç¥£ÈÖÁÈ¡Ö¥â¥ó¥Æ¥£ ¥Ñ¥¤¥½¥ó¡×¤Î¥Õ¥¡¥ó¤Ç¤¢¤ë Guido ¤Ï¤³¤Î¸À¸ì¤ò¡ÖPython¡×¤È̾¤Å¤±¤Þ¤·¤¿¡£
+¤³¤Î¤è¤¦¤ÊÇطʤ«¤éÀ¸¤Þ¤ì¤¿ Python ¤Î¸À¸ìÀ߷פϡ¢¡Ö¥·¥ó¥×¥ë¡×¤Ç¡Ö½¬ÆÀ¤¬ÍưספȤ¤¤¦ÌÜɸ¤Ë½ÅÅÀ¤¬ÃÖ¤«¤ì¤Æ¤¤¤Þ¤¹¡£
+¿¤¯¤Î¥¹¥¯¥ê¥×¥È·Ï¸À¸ì¤Ç¤Ï¥æ¡¼¥¶¤ÎÌÜÀè¤ÎÍøÊØÀ¤òÍ¥À褷¤Æ¿§¡¹¤Êµ¡Ç½¤ò¸À¸ìÍ×ÁǤȤ·¤Æ¼è¤êÆþ¤ì¤ë¾ì¹ç¤¬Â¿¤¤¤Î¤Ç¤¹¤¬¡¢Python ¤Ç¤Ï¤½¤¦¤¤¤Ã¤¿¾®ºÙ¹©¤¬Äɲ䵤ì¤ë¤³¤È¤Ï¤¢¤Þ¤ê¤¢¤ê¤Þ¤»¤ó¡£
+¸À¸ì¼«ÂΤε¡Ç½¤ÏºÇ¾®¸Â¤Ë²¡¤µ¤¨¡¢É¬Íפʵ¡Ç½¤Ï³ÈÄ¥¥â¥¸¥å¡¼¥ë¤È¤·¤ÆÄɲ乤롢¤È¤¤¤¦¤Î¤¬ Python ¤Î¥Ý¥ê¥·¡¼¤Ç¤¹¡£
+
diff --git a/Lib/test/cjkencodings/euc_kr-utf8.txt b/Lib/test/cjkencodings/euc_kr-utf8.txt
new file mode 100644
index 0000000..16c3741
--- /dev/null
+++ b/Lib/test/cjkencodings/euc_kr-utf8.txt
@@ -0,0 +1,7 @@
+◎ 파이썬(Python)은 배우기 쉽고, 강력한 프로그래밍 언어입니다. 파이썬은
+효율적인 고수준 데이터 구조와 간단하지만 효율적인 객체지향프로그래밍을
+지원합니다. 파이썬의 우아(優雅)한 문법과 동적 타이핑, 그리고 인터프리팅
+환경은 파이썬을 스크립팅과 여러 분야에서와 대부분의 플랫폼에서의 빠른
+애플리케이션 개발을 할 수 있는 이상적인 언어로 만들어줍니다.
+
+☆첫가끝: 날아라 쓔쓔쓩~ 닁큼! 뜽금없이 전홥니다. 뷁. 그런거 읎다.
diff --git a/Lib/test/cjkencodings/euc_kr.txt b/Lib/test/cjkencodings/euc_kr.txt
new file mode 100644
index 0000000..f68dd35
--- /dev/null
+++ b/Lib/test/cjkencodings/euc_kr.txt
@@ -0,0 +1,7 @@
+¡Ý ÆÄÀ̽ã(Python)Àº ¹è¿ì±â ½±°í, °·ÂÇÑ ÇÁ·Î±×·¡¹Ö ¾ð¾îÀÔ´Ï´Ù. ÆÄÀ̽ãÀº
+È¿À²ÀûÀÎ °í¼öÁØ µ¥ÀÌÅÍ ±¸Á¶¿Í °£´ÜÇÏÁö¸¸ È¿À²ÀûÀÎ °´Ã¼ÁöÇâÇÁ·Î±×·¡¹ÖÀ»
+Áö¿øÇÕ´Ï´Ù. ÆÄÀ̽ãÀÇ ¿ì¾Æ(éÐäº)ÇÑ ¹®¹ý°ú µ¿Àû ŸÀÌÇÎ, ±×¸®°í ÀÎÅÍÇÁ¸®ÆÃ
+ȯ°æÀº ÆÄÀ̽ãÀ» ½ºÅ©¸³Æðú ¿©·¯ ºÐ¾ß¿¡¼¿Í ´ëºÎºÐÀÇ Ç÷§Æû¿¡¼ÀÇ ºü¸¥
+¾ÖÇø®ÄÉÀÌ¼Ç °³¹ßÀ» ÇÒ ¼ö ÀÖ´Â ÀÌ»óÀûÀÎ ¾ð¾î·Î ¸¸µé¾îÁÝ´Ï´Ù.
+
+¡Ùù°¡³¡: ³¯¾Æ¶ó ¤Ô¤¶¤Ð¤Ô¤Ô¤¶¤Ð¤Ô¾±~ ¤Ô¤¤¤Ò¤·Å! ¤Ô¤¨¤Ñ¤·±Ý¾øÀÌ Àü¤Ô¤¾¤È¤²´Ï´Ù. ¤Ô¤²¤Î¤ª. ±×·±°Å ¤Ô¤·¤Ñ¤´´Ù.
diff --git a/Lib/test/cjkencodings/gb18030-utf8.txt b/Lib/test/cjkencodings/gb18030-utf8.txt
new file mode 100644
index 0000000..2060d25
--- /dev/null
+++ b/Lib/test/cjkencodings/gb18030-utf8.txt
@@ -0,0 +1,15 @@
+Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
+已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
+的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
+运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
+种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
+如何在 Python 中使用既有的 C library?
+ 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
+課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
+library, 並有一個 fast prototyping 的 programming language 可
+供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
+fast prototyping 的 programming language. 故我們希望能將既有的
+C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
+要討論的問題就是:
+파이썬은 강력한 기능을 지닌 범용 컴퓨터 프로그래밍 언어다.
+
diff --git a/Lib/test/cjkencodings/gb18030.txt b/Lib/test/cjkencodings/gb18030.txt
new file mode 100644
index 0000000..5d1f6dc
--- /dev/null
+++ b/Lib/test/cjkencodings/gb18030.txt
@@ -0,0 +1,15 @@
+Python£¨ÅÉÉ£©ÓïÑÔÊÇÒ»ÖÖ¹¦ÄÜÇ¿´ó¶øÍêÉƵÄͨÓÃÐͼÆËã»ú³ÌÐòÉè¼ÆÓïÑÔ£¬
+ÒѾ¾ßÓÐÊ®¶àÄêµÄ·¢Õ¹ÀúÊ·£¬³ÉÊìÇÒÎȶ¨¡£ÕâÖÖÓïÑÔ¾ßÓзdz£¼ò½Ý¶øÇåÎú
+µÄÓï·¨Ìص㣬ÊʺÏÍê³É¸÷Öָ߲ãÈÎÎñ£¬¼¸ºõ¿ÉÒÔÔÚËùÓеIJÙ×÷ϵͳÖÐ
+ÔËÐС£ÕâÖÖÓïÑÔ¼òµ¥¶øÇ¿´ó£¬Êʺϸ÷ÖÖÈËʿѧϰʹÓá£Ä¿Ç°£¬»ùÓÚÕâ
+ÖÖÓïÑÔµÄÏà¹Ø¼¼ÊõÕýÔÚ·ÉËٵķ¢Õ¹£¬Óû§ÊýÁ¿¼±¾çÀ©´ó£¬Ïà¹ØµÄ×ÊÔ´·Ç³£¶à¡£
+ÈçºÎÔÚ Python ÖÐʹÓüÈÓÐµÄ C library?
+¡¡ÔÚÙYӿƼ¼¿ìËÙ°lÕ¹µÄ½ñÌì, é_°l¼°yÔÜówµÄËÙ¶ÈÊDz»ÈݺöÒµÄ
+Õnî}. é¼Ó¿ìé_°l¼°yÔµÄËÙ¶È, Îұ㳣ϣÍûÄÜÀûÓÃһЩÒÑé_°lºÃµÄ
+library, KÓÐÒ» fast prototyping µÄ programming language ¿É
+¹©Ê¹ÓÃ. Ä¿Ç°ÓÐÔSÔS¶à¶àµÄ library ÊÇÒÔ C ³É, ¶ø Python ÊÇÒ»
+fast prototyping µÄ programming language. ¹ÊÎÒÏ£ÍûÄÜ¢¼ÈÓеÄ
+C library Äõ½ Python µÄh¾³ÖÐyÔ¼°ÕûºÏ. ÆäÖÐ×îÖ÷ÒªÒ²ÊÇÎÒËù
+ÒªÓÕµÄî}¾ÍÊÇ:
+5Ç1332±131 7Ñ60463 858û635 3Õ195 0ý930 4Ü35ö755 5ù509899ü30ð4 2ë92ë599.
+
diff --git a/Lib/test/cjkencodings/gb2312-utf8.txt b/Lib/test/cjkencodings/gb2312-utf8.txt
new file mode 100644
index 0000000..efb7d8f
--- /dev/null
+++ b/Lib/test/cjkencodings/gb2312-utf8.txt
@@ -0,0 +1,6 @@
+Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
+已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
+的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
+运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
+种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
+
diff --git a/Lib/test/cjkencodings/gb2312.txt b/Lib/test/cjkencodings/gb2312.txt
new file mode 100644
index 0000000..1536ac1
--- /dev/null
+++ b/Lib/test/cjkencodings/gb2312.txt
@@ -0,0 +1,6 @@
+Python£¨ÅÉÉ£©ÓïÑÔÊÇÒ»ÖÖ¹¦ÄÜÇ¿´ó¶øÍêÉƵÄͨÓÃÐͼÆËã»ú³ÌÐòÉè¼ÆÓïÑÔ£¬
+ÒѾ¾ßÓÐÊ®¶àÄêµÄ·¢Õ¹ÀúÊ·£¬³ÉÊìÇÒÎȶ¨¡£ÕâÖÖÓïÑÔ¾ßÓзdz£¼ò½Ý¶øÇåÎú
+µÄÓï·¨Ìص㣬ÊʺÏÍê³É¸÷Öָ߲ãÈÎÎñ£¬¼¸ºõ¿ÉÒÔÔÚËùÓеIJÙ×÷ϵͳÖÐ
+ÔËÐС£ÕâÖÖÓïÑÔ¼òµ¥¶øÇ¿´ó£¬Êʺϸ÷ÖÖÈËʿѧϰʹÓá£Ä¿Ç°£¬»ùÓÚÕâ
+ÖÖÓïÑÔµÄÏà¹Ø¼¼ÊõÕýÔÚ·ÉËٵķ¢Õ¹£¬Óû§ÊýÁ¿¼±¾çÀ©´ó£¬Ïà¹ØµÄ×ÊÔ´·Ç³£¶à¡£
+
diff --git a/Lib/test/cjkencodings/gbk-utf8.txt b/Lib/test/cjkencodings/gbk-utf8.txt
new file mode 100644
index 0000000..75bbd31
--- /dev/null
+++ b/Lib/test/cjkencodings/gbk-utf8.txt
@@ -0,0 +1,14 @@
+Python(派森)语言是一种功能强大而完善的通用型计算机程序设计语言,
+已经具有十多年的发展历史,成熟且稳定。这种语言具有非常简捷而清晰
+的语法特点,适合完成各种高层任务,几乎可以在所有的操作系统中
+运行。这种语言简单而强大,适合各种人士学习使用。目前,基于这
+种语言的相关技术正在飞速的发展,用户数量急剧扩大,相关的资源非常多。
+如何在 Python 中使用既有的 C library?
+ 在資訊科技快速發展的今天, 開發及測試軟體的速度是不容忽視的
+課題. 為加快開發及測試的速度, 我們便常希望能利用一些已開發好的
+library, 並有一個 fast prototyping 的 programming language 可
+供使用. 目前有許許多多的 library 是以 C 寫成, 而 Python 是一個
+fast prototyping 的 programming language. 故我們希望能將既有的
+C library 拿到 Python 的環境中測試及整合. 其中最主要也是我們所
+要討論的問題就是:
+
diff --git a/Lib/test/cjkencodings/gbk.txt b/Lib/test/cjkencodings/gbk.txt
new file mode 100644
index 0000000..8788f8a
--- /dev/null
+++ b/Lib/test/cjkencodings/gbk.txt
@@ -0,0 +1,14 @@
+Python£¨ÅÉÉ£©ÓïÑÔÊÇÒ»ÖÖ¹¦ÄÜÇ¿´ó¶øÍêÉƵÄͨÓÃÐͼÆËã»ú³ÌÐòÉè¼ÆÓïÑÔ£¬
+ÒѾ¾ßÓÐÊ®¶àÄêµÄ·¢Õ¹ÀúÊ·£¬³ÉÊìÇÒÎȶ¨¡£ÕâÖÖÓïÑÔ¾ßÓзdz£¼ò½Ý¶øÇåÎú
+µÄÓï·¨Ìص㣬ÊʺÏÍê³É¸÷Öָ߲ãÈÎÎñ£¬¼¸ºõ¿ÉÒÔÔÚËùÓеIJÙ×÷ϵͳÖÐ
+ÔËÐС£ÕâÖÖÓïÑÔ¼òµ¥¶øÇ¿´ó£¬Êʺϸ÷ÖÖÈËʿѧϰʹÓá£Ä¿Ç°£¬»ùÓÚÕâ
+ÖÖÓïÑÔµÄÏà¹Ø¼¼ÊõÕýÔÚ·ÉËٵķ¢Õ¹£¬Óû§ÊýÁ¿¼±¾çÀ©´ó£¬Ïà¹ØµÄ×ÊÔ´·Ç³£¶à¡£
+ÈçºÎÔÚ Python ÖÐʹÓüÈÓÐµÄ C library?
+¡¡ÔÚÙYӿƼ¼¿ìËÙ°lÕ¹µÄ½ñÌì, é_°l¼°yÔÜówµÄËÙ¶ÈÊDz»ÈݺöÒµÄ
+Õnî}. é¼Ó¿ìé_°l¼°yÔµÄËÙ¶È, Îұ㳣ϣÍûÄÜÀûÓÃһЩÒÑé_°lºÃµÄ
+library, KÓÐÒ» fast prototyping µÄ programming language ¿É
+¹©Ê¹ÓÃ. Ä¿Ç°ÓÐÔSÔS¶à¶àµÄ library ÊÇÒÔ C ³É, ¶ø Python ÊÇÒ»
+fast prototyping µÄ programming language. ¹ÊÎÒÏ£ÍûÄÜ¢¼ÈÓеÄ
+C library Äõ½ Python µÄh¾³ÖÐyÔ¼°ÕûºÏ. ÆäÖÐ×îÖ÷ÒªÒ²ÊÇÎÒËù
+ÒªÓÕµÄî}¾ÍÊÇ:
+
diff --git a/Lib/test/cjkencodings/johab-utf8.txt b/Lib/test/cjkencodings/johab-utf8.txt
new file mode 100644
index 0000000..5655e38
--- /dev/null
+++ b/Lib/test/cjkencodings/johab-utf8.txt
@@ -0,0 +1,9 @@
+똠방각하 펲시콜라
+
+㉯㉯납!! 因九月패믤릔궈 ⓡⓖ훀¿¿¿ 긍뒙 ⓔ뎨 ㉯. .
+亞영ⓔ능횹 . . . . 서울뤄 뎐학乙 家훀 ! ! !ㅠ.ㅠ
+흐흐흐 ㄱㄱㄱ☆ㅠ_ㅠ 어릨 탸콰긐 뎌응 칑九들乙 ㉯드긐
+설릌 家훀 . . . . 굴애쉌 ⓔ궈 ⓡ릘㉱긐 因仁川女中까즼
+와쒀훀 ! ! 亞영ⓔ 家능궈 ☆上관 없능궈능 亞능뒈훀 글애듴
+ⓡ려듀九 싀풔숴훀 어릨 因仁川女中싁⑨들앜!! ㉯㉯납♡ ⌒⌒*
+
diff --git a/Lib/test/cjkencodings/johab.txt b/Lib/test/cjkencodings/johab.txt
new file mode 100644
index 0000000..067781b
--- /dev/null
+++ b/Lib/test/cjkencodings/johab.txt
@@ -0,0 +1,9 @@
+±¤wbÐa Í\¯¡Å©a
+
+ÜÀÜÀs!! ñgâðUÌ£
¡ ÜÞÜÓÒzٯٯٯ wÓ ÜÑ ÜÀ. .
+í<µwÜÑwÒs . . . . ¬á¶¡ eÐbðà à;Òz ! ! !A.A
+ÓaÓaÓa AAAÙiA_A ´á È¡ÅÁz a·w Ãâiðà ÜÀaz
+¬éz à;Òz . . . . ´®º ÜÑ¡ ÜÞÜÂz ñgñbõIíüóéa»
+µÁ²¡Òz ! ! í<µwÜÑ à;w¡ Ùiê¾Å ´ôw¡w í<wÁÒz i´z
+ÜÞaA⠯Ρ®¡Òz ´á ñgñbõIíüóé¯Üïi´z!! ÜÀÜÀsÙ½ ÙbÙb*
+
diff --git a/Lib/test/cjkencodings/shift_jis-utf8.txt b/Lib/test/cjkencodings/shift_jis-utf8.txt
new file mode 100644
index 0000000..7763250
--- /dev/null
+++ b/Lib/test/cjkencodings/shift_jis-utf8.txt
@@ -0,0 +1,7 @@
+Python の開発は、1990 年ごろから開始されています。
+開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
+このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
+このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
+多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
+言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
+
diff --git a/Lib/test/cjkencodings/shift_jis.txt b/Lib/test/cjkencodings/shift_jis.txt
new file mode 100644
index 0000000..10b760d
--- /dev/null
+++ b/Lib/test/cjkencodings/shift_jis.txt
@@ -0,0 +1,7 @@
+Python ÌJÍA1990 N²ë©çJn³êĢܷB
+JÒÌ Guido van Rossum ͳçpÌvO~O¾êuABCvÌJÉQÁµÄ¢Üµ½ªAABC ÍÀpãÌÚIÉÍ ÜèKµÄ¢Ü¹ñŵ½B
+±Ì½ßAGuido ÍæèÀpIÈvO~O¾êÌJðJnµAp BBS úÌRfBÔgueB pC\vÌt@Å é Guido ͱ̾êðuPythonvƼïܵ½B
+±Ìæ¤Èwi©ç¶Üê½ Python ̾êÝvÍAuVvvÅuK¾ªeÕvÆ¢¤ÚWÉd_ªu©êĢܷB
+½ÌXNvgn¾êÅÍ[UÌÚæÌÖ«ðDæµÄFXÈ@\ð¾êvfƵÄæèüêéꪽ¢ÌÅ·ªAPython ÅÍ»¤¢Á½¬×HªÇÁ³êé±ÆÍ Üè èܹñB
+¾ê©ÌÌ@\ÍŬÀɳ¦AKvÈ@\Íg£W
[ƵÄÇÁ·éAÆ¢¤Ìª Python Ì|V[Å·B
+
diff --git a/Lib/test/cjkencodings/shift_jisx0213-utf8.txt b/Lib/test/cjkencodings/shift_jisx0213-utf8.txt
new file mode 100644
index 0000000..9a56a2e
--- /dev/null
+++ b/Lib/test/cjkencodings/shift_jisx0213-utf8.txt
@@ -0,0 +1,8 @@
+Python の開発は、1990 年ごろから開始されています。
+開発者の Guido van Rossum は教育用のプログラミング言語「ABC」の開発に参加していましたが、ABC は実用上の目的にはあまり適していませんでした。
+このため、Guido はより実用的なプログラミング言語の開発を開始し、英国 BBS 放送のコメディ番組「モンティ パイソン」のファンである Guido はこの言語を「Python」と名づけました。
+このような背景から生まれた Python の言語設計は、「シンプル」で「習得が容易」という目標に重点が置かれています。
+多くのスクリプト系言語ではユーザの目先の利便性を優先して色々な機能を言語要素として取り入れる場合が多いのですが、Python ではそういった小細工が追加されることはあまりありません。
+言語自体の機能は最小限に押さえ、必要な機能は拡張モジュールとして追加する、というのが Python のポリシーです。
+
+ノか゚ ト゚ トキ喝塀 𡚴𪎌 麀齁𩛰
diff --git a/Lib/test/cjkencodings/shift_jisx0213.txt b/Lib/test/cjkencodings/shift_jisx0213.txt
new file mode 100644
index 0000000..08c9ef4
--- /dev/null
+++ b/Lib/test/cjkencodings/shift_jisx0213.txt
@@ -0,0 +1,8 @@
+Python ÌJÍA1990 N²ë©çJn³êĢܷB
+JÒÌ Guido van Rossum ͳçpÌvO~O¾êuABCvÌJÉQÁµÄ¢Üµ½ªAABC ÍÀpãÌÚIÉÍ ÜèKµÄ¢Ü¹ñŵ½B
+±Ì½ßAGuido ÍæèÀpIÈvO~O¾êÌJðJnµAp BBS úÌRfBÔgueB pC\vÌt@Å é Guido ͱ̾êðuPythonvƼïܵ½B
+±Ìæ¤Èwi©ç¶Üê½ Python ̾êÝvÍAuVvvÅuK¾ªeÕvÆ¢¤ÚWÉd_ªu©êĢܷB
+½ÌXNvgn¾êÅÍ[UÌÚæÌÖ«ðDæµÄFXÈ@\ð¾êvfƵÄæèüêéꪽ¢ÌÅ·ªAPython ÅÍ»¤¢Á½¬×HªÇÁ³êé±ÆÍ Üè èܹñB
+¾ê©ÌÌ@\ÍŬÀɳ¦AKvÈ@\Íg£W
[ƵÄÇÁ·éAÆ¢¤Ìª Python Ì|V[Å·B
+
+mõ gLKy üÖ üÒüæûÔ
diff --git a/Lib/test/cjkencodings_test.py b/Lib/test/cjkencodings_test.py
deleted file mode 100644
index 7e55f37..0000000
--- a/Lib/test/cjkencodings_test.py
+++ /dev/null
@@ -1,1019 +0,0 @@
-teststring = {
-'big5': (
-b"\xa6\x70\xa6\xf3\xa6\x62\x20\x50\x79\x74\x68\x6f\x6e\x20\xa4\xa4"
-b"\xa8\xcf\xa5\xce\xac\x4a\xa6\xb3\xaa\xba\x20\x43\x20\x6c\x69\x62"
-b"\x72\x61\x72\x79\x3f\x0a\xa1\x40\xa6\x62\xb8\xea\xb0\x54\xac\xec"
-b"\xa7\xde\xa7\xd6\xb3\x74\xb5\x6f\xae\x69\xaa\xba\xa4\xb5\xa4\xd1"
-b"\x2c\x20\xb6\x7d\xb5\x6f\xa4\xce\xb4\xfa\xb8\xd5\xb3\x6e\xc5\xe9"
-b"\xaa\xba\xb3\x74\xab\xd7\xac\x4f\xa4\xa3\xae\x65\xa9\xbf\xb5\xf8"
-b"\xaa\xba\x0a\xbd\xd2\xc3\x44\x2e\x20\xac\xb0\xa5\x5b\xa7\xd6\xb6"
-b"\x7d\xb5\x6f\xa4\xce\xb4\xfa\xb8\xd5\xaa\xba\xb3\x74\xab\xd7\x2c"
-b"\x20\xa7\xda\xad\xcc\xab\x4b\xb1\x60\xa7\xc6\xb1\xe6\xaf\xe0\xa7"
-b"\x51\xa5\xce\xa4\x40\xa8\xc7\xa4\x77\xb6\x7d\xb5\x6f\xa6\x6e\xaa"
-b"\xba\x0a\x6c\x69\x62\x72\x61\x72\x79\x2c\x20\xa8\xc3\xa6\xb3\xa4"
-b"\x40\xad\xd3\x20\x66\x61\x73\x74\x20\x70\x72\x6f\x74\x6f\x74\x79"
-b"\x70\x69\x6e\x67\x20\xaa\xba\x20\x70\x72\x6f\x67\x72\x61\x6d\x6d"
-b"\x69\x6e\x67\x20\x6c\x61\x6e\x67\x75\x61\x67\x65\x20\xa5\x69\x0a"
-b"\xa8\xd1\xa8\xcf\xa5\xce\x2e\x20\xa5\xd8\xab\x65\xa6\xb3\xb3\x5c"
-b"\xb3\x5c\xa6\x68\xa6\x68\xaa\xba\x20\x6c\x69\x62\x72\x61\x72\x79"
-b"\x20\xac\x4f\xa5\x48\x20\x43\x20\xbc\x67\xa6\xa8\x2c\x20\xa6\xd3"
-b"\x20\x50\x79\x74\x68\x6f\x6e\x20\xac\x4f\xa4\x40\xad\xd3\x0a\x66"
-b"\x61\x73\x74\x20\x70\x72\x6f\x74\x6f\x74\x79\x70\x69\x6e\x67\x20"
-b"\xaa\xba\x20\x70\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e\x67\x20\x6c"
-b"\x61\x6e\x67\x75\x61\x67\x65\x2e\x20\xac\x47\xa7\xda\xad\xcc\xa7"
-b"\xc6\xb1\xe6\xaf\xe0\xb1\x4e\xac\x4a\xa6\xb3\xaa\xba\x0a\x43\x20"
-b"\x6c\x69\x62\x72\x61\x72\x79\x20\xae\xb3\xa8\xec\x20\x50\x79\x74"
-b"\x68\x6f\x6e\x20\xaa\xba\xc0\xf4\xb9\xd2\xa4\xa4\xb4\xfa\xb8\xd5"
-b"\xa4\xce\xbe\xe3\xa6\x58\x2e\x20\xa8\xe4\xa4\xa4\xb3\xcc\xa5\x44"
-b"\xad\x6e\xa4\x5d\xac\x4f\xa7\xda\xad\xcc\xa9\xd2\x0a\xad\x6e\xb0"
-b"\x51\xbd\xd7\xaa\xba\xb0\xdd\xc3\x44\xb4\x4e\xac\x4f\x3a\x0a\x0a",
-b"\xe5\xa6\x82\xe4\xbd\x95\xe5\x9c\xa8\x20\x50\x79\x74\x68\x6f\x6e"
-b"\x20\xe4\xb8\xad\xe4\xbd\xbf\xe7\x94\xa8\xe6\x97\xa2\xe6\x9c\x89"
-b"\xe7\x9a\x84\x20\x43\x20\x6c\x69\x62\x72\x61\x72\x79\x3f\x0a\xe3"
-b"\x80\x80\xe5\x9c\xa8\xe8\xb3\x87\xe8\xa8\x8a\xe7\xa7\x91\xe6\x8a"
-b"\x80\xe5\xbf\xab\xe9\x80\x9f\xe7\x99\xbc\xe5\xb1\x95\xe7\x9a\x84"
-b"\xe4\xbb\x8a\xe5\xa4\xa9\x2c\x20\xe9\x96\x8b\xe7\x99\xbc\xe5\x8f"
-b"\x8a\xe6\xb8\xac\xe8\xa9\xa6\xe8\xbb\x9f\xe9\xab\x94\xe7\x9a\x84"
-b"\xe9\x80\x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5\x80\x8b\x0a\x66\x61\x73\x74\x20"
-b"\x70\x72\x6f\x74\x6f\x74\x79\x70\x69\x6e\x67\x20\xe7\x9a\x84\x20"
-b"\x70\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e\x67\x20\x6c\x61\x6e\x67"
-b"\x75\x61\x67\x65\x2e\x20\xe6\x95\x85\xe6\x88\x91\xe5\x80\x91\xe5"
-b"\xb8\x8c\xe6\x9c\x9b\xe8\x83\xbd\xe5\xb0\x87\xe6\x97\xa2\xe6\x9c"
-b"\x89\xe7\x9a\x84\x0a\x43\x20\x6c\x69\x62\x72\x61\x72\x79\x20\xe6"
-b"\x8b\xbf\xe5\x88\xb0\x20\x50\x79\x74\x68\x6f\x6e\x20\xe7\x9a\x84"
-b"\xe7\x92\xb0\xe5\xa2\x83\xe4\xb8\xad\xe6\xb8\xac\xe8\xa9\xa6\xe5"
-b"\x8f\x8a\xe6\x95\xb4\xe5\x90\x88\x2e\x20\xe5\x85\xb6\xe4\xb8\xad"
-b"\xe6\x9c\x80\xe4\xb8\xbb\xe8\xa6\x81\xe4\xb9\x9f\xe6\x98\xaf\xe6"
-b"\x88\x91\xe5\x80\x91\xe6\x89\x80\x0a\xe8\xa6\x81\xe8\xa8\x8e\xe8"
-b"\xab\x96\xe7\x9a\x84\xe5\x95\x8f\xe9\xa1\x8c\xe5\xb0\xb1\xe6\x98"
-b"\xaf\x3a\x0a\x0a"),
-'big5hkscs': (
-b"\x88\x45\x88\x5c\x8a\x73\x8b\xda\x8d\xd8\x0a\x88\x66\x88\x62\x88"
-b"\xa7\x20\x88\xa7\x88\xa3\x0a",
-b"\xf0\xa0\x84\x8c\xc4\x9a\xe9\xb5\xae\xe7\xbd\x93\xe6\xb4\x86\x0a"
-b"\xc3\x8a\xc3\x8a\xcc\x84\xc3\xaa\x20\xc3\xaa\xc3\xaa\xcc\x84\x0a"),
-'cp949': (
-b"\x8c\x63\xb9\xe6\xb0\xa2\xc7\xcf\x20\xbc\x84\xbd\xc3\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e4\xac"
-b"\xb4\xc9\xb5\xd8\xc4\x52\x20\xb1\xdb\xbe\xd6\x8a\xdb\x0a\xa8\xde"
-b"\xb7\xc1\xb5\xe0\xce\xfa\x20\x9a\xc3\xc7\xb4\xbd\xa4\xc4\x52\x20"
-b"\xbe\xee\x90\x8a\x20\xec\xd7\xec\xd2\xf4\xb9\xe5\xfc\xf1\xe9\x9a"
-b"\xc4\xa8\xef\xb5\xe9\x9d\xda\x21\x21\x20\xa8\xc0\xa8\xc0\xb3\xb3"
-b"\xa2\xbd\x20\xa1\xd2\xa1\xd2\x2a\x0a\x0a",
-b"\xeb\x98\xa0\xeb\xb0\xa9\xea\xb0\x81\xed\x95\x98\x20\xed\x8e\xb2"
-b"\xec\x8b\x9c\xec\xbd\x9c\xeb\x9d\xbc\x0a\x0a\xe3\x89\xaf\xe3\x89"
-b"\xaf\xeb\x82\xa9\x21\x21\x20\xe5\x9b\xa0\xe4\xb9\x9d\xe6\x9c\x88"
-b"\xed\x8c\xa8\xeb\xaf\xa4\xeb\xa6\x94\xea\xb6\x88\x20\xe2\x93\xa1"
-b"\xe2\x93\x96\xed\x9b\x80\xc2\xbf\xc2\xbf\xc2\xbf\x20\xea\xb8\x8d"
-b"\xeb\x92\x99\x20\xe2\x93\x94\xeb\x8e\xa8\x20\xe3\x89\xaf\x2e\x20"
-b"\x2e\x0a\xe4\xba\x9e\xec\x98\x81\xe2\x93\x94\xeb\x8a\xa5\xed\x9a"
-b"\xb9\x20\x2e\x20\x2e\x20\x2e\x20\x2e\x20\xec\x84\x9c\xec\x9a\xb8"
-b"\xeb\xa4\x84\x20\xeb\x8e\x90\xed\x95\x99\xe4\xb9\x99\x20\xe5\xae"
-b"\xb6\xed\x9b\x80\x20\x21\x20\x21\x20\x21\xe3\x85\xa0\x2e\xe3\x85"
-b"\xa0\x0a\xed\x9d\x90\xed\x9d\x90\xed\x9d\x90\x20\xe3\x84\xb1\xe3"
-b"\x84\xb1\xe3\x84\xb1\xe2\x98\x86\xe3\x85\xa0\x5f\xe3\x85\xa0\x20"
-b"\xec\x96\xb4\xeb\xa6\xa8\x20\xed\x83\xb8\xec\xbd\xb0\xea\xb8\x90"
-b"\x20\xeb\x8e\x8c\xec\x9d\x91\x20\xec\xb9\x91\xe4\xb9\x9d\xeb\x93"
-b"\xa4\xe4\xb9\x99\x20\xe3\x89\xaf\xeb\x93\x9c\xea\xb8\x90\x0a\xec"
-b"\x84\xa4\xeb\xa6\x8c\x20\xe5\xae\xb6\xed\x9b\x80\x20\x2e\x20\x2e"
-b"\x20\x2e\x20\x2e\x20\xea\xb5\xb4\xec\x95\xa0\xec\x89\x8c\x20\xe2"
-b"\x93\x94\xea\xb6\x88\x20\xe2\x93\xa1\xeb\xa6\x98\xe3\x89\xb1\xea"
-b"\xb8\x90\x20\xe5\x9b\xa0\xe4\xbb\x81\xe5\xb7\x9d\xef\xa6\x81\xe4"
-b"\xb8\xad\xea\xb9\x8c\xec\xa6\xbc\x0a\xec\x99\x80\xec\x92\x80\xed"
-b"\x9b\x80\x20\x21\x20\x21\x20\xe4\xba\x9e\xec\x98\x81\xe2\x93\x94"
-b"\x20\xe5\xae\xb6\xeb\x8a\xa5\xea\xb6\x88\x20\xe2\x98\x86\xe4\xb8"
-b"\x8a\xea\xb4\x80\x20\xec\x97\x86\xeb\x8a\xa5\xea\xb6\x88\xeb\x8a"
-b"\xa5\x20\xe4\xba\x9e\xeb\x8a\xa5\xeb\x92\x88\xed\x9b\x80\x20\xea"
-b"\xb8\x80\xec\x95\xa0\xeb\x93\xb4\x0a\xe2\x93\xa1\xeb\xa0\xa4\xeb"
-b"\x93\x80\xe4\xb9\x9d\x20\xec\x8b\x80\xed\x92\x94\xec\x88\xb4\xed"
-b"\x9b\x80\x20\xec\x96\xb4\xeb\xa6\xa8\x20\xe5\x9b\xa0\xe4\xbb\x81"
-b"\xe5\xb7\x9d\xef\xa6\x81\xe4\xb8\xad\xec\x8b\x81\xe2\x91\xa8\xeb"
-b"\x93\xa4\xec\x95\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b9"
-b"\xa4\xeb\xa1\xa2\xa4\xc8\xa4\xa4\xa4\xa6\xa4\xce\xa4\xac\x20\x50"
-b"\x79\x74\x68\x6f\x6e\x20\xa4\xce\xa5\xdd\xa5\xea\xa5\xb7\xa1\xbc"
-b"\xa4\xc7\xa4\xb9\xa1\xa3\x0a\x0a\xa5\xce\xa4\xf7\x20\xa5\xfe\x20"
-b"\xa5\xc8\xa5\xad\xaf\xac\xaf\xda\x20\xcf\xe3\x8f\xfe\xd8\x20\x8f"
-b"\xfe\xd4\x8f\xfe\xe8\x8f\xfc\xd6\x0a",
-b"\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xaf\xe3\x80\x81\x31\x39\x39\x30\x20\xe5\xb9\xb4\xe3\x81"
-b"\x94\xe3\x82\x8d\xe3\x81\x8b\xe3\x82\x89\xe9\x96\x8b\xe5\xa7\x8b"
-b"\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3"
-b"\x81\x99\xe3\x80\x82\x0a\xe9\x96\x8b\xe7\x99\xba\xe8\x80\x85\xe3"
-b"\x81\xae\x20\x47\x75\x69\x64\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73"
-b"\x73\x75\x6d\x20\xe3\x81\xaf\xe6\x95\x99\xe8\x82\xb2\xe7\x94\xa8"
-b"\xe3\x81\xae\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83\xa9\xe3"
-b"\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e\xe3\x80"
-b"\x8c\x41\x42\x43\xe3\x80\x8d\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xab\xe5\x8f\x82\xe5\x8a\xa0\xe3\x81\x97\xe3\x81\xa6\xe3"
-b"\x81\x84\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x81\x8c\xe3\x80"
-b"\x81\x41\x42\x43\x20\xe3\x81\xaf\xe5\xae\x9f\xe7\x94\xa8\xe4\xb8"
-b"\x8a\xe3\x81\xae\xe7\x9b\xae\xe7\x9a\x84\xe3\x81\xab\xe3\x81\xaf"
-b"\xe3\x81\x82\xe3\x81\xbe\xe3\x82\x8a\xe9\x81\xa9\xe3\x81\x97\xe3"
-b"\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x81"
-b"\xa7\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a\xe3\x81\x93\xe3\x81"
-b"\xae\xe3\x81\x9f\xe3\x82\x81\xe3\x80\x81\x47\x75\x69\x64\x6f\x20"
-b"\xe3\x81\xaf\xe3\x82\x88\xe3\x82\x8a\xe5\xae\x9f\xe7\x94\xa8\xe7"
-b"\x9a\x84\xe3\x81\xaa\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83"
-b"\xa9\xe3\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e"
-b"\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba\xe3\x82\x92\xe9\x96\x8b\xe5"
-b"\xa7\x8b\xe3\x81\x97\xe3\x80\x81\xe8\x8b\xb1\xe5\x9b\xbd\x20\x42"
-b"\x42\x53\x20\xe6\x94\xbe\xe9\x80\x81\xe3\x81\xae\xe3\x82\xb3\xe3"
-b"\x83\xa1\xe3\x83\x87\xe3\x82\xa3\xe7\x95\xaa\xe7\xb5\x84\xe3\x80"
-b"\x8c\xe3\x83\xa2\xe3\x83\xb3\xe3\x83\x86\xe3\x82\xa3\x20\xe3\x83"
-b"\x91\xe3\x82\xa4\xe3\x82\xbd\xe3\x83\xb3\xe3\x80\x8d\xe3\x81\xae"
-b"\xe3\x83\x95\xe3\x82\xa1\xe3\x83\xb3\xe3\x81\xa7\xe3\x81\x82\xe3"
-b"\x82\x8b\x20\x47\x75\x69\x64\x6f\x20\xe3\x81\xaf\xe3\x81\x93\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe3\x80\x8c\x50\x79"
-b"\x74\x68\x6f\x6e\xe3\x80\x8d\xe3\x81\xa8\xe5\x90\x8d\xe3\x81\xa5"
-b"\xe3\x81\x91\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a"
-b"\xe3\x81\x93\xe3\x81\xae\xe3\x82\x88\xe3\x81\x86\xe3\x81\xaa\xe8"
-b"\x83\x8c\xe6\x99\xaf\xe3\x81\x8b\xe3\x82\x89\xe7\x94\x9f\xe3\x81"
-b"\xbe\xe3\x82\x8c\xe3\x81\x9f\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe8\xa8\xad\xe8\xa8\x88\xe3\x81"
-b"\xaf\xe3\x80\x81\xe3\x80\x8c\xe3\x82\xb7\xe3\x83\xb3\xe3\x83\x97"
-b"\xe3\x83\xab\xe3\x80\x8d\xe3\x81\xa7\xe3\x80\x8c\xe7\xbf\x92\xe5"
-b"\xbe\x97\xe3\x81\x8c\xe5\xae\xb9\xe6\x98\x93\xe3\x80\x8d\xe3\x81"
-b"\xa8\xe3\x81\x84\xe3\x81\x86\xe7\x9b\xae\xe6\xa8\x99\xe3\x81\xab"
-b"\xe9\x87\x8d\xe7\x82\xb9\xe3\x81\x8c\xe7\xbd\xae\xe3\x81\x8b\xe3"
-b"\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x99\xe3\x80"
-b"\x82\x0a\xe5\xa4\x9a\xe3\x81\x8f\xe3\x81\xae\xe3\x82\xb9\xe3\x82"
-b"\xaf\xe3\x83\xaa\xe3\x83\x97\xe3\x83\x88\xe7\xb3\xbb\xe8\xa8\x80"
-b"\xe8\xaa\x9e\xe3\x81\xa7\xe3\x81\xaf\xe3\x83\xa6\xe3\x83\xbc\xe3"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x80\x81\xe5\xbf\x85\xe8\xa6\x81\xe3\x81\xaa\xe6"
-b"\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x8b\xa1\xe5\xbc\xb5\xe3\x83"
-b"\xa2\xe3\x82\xb8\xe3\x83\xa5\xe3\x83\xbc\xe3\x83\xab\xe3\x81\xa8"
-b"\xe3\x81\x97\xe3\x81\xa6\xe8\xbf\xbd\xe5\x8a\xa0\xe3\x81\x99\xe3"
-b"\x82\x8b\xe3\x80\x81\xe3\x81\xa8\xe3\x81\x84\xe3\x81\x86\xe3\x81"
-b"\xae\xe3\x81\x8c\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe3"
-b"\x83\x9d\xe3\x83\xaa\xe3\x82\xb7\xe3\x83\xbc\xe3\x81\xa7\xe3\x81"
-b"\x99\xe3\x80\x82\x0a\x0a\xe3\x83\x8e\xe3\x81\x8b\xe3\x82\x9a\x20"
-b"\xe3\x83\x88\xe3\x82\x9a\x20\xe3\x83\x88\xe3\x82\xad\xef\xa8\xb6"
-b"\xef\xa8\xb9\x20\xf0\xa1\x9a\xb4\xf0\xaa\x8e\x8c\x20\xe9\xba\x80"
-b"\xe9\xbd\x81\xf0\xa9\x9b\xb0\x0a"),
-'euc_jp': (
-b"\x50\x79\x74\x68\x6f\x6e\x20\xa4\xce\xb3\xab\xc8\xaf\xa4\xcf\xa1"
-b"\xa2\x31\x39\x39\x30\x20\xc7\xaf\xa4\xb4\xa4\xed\xa4\xab\xa4\xe9"
-b"\xb3\xab\xbb\xcf\xa4\xb5\xa4\xec\xa4\xc6\xa4\xa4\xa4\xde\xa4\xb9"
-b"\xa1\xa3\x0a\xb3\xab\xc8\xaf\xbc\xd4\xa4\xce\x20\x47\x75\x69\x64"
-b"\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73\x73\x75\x6d\x20\xa4\xcf\xb6"
-b"\xb5\xb0\xe9\xcd\xd1\xa4\xce\xa5\xd7\xa5\xed\xa5\xb0\xa5\xe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x47\x75\x69\x64\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73"
-b"\x73\x75\x6d\x20\xe3\x81\xaf\xe6\x95\x99\xe8\x82\xb2\xe7\x94\xa8"
-b"\xe3\x81\xae\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83\xa9\xe3"
-b"\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e\xe3\x80"
-b"\x8c\x41\x42\x43\xe3\x80\x8d\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xab\xe5\x8f\x82\xe5\x8a\xa0\xe3\x81\x97\xe3\x81\xa6\xe3"
-b"\x81\x84\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x81\x8c\xe3\x80"
-b"\x81\x41\x42\x43\x20\xe3\x81\xaf\xe5\xae\x9f\xe7\x94\xa8\xe4\xb8"
-b"\x8a\xe3\x81\xae\xe7\x9b\xae\xe7\x9a\x84\xe3\x81\xab\xe3\x81\xaf"
-b"\xe3\x81\x82\xe3\x81\xbe\xe3\x82\x8a\xe9\x81\xa9\xe3\x81\x97\xe3"
-b"\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x81"
-b"\xa7\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a\xe3\x81\x93\xe3\x81"
-b"\xae\xe3\x81\x9f\xe3\x82\x81\xe3\x80\x81\x47\x75\x69\x64\x6f\x20"
-b"\xe3\x81\xaf\xe3\x82\x88\xe3\x82\x8a\xe5\xae\x9f\xe7\x94\xa8\xe7"
-b"\x9a\x84\xe3\x81\xaa\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83"
-b"\xa9\xe3\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e"
-b"\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba\xe3\x82\x92\xe9\x96\x8b\xe5"
-b"\xa7\x8b\xe3\x81\x97\xe3\x80\x81\xe8\x8b\xb1\xe5\x9b\xbd\x20\x42"
-b"\x42\x53\x20\xe6\x94\xbe\xe9\x80\x81\xe3\x81\xae\xe3\x82\xb3\xe3"
-b"\x83\xa1\xe3\x83\x87\xe3\x82\xa3\xe7\x95\xaa\xe7\xb5\x84\xe3\x80"
-b"\x8c\xe3\x83\xa2\xe3\x83\xb3\xe3\x83\x86\xe3\x82\xa3\x20\xe3\x83"
-b"\x91\xe3\x82\xa4\xe3\x82\xbd\xe3\x83\xb3\xe3\x80\x8d\xe3\x81\xae"
-b"\xe3\x83\x95\xe3\x82\xa1\xe3\x83\xb3\xe3\x81\xa7\xe3\x81\x82\xe3"
-b"\x82\x8b\x20\x47\x75\x69\x64\x6f\x20\xe3\x81\xaf\xe3\x81\x93\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe3\x80\x8c\x50\x79"
-b"\x74\x68\x6f\x6e\xe3\x80\x8d\xe3\x81\xa8\xe5\x90\x8d\xe3\x81\xa5"
-b"\xe3\x81\x91\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a"
-b"\xe3\x81\x93\xe3\x81\xae\xe3\x82\x88\xe3\x81\x86\xe3\x81\xaa\xe8"
-b"\x83\x8c\xe6\x99\xaf\xe3\x81\x8b\xe3\x82\x89\xe7\x94\x9f\xe3\x81"
-b"\xbe\xe3\x82\x8c\xe3\x81\x9f\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe8\xa8\xad\xe8\xa8\x88\xe3\x81"
-b"\xaf\xe3\x80\x81\xe3\x80\x8c\xe3\x82\xb7\xe3\x83\xb3\xe3\x83\x97"
-b"\xe3\x83\xab\xe3\x80\x8d\xe3\x81\xa7\xe3\x80\x8c\xe7\xbf\x92\xe5"
-b"\xbe\x97\xe3\x81\x8c\xe5\xae\xb9\xe6\x98\x93\xe3\x80\x8d\xe3\x81"
-b"\xa8\xe3\x81\x84\xe3\x81\x86\xe7\x9b\xae\xe6\xa8\x99\xe3\x81\xab"
-b"\xe9\x87\x8d\xe7\x82\xb9\xe3\x81\x8c\xe7\xbd\xae\xe3\x81\x8b\xe3"
-b"\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x99\xe3\x80"
-b"\x82\x0a\xe5\xa4\x9a\xe3\x81\x8f\xe3\x81\xae\xe3\x82\xb9\xe3\x82"
-b"\xaf\xe3\x83\xaa\xe3\x83\x97\xe3\x83\x88\xe7\xb3\xbb\xe8\xa8\x80"
-b"\xe8\xaa\x9e\xe3\x81\xa7\xe3\x81\xaf\xe3\x83\xa6\xe3\x83\xbc\xe3"
-b"\x82\xb6\xe3\x81\xae\xe7\x9b\xae\xe5\x85\x88\xe3\x81\xae\xe5\x88"
-b"\xa9\xe4\xbe\xbf\xe6\x80\xa7\xe3\x82\x92\xe5\x84\xaa\xe5\x85\x88"
-b"\xe3\x81\x97\xe3\x81\xa6\xe8\x89\xb2\xe3\x80\x85\xe3\x81\xaa\xe6"
-b"\xa9\x9f\xe8\x83\xbd\xe3\x82\x92\xe8\xa8\x80\xe8\xaa\x9e\xe8\xa6"
-b"\x81\xe7\xb4\xa0\xe3\x81\xa8\xe3\x81\x97\xe3\x81\xa6\xe5\x8f\x96"
-b"\xe3\x82\x8a\xe5\x85\xa5\xe3\x82\x8c\xe3\x82\x8b\xe5\xa0\xb4\xe5"
-b"\x90\x88\xe3\x81\x8c\xe5\xa4\x9a\xe3\x81\x84\xe3\x81\xae\xe3\x81"
-b"\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81\x50\x79\x74\x68\x6f\x6e"
-b"\x20\xe3\x81\xa7\xe3\x81\xaf\xe3\x81\x9d\xe3\x81\x86\xe3\x81\x84"
-b"\xe3\x81\xa3\xe3\x81\x9f\xe5\xb0\x8f\xe7\xb4\xb0\xe5\xb7\xa5\xe3"
-b"\x81\x8c\xe8\xbf\xbd\xe5\x8a\xa0\xe3\x81\x95\xe3\x82\x8c\xe3\x82"
-b"\x8b\xe3\x81\x93\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\x82\xe3\x81\xbe"
-b"\xe3\x82\x8a\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3"
-b"\x82\x93\xe3\x80\x82\x0a\xe8\xa8\x80\xe8\xaa\x9e\xe8\x87\xaa\xe4"
-b"\xbd\x93\xe3\x81\xae\xe6\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x9c"
-b"\x80\xe5\xb0\x8f\xe9\x99\x90\xe3\x81\xab\xe6\x8a\xbc\xe3\x81\x95"
-b"\xe3\x81\x88\xe3\x80\x81\xe5\xbf\x85\xe8\xa6\x81\xe3\x81\xaa\xe6"
-b"\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x8b\xa1\xe5\xbc\xb5\xe3\x83"
-b"\xa2\xe3\x82\xb8\xe3\x83\xa5\xe3\x83\xbc\xe3\x83\xab\xe3\x81\xa8"
-b"\xe3\x81\x97\xe3\x81\xa6\xe8\xbf\xbd\xe5\x8a\xa0\xe3\x81\x99\xe3"
-b"\x82\x8b\xe3\x80\x81\xe3\x81\xa8\xe3\x81\x84\xe3\x81\x86\xe3\x81"
-b"\xae\xe3\x81\x8c\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe3"
-b"\x83\x9d\xe3\x83\xaa\xe3\x82\xb7\xe3\x83\xbc\xe3\x81\xa7\xe3\x81"
-b"\x99\xe3\x80\x82\x0a\x0a"),
-'euc_kr': (
-b"\xa1\xdd\x20\xc6\xc4\xc0\xcc\xbd\xe3\x28\x50\x79\x74\x68\x6f\x6e"
-b"\x29\xc0\xba\x20\xb9\xe8\xbf\xec\xb1\xe2\x20\xbd\xb1\xb0\xed\x2c"
-b"\x20\xb0\xad\xb7\xc2\xc7\xd1\x20\xc7\x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x20\xed\x8c\x8c\xec\x9d\xb4\xec\x8d\xac\xec"
-b"\x9d\x80\x0a\xed\x9a\xa8\xec\x9c\xa8\xec\xa0\x81\xec\x9d\xb8\x20"
-b"\xea\xb3\xa0\xec\x88\x98\xec\xa4\x80\x20\xeb\x8d\xb0\xec\x9d\xb4"
-b"\xed\x84\xb0\x20\xea\xb5\xac\xec\xa1\xb0\xec\x99\x80\x20\xea\xb0"
-b"\x84\xeb\x8b\xa8\xed\x95\x98\xec\xa7\x80\xeb\xa7\x8c\x20\xed\x9a"
-b"\xa8\xec\x9c\xa8\xec\xa0\x81\xec\x9d\xb8\x20\xea\xb0\x9d\xec\xb2"
-b"\xb4\xec\xa7\x80\xed\x96\xa5\xed\x94\x84\xeb\xa1\x9c\xea\xb7\xb8"
-b"\xeb\x9e\x98\xeb\xb0\x8d\xec\x9d\x84\x0a\xec\xa7\x80\xec\x9b\x90"
-b"\xed\x95\xa9\xeb\x8b\x88\xeb\x8b\xa4\x2e\x20\xed\x8c\x8c\xec\x9d"
-b"\xb4\xec\x8d\xac\xec\x9d\x98\x20\xec\x9a\xb0\xec\x95\x84\x28\xe5"
-b"\x84\xaa\xe9\x9b\x85\x29\xed\x95\x9c\x20\xeb\xac\xb8\xeb\xb2\x95"
-b"\xea\xb3\xbc\x20\xeb\x8f\x99\xec\xa0\x81\x20\xed\x83\x80\xec\x9d"
-b"\xb4\xed\x95\x91\x2c\x20\xea\xb7\xb8\xeb\xa6\xac\xea\xb3\xa0\x20"
-b"\xec\x9d\xb8\xed\x84\xb0\xed\x94\x84\xeb\xa6\xac\xed\x8c\x85\x0a"
-b"\xed\x99\x98\xea\xb2\xbd\xec\x9d\x80\x20\xed\x8c\x8c\xec\x9d\xb4"
-b"\xec\x8d\xac\xec\x9d\x84\x20\xec\x8a\xa4\xed\x81\xac\xeb\xa6\xbd"
-b"\xed\x8c\x85\xea\xb3\xbc\x20\xec\x97\xac\xeb\x9f\xac\x20\xeb\xb6"
-b"\x84\xec\x95\xbc\xec\x97\x90\xec\x84\x9c\xec\x99\x80\x20\xeb\x8c"
-b"\x80\xeb\xb6\x80\xeb\xb6\x84\xec\x9d\x98\x20\xed\x94\x8c\xeb\x9e"
-b"\xab\xed\x8f\xbc\xec\x97\x90\xec\x84\x9c\xec\x9d\x98\x20\xeb\xb9"
-b"\xa0\xeb\xa5\xb8\x0a\xec\x95\xa0\xed\x94\x8c\xeb\xa6\xac\xec\xbc"
-b"\x80\xec\x9d\xb4\xec\x85\x98\x20\xea\xb0\x9c\xeb\xb0\x9c\xec\x9d"
-b"\x84\x20\xed\x95\xa0\x20\xec\x88\x98\x20\xec\x9e\x88\xeb\x8a\x94"
-b"\x20\xec\x9d\xb4\xec\x83\x81\xec\xa0\x81\xec\x9d\xb8\x20\xec\x96"
-b"\xb8\xec\x96\xb4\xeb\xa1\x9c\x20\xeb\xa7\x8c\xeb\x93\xa4\xec\x96"
-b"\xb4\xec\xa4\x8d\xeb\x8b\x88\xeb\x8b\xa4\x2e\x0a\x0a\xe2\x98\x86"
-b"\xec\xb2\xab\xea\xb0\x80\xeb\x81\x9d\x3a\x20\xeb\x82\xa0\xec\x95"
-b"\x84\xeb\x9d\xbc\x20\xec\x93\x94\xec\x93\x94\xec\x93\xa9\x7e\x20"
-b"\xeb\x8b\x81\xed\x81\xbc\x21\x20\xeb\x9c\xbd\xea\xb8\x88\xec\x97"
-b"\x86\xec\x9d\xb4\x20\xec\xa0\x84\xed\x99\xa5\xeb\x8b\x88\xeb\x8b"
-b"\xa4\x2e\x20\xeb\xb7\x81\x2e\x20\xea\xb7\xb8\xeb\x9f\xb0\xea\xb1"
-b"\xb0\x20\xec\x9d\x8e\xeb\x8b\xa4\x2e\x0a"),
-'gb18030': (
-b"\x50\x79\x74\x68\x6f\x6e\xa3\xa8\xc5\xc9\xc9\xad\xa3\xa9\xd3\xef"
-b"\xd1\xd4\xca\xc7\xd2\xbb\xd6\xd6\xb9\xa6\xc4\xdc\xc7\xbf\xb4\xf3"
-b"\xb6\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x6c\x61\x6e\x67\x75\x61\x67\x65\x20"
-b"\xbf\xc9\x0a\xb9\xa9\xca\xb9\xd3\xc3\x2e\x20\xc4\xbf\xc7\xb0\xd3"
-b"\xd0\xd4\x53\xd4\x53\xb6\xe0\xb6\xe0\xb5\xc4\x20\x6c\x69\x62\x72"
-b"\x61\x72\x79\x20\xca\xc7\xd2\xd4\x20\x43\x20\x8c\x91\xb3\xc9\x2c"
-b"\x20\xb6\xf8\x20\x50\x79\x74\x68\x6f\x6e\x20\xca\xc7\xd2\xbb\x82"
-b"\x80\x0a\x66\x61\x73\x74\x20\x70\x72\x6f\x74\x6f\x74\x79\x70\x69"
-b"\x6e\x67\x20\xb5\xc4\x20\x70\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e"
-b"\x67\x20\x6c\x61\x6e\x67\x75\x61\x67\x65\x2e\x20\xb9\xca\xce\xd2"
-b"\x82\x83\xcf\xa3\xcd\xfb\xc4\xdc\x8c\xa2\xbc\xc8\xd3\xd0\xb5\xc4"
-b"\x0a\x43\x20\x6c\x69\x62\x72\x61\x72\x79\x20\xc4\xc3\xb5\xbd\x20"
-b"\x50\x79\x74\x68\x6f\x6e\x20\xb5\xc4\xad\x68\xbe\xb3\xd6\xd0\x9c"
-b"\x79\xd4\x87\xbc\xb0\xd5\xfb\xba\xcf\x2e\x20\xc6\xe4\xd6\xd0\xd7"
-b"\xee\xd6\xf7\xd2\xaa\xd2\xb2\xca\xc7\xce\xd2\x82\x83\xcb\xf9\x0a"
-b"\xd2\xaa\xd3\x91\xd5\x93\xb5\xc4\x86\x96\xee\x7d\xbe\xcd\xca\xc7"
-b"\x3a\x0a\x83\x35\xc7\x31\x83\x33\x9a\x33\x83\x32\xb1\x31\x83\x33"
-b"\x95\x31\x20\x82\x37\xd1\x36\x83\x30\x8c\x34\x83\x36\x84\x33\x20"
-b"\x82\x38\x89\x35\x82\x38\xfb\x36\x83\x33\x95\x35\x20\x83\x33\xd5"
-b"\x31\x82\x39\x81\x35\x20\x83\x30\xfd\x39\x83\x33\x86\x30\x20\x83"
-b"\x34\xdc\x33\x83\x35\xf6\x37\x83\x35\x97\x35\x20\x83\x35\xf9\x35"
-b"\x83\x30\x91\x39\x82\x38\x83\x39\x82\x39\xfc\x33\x83\x30\xf0\x34"
-b"\x20\x83\x32\xeb\x39\x83\x32\xeb\x35\x82\x39\x83\x39\x2e\x0a\x0a",
-b"\x50\x79\x74\x68\x6f\x6e\xef\xbc\x88\xe6\xb4\xbe\xe6\xa3\xae\xef"
-b"\xbc\x89\xe8\xaf\xad\xe8\xa8\x80\xe6\x98\xaf\xe4\xb8\x80\xe7\xa7"
-b"\x8d\xe5\x8a\x9f\xe8\x83\xbd\xe5\xbc\xba\xe5\xa4\xa7\xe8\x80\x8c"
-b"\xe5\xae\x8c\xe5\x96\x84\xe7\x9a\x84\xe9\x80\x9a\xe7\x94\xa8\xe5"
-b"\x9e\x8b\xe8\xae\xa1\xe7\xae\x97\xe6\x9c\xba\xe7\xa8\x8b\xe5\xba"
-b"\x8f\xe8\xae\xbe\xe8\xae\xa1\xe8\xaf\xad\xe8\xa8\x80\xef\xbc\x8c"
-b"\x0a\xe5\xb7\xb2\xe7\xbb\x8f\xe5\x85\xb7\xe6\x9c\x89\xe5\x8d\x81"
-b"\xe5\xa4\x9a\xe5\xb9\xb4\xe7\x9a\x84\xe5\x8f\x91\xe5\xb1\x95\xe5"
-b"\x8e\x86\xe5\x8f\xb2\xef\xbc\x8c\xe6\x88\x90\xe7\x86\x9f\xe4\xb8"
-b"\x94\xe7\xa8\xb3\xe5\xae\x9a\xe3\x80\x82\xe8\xbf\x99\xe7\xa7\x8d"
-b"\xe8\xaf\xad\xe8\xa8\x80\xe5\x85\xb7\xe6\x9c\x89\xe9\x9d\x9e\xe5"
-b"\xb8\xb8\xe7\xae\x80\xe6\x8d\xb7\xe8\x80\x8c\xe6\xb8\x85\xe6\x99"
-b"\xb0\x0a\xe7\x9a\x84\xe8\xaf\xad\xe6\xb3\x95\xe7\x89\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2c\x20\xe4\xb8\xa6"
-b"\xe6\x9c\x89\xe4\xb8\x80\xe5\x80\x8b\x20\x66\x61\x73\x74\x20\x70"
-b"\x72\x6f\x74\x6f\x74\x79\x70\x69\x6e\x67\x20\xe7\x9a\x84\x20\x70"
-b"\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e\x67\x20\x6c\x61\x6e\x67\x75"
-b"\x61\x67\x65\x20\xe5\x8f\xaf\x0a\xe4\xbe\x9b\xe4\xbd\xbf\xe7\x94"
-b"\xa8\x2e\x20\xe7\x9b\xae\xe5\x89\x8d\xe6\x9c\x89\xe8\xa8\xb1\xe8"
-b"\xa8\xb1\xe5\xa4\x9a\xe5\xa4\x9a\xe7\x9a\x84\x20\x6c\x69\x62\x72"
-b"\x61\x72\x79\x20\xe6\x98\xaf\xe4\xbb\xa5\x20\x43\x20\xe5\xaf\xab"
-b"\xe6\x88\x90\x2c\x20\xe8\x80\x8c\x20\x50\x79\x74\x68\x6f\x6e\x20"
-b"\xe6\x98\xaf\xe4\xb8\x80\xe5\x80\x8b\x0a\x66\x61\x73\x74\x20\x70"
-b"\x72\x6f\x74\x6f\x74\x79\x70\x69\x6e\x67\x20\xe7\x9a\x84\x20\x70"
-b"\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e\x67\x20\x6c\x61\x6e\x67\x75"
-b"\x61\x67\x65\x2e\x20\xe6\x95\x85\xe6\x88\x91\xe5\x80\x91\xe5\xb8"
-b"\x8c\xe6\x9c\x9b\xe8\x83\xbd\xe5\xb0\x87\xe6\x97\xa2\xe6\x9c\x89"
-b"\xe7\x9a\x84\x0a\x43\x20\x6c\x69\x62\x72\x61\x72\x79\x20\xe6\x8b"
-b"\xbf\xe5\x88\xb0\x20\x50\x79\x74\x68\x6f\x6e\x20\xe7\x9a\x84\xe7"
-b"\x92\xb0\xe5\xa2\x83\xe4\xb8\xad\xe6\xb8\xac\xe8\xa9\xa6\xe5\x8f"
-b"\x8a\xe6\x95\xb4\xe5\x90\x88\x2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\xd3"
-b"\xd0\xd4\x53\xd4\x53\xb6\xe0\xb6\xe0\xb5\xc4\x20\x6c\x69\x62\x72"
-b"\x61\x72\x79\x20\xca\xc7\xd2\xd4\x20\x43\x20\x8c\x91\xb3\xc9\x2c"
-b"\x20\xb6\xf8\x20\x50\x79\x74\x68\x6f\x6e\x20\xca\xc7\xd2\xbb\x82"
-b"\x80\x0a\x66\x61\x73\x74\x20\x70\x72\x6f\x74\x6f\x74\x79\x70\x69"
-b"\x6e\x67\x20\xb5\xc4\x20\x70\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e"
-b"\x67\x20\x6c\x61\x6e\x67\x75\x61\x67\x65\x2e\x20\xb9\xca\xce\xd2"
-b"\x82\x83\xcf\xa3\xcd\xfb\xc4\xdc\x8c\xa2\xbc\xc8\xd3\xd0\xb5\xc4"
-b"\x0a\x43\x20\x6c\x69\x62\x72\x61\x72\x79\x20\xc4\xc3\xb5\xbd\x20"
-b"\x50\x79\x74\x68\x6f\x6e\x20\xb5\xc4\xad\x68\xbe\xb3\xd6\xd0\x9c"
-b"\x79\xd4\x87\xbc\xb0\xd5\xfb\xba\xcf\x2e\x20\xc6\xe4\xd6\xd0\xd7"
-b"\xee\xd6\xf7\xd2\xaa\xd2\xb2\xca\xc7\xce\xd2\x82\x83\xcb\xf9\x0a"
-b"\xd2\xaa\xd3\x91\xd5\x93\xb5\xc4\x86\x96\xee\x7d\xbe\xcd\xca\xc7"
-b"\x3a\x0a\x0a",
-b"\x50\x79\x74\x68\x6f\x6e\xef\xbc\x88\xe6\xb4\xbe\xe6\xa3\xae\xef"
-b"\xbc\x89\xe8\xaf\xad\xe8\xa8\x80\xe6\x98\xaf\xe4\xb8\x80\xe7\xa7"
-b"\x8d\xe5\x8a\x9f\xe8\x83\xbd\xe5\xbc\xba\xe5\xa4\xa7\xe8\x80\x8c"
-b"\xe5\xae\x8c\xe5\x96\x84\xe7\x9a\x84\xe9\x80\x9a\xe7\x94\xa8\xe5"
-b"\x9e\x8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\x20\xe8\x80\x8c\x20\x50\x79\x74\x68\x6f\x6e\x20"
-b"\xe6\x98\xaf\xe4\xb8\x80\xe5\x80\x8b\x0a\x66\x61\x73\x74\x20\x70"
-b"\x72\x6f\x74\x6f\x74\x79\x70\x69\x6e\x67\x20\xe7\x9a\x84\x20\x70"
-b"\x72\x6f\x67\x72\x61\x6d\x6d\x69\x6e\x67\x20\x6c\x61\x6e\x67\x75"
-b"\x61\x67\x65\x2e\x20\xe6\x95\x85\xe6\x88\x91\xe5\x80\x91\xe5\xb8"
-b"\x8c\xe6\x9c\x9b\xe8\x83\xbd\xe5\xb0\x87\xe6\x97\xa2\xe6\x9c\x89"
-b"\xe7\x9a\x84\x0a\x43\x20\x6c\x69\x62\x72\x61\x72\x79\x20\xe6\x8b"
-b"\xbf\xe5\x88\xb0\x20\x50\x79\x74\x68\x6f\x6e\x20\xe7\x9a\x84\xe7"
-b"\x92\xb0\xe5\xa2\x83\xe4\xb8\xad\xe6\xb8\xac\xe8\xa9\xa6\xe5\x8f"
-b"\x8a\xe6\x95\xb4\xe5\x90\x88\x2e\x20\xe5\x85\xb6\xe4\xb8\xad\xe6"
-b"\x9c\x80\xe4\xb8\xbb\xe8\xa6\x81\xe4\xb9\x9f\xe6\x98\xaf\xe6\x88"
-b"\x91\xe5\x80\x91\xe6\x89\x80\x0a\xe8\xa6\x81\xe8\xa8\x8e\xe8\xab"
-b"\x96\xe7\x9a\x84\xe5\x95\x8f\xe9\xa1\x8c\xe5\xb0\xb1\xe6\x98\xaf"
-b"\x3a\x0a\x0a"),
-'johab': (
-b"\x99\xb1\xa4\x77\x88\x62\xd0\x61\x20\xcd\x5c\xaf\xa1\xc5\xa9\x9c"
-b"\x61\x0a\x0a\xdc\xc0\xdc\xc0\x90\x73\x21\x21\x20\xf1\x67\xe2\x9c"
-b"\xf0\x55\xcc\x81\xa3\x89\x9f\x85\x8a\xa1\x20\xdc\xde\xdc\xd3\xd2"
-b"\x7a\xd9\xaf\xd9\xaf\xd9\xaf\x20\x8b\x77\x96\xd3\x20\xdc\xd1\x95"
-b"\x81\x20\xdc\xc0\x2e\x20\x2e\x0a\xed\x3c\xb5\x77\xdc\xd1\x93\x77"
-b"\xd2\x73\x20\x2e\x20\x2e\x20\x2e\x20\x2e\x20\xac\xe1\xb6\x89\x9e"
-b"\xa1\x20\x95\x65\xd0\x62\xf0\xe0\x20\xe0\x3b\xd2\x7a\x20\x21\x20"
-b"\x21\x20\x21\x87\x41\x2e\x87\x41\x0a\xd3\x61\xd3\x61\xd3\x61\x20"
-b"\x88\x41\x88\x41\x88\x41\xd9\x69\x87\x41\x5f\x87\x41\x20\xb4\xe1"
-b"\x9f\x9a\x20\xc8\xa1\xc5\xc1\x8b\x7a\x20\x95\x61\xb7\x77\x20\xc3"
-b"\x97\xe2\x9c\x97\x69\xf0\xe0\x20\xdc\xc0\x97\x61\x8b\x7a\x0a\xac"
-b"\xe9\x9f\x7a\x20\xe0\x3b\xd2\x7a\x20\x2e\x20\x2e\x20\x2e\x20\x2e"
-b"\x20\x8a\x89\xb4\x81\xae\xba\x20\xdc\xd1\x8a\xa1\x20\xdc\xde\x9f"
-b"\x89\xdc\xc2\x8b\x7a\x20\xf1\x67\xf1\x62\xf5\x49\xed\xfc\xf3\xe9"
-b"\x8c\x61\xbb\x9a\x0a\xb5\xc1\xb2\xa1\xd2\x7a\x20\x21\x20\x21\x20"
-b"\xed\x3c\xb5\x77\xdc\xd1\x20\xe0\x3b\x93\x77\x8a\xa1\x20\xd9\x69"
-b"\xea\xbe\x89\xc5\x20\xb4\xf4\x93\x77\x8a\xa1\x93\x77\x20\xed\x3c"
-b"\x93\x77\x96\xc1\xd2\x7a\x20\x8b\x69\xb4\x81\x97\x7a\x0a\xdc\xde"
-b"\x9d\x61\x97\x41\xe2\x9c\x20\xaf\x81\xce\xa1\xae\xa1\xd2\x7a\x20"
-b"\xb4\xe1\x9f\x9a\x20\xf1\x67\xf1\x62\xf5\x49\xed\xfc\xf3\xe9\xaf"
-b"\x82\xdc\xef\x97\x69\xb4\x7a\x21\x21\x20\xdc\xc0\xdc\xc0\x90\x73"
-b"\xd9\xbd\x20\xd9\x62\xd9\x62\x2a\x0a\x0a",
-b"\xeb\x98\xa0\xeb\xb0\xa9\xea\xb0\x81\xed\x95\x98\x20\xed\x8e\xb2"
-b"\xec\x8b\x9c\xec\xbd\x9c\xeb\x9d\xbc\x0a\x0a\xe3\x89\xaf\xe3\x89"
-b"\xaf\xeb\x82\xa9\x21\x21\x20\xe5\x9b\xa0\xe4\xb9\x9d\xe6\x9c\x88"
-b"\xed\x8c\xa8\xeb\xaf\xa4\xeb\xa6\x94\xea\xb6\x88\x20\xe2\x93\xa1"
-b"\xe2\x93\x96\xed\x9b\x80\xc2\xbf\xc2\xbf\xc2\xbf\x20\xea\xb8\x8d"
-b"\xeb\x92\x99\x20\xe2\x93\x94\xeb\x8e\xa8\x20\xe3\x89\xaf\x2e\x20"
-b"\x2e\x0a\xe4\xba\x9e\xec\x98\x81\xe2\x93\x94\xeb\x8a\xa5\xed\x9a"
-b"\xb9\x20\x2e\x20\x2e\x20\x2e\x20\x2e\x20\xec\x84\x9c\xec\x9a\xb8"
-b"\xeb\xa4\x84\x20\xeb\x8e\x90\xed\x95\x99\xe4\xb9\x99\x20\xe5\xae"
-b"\xb6\xed\x9b\x80\x20\x21\x20\x21\x20\x21\xe3\x85\xa0\x2e\xe3\x85"
-b"\xa0\x0a\xed\x9d\x90\xed\x9d\x90\xed\x9d\x90\x20\xe3\x84\xb1\xe3"
-b"\x84\xb1\xe3\x84\xb1\xe2\x98\x86\xe3\x85\xa0\x5f\xe3\x85\xa0\x20"
-b"\xec\x96\xb4\xeb\xa6\xa8\x20\xed\x83\xb8\xec\xbd\xb0\xea\xb8\x90"
-b"\x20\xeb\x8e\x8c\xec\x9d\x91\x20\xec\xb9\x91\xe4\xb9\x9d\xeb\x93"
-b"\xa4\xe4\xb9\x99\x20\xe3\x89\xaf\xeb\x93\x9c\xea\xb8\x90\x0a\xec"
-b"\x84\xa4\xeb\xa6\x8c\x20\xe5\xae\xb6\xed\x9b\x80\x20\x2e\x20\x2e"
-b"\x20\x2e\x20\x2e\x20\xea\xb5\xb4\xec\x95\xa0\xec\x89\x8c\x20\xe2"
-b"\x93\x94\xea\xb6\x88\x20\xe2\x93\xa1\xeb\xa6\x98\xe3\x89\xb1\xea"
-b"\xb8\x90\x20\xe5\x9b\xa0\xe4\xbb\x81\xe5\xb7\x9d\xef\xa6\x81\xe4"
-b"\xb8\xad\xea\xb9\x8c\xec\xa6\xbc\x0a\xec\x99\x80\xec\x92\x80\xed"
-b"\x9b\x80\x20\x21\x20\x21\x20\xe4\xba\x9e\xec\x98\x81\xe2\x93\x94"
-b"\x20\xe5\xae\xb6\xeb\x8a\xa5\xea\xb6\x88\x20\xe2\x98\x86\xe4\xb8"
-b"\x8a\xea\xb4\x80\x20\xec\x97\x86\xeb\x8a\xa5\xea\xb6\x88\xeb\x8a"
-b"\xa5\x20\xe4\xba\x9e\xeb\x8a\xa5\xeb\x92\x88\xed\x9b\x80\x20\xea"
-b"\xb8\x80\xec\x95\xa0\xeb\x93\xb4\x0a\xe2\x93\xa1\xeb\xa0\xa4\xeb"
-b"\x93\x80\xe4\xb9\x9d\x20\xec\x8b\x80\xed\x92\x94\xec\x88\xb4\xed"
-b"\x9b\x80\x20\xec\x96\xb4\xeb\xa6\xa8\x20\xe5\x9b\xa0\xe4\xbb\x81"
-b"\xe5\xb7\x9d\xef\xa6\x81\xe4\xb8\xad\xec\x8b\x81\xe2\x91\xa8\xeb"
-b"\x93\xa4\xec\x95\x9c\x21\x21\x20\xe3\x89\xaf\xe3\x89\xaf\xeb\x82"
-b"\xa9\xe2\x99\xa1\x20\xe2\x8c\x92\xe2\x8c\x92\x2a\x0a\x0a"),
-'shift_jis': (
-b"\x50\x79\x74\x68\x6f\x6e\x20\x82\xcc\x8a\x4a\x94\xad\x82\xcd\x81"
-b"\x41\x31\x39\x39\x30\x20\x94\x4e\x82\xb2\x82\xeb\x82\xa9\x82\xe7"
-b"\x8a\x4a\x8e\x6e\x82\xb3\x82\xea\x82\xc4\x82\xa2\x82\xdc\x82\xb7"
-b"\x81\x42\x0a\x8a\x4a\x94\xad\x8e\xd2\x82\xcc\x20\x47\x75\x69\x64"
-b"\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73\x73\x75\x6d\x20\x82\xcd\x8b"
-b"\xb3\x88\xe7\x97\x70\x82\xcc\x83\x76\x83\x8d\x83\x4f\x83\x89\x83"
-b"\x7e\x83\x93\x83\x4f\x8c\xbe\x8c\xea\x81\x75\x41\x42\x43\x81\x76"
-b"\x82\xcc\x8a\x4a\x94\xad\x82\xc9\x8e\x51\x89\xc1\x82\xb5\x82\xc4"
-b"\x82\xa2\x82\xdc\x82\xb5\x82\xbd\x82\xaa\x81\x41\x41\x42\x43\x20"
-b"\x82\xcd\x8e\xc0\x97\x70\x8f\xe3\x82\xcc\x96\xda\x93\x49\x82\xc9"
-b"\x82\xcd\x82\xa0\x82\xdc\x82\xe8\x93\x4b\x82\xb5\x82\xc4\x82\xa2"
-b"\x82\xdc\x82\xb9\x82\xf1\x82\xc5\x82\xb5\x82\xbd\x81\x42\x0a\x82"
-b"\xb1\x82\xcc\x82\xbd\x82\xdf\x81\x41\x47\x75\x69\x64\x6f\x20\x82"
-b"\xcd\x82\xe6\x82\xe8\x8e\xc0\x97\x70\x93\x49\x82\xc8\x83\x76\x83"
-b"\x8d\x83\x4f\x83\x89\x83\x7e\x83\x93\x83\x4f\x8c\xbe\x8c\xea\x82"
-b"\xcc\x8a\x4a\x94\xad\x82\xf0\x8a\x4a\x8e\x6e\x82\xb5\x81\x41\x89"
-b"\x70\x8d\x91\x20\x42\x42\x53\x20\x95\xfa\x91\x97\x82\xcc\x83\x52"
-b"\x83\x81\x83\x66\x83\x42\x94\xd4\x91\x67\x81\x75\x83\x82\x83\x93"
-b"\x83\x65\x83\x42\x20\x83\x70\x83\x43\x83\x5c\x83\x93\x81\x76\x82"
-b"\xcc\x83\x74\x83\x40\x83\x93\x82\xc5\x82\xa0\x82\xe9\x20\x47\x75"
-b"\x69\x64\x6f\x20\x82\xcd\x82\xb1\x82\xcc\x8c\xbe\x8c\xea\x82\xf0"
-b"\x81\x75\x50\x79\x74\x68\x6f\x6e\x81\x76\x82\xc6\x96\xbc\x82\xc3"
-b"\x82\xaf\x82\xdc\x82\xb5\x82\xbd\x81\x42\x0a\x82\xb1\x82\xcc\x82"
-b"\xe6\x82\xa4\x82\xc8\x94\x77\x8c\x69\x82\xa9\x82\xe7\x90\xb6\x82"
-b"\xdc\x82\xea\x82\xbd\x20\x50\x79\x74\x68\x6f\x6e\x20\x82\xcc\x8c"
-b"\xbe\x8c\xea\x90\xdd\x8c\x76\x82\xcd\x81\x41\x81\x75\x83\x56\x83"
-b"\x93\x83\x76\x83\x8b\x81\x76\x82\xc5\x81\x75\x8f\x4b\x93\xbe\x82"
-b"\xaa\x97\x65\x88\xd5\x81\x76\x82\xc6\x82\xa2\x82\xa4\x96\xda\x95"
-b"\x57\x82\xc9\x8f\x64\x93\x5f\x82\xaa\x92\x75\x82\xa9\x82\xea\x82"
-b"\xc4\x82\xa2\x82\xdc\x82\xb7\x81\x42\x0a\x91\xbd\x82\xad\x82\xcc"
-b"\x83\x58\x83\x4e\x83\x8a\x83\x76\x83\x67\x8c\x6e\x8c\xbe\x8c\xea"
-b"\x82\xc5\x82\xcd\x83\x86\x81\x5b\x83\x55\x82\xcc\x96\xda\x90\xe6"
-b"\x82\xcc\x97\x98\x95\xd6\x90\xab\x82\xf0\x97\x44\x90\xe6\x82\xb5"
-b"\x82\xc4\x90\x46\x81\x58\x82\xc8\x8b\x40\x94\x5c\x82\xf0\x8c\xbe"
-b"\x8c\xea\x97\x76\x91\x66\x82\xc6\x82\xb5\x82\xc4\x8e\xe6\x82\xe8"
-b"\x93\xfc\x82\xea\x82\xe9\x8f\xea\x8d\x87\x82\xaa\x91\xbd\x82\xa2"
-b"\x82\xcc\x82\xc5\x82\xb7\x82\xaa\x81\x41\x50\x79\x74\x68\x6f\x6e"
-b"\x20\x82\xc5\x82\xcd\x82\xbb\x82\xa4\x82\xa2\x82\xc1\x82\xbd\x8f"
-b"\xac\x8d\xd7\x8d\x48\x82\xaa\x92\xc7\x89\xc1\x82\xb3\x82\xea\x82"
-b"\xe9\x82\xb1\x82\xc6\x82\xcd\x82\xa0\x82\xdc\x82\xe8\x82\xa0\x82"
-b"\xe8\x82\xdc\x82\xb9\x82\xf1\x81\x42\x0a\x8c\xbe\x8c\xea\x8e\xa9"
-b"\x91\xcc\x82\xcc\x8b\x40\x94\x5c\x82\xcd\x8d\xc5\x8f\xac\x8c\xc0"
-b"\x82\xc9\x89\x9f\x82\xb3\x82\xa6\x81\x41\x95\x4b\x97\x76\x82\xc8"
-b"\x8b\x40\x94\x5c\x82\xcd\x8a\x67\x92\xa3\x83\x82\x83\x57\x83\x85"
-b"\x81\x5b\x83\x8b\x82\xc6\x82\xb5\x82\xc4\x92\xc7\x89\xc1\x82\xb7"
-b"\x82\xe9\x81\x41\x82\xc6\x82\xa2\x82\xa4\x82\xcc\x82\xaa\x20\x50"
-b"\x79\x74\x68\x6f\x6e\x20\x82\xcc\x83\x7c\x83\x8a\x83\x56\x81\x5b"
-b"\x82\xc5\x82\xb7\x81\x42\x0a\x0a",
-b"\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xaf\xe3\x80\x81\x31\x39\x39\x30\x20\xe5\xb9\xb4\xe3\x81"
-b"\x94\xe3\x82\x8d\xe3\x81\x8b\xe3\x82\x89\xe9\x96\x8b\xe5\xa7\x8b"
-b"\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3"
-b"\x81\x99\xe3\x80\x82\x0a\xe9\x96\x8b\xe7\x99\xba\xe8\x80\x85\xe3"
-b"\x81\xae\x20\x47\x75\x69\x64\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73"
-b"\x73\x75\x6d\x20\xe3\x81\xaf\xe6\x95\x99\xe8\x82\xb2\xe7\x94\xa8"
-b"\xe3\x81\xae\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83\xa9\xe3"
-b"\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e\xe3\x80"
-b"\x8c\x41\x42\x43\xe3\x80\x8d\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xab\xe5\x8f\x82\xe5\x8a\xa0\xe3\x81\x97\xe3\x81\xa6\xe3"
-b"\x81\x84\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x81\x8c\xe3\x80"
-b"\x81\x41\x42\x43\x20\xe3\x81\xaf\xe5\xae\x9f\xe7\x94\xa8\xe4\xb8"
-b"\x8a\xe3\x81\xae\xe7\x9b\xae\xe7\x9a\x84\xe3\x81\xab\xe3\x81\xaf"
-b"\xe3\x81\x82\xe3\x81\xbe\xe3\x82\x8a\xe9\x81\xa9\xe3\x81\x97\xe3"
-b"\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x81"
-b"\xa7\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a\xe3\x81\x93\xe3\x81"
-b"\xae\xe3\x81\x9f\xe3\x82\x81\xe3\x80\x81\x47\x75\x69\x64\x6f\x20"
-b"\xe3\x81\xaf\xe3\x82\x88\xe3\x82\x8a\xe5\xae\x9f\xe7\x94\xa8\xe7"
-b"\x9a\x84\xe3\x81\xaa\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83"
-b"\xa9\xe3\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e"
-b"\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba\xe3\x82\x92\xe9\x96\x8b\xe5"
-b"\xa7\x8b\xe3\x81\x97\xe3\x80\x81\xe8\x8b\xb1\xe5\x9b\xbd\x20\x42"
-b"\x42\x53\x20\xe6\x94\xbe\xe9\x80\x81\xe3\x81\xae\xe3\x82\xb3\xe3"
-b"\x83\xa1\xe3\x83\x87\xe3\x82\xa3\xe7\x95\xaa\xe7\xb5\x84\xe3\x80"
-b"\x8c\xe3\x83\xa2\xe3\x83\xb3\xe3\x83\x86\xe3\x82\xa3\x20\xe3\x83"
-b"\x91\xe3\x82\xa4\xe3\x82\xbd\xe3\x83\xb3\xe3\x80\x8d\xe3\x81\xae"
-b"\xe3\x83\x95\xe3\x82\xa1\xe3\x83\xb3\xe3\x81\xa7\xe3\x81\x82\xe3"
-b"\x82\x8b\x20\x47\x75\x69\x64\x6f\x20\xe3\x81\xaf\xe3\x81\x93\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe3\x80\x8c\x50\x79"
-b"\x74\x68\x6f\x6e\xe3\x80\x8d\xe3\x81\xa8\xe5\x90\x8d\xe3\x81\xa5"
-b"\xe3\x81\x91\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a"
-b"\xe3\x81\x93\xe3\x81\xae\xe3\x82\x88\xe3\x81\x86\xe3\x81\xaa\xe8"
-b"\x83\x8c\xe6\x99\xaf\xe3\x81\x8b\xe3\x82\x89\xe7\x94\x9f\xe3\x81"
-b"\xbe\xe3\x82\x8c\xe3\x81\x9f\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe8\xa8\xad\xe8\xa8\x88\xe3\x81"
-b"\xaf\xe3\x80\x81\xe3\x80\x8c\xe3\x82\xb7\xe3\x83\xb3\xe3\x83\x97"
-b"\xe3\x83\xab\xe3\x80\x8d\xe3\x81\xa7\xe3\x80\x8c\xe7\xbf\x92\xe5"
-b"\xbe\x97\xe3\x81\x8c\xe5\xae\xb9\xe6\x98\x93\xe3\x80\x8d\xe3\x81"
-b"\xa8\xe3\x81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\xe3\x81\x95\xe3\x82\x8c\xe3\x82"
-b"\x8b\xe3\x81\x93\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\x82\xe3\x81\xbe"
-b"\xe3\x82\x8a\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3"
-b"\x82\x93\xe3\x80\x82\x0a\xe8\xa8\x80\xe8\xaa\x9e\xe8\x87\xaa\xe4"
-b"\xbd\x93\xe3\x81\xae\xe6\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x9c"
-b"\x80\xe5\xb0\x8f\xe9\x99\x90\xe3\x81\xab\xe6\x8a\xbc\xe3\x81\x95"
-b"\xe3\x81\x88\xe3\x80\x81\xe5\xbf\x85\xe8\xa6\x81\xe3\x81\xaa\xe6"
-b"\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x8b\xa1\xe5\xbc\xb5\xe3\x83"
-b"\xa2\xe3\x82\xb8\xe3\x83\xa5\xe3\x83\xbc\xe3\x83\xab\xe3\x81\xa8"
-b"\xe3\x81\x97\xe3\x81\xa6\xe8\xbf\xbd\xe5\x8a\xa0\xe3\x81\x99\xe3"
-b"\x82\x8b\xe3\x80\x81\xe3\x81\xa8\xe3\x81\x84\xe3\x81\x86\xe3\x81"
-b"\xae\xe3\x81\x8c\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe3"
-b"\x83\x9d\xe3\x83\xaa\xe3\x82\xb7\xe3\x83\xbc\xe3\x81\xa7\xe3\x81"
-b"\x99\xe3\x80\x82\x0a\x0a"),
-'shift_jisx0213': (
-b"\x50\x79\x74\x68\x6f\x6e\x20\x82\xcc\x8a\x4a\x94\xad\x82\xcd\x81"
-b"\x41\x31\x39\x39\x30\x20\x94\x4e\x82\xb2\x82\xeb\x82\xa9\x82\xe7"
-b"\x8a\x4a\x8e\x6e\x82\xb3\x82\xea\x82\xc4\x82\xa2\x82\xdc\x82\xb7"
-b"\x81\x42\x0a\x8a\x4a\x94\xad\x8e\xd2\x82\xcc\x20\x47\x75\x69\x64"
-b"\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73\x73\x75\x6d\x20\x82\xcd\x8b"
-b"\xb3\x88\xe7\x97\x70\x82\xcc\x83\x76\x83\x8d\x83\x4f\x83\x89\x83"
-b"\x7e\x83\x93\x83\x4f\x8c\xbe\x8c\xea\x81\x75\x41\x42\x43\x81\x76"
-b"\x82\xcc\x8a\x4a\x94\xad\x82\xc9\x8e\x51\x89\xc1\x82\xb5\x82\xc4"
-b"\x82\xa2\x82\xdc\x82\xb5\x82\xbd\x82\xaa\x81\x41\x41\x42\x43\x20"
-b"\x82\xcd\x8e\xc0\x97\x70\x8f\xe3\x82\xcc\x96\xda\x93\x49\x82\xc9"
-b"\x82\xcd\x82\xa0\x82\xdc\x82\xe8\x93\x4b\x82\xb5\x82\xc4\x82\xa2"
-b"\x82\xdc\x82\xb9\x82\xf1\x82\xc5\x82\xb5\x82\xbd\x81\x42\x0a\x82"
-b"\xb1\x82\xcc\x82\xbd\x82\xdf\x81\x41\x47\x75\x69\x64\x6f\x20\x82"
-b"\xcd\x82\xe6\x82\xe8\x8e\xc0\x97\x70\x93\x49\x82\xc8\x83\x76\x83"
-b"\x8d\x83\x4f\x83\x89\x83\x7e\x83\x93\x83\x4f\x8c\xbe\x8c\xea\x82"
-b"\xcc\x8a\x4a\x94\xad\x82\xf0\x8a\x4a\x8e\x6e\x82\xb5\x81\x41\x89"
-b"\x70\x8d\x91\x20\x42\x42\x53\x20\x95\xfa\x91\x97\x82\xcc\x83\x52"
-b"\x83\x81\x83\x66\x83\x42\x94\xd4\x91\x67\x81\x75\x83\x82\x83\x93"
-b"\x83\x65\x83\x42\x20\x83\x70\x83\x43\x83\x5c\x83\x93\x81\x76\x82"
-b"\xcc\x83\x74\x83\x40\x83\x93\x82\xc5\x82\xa0\x82\xe9\x20\x47\x75"
-b"\x69\x64\x6f\x20\x82\xcd\x82\xb1\x82\xcc\x8c\xbe\x8c\xea\x82\xf0"
-b"\x81\x75\x50\x79\x74\x68\x6f\x6e\x81\x76\x82\xc6\x96\xbc\x82\xc3"
-b"\x82\xaf\x82\xdc\x82\xb5\x82\xbd\x81\x42\x0a\x82\xb1\x82\xcc\x82"
-b"\xe6\x82\xa4\x82\xc8\x94\x77\x8c\x69\x82\xa9\x82\xe7\x90\xb6\x82"
-b"\xdc\x82\xea\x82\xbd\x20\x50\x79\x74\x68\x6f\x6e\x20\x82\xcc\x8c"
-b"\xbe\x8c\xea\x90\xdd\x8c\x76\x82\xcd\x81\x41\x81\x75\x83\x56\x83"
-b"\x93\x83\x76\x83\x8b\x81\x76\x82\xc5\x81\x75\x8f\x4b\x93\xbe\x82"
-b"\xaa\x97\x65\x88\xd5\x81\x76\x82\xc6\x82\xa2\x82\xa4\x96\xda\x95"
-b"\x57\x82\xc9\x8f\x64\x93\x5f\x82\xaa\x92\x75\x82\xa9\x82\xea\x82"
-b"\xc4\x82\xa2\x82\xdc\x82\xb7\x81\x42\x0a\x91\xbd\x82\xad\x82\xcc"
-b"\x83\x58\x83\x4e\x83\x8a\x83\x76\x83\x67\x8c\x6e\x8c\xbe\x8c\xea"
-b"\x82\xc5\x82\xcd\x83\x86\x81\x5b\x83\x55\x82\xcc\x96\xda\x90\xe6"
-b"\x82\xcc\x97\x98\x95\xd6\x90\xab\x82\xf0\x97\x44\x90\xe6\x82\xb5"
-b"\x82\xc4\x90\x46\x81\x58\x82\xc8\x8b\x40\x94\x5c\x82\xf0\x8c\xbe"
-b"\x8c\xea\x97\x76\x91\x66\x82\xc6\x82\xb5\x82\xc4\x8e\xe6\x82\xe8"
-b"\x93\xfc\x82\xea\x82\xe9\x8f\xea\x8d\x87\x82\xaa\x91\xbd\x82\xa2"
-b"\x82\xcc\x82\xc5\x82\xb7\x82\xaa\x81\x41\x50\x79\x74\x68\x6f\x6e"
-b"\x20\x82\xc5\x82\xcd\x82\xbb\x82\xa4\x82\xa2\x82\xc1\x82\xbd\x8f"
-b"\xac\x8d\xd7\x8d\x48\x82\xaa\x92\xc7\x89\xc1\x82\xb3\x82\xea\x82"
-b"\xe9\x82\xb1\x82\xc6\x82\xcd\x82\xa0\x82\xdc\x82\xe8\x82\xa0\x82"
-b"\xe8\x82\xdc\x82\xb9\x82\xf1\x81\x42\x0a\x8c\xbe\x8c\xea\x8e\xa9"
-b"\x91\xcc\x82\xcc\x8b\x40\x94\x5c\x82\xcd\x8d\xc5\x8f\xac\x8c\xc0"
-b"\x82\xc9\x89\x9f\x82\xb3\x82\xa6\x81\x41\x95\x4b\x97\x76\x82\xc8"
-b"\x8b\x40\x94\x5c\x82\xcd\x8a\x67\x92\xa3\x83\x82\x83\x57\x83\x85"
-b"\x81\x5b\x83\x8b\x82\xc6\x82\xb5\x82\xc4\x92\xc7\x89\xc1\x82\xb7"
-b"\x82\xe9\x81\x41\x82\xc6\x82\xa2\x82\xa4\x82\xcc\x82\xaa\x20\x50"
-b"\x79\x74\x68\x6f\x6e\x20\x82\xcc\x83\x7c\x83\x8a\x83\x56\x81\x5b"
-b"\x82\xc5\x82\xb7\x81\x42\x0a\x0a\x83\x6d\x82\xf5\x20\x83\x9e\x20"
-b"\x83\x67\x83\x4c\x88\x4b\x88\x79\x20\x98\x83\xfc\xd6\x20\xfc\xd2"
-b"\xfc\xe6\xfb\xd4\x0a",
-b"\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xaf\xe3\x80\x81\x31\x39\x39\x30\x20\xe5\xb9\xb4\xe3\x81"
-b"\x94\xe3\x82\x8d\xe3\x81\x8b\xe3\x82\x89\xe9\x96\x8b\xe5\xa7\x8b"
-b"\xe3\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3"
-b"\x81\x99\xe3\x80\x82\x0a\xe9\x96\x8b\xe7\x99\xba\xe8\x80\x85\xe3"
-b"\x81\xae\x20\x47\x75\x69\x64\x6f\x20\x76\x61\x6e\x20\x52\x6f\x73"
-b"\x73\x75\x6d\x20\xe3\x81\xaf\xe6\x95\x99\xe8\x82\xb2\xe7\x94\xa8"
-b"\xe3\x81\xae\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83\xa9\xe3"
-b"\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e\xe3\x80"
-b"\x8c\x41\x42\x43\xe3\x80\x8d\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba"
-b"\xe3\x81\xab\xe5\x8f\x82\xe5\x8a\xa0\xe3\x81\x97\xe3\x81\xa6\xe3"
-b"\x81\x84\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x81\x8c\xe3\x80"
-b"\x81\x41\x42\x43\x20\xe3\x81\xaf\xe5\xae\x9f\xe7\x94\xa8\xe4\xb8"
-b"\x8a\xe3\x81\xae\xe7\x9b\xae\xe7\x9a\x84\xe3\x81\xab\xe3\x81\xaf"
-b"\xe3\x81\x82\xe3\x81\xbe\xe3\x82\x8a\xe9\x81\xa9\xe3\x81\x97\xe3"
-b"\x81\xa6\xe3\x81\x84\xe3\x81\xbe\xe3\x81\x9b\xe3\x82\x93\xe3\x81"
-b"\xa7\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a\xe3\x81\x93\xe3\x81"
-b"\xae\xe3\x81\x9f\xe3\x82\x81\xe3\x80\x81\x47\x75\x69\x64\x6f\x20"
-b"\xe3\x81\xaf\xe3\x82\x88\xe3\x82\x8a\xe5\xae\x9f\xe7\x94\xa8\xe7"
-b"\x9a\x84\xe3\x81\xaa\xe3\x83\x97\xe3\x83\xad\xe3\x82\xb0\xe3\x83"
-b"\xa9\xe3\x83\x9f\xe3\x83\xb3\xe3\x82\xb0\xe8\xa8\x80\xe8\xaa\x9e"
-b"\xe3\x81\xae\xe9\x96\x8b\xe7\x99\xba\xe3\x82\x92\xe9\x96\x8b\xe5"
-b"\xa7\x8b\xe3\x81\x97\xe3\x80\x81\xe8\x8b\xb1\xe5\x9b\xbd\x20\x42"
-b"\x42\x53\x20\xe6\x94\xbe\xe9\x80\x81\xe3\x81\xae\xe3\x82\xb3\xe3"
-b"\x83\xa1\xe3\x83\x87\xe3\x82\xa3\xe7\x95\xaa\xe7\xb5\x84\xe3\x80"
-b"\x8c\xe3\x83\xa2\xe3\x83\xb3\xe3\x83\x86\xe3\x82\xa3\x20\xe3\x83"
-b"\x91\xe3\x82\xa4\xe3\x82\xbd\xe3\x83\xb3\xe3\x80\x8d\xe3\x81\xae"
-b"\xe3\x83\x95\xe3\x82\xa1\xe3\x83\xb3\xe3\x81\xa7\xe3\x81\x82\xe3"
-b"\x82\x8b\x20\x47\x75\x69\x64\x6f\x20\xe3\x81\xaf\xe3\x81\x93\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe3\x82\x92\xe3\x80\x8c\x50\x79"
-b"\x74\x68\x6f\x6e\xe3\x80\x8d\xe3\x81\xa8\xe5\x90\x8d\xe3\x81\xa5"
-b"\xe3\x81\x91\xe3\x81\xbe\xe3\x81\x97\xe3\x81\x9f\xe3\x80\x82\x0a"
-b"\xe3\x81\x93\xe3\x81\xae\xe3\x82\x88\xe3\x81\x86\xe3\x81\xaa\xe8"
-b"\x83\x8c\xe6\x99\xaf\xe3\x81\x8b\xe3\x82\x89\xe7\x94\x9f\xe3\x81"
-b"\xbe\xe3\x82\x8c\xe3\x81\x9f\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3"
-b"\x81\xae\xe8\xa8\x80\xe8\xaa\x9e\xe8\xa8\xad\xe8\xa8\x88\xe3\x81"
-b"\xaf\xe3\x80\x81\xe3\x80\x8c\xe3\x82\xb7\xe3\x83\xb3\xe3\x83\x97"
-b"\xe3\x83\xab\xe3\x80\x8d\xe3\x81\xa7\xe3\x80\x8c\xe7\xbf\x92\xe5"
-b"\xbe\x97\xe3\x81\x8c\xe5\xae\xb9\xe6\x98\x93\xe3\x80\x8d\xe3\x81"
-b"\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e5\x8a\xa0\xe3\x81\x95\xe3\x82\x8c\xe3\x82"
-b"\x8b\xe3\x81\x93\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\x82\xe3\x81\xbe"
-b"\xe3\x82\x8a\xe3\x81\x82\xe3\x82\x8a\xe3\x81\xbe\xe3\x81\x9b\xe3"
-b"\x82\x93\xe3\x80\x82\x0a\xe8\xa8\x80\xe8\xaa\x9e\xe8\x87\xaa\xe4"
-b"\xbd\x93\xe3\x81\xae\xe6\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x9c"
-b"\x80\xe5\xb0\x8f\xe9\x99\x90\xe3\x81\xab\xe6\x8a\xbc\xe3\x81\x95"
-b"\xe3\x81\x88\xe3\x80\x81\xe5\xbf\x85\xe8\xa6\x81\xe3\x81\xaa\xe6"
-b"\xa9\x9f\xe8\x83\xbd\xe3\x81\xaf\xe6\x8b\xa1\xe5\xbc\xb5\xe3\x83"
-b"\xa2\xe3\x82\xb8\xe3\x83\xa5\xe3\x83\xbc\xe3\x83\xab\xe3\x81\xa8"
-b"\xe3\x81\x97\xe3\x81\xa6\xe8\xbf\xbd\xe5\x8a\xa0\xe3\x81\x99\xe3"
-b"\x82\x8b\xe3\x80\x81\xe3\x81\xa8\xe3\x81\x84\xe3\x81\x86\xe3\x81"
-b"\xae\xe3\x81\x8c\x20\x50\x79\x74\x68\x6f\x6e\x20\xe3\x81\xae\xe3"
-b"\x83\x9d\xe3\x83\xaa\xe3\x82\xb7\xe3\x83\xbc\xe3\x81\xa7\xe3\x81"
-b"\x99\xe3\x80\x82\x0a\x0a\xe3\x83\x8e\xe3\x81\x8b\xe3\x82\x9a\x20"
-b"\xe3\x83\x88\xe3\x82\x9a\x20\xe3\x83\x88\xe3\x82\xad\xef\xa8\xb6"
-b"\xef\xa8\xb9\x20\xf0\xa1\x9a\xb4\xf0\xaa\x8e\x8c\x20\xe9\xba\x80"
-b"\xe9\xbd\x81\xf0\xa9\x9b\xb0\x0a"),
-}
diff --git a/Lib/test/support.py b/Lib/test/support.py
index bef7161..b3b1bbd 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -32,6 +32,7 @@
"set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner",
"run_unittest", "run_doctest", "threading_setup", "threading_cleanup",
"reap_children", "cpython_only", "check_impl_detail", "get_attribute",
+ "import_fresh_module"
]
class Error(Exception):
@@ -79,23 +80,20 @@
def _save_and_remove_module(name, orig_modules):
"""Helper function to save and remove a module from sys.modules
- Return value is True if the module was in sys.modules and
- False otherwise."""
- saved = True
- try:
- orig_modules[name] = sys.modules[name]
- except KeyError:
- saved = False
- else:
+ Raise ImportError if the module can't be imported."""
+ # try to import the module and raise an error if it can't be imported
+ if name not in sys.modules:
+ __import__(name)
del sys.modules[name]
- return saved
-
+ for modname in list(sys.modules):
+ if modname == name or modname.startswith(name + '.'):
+ orig_modules[modname] = sys.modules[modname]
+ del sys.modules[modname]
def _save_and_block_module(name, orig_modules):
"""Helper function to save and block a module in sys.modules
- Return value is True if the module was in sys.modules and
- False otherwise."""
+ Return True if the module was in sys.modules, False otherwise."""
saved = True
try:
orig_modules[name] = sys.modules[name]
@@ -111,14 +109,15 @@
the sys.modules cache is restored to its original state.
Modules named in fresh are also imported anew if needed by the import.
+ If one of these modules can't be imported, None is returned.
Importing of modules named in blocked is prevented while the fresh import
takes place.
If deprecated is True, any module or package deprecation messages
will be suppressed."""
- # NOTE: test_heapq and test_warnings include extra sanity checks to make
- # sure that this utility function is working as expected
+ # NOTE: test_heapq, test_json and test_warnings include extra sanity checks
+ # to make sure that this utility function is working as expected
with _ignore_deprecated_imports(deprecated):
# Keep track of modules saved for later restoration as well
# as those which just need a blocking entry removed
@@ -132,6 +131,8 @@
if not _save_and_block_module(blocked_name, orig_modules):
names_to_remove.append(blocked_name)
fresh_module = importlib.import_module(name)
+ except ImportError:
+ fresh_module = None
finally:
for orig_name, module in orig_modules.items():
sys.modules[orig_name] = module
@@ -711,14 +712,8 @@
@contextlib.contextmanager
def captured_output(stream_name):
- """Run the 'with' statement body using a StringIO object in place of a
- specific attribute on the sys module.
- Example use (with 'stream_name=stdout')::
-
- with captured_stdout() as s:
- print("hello")
- assert s.getvalue() == "hello"
- """
+ """Return a context manager used by captured_stdout and captured_stdin
+ that temporarily replaces the sys stream *stream_name* with a StringIO."""
import io
orig_stdout = getattr(sys, stream_name)
setattr(sys, stream_name, io.StringIO())
@@ -728,6 +723,12 @@
setattr(sys, stream_name, orig_stdout)
def captured_stdout():
+ """Capture the output of sys.stdout:
+
+ with captured_stdout() as s:
+ print("hello")
+ self.assertEqual(s.getvalue(), "hello")
+ """
return captured_output("stdout")
def gc_collect():
diff --git a/Lib/test/test_atexit.py b/Lib/test/test_atexit.py
index 8a71036..9c7e109 100644
--- a/Lib/test/test_atexit.py
+++ b/Lib/test/test_atexit.py
@@ -65,6 +65,14 @@
self.assertRaises(TypeError, atexit._run_exitfuncs)
+ def test_raise_unnormalized(self):
+ # Issue #10756: Make sure that an unnormalized exception is
+ # handled properly
+ atexit.register(lambda: 1 / 0)
+
+ self.assertRaises(ZeroDivisionError, atexit._run_exitfuncs)
+ self.assertIn("ZeroDivisionError", self.stream.getvalue())
+
def test_stress(self):
a = [0]
def inc():
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 93cdf91..e412a64 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -515,13 +515,11 @@
s1 = 'Hello\r\nworld\r\n'
s = s1.encode(self.encoding)
- try:
- with open(support.TESTFN, 'wb') as fp:
- fp.write(s)
- with codecs.open(support.TESTFN, 'U', encoding=self.encoding) as reader:
- self.assertEqual(reader.read(), s1)
- finally:
- support.unlink(support.TESTFN)
+ self.addCleanup(support.unlink, support.TESTFN)
+ with open(support.TESTFN, 'wb') as fp:
+ fp.write(s)
+ with codecs.open(support.TESTFN, 'U', encoding=self.encoding) as reader:
+ self.assertEqual(reader.read(), s1)
class UTF16LETest(ReadTest):
encoding = "utf-16-le"
@@ -1628,6 +1626,7 @@
"utf-32",
"utf-32-le",
"utf-32-be")
+ self.addCleanup(support.unlink, support.TESTFN)
for encoding in tests:
# Check if the BOM is written only once
with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index aafe428..c74e232 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1595,6 +1595,7 @@
# probably not worth it.
# ("__enter__", run_context, iden),
# ("__exit__", run_context, iden),
+ ("__dir__", dir, empty_seq, set(), {}),
]
class Checker(object):
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
index d072145..a9713f5 100644
--- a/Lib/test/test_frozen.py
+++ b/Lib/test/test_frozen.py
@@ -6,31 +6,37 @@
class FrozenTests(unittest.TestCase):
def test_frozen(self):
- try:
- import __hello__
- except ImportError as x:
- self.fail("import __hello__ failed:" + str(x))
- self.assertEqual(__hello__.initialized, True)
- self.assertEqual(len(dir(__hello__)), 6, dir(__hello__))
+ with captured_stdout() as stdout:
+ try:
+ import __hello__
+ except ImportError as x:
+ self.fail("import __hello__ failed:" + str(x))
+ self.assertEqual(__hello__.initialized, True)
+ self.assertEqual(len(dir(__hello__)), 6, dir(__hello__))
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
- try:
- import __phello__
- except ImportError as x:
- self.fail("import __phello__ failed:" + str(x))
- self.assertEqual(__phello__.initialized, True)
- if not "__phello__.spam" in sys.modules:
- self.assertEqual(len(dir(__phello__)), 7, dir(__phello__))
- else:
- self.assertEqual(len(dir(__phello__)), 8, dir(__phello__))
- self.assertEqual(__phello__.__path__, [__phello__.__name__])
+ with captured_stdout() as stdout:
+ try:
+ import __phello__
+ except ImportError as x:
+ self.fail("import __phello__ failed:" + str(x))
+ self.assertEqual(__phello__.initialized, True)
+ if not "__phello__.spam" in sys.modules:
+ self.assertEqual(len(dir(__phello__)), 7, dir(__phello__))
+ else:
+ self.assertEqual(len(dir(__phello__)), 8, dir(__phello__))
+ self.assertEqual(__phello__.__path__, [__phello__.__name__])
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
- try:
- import __phello__.spam
- except ImportError as x:
- self.fail("import __phello__.spam failed:" + str(x))
- self.assertEqual(__phello__.spam.initialized, True)
- self.assertEqual(len(dir(__phello__.spam)), 6)
- self.assertEqual(len(dir(__phello__)), 8)
+ with captured_stdout() as stdout:
+ try:
+ import __phello__.spam
+ except ImportError as x:
+ self.fail("import __phello__.spam failed:" + str(x))
+ self.assertEqual(__phello__.spam.initialized, True)
+ self.assertEqual(len(dir(__phello__.spam)), 6)
+ self.assertEqual(len(dir(__phello__)), 8)
+ self.assertEqual(stdout.getvalue(), 'Hello world!\n')
try:
import __phello__.foo
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index fa1079f..2b2c4cf 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -42,6 +42,8 @@
def __init__(self, conn):
asynchat.async_chat.__init__(self, conn)
+ # tells the socket to handle urgent data inline (ABOR command)
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1)
self.set_terminator(b"\r\n")
self.in_buffer = []
self.dtp = None
@@ -158,6 +160,9 @@
self.push('221 quit ok')
self.close()
+ def cmd_abor(self, arg):
+ self.push('226 abor ok')
+
def cmd_stor(self, arg):
self.push('125 stor ok')
@@ -312,6 +317,9 @@
# Ensure the connection gets closed; sock attribute should be None
self.assertEqual(self.client.sock, None)
+ def test_abort(self):
+ self.client.abort()
+
def test_retrbinary(self):
def callback(data):
received.append(data.decode('ascii'))
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py
index 5e3b0ee..9682f6e 100644
--- a/Lib/test/test_heapq.py
+++ b/Lib/test/test_heapq.py
@@ -1,16 +1,31 @@
"""Unittests for heapq."""
-import random
-import unittest
-from test import support
import sys
+import random
-# We do a bit of trickery here to be able to test both the C implementation
-# and the Python implementation of the module.
-import heapq as c_heapq
+from test import support
+from unittest import TestCase, skipUnless
+
py_heapq = support.import_fresh_module('heapq', blocked=['_heapq'])
+c_heapq = support.import_fresh_module('heapq', fresh=['_heapq'])
-class TestHeap(unittest.TestCase):
+# _heapq.nlargest/nsmallest are saved in heapq._nlargest/_smallest when
+# _heapq is imported, so check them there
+func_names = ['heapify', 'heappop', 'heappush', 'heappushpop',
+ 'heapreplace', '_nlargest', '_nsmallest']
+
+class TestModules(TestCase):
+ def test_py_functions(self):
+ for fname in func_names:
+ self.assertEqual(getattr(py_heapq, fname).__module__, 'heapq')
+
+ @skipUnless(c_heapq, 'requires _heapq')
+ def test_c_functions(self):
+ for fname in func_names:
+ self.assertEqual(getattr(c_heapq, fname).__module__, '_heapq')
+
+
+class TestHeap(TestCase):
module = None
def test_push_pop(self):
@@ -176,21 +191,8 @@
self.assertEqual(list(self.module.nlargest(n, data, key=f)),
sorted(data, key=f, reverse=True)[:n])
-class TestHeapPython(TestHeap):
- module = py_heapq
-
- # As an early adopter, we sanity check the
- # test.support.import_fresh_module utility function
- def test_pure_python(self):
- self.assertFalse(sys.modules['heapq'] is self.module)
- self.assertTrue(hasattr(self.module.heapify, '__code__'))
-
-
-class TestHeapC(TestHeap):
- module = c_heapq
-
def test_comparison_operator(self):
- # Issue 3501: Make sure heapq works with both __lt__
+ # Issue 3051: Make sure heapq works with both __lt__
# For python 3.0, __le__ alone is not enough
def hsort(data, comp):
data = [comp(x) for x in data]
@@ -211,11 +213,14 @@
self.assertEqual(hsort(data, LT), target)
self.assertRaises(TypeError, data, LE)
- # As an early adopter, we sanity check the
- # test.support.import_fresh_module utility function
- def test_accelerated(self):
- self.assertTrue(sys.modules['heapq'] is self.module)
- self.assertFalse(hasattr(self.module.heapify, '__code__'))
+
+class TestHeapPython(TestHeap):
+ module = py_heapq
+
+
+@skipUnless(c_heapq, 'requires _heapq')
+class TestHeapC(TestHeap):
+ module = c_heapq
#==============================================================================
@@ -313,7 +318,9 @@
'Test multiple tiers of iterators'
return chain(map(lambda x:x, R(Ig(G(seqn)))))
-class TestErrorHandling(unittest.TestCase):
+
+@skipUnless(c_heapq, 'requires _heapq')
+class TestErrorHandling(TestCase):
# only for C implementation
module = c_heapq
@@ -370,9 +377,7 @@
def test_main(verbose=None):
- from types import BuiltinFunctionType
-
- test_classes = [TestHeapPython, TestHeapC, TestErrorHandling]
+ test_classes = [TestModules, TestHeapPython, TestHeapC, TestErrorHandling]
support.run_unittest(*test_classes)
# verify reference counting
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 5f62494..1ec6f93 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1461,6 +1461,32 @@
self.assertEqual(s,
b"A" + b"B" * overwrite_size + b"A" * (9 - overwrite_size))
+ def test_write_rewind_write(self):
+ # Various combinations of reading / writing / seeking backwards / writing again
+ def mutate(bufio, pos1, pos2):
+ assert pos2 >= pos1
+ # Fill the buffer
+ bufio.seek(pos1)
+ bufio.read(pos2 - pos1)
+ bufio.write(b'\x02')
+ # This writes earlier than the previous write, but still inside
+ # the buffer.
+ bufio.seek(pos1)
+ bufio.write(b'\x01')
+
+ b = b"\x80\x81\x82\x83\x84"
+ for i in range(0, len(b)):
+ for j in range(i, len(b)):
+ raw = self.BytesIO(b)
+ bufio = self.tp(raw, 100)
+ mutate(bufio, i, j)
+ bufio.flush()
+ expected = bytearray(b)
+ expected[j] = 2
+ expected[i] = 1
+ self.assertEqual(raw.getvalue(), expected,
+ "failed result for i=%d, j=%d" % (i, j))
+
def test_truncate_after_read_or_write(self):
raw = self.BytesIO(b"A" * 10)
bufio = self.tp(raw, 100)
diff --git a/Lib/test/test_linecache.py b/Lib/test/test_linecache.py
index 8e225d5..56e09dc 100644
--- a/Lib/test/test_linecache.py
+++ b/Lib/test/test_linecache.py
@@ -9,7 +9,7 @@
FILENAME = linecache.__file__
INVALID_NAME = '!@$)(!@#_1'
EMPTY = ''
-TESTS = 'cjkencodings_test inspect_fodder inspect_fodder2 mapping_tests'
+TESTS = 'inspect_fodder inspect_fodder2 mapping_tests'
TESTS = TESTS.split()
TEST_PATH = os.path.dirname(support.__file__)
MODULES = "linecache unittest".split()
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index dd13c72..9be1332 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -742,21 +742,18 @@
def test_reread(self):
- # Initially, the mailbox has not been read and the time is null.
- assert getattr(self._box, '_last_read', None) is None
-
- # Refresh mailbox; the times should now be set to something.
- self._box._refresh()
- assert getattr(self._box, '_last_read', None) is not None
-
- # Put the last modified times more than one second into the past
- # (because mtime has a one second granularity, a refresh is done
- # unconditionally if called for within the same second, just in case
- # the mbox has changed).
+ # Put the last modified times more than two seconds into the past
+ # (because mtime may have a two second granularity)
for subdir in ('cur', 'new'):
os.utime(os.path.join(self._box._path, subdir),
(time.time()-5,)*2)
+ # Because mtime has a two second granularity in worst case (FAT), a
+ # refresh is done unconditionally if called for within
+ # two-second-plus-a-bit of the last one, just in case the mbox has
+ # changed; so now we have to wait for that interval to expire.
+ time.sleep(2.01 + self._box._skewfactor)
+
# Re-reading causes the ._toc attribute to be assigned a new dictionary
# object, so we'll check that the ._toc attribute isn't a different
# object.
@@ -765,7 +762,7 @@
return self._box._toc is not orig_toc
self._box._refresh()
- assert not refreshed()
+ self.assertFalse(refreshed())
# Now, write something into cur and remove it. This changes
# the mtime and should cause a re-read.
@@ -774,7 +771,7 @@
f.close()
os.unlink(filename)
self._box._refresh()
- assert refreshed()
+ self.assertTrue(refreshed())
class _TestMboxMMDF(TestMailbox):
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index c58d17d..8a8afef 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -51,26 +51,6 @@
return doc
class MinidomTest(unittest.TestCase):
- def tearDown(self):
- try:
- Node.allnodes
- except AttributeError:
- # We don't actually have the minidom from the standard library,
- # but are picking up the PyXML version from site-packages.
- pass
- else:
- self.confirm(len(Node.allnodes) == 0,
- "assertion: len(Node.allnodes) == 0")
- if len(Node.allnodes):
- print("Garbage left over:")
- if verbose:
- print(list(Node.allnodes.items())[0:10])
- else:
- # Don't print specific nodes if repeatable results
- # are needed
- print(len(Node.allnodes))
- Node.allnodes = {}
-
def confirm(self, test, testname = "Test"):
self.assertTrue(test, testname)
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 7c51085..f7d6c6f 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -1,4 +1,5 @@
-from test.support import TESTFN, run_unittest, import_module, unlink, requires
+from test.support import (TESTFN, run_unittest, import_module, unlink,
+ requires, _2G, _4G)
import unittest
import os, re, itertools, socket, sys
@@ -653,29 +654,22 @@
def tearDown(self):
unlink(TESTFN)
- def _working_largefile(self):
- # Only run if the current filesystem supports large files.
- f = open(TESTFN, 'wb', buffering=0)
- try:
- f.seek(0x80000001)
- f.write(b'x')
- f.flush()
- except (IOError, OverflowError):
- raise unittest.SkipTest("filesystem does not have largefile support")
- finally:
- f.close()
- unlink(TESTFN)
-
- def test_large_offset(self):
+ def _make_test_file(self, num_zeroes, tail):
if sys.platform[:3] == 'win' or sys.platform == 'darwin':
requires('largefile',
'test requires %s bytes and a long time to run' % str(0x180000000))
- self._working_largefile()
- with open(TESTFN, 'wb') as f:
- f.seek(0x14FFFFFFF)
- f.write(b" ")
+ f = open(TESTFN, 'w+b')
+ try:
+ f.seek(num_zeroes)
+ f.write(tail)
+ f.flush()
+ except (IOError, OverflowError):
+ f.close()
+ raise unittest.SkipTest("filesystem does not have largefile support")
+ return f
- with open(TESTFN, 'rb') as f:
+ def test_large_offset(self):
+ with self._make_test_file(0x14FFFFFFF, b" ") as f:
m = mmap.mmap(f.fileno(), 0, offset=0x140000000, access=mmap.ACCESS_READ)
try:
self.assertEqual(m[0xFFFFFFF], 32)
@@ -683,21 +677,34 @@
m.close()
def test_large_filesize(self):
- if sys.platform[:3] == 'win' or sys.platform == 'darwin':
- requires('largefile',
- 'test requires %s bytes and a long time to run' % str(0x180000000))
- self._working_largefile()
- with open(TESTFN, 'wb') as f:
- f.seek(0x17FFFFFFF)
- f.write(b" ")
-
- with open(TESTFN, 'rb') as f:
+ with self._make_test_file(0x17FFFFFFF, b" ") as f:
m = mmap.mmap(f.fileno(), 0x10000, access=mmap.ACCESS_READ)
try:
self.assertEqual(m.size(), 0x180000000)
finally:
m.close()
+ # Issue 11277: mmap() with large (~4GB) sparse files crashes on OS X.
+
+ def _test_around_boundary(self, boundary):
+ tail = b' DEARdear '
+ start = boundary - len(tail) // 2
+ end = start + len(tail)
+ with self._make_test_file(start, tail) as f:
+ m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
+ try:
+ self.assertEqual(m[start:end], tail)
+ finally:
+ m.close()
+
+ @unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems")
+ def test_around_2GB(self):
+ self._test_around_boundary(_2G)
+
+ @unittest.skipUnless(sys.maxsize > _4G, "test cannot run on 32-bit systems")
+ def test_around_4GB(self):
+ self._test_around_boundary(_4G)
+
def test_main():
run_unittest(MmapTests, LargeMmapTests)
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index d28c653..75e95ca 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -4,8 +4,11 @@
# Common Unittest Routines for CJK codecs
#
-import sys, codecs
-import unittest, re
+import codecs
+import os
+import re
+import sys
+import unittest
from test import support
from io import BytesIO
@@ -342,6 +345,10 @@
if (csetch, unich) not in self.pass_dectest:
self.assertEqual(str(csetch, self.encoding), unich)
-def load_teststring(encoding):
- from test import cjkencodings_test
- return cjkencodings_test.teststring[encoding]
+def load_teststring(name):
+ dir = os.path.join(os.path.dirname(__file__), 'cjkencodings')
+ with open(os.path.join(dir, name + '.txt'), 'rb') as f:
+ encoded = f.read()
+ with open(os.path.join(dir, name + '-utf8.txt'), 'rb') as f:
+ utf8 = f.read()
+ return encoded, utf8
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 6c9147a..ad7311f 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -694,51 +694,6 @@
self.assertEqual(attrs.getQNameByName((ns_uri, "attr")), "ns:attr")
- # During the development of Python 2.5, an attempt to move the "xml"
- # package implementation to a new package ("xmlcore") proved painful.
- # The goal of this change was to allow applications to be able to
- # obtain and rely on behavior in the standard library implementation
- # of the XML support without needing to be concerned about the
- # availability of the PyXML implementation.
- #
- # While the existing import hackery in Lib/xml/__init__.py can cause
- # PyXML's _xmlpus package to supplant the "xml" package, that only
- # works because either implementation uses the "xml" package name for
- # imports.
- #
- # The move resulted in a number of problems related to the fact that
- # the import machinery's "package context" is based on the name that's
- # being imported rather than the __name__ of the actual package
- # containment; it wasn't possible for the "xml" package to be replaced
- # by a simple module that indirected imports to the "xmlcore" package.
- #
- # The following two tests exercised bugs that were introduced in that
- # attempt. Keeping these tests around will help detect problems with
- # other attempts to provide reliable access to the standard library's
- # implementation of the XML support.
-
- def test_sf_1511497(self):
- # Bug report: http://www.python.org/sf/1511497
- import sys
- old_modules = sys.modules.copy()
- for modname in list(sys.modules.keys()):
- if modname.startswith("xml."):
- del sys.modules[modname]
- try:
- import xml.sax.expatreader
- module = xml.sax.expatreader
- self.assertEqual(module.__name__, "xml.sax.expatreader")
- finally:
- sys.modules.update(old_modules)
-
- def test_sf_1513611(self):
- # Bug report: http://www.python.org/sf/1513611
- sio = StringIO("invalid")
- parser = make_parser()
- from xml.sax import SAXParseException
- self.assertRaises(SAXParseException, parser.parse, sio)
-
-
def test_main():
run_unittest(MakeParserTest,
SaxutilsTest,
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index becd91c..8547351 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -522,6 +522,24 @@
self.assertTrue(srcfile._exited_with[0] is None)
self.assertTrue(srcfile._raised)
+ def test_move_dir_caseinsensitive(self):
+ # Renames a folder to the same name
+ # but a different case.
+
+ self.src_dir = tempfile.mkdtemp()
+ dst_dir = os.path.join(
+ os.path.dirname(self.src_dir),
+ os.path.basename(self.src_dir).upper())
+ self.assertNotEqual(self.src_dir, dst_dir)
+
+ try:
+ shutil.move(self.src_dir, dst_dir)
+ self.assertTrue(os.path.isdir(dst_dir))
+ finally:
+ if os.path.exists(dst_dir):
+ os.rmdir(dst_dir)
+
+
def test_main():
support.run_unittest(TestShutil, TestMove, TestCopyFile)
diff --git a/Lib/test/test_smtpnet.py b/Lib/test/test_smtpnet.py
index 6634df7..1571ca3 100644
--- a/Lib/test/test_smtpnet.py
+++ b/Lib/test/test_smtpnet.py
@@ -17,6 +17,13 @@
server.ehlo()
server.quit()
+ def test_connect_default_port(self):
+ support.get_attribute(smtplib, 'SMTP_SSL')
+ with support.transient_internet(self.testServer):
+ server = smtplib.SMTP_SSL(self.testServer)
+ server.ehlo()
+ server.quit()
+
def test_main():
support.run_unittest(SmtpSSLTest)
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 67c5413..6a9497b 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -274,6 +274,36 @@
self.assertRaises(socket.error, raise_gaierror,
"Error raising socket exception.")
+ def testSendtoErrors(self):
+ # Testing that sendto doens't masks failures. See #10169.
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ self.addCleanup(s.close)
+ s.bind(('', 0))
+ sockname = s.getsockname()
+ # 2 args
+ with self.assertRaises(TypeError):
+ s.sendto('\u2620', sockname)
+ with self.assertRaises(TypeError):
+ s.sendto(5j, sockname)
+ with self.assertRaises(TypeError):
+ s.sendto(b'foo', None)
+ # 3 args
+ with self.assertRaises(TypeError):
+ s.sendto('\u2620', 0, sockname)
+ with self.assertRaises(TypeError):
+ s.sendto(5j, 0, sockname)
+ with self.assertRaises(TypeError):
+ s.sendto(b'foo', 0, None)
+ with self.assertRaises(TypeError):
+ s.sendto(b'foo', 'bar', sockname)
+ with self.assertRaises(TypeError):
+ s.sendto(b'foo', None, None)
+ # wrong number of args
+ with self.assertRaises(TypeError):
+ s.sendto(b'foo')
+ with self.assertRaises(TypeError):
+ s.sendto(b'foo', 0, sockname, 4)
+
def testCrucialConstants(self):
# Testing for mission critical constants
socket.AF_INET
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index bb38890..f2f4f80 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -40,7 +40,7 @@
class BasicTests(unittest.TestCase):
def test_constants(self):
- ssl.PROTOCOL_SSLv2
+ #ssl.PROTOCOL_SSLv2
ssl.PROTOCOL_SSLv23
ssl.PROTOCOL_SSLv3
ssl.PROTOCOL_TLSv1
@@ -838,6 +838,7 @@
finally:
t.join()
+ @unittest.skipUnless(hasattr(ssl, 'PROTOCOL_SSLv2'), "need SSLv2")
def test_protocol_sslv2(self):
"""Connecting to an SSLv2 server with various client options"""
if support.verbose:
@@ -857,14 +858,15 @@
sys.stdout.write("\ntest_protocol_sslv23 disabled, "
"as it fails on OpenSSL 1.0.0+")
return
- try:
- try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True)
- except (ssl.SSLError, socket.error) as x:
- # this fails on some older versions of OpenSSL (0.9.7l, for instance)
- if support.verbose:
- sys.stdout.write(
- " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n"
- % str(x))
+ if hasattr(ssl, 'PROTOCOL_SSLv2'):
+ try:
+ try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv2, True)
+ except (ssl.SSLError, socket.error) as x:
+ # this fails on some older versions of OpenSSL (0.9.7l, for instance)
+ if support.verbose:
+ sys.stdout.write(
+ " SSL2 client to SSL23 server test unexpectedly failed:\n %s\n"
+ % str(x))
try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv3, True)
try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_SSLv23, True)
try_protocol_combo(ssl.PROTOCOL_SSLv23, ssl.PROTOCOL_TLSv1, True)
@@ -886,7 +888,8 @@
try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True)
try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_OPTIONAL)
try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv3, True, ssl.CERT_REQUIRED)
- try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False)
+ if hasattr(ssl, 'PROTOCOL_SSLv2'):
+ try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv2, False)
try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_SSLv23, False)
try_protocol_combo(ssl.PROTOCOL_SSLv3, ssl.PROTOCOL_TLSv1, False)
@@ -899,7 +902,8 @@
try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True)
try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_OPTIONAL)
try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_TLSv1, True, ssl.CERT_REQUIRED)
- try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False)
+ if hasattr(ssl, 'PROTOCOL_SSLv2'):
+ try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv2, False)
try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv3, False)
try_protocol_combo(ssl.PROTOCOL_TLSv1, ssl.PROTOCOL_SSLv23, False)
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 34d0fbc..a36b010 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -3,7 +3,13 @@
import zlib
except ImportError:
zlib = None
-import zipfile, os, unittest, sys, shutil, struct, io
+import io
+import os
+import shutil
+import struct
+import sys
+import unittest
+import zipfile
from tempfile import TemporaryFile
from random import randint, random
@@ -14,6 +20,7 @@
TESTFN2 = TESTFN + "2"
TESTFNDIR = TESTFN + "d"
FIXEDTEST_SIZE = 1000
+DATAFILES_DIR = 'zipfile_datafiles'
SMALL_TEST_DATA = [('_ziptest1', '1q2w3e4r5t'),
('ziptest2dir/_ziptest2', 'qawsedrftg'),
@@ -387,9 +394,24 @@
orig_zip.writestr(zinfo, data)
orig_zip.close()
+ def test_unicode_filenames(self):
+ if __name__ == '__main__':
+ myfile = sys.argv[0]
+ else:
+ myfile = __file__
+
+ mydir = os.path.dirname(myfile) or os.curdir
+ fname = os.path.join(mydir, 'zip_cp437_header.zip')
+
+ zipfp = zipfile.ZipFile(fname)
+ try:
+ zipfp.extractall()
+ finally:
+ zipfp.close()
+
def tearDown(self):
- os.remove(TESTFN)
- os.remove(TESTFN2)
+ support.unlink(TESTFN)
+ support.unlink(TESTFN2)
class TestZip64InSmallFiles(unittest.TestCase):
# These tests test the ZIP64 functionality without using large files,
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index ebf6ad4..71d5a51 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -19,11 +19,6 @@
from traceback import extract_tb, extract_stack, print_tb
raise_src = 'def do_raise(): raise TypeError\n'
-# so we only run testAFakeZlib once if this test is run repeatedly
-# which happens when we look for ref leaks
-test_imported = False
-
-
def make_pyc(co, mtime):
data = marshal.dumps(co)
if type(mtime) is type(0.0):
@@ -453,19 +448,7 @@
zipimport._zip_directory_cache.clear()
-def cleanup():
- # this is necessary if test is run repeated (like when finding leaks)
- global test_imported
- if test_imported:
- zipimport._zip_directory_cache.clear()
- if hasattr(UncompressedZipImportTestCase, 'testAFakeZlib'):
- delattr(UncompressedZipImportTestCase, 'testAFakeZlib')
- if hasattr(CompressedZipImportTestCase, 'testAFakeZlib'):
- delattr(CompressedZipImportTestCase, 'testAFakeZlib')
- test_imported = True
-
def test_main():
- cleanup()
try:
support.run_unittest(
UncompressedZipImportTestCase,
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index 7593c06..599ce24 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -186,6 +186,17 @@
def test_big_decompress_buffer(self, size):
self.check_big_decompress_buffer(size, zlib.decompress)
+ @precisionbigmemtest(size=_4G + 100, memuse=1)
+ def test_length_overflow(self, size):
+ if size < _4G + 100:
+ self.skipTest("not enough free memory, need at least 4 GB")
+ data = b'x' * size
+ try:
+ self.assertRaises(OverflowError, zlib.compress, data, 1)
+ self.assertRaises(OverflowError, zlib.decompress, data)
+ finally:
+ data = None
+
class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase):
# Test compression object
@@ -350,6 +361,15 @@
self.assertRaises(ValueError, dco.decompress, b"", -1)
self.assertEqual(b'', dco.unconsumed_tail)
+ def test_clear_unconsumed_tail(self):
+ # Issue #12050: calling decompress() without providing max_length
+ # should clear the unconsumed_tail attribute.
+ cdata = b"x\x9cKLJ\x06\x00\x02M\x01" # "abc"
+ dco = zlib.decompressobj()
+ ddata = dco.decompress(cdata, 1)
+ ddata += dco.decompress(dco.unconsumed_tail)
+ self.assertEqual(dco.unconsumed_tail, b"")
+
def test_flushes(self):
# Test flush() with the various options, using all the
# different levels in order to provide more variations.
@@ -503,6 +523,19 @@
decompress = lambda s: d.decompress(s) + d.flush()
self.check_big_decompress_buffer(size, decompress)
+ @precisionbigmemtest(size=_4G + 100, memuse=1)
+ def test_length_overflow(self, size):
+ if size < _4G + 100:
+ self.skipTest("not enough free memory, need at least 4 GB")
+ data = b'x' * size
+ c = zlib.compressobj(1)
+ d = zlib.decompressobj()
+ try:
+ self.assertRaises(OverflowError, c.compress, data)
+ self.assertRaises(OverflowError, d.decompress, data)
+ finally:
+ data = None
+
def genblock(seed, length, step=1024, generator=random):
"""length-byte stream of random data from a seed (in step-byte blocks)."""
diff --git a/Lib/test/zip_cp437_header.zip b/Lib/test/zip_cp437_header.zip
new file mode 100644
index 0000000..f7c6cf1
--- /dev/null
+++ b/Lib/test/zip_cp437_header.zip
Binary files differ
diff --git a/Lib/xml/__init__.py b/Lib/xml/__init__.py
index deed983..bf6d8dd 100644
--- a/Lib/xml/__init__.py
+++ b/Lib/xml/__init__.py
@@ -18,24 +18,3 @@
__all__ = ["dom", "parsers", "sax", "etree"]
-
-_MINIMUM_XMLPLUS_VERSION = (0, 8, 4)
-
-
-try:
- import _xmlplus
-except ImportError:
- pass
-else:
- try:
- v = _xmlplus.version_info
- except AttributeError:
- # _xmlplus is too old; ignore it
- pass
- else:
- if v >= _MINIMUM_XMLPLUS_VERSION:
- import sys
- _xmlplus.__path__.extend(__path__)
- sys.modules[__name__] = _xmlplus
- else:
- del v
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 2ec6306..a382383 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -928,7 +928,13 @@
if fheader[_FH_EXTRA_FIELD_LENGTH]:
zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])
- if fname != zinfo.orig_filename.encode("utf-8"):
+ if zinfo.flag_bits & 0x800:
+ # UTF-8 filename
+ fname_str = fname.decode("utf-8")
+ else:
+ fname_str = fname.decode("cp437")
+
+ if fname_str != zinfo.orig_filename:
raise BadZipfile(
'File name in directory %r and header %r differ.'
% (zinfo.orig_filename, fname))
diff --git a/Misc/ACKS b/Misc/ACKS
index 59b3661..80fda10 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -335,6 +335,7 @@
Lance Finn Helsten
Jonathan Hendry
James Henstridge
+Kasun Herath
Chris Herborth
Ivan Herman
Jürgen Hermann
diff --git a/Misc/NEWS b/Misc/NEWS
index 8878612..37bbbc1 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,15 @@
Core and Builtins
-----------------
+- Correct lookup of __dir__ on objects. Among other things, this causes errors
+ besides AttributeError found on lookup to be propagated.
+
+- Issue #12060: Use sig_atomic_t type and volatile keyword in the signal
+ module. Patch written by Charles-François Natali.
+
+- Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c,
+ clear the end-of-file indicator after CTRL+d.
+
- Issue #9756: When calling a method descriptor or a slot wrapper descriptor,
the check of the object type doesn't read the __class__ attribute anymore.
Fix a crash if a class override its __class__ attribute (e.g. a proxy of the
@@ -66,6 +75,56 @@
Library
-------
+- Issue #12124: zipimport doesn't keep a reference to zlib.decompress() anymore
+ to be able to unload the module.
+
+- Issue #10801: In zipfile, support different encodings for the header and
+ the filenames.
+
+- Issue #10154, #10090: change the normalization of UTF-8 to "UTF-8" instead
+ of "UTF8" in the locale module as the latter is not supported MacOSX and OpenBSD.
+
+- Issue #10756: atexit normalizes the exception before displaying it. Patch by
+ Andreas Stührk.
+
+- Issue #8650: Make zlib module 64-bit clean. compress(), decompress() and
+ their incremental counterparts now raise OverflowError if given an input
+ larger than 4GB, instead of silently truncating the input and returning
+ an incorrect result.
+
+- Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail
+ attribute when called without a max_length argument.
+
+- Issue #12062: Fix a flushing bug when doing a certain type of I/O sequence
+ on a file opened in read+write mode (namely: reading, seeking a bit forward,
+ writing, then seeking before the previous write but still within buffered
+ data, and writing again).
+
+- Issue #1028: Tk returns invalid Unicode null in %A: UnicodeDecodeError.
+ With Tk < 8.5 _tkinter.c:PythonCmd() raised UnicodeDecodeError, caused
+ IDLE to exit. Converted to valid Unicode null in PythonCmd().
+
+- Issue #10419: Fix build_scripts command of distutils to handle correctly
+ non-ASCII scripts. Open and write the script in binary mode, but ensure that
+ the shebang is decodable from UTF-8 and from the encoding of the script.
+
+- Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional.
+
+- Issue #11164: Stop trying to use _xmlplus in the xml module.
+
+- Issue #11927: SMTP_SSL now uses port 465 by default as documented. Patch
+ by Kasun Herath.
+
+- Issue #12002: ftplib's abort() method raises TypeError.
+
+- Issue #11999: fixed sporadic sync failure mailbox.Maildir due to its trying to
+ detect mtime changes by comparing to the system clock instead of to the
+ previous value of the mtime.
+
+- Issue #10684: shutil.move used to delete a folder on case insensitive
+ filesystems when the source and destination name where the same except
+ for the case.
+
- Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X to get
around a mmap bug with sparse files. Patch written by Steffen Daode Nurpmeso.
@@ -303,8 +362,14 @@
- Issue #11500: Fixed a bug in the os x proxy bypass code for fully qualified
IP addresses in the proxy exception list.
-Extensions
-----------
+Extension Modules
+-----------------
+
+- Issue #12051: Fix segfault in json.dumps() while encoding highly-nested
+ objects using the C accelerations.
+
+- Issue #12017: Fix segfault in json.loads() while decoding highly-nested
+ objects using the C accelerations.
- Issue #1838: Prevent segfault in ctypes, when _as_parameter_ on a class is set
to an instance of the class.
@@ -337,6 +402,13 @@
Tests
-----
+- Issue #11614: import __hello__ prints "Hello World!". Patch written by
+ Andreas Stührk.
+
+- Issue #5723: Improve json tests to be executed with and without accelerations.
+
+- Issue #11910: Fix test_heapq to skip the C tests when _heapq is missing.
+
- Fix test_startfile to wait for child process to terminate before finishing.
- Issue #11719: Fix message about unexpected test_msilib skip on non-Windows
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index 71c4052..25b91e3 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -1749,7 +1749,7 @@
avail = Py_SAFE_DOWNCAST(self->buffer_size - self->pos, Py_off_t, Py_ssize_t);
if (buf.len <= avail) {
memcpy(self->buffer + self->pos, buf.buf, buf.len);
- if (!VALID_WRITE_BUFFER(self)) {
+ if (!VALID_WRITE_BUFFER(self) || self->write_pos > self->pos) {
self->write_pos = self->pos;
}
ADJUST_POSITION(self, self->pos + buf.len);
diff --git a/Modules/_json.c b/Modules/_json.c
index 4da5e74..5ced5c9 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -899,6 +899,7 @@
Returns a new PyObject representation of the term.
*/
+ PyObject *res;
Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr);
Py_ssize_t length = PyUnicode_GET_SIZE(pystr);
if (idx >= length) {
@@ -913,10 +914,20 @@
next_idx_ptr);
case '{':
/* object */
- return _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr);
+ if (Py_EnterRecursiveCall(" while decoding a JSON object "
+ "from a unicode string"))
+ return NULL;
+ res = _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr);
+ Py_LeaveRecursiveCall();
+ return res;
case '[':
/* array */
- return _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr);
+ if (Py_EnterRecursiveCall(" while decoding a JSON array "
+ "from a unicode string"))
+ return NULL;
+ res = _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr);
+ Py_LeaveRecursiveCall();
+ return res;
case 'n':
/* null */
if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') {
@@ -1290,10 +1301,18 @@
return _steal_list_append(rval, encoded);
}
else if (PyList_Check(obj) || PyTuple_Check(obj)) {
- return encoder_listencode_list(s, rval, obj, indent_level);
+ if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+ return -1;
+ rv = encoder_listencode_list(s, rval, obj, indent_level);
+ Py_LeaveRecursiveCall();
+ return rv;
}
else if (PyDict_Check(obj)) {
- return encoder_listencode_dict(s, rval, obj, indent_level);
+ if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+ return -1;
+ rv = encoder_listencode_dict(s, rval, obj, indent_level);
+ Py_LeaveRecursiveCall();
+ return rv;
}
else {
PyObject *ident = NULL;
@@ -1319,7 +1338,12 @@
Py_XDECREF(ident);
return -1;
}
+
+ if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+ return -1;
rv = encoder_listencode_obj(s, rval, newobj, indent_level);
+ Py_LeaveRecursiveCall();
+
Py_DECREF(newobj);
if (rv) {
Py_XDECREF(ident);
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 73a76bb..8ebdc9b 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -63,8 +63,10 @@
};
enum py_ssl_version {
+#ifndef OPENSSL_NO_SSL2
PY_SSL_VERSION_SSL2,
- PY_SSL_VERSION_SSL3,
+#endif
+ PY_SSL_VERSION_SSL3=1,
PY_SSL_VERSION_SSL23,
PY_SSL_VERSION_TLS1
};
@@ -306,8 +308,10 @@
self->ctx = SSL_CTX_new(TLSv1_method()); /* Set up context */
else if (proto_version == PY_SSL_VERSION_SSL3)
self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */
+#ifndef OPENSSL_NO_SSL2
else if (proto_version == PY_SSL_VERSION_SSL2)
self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */
+#endif
else if (proto_version == PY_SSL_VERSION_SSL23)
self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
PySSL_END_ALLOW_THREADS
@@ -1787,8 +1791,10 @@
PY_SSL_CERT_REQUIRED);
/* protocol versions */
+#ifndef OPENSSL_NO_SSL2
PyModule_AddIntConstant(m, "PROTOCOL_SSLv2",
PY_SSL_VERSION_SSL2);
+#endif
PyModule_AddIntConstant(m, "PROTOCOL_SSLv3",
PY_SSL_VERSION_SSL3);
PyModule_AddIntConstant(m, "PROTOCOL_SSLv23",
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 8552575..438955e 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2023,7 +2023,19 @@
for (i = 0; i < (argc - 1); i++) {
PyObject *s = PyUnicode_FromString(argv[i + 1]);
- if (!s || PyTuple_SetItem(arg, i, s)) {
+ if (!s) {
+ /* Is Tk leaking 0xC080 in %A - a "modified" utf-8 null? */
+ if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError) &&
+ !strcmp(argv[i + 1], "\xC0\x80")) {
+ PyErr_Clear();
+ /* Convert to "strict" utf-8 null */
+ s = PyUnicode_FromString("\0");
+ } else {
+ Py_DECREF(arg);
+ return PythonCmd_Error(interp);
+ }
+ }
+ if (PyTuple_SetItem(arg, i, s)) {
Py_DECREF(arg);
return PythonCmd_Error(interp);
}
diff --git a/Modules/atexitmodule.c b/Modules/atexitmodule.c
index 1382133..1ee7ead 100644
--- a/Modules/atexitmodule.c
+++ b/Modules/atexitmodule.c
@@ -72,6 +72,7 @@
PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
if (!PyErr_ExceptionMatches(PyExc_SystemExit)) {
PySys_WriteStderr("Error in atexit._run_exitfuncs:\n");
+ PyErr_NormalizeException(&exc_type, &exc_value, &exc_tb);
PyErr_Display(exc_type, exc_value, exc_tb);
}
}
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 1429770..5a6c777 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -78,12 +78,12 @@
static pid_t main_pid;
#endif
-static struct {
- int tripped;
+static volatile struct {
+ sig_atomic_t tripped;
PyObject *func;
} Handlers[NSIG];
-static sig_atomic_t wakeup_fd = -1;
+static volatile sig_atomic_t wakeup_fd = -1;
/* Speed up sigcheck() when none tripped */
static volatile sig_atomic_t is_tripped = 0;
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index fb5f42b..e874498 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -785,35 +785,33 @@
/* Return the zlib.decompress function object, or NULL if zlib couldn't
be imported. The function is cached when found, so subsequent calls
- don't import zlib again. Returns a *borrowed* reference.
- XXX This makes zlib.decompress immortal. */
+ don't import zlib again. */
static PyObject *
get_decompress_func(void)
{
- static PyObject *decompress = NULL;
+ static int importing_zlib = 0;
+ PyObject *zlib;
+ PyObject *decompress;
- if (decompress == NULL) {
- PyObject *zlib;
- static int importing_zlib = 0;
-
- if (importing_zlib != 0)
- /* Someone has a zlib.py[co] in their Zip file;
- let's avoid a stack overflow. */
- return NULL;
- importing_zlib = 1;
- zlib = PyImport_ImportModuleNoBlock("zlib");
- importing_zlib = 0;
- if (zlib != NULL) {
- decompress = PyObject_GetAttrString(zlib,
- "decompress");
- Py_DECREF(zlib);
- }
- else
- PyErr_Clear();
- if (Py_VerboseFlag)
- PySys_WriteStderr("# zipimport: zlib %s\n",
- zlib != NULL ? "available": "UNAVAILABLE");
+ if (importing_zlib != 0)
+ /* Someone has a zlib.py[co] in their Zip file;
+ let's avoid a stack overflow. */
+ return NULL;
+ importing_zlib = 1;
+ zlib = PyImport_ImportModuleNoBlock("zlib");
+ importing_zlib = 0;
+ if (zlib != NULL) {
+ decompress = PyObject_GetAttrString(zlib,
+ "decompress");
+ Py_DECREF(zlib);
}
+ else {
+ PyErr_Clear();
+ decompress = NULL;
+ }
+ if (Py_VerboseFlag)
+ PySys_WriteStderr("# zipimport: zlib %s\n",
+ zlib != NULL ? "available": "UNAVAILABLE");
return decompress;
}
@@ -904,6 +902,7 @@
goto error;
}
data = PyObject_CallFunction(decompress, "Oi", raw_data, -15);
+ Py_DECREF(decompress);
error:
Py_DECREF(raw_data);
return data;
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index c78cf42..ba0e59c 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -116,13 +116,20 @@
{
PyObject *ReturnVal = NULL;
Py_buffer pinput;
- Byte *input, *output;
- int length, level=Z_DEFAULT_COMPRESSION, err;
+ Byte *input, *output = NULL;
+ unsigned int length;
+ int level=Z_DEFAULT_COMPRESSION, err;
z_stream zst;
/* require Python string object, optional 'level' arg */
if (!PyArg_ParseTuple(args, "y*|i:compress", &pinput, &level))
return NULL;
+
+ if (pinput.len > UINT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Size does not fit in an unsigned int");
+ goto error;
+ }
input = pinput.buf;
length = pinput.len;
@@ -130,10 +137,9 @@
output = (Byte*)malloc(zst.avail_out);
if (output == NULL) {
- PyBuffer_Release(&pinput);
PyErr_SetString(PyExc_MemoryError,
"Can't allocate memory to compress data");
- return NULL;
+ goto error;
}
/* Past the point of no return. From here on out, we need to make sure
@@ -196,10 +202,11 @@
static PyObject *
PyZlib_decompress(PyObject *self, PyObject *args)
{
- PyObject *result_str;
+ PyObject *result_str = NULL;
Py_buffer pinput;
Byte *input;
- int length, err;
+ unsigned int length;
+ int err;
int wsize=DEF_WBITS;
Py_ssize_t r_strlen=DEFAULTALLOC;
z_stream zst;
@@ -207,6 +214,12 @@
if (!PyArg_ParseTuple(args, "y*|in:decompress",
&pinput, &wsize, &r_strlen))
return NULL;
+
+ if (pinput.len > UINT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Size does not fit in an unsigned int");
+ goto error;
+ }
input = pinput.buf;
length = pinput.len;
@@ -216,10 +229,8 @@
zst.avail_in = length;
zst.avail_out = r_strlen;
- if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen))) {
- PyBuffer_Release(&pinput);
- return NULL;
- }
+ if (!(result_str = PyBytes_FromStringAndSize(NULL, r_strlen)))
+ goto error;
zst.zalloc = (alloc_func)NULL;
zst.zfree = (free_func)Z_NULL;
@@ -409,22 +420,26 @@
static PyObject *
PyZlib_objcompress(compobject *self, PyObject *args)
{
- int err, inplen;
+ int err;
+ unsigned int inplen;
Py_ssize_t length = DEFAULTALLOC;
- PyObject *RetVal;
+ PyObject *RetVal = NULL;
Py_buffer pinput;
Byte *input;
unsigned long start_total_out;
if (!PyArg_ParseTuple(args, "y*:compress", &pinput))
return NULL;
+ if (pinput.len > UINT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Size does not fit in an unsigned int");
+ goto error_outer;
+ }
input = pinput.buf;
inplen = pinput.len;
- if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) {
- PyBuffer_Release(&pinput);
- return NULL;
- }
+ if (!(RetVal = PyBytes_FromStringAndSize(NULL, length)))
+ goto error_outer;
ENTER_ZLIB(self);
@@ -473,6 +488,7 @@
error:
LEAVE_ZLIB(self);
+ error_outer:
PyBuffer_Release(&pinput);
return RetVal;
}
@@ -491,9 +507,10 @@
static PyObject *
PyZlib_objdecompress(compobject *self, PyObject *args)
{
- int err, inplen, max_length = 0;
+ int err, max_length = 0;
+ unsigned int inplen;
Py_ssize_t old_length, length = DEFAULTALLOC;
- PyObject *RetVal;
+ PyObject *RetVal = NULL;
Py_buffer pinput;
Byte *input;
unsigned long start_total_out;
@@ -501,22 +518,24 @@
if (!PyArg_ParseTuple(args, "y*|i:decompress", &pinput,
&max_length))
return NULL;
+ if (pinput.len > UINT_MAX) {
+ PyErr_SetString(PyExc_OverflowError,
+ "Size does not fit in an unsigned int");
+ goto error_outer;
+ }
input = pinput.buf;
inplen = pinput.len;
if (max_length < 0) {
- PyBuffer_Release(&pinput);
PyErr_SetString(PyExc_ValueError,
"max_length must be greater than zero");
- return NULL;
+ goto error_outer;
}
/* limit amount of data allocated to max_length */
if (max_length && length > max_length)
length = max_length;
- if (!(RetVal = PyBytes_FromStringAndSize(NULL, length))) {
- PyBuffer_Release(&pinput);
- return NULL;
- }
+ if (!(RetVal = PyBytes_FromStringAndSize(NULL, length)))
+ goto error_outer;
ENTER_ZLIB(self);
@@ -560,17 +579,22 @@
Py_END_ALLOW_THREADS
}
- /* Not all of the compressed data could be accommodated in the output buffer
- of specified size. Return the unconsumed tail in an attribute.*/
if(max_length) {
+ /* Not all of the compressed data could be accommodated in a buffer of
+ the specified size. Return the unconsumed tail in an attribute. */
Py_DECREF(self->unconsumed_tail);
self->unconsumed_tail = PyBytes_FromStringAndSize((char *)self->zst.next_in,
self->zst.avail_in);
- if(!self->unconsumed_tail) {
- Py_DECREF(RetVal);
- RetVal = NULL;
- goto error;
- }
+ }
+ else if (PyBytes_GET_SIZE(self->unconsumed_tail) > 0) {
+ /* All of the compressed data was consumed. Clear unconsumed_tail. */
+ Py_DECREF(self->unconsumed_tail);
+ self->unconsumed_tail = PyBytes_FromStringAndSize("", 0);
+ }
+ if (self->unconsumed_tail == NULL) {
+ Py_DECREF(RetVal);
+ RetVal = NULL;
+ goto error;
}
/* The end of the compressed data has been reached, so set the
@@ -605,6 +629,7 @@
error:
LEAVE_ZLIB(self);
+ error_outer:
PyBuffer_Release(&pinput);
return RetVal;
}
diff --git a/Objects/object.c b/Objects/object.c
index d534273..ac57cd7 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1348,14 +1348,15 @@
static PyObject *
_dir_object(PyObject *obj)
{
- PyObject * result = NULL;
- PyObject * dirfunc = PyObject_GetAttrString((PyObject*)obj->ob_type,
- "__dir__");
+ PyObject *result = NULL;
+ static PyObject *dir_str = NULL;
+ PyObject *dirfunc = _PyObject_LookupSpecial(obj, "__dir__", &dir_str);
assert(obj);
if (dirfunc == NULL) {
+ if (PyErr_Occurred())
+ return NULL;
/* use default implementation */
- PyErr_Clear();
if (PyModule_Check(obj))
result = _specialized_dir_module(obj);
else if (PyType_Check(obj))
@@ -1365,7 +1366,7 @@
}
else {
/* use __dir__ */
- result = PyObject_CallFunctionObjArgs(dirfunc, obj, NULL);
+ result = PyObject_CallFunctionObjArgs(dirfunc, NULL);
Py_DECREF(dirfunc);
if (result == NULL)
return NULL;
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
index 7166fc1..4cc4b2c 100644
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -73,6 +73,7 @@
}
#endif /* MS_WINDOWS */
if (feof(fp)) {
+ clearerr(fp);
return -1; /* EOF */
}
#ifdef EINTR
diff --git a/Python/frozen.c b/Python/frozen.c
index 57d8257..ddf6224 100644
--- a/Python/frozen.c
+++ b/Python/frozen.c
@@ -12,14 +12,17 @@
the appropriate bytes from M___main__.c. */
static unsigned char M___hello__[] = {
- 99,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
- 0,64,0,0,0,115,10,0,0,0,100,1,0,90,1,0,
- 100,0,0,83,40,2,0,0,0,78,84,40,2,0,0,0,
- 117,4,0,0,0,84,114,117,101,117,11,0,0,0,105,110,
- 105,116,105,97,108,105,122,101,100,40,0,0,0,0,40,0,
- 0,0,0,40,0,0,0,0,117,7,0,0,0,102,108,97,
- 103,46,112,121,117,8,0,0,0,60,109,111,100,117,108,101,
- 62,1,0,0,0,115,0,0,0,0,
+ 99,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+ 0,64,0,0,0,115,20,0,0,0,100,2,0,90,1,0,
+ 101,2,0,100,0,0,131,1,0,1,100,1,0,83,40,3,
+ 0,0,0,117,12,0,0,0,72,101,108,108,111,32,119,111,
+ 114,108,100,33,78,84,40,3,0,0,0,117,4,0,0,0,
+ 84,114,117,101,117,11,0,0,0,105,110,105,116,105,97,108,
+ 105,122,101,100,117,5,0,0,0,112,114,105,110,116,40,0,
+ 0,0,0,40,0,0,0,0,40,0,0,0,0,117,7,0,
+ 0,0,102,108,97,103,46,112,121,117,8,0,0,0,60,109,
+ 111,100,117,108,101,62,1,0,0,0,115,2,0,0,0,6,
+ 1,
};
#define SIZE (int)sizeof(M___hello__)
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index c6cf088..c4ae921 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -82,7 +82,7 @@
int Py_DebugFlag; /* Needed by parser.c */
int Py_VerboseFlag; /* Needed by import.c */
int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
-int Py_InspectFlag; /* Needed to determine whether to exit at SystemError */
+int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
int Py_NoSiteFlag; /* Suppress 'import site' */
int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
diff --git a/Tools/freeze/flag.py b/Tools/freeze/flag.py
index ea6d633..1cefa0a 100644
--- a/Tools/freeze/flag.py
+++ b/Tools/freeze/flag.py
@@ -1 +1,2 @@
initialized = True
+print("Hello world!")