From solipsis at pitrou.net Sun Jan 1 05:31:47 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 01 Jan 2012 05:31:47 +0100 Subject: [Python-checkins] Daily reference leaks (0ddb0bb63550): sum=0 Message-ID: results for 0ddb0bb63550 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/refloggE5vEw', '-x'] From python-checkins at python.org Sun Jan 1 05:45:46 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 01 Jan 2012 05:45:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_add_another_yea?= =?utf8?q?r_to_glorious_PSF_IP?= Message-ID: http://hg.python.org/cpython/rev/879798e70473 changeset: 74212:879798e70473 branch: 3.2 parent: 74204:ce349e1f923e user: Benjamin Peterson date: Sat Dec 31 22:42:26 2011 -0600 summary: add another year to glorious PSF IP files: Doc/README.txt | 2 +- Doc/copyright.rst | 2 +- Doc/license.rst | 2 +- LICENSE | 2 +- Python/getcopyright.c | 2 +- README | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/README.txt b/Doc/README.txt --- a/Doc/README.txt +++ b/Doc/README.txt @@ -135,7 +135,7 @@ as long as you don't change or remove the copyright notice: ---------------------------------------------------------------------- -Copyright (c) 2000-2011 Python Software Foundation. +Copyright (c) 2000-2012 Python Software Foundation. All rights reserved. Copyright (c) 2000 BeOpen.com. diff --git a/Doc/copyright.rst b/Doc/copyright.rst --- a/Doc/copyright.rst +++ b/Doc/copyright.rst @@ -4,7 +4,7 @@ Python and this documentation is: -Copyright ? 2001-2011 Python Software Foundation. All rights reserved. +Copyright ? 2001-2012 Python Software Foundation. All rights reserved. Copyright ? 2000 BeOpen.com. All rights reserved. diff --git a/Doc/license.rst b/Doc/license.rst --- a/Doc/license.rst +++ b/Doc/license.rst @@ -146,7 +146,7 @@ analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python |release| alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of - copyright, i.e., "Copyright ? 2001-2011 Python Software Foundation; All Rights + copyright, i.e., "Copyright ? 2001-2012 Python Software Foundation; All Rights Reserved" are retained in Python |release| alone or in any derivative version prepared by Licensee. diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -108,7 +108,7 @@ distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011 Python Software Foundation; All Rights Reserved" are retained in Python +2011, 2012 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on diff --git a/Python/getcopyright.c b/Python/getcopyright.c --- a/Python/getcopyright.c +++ b/Python/getcopyright.c @@ -4,7 +4,7 @@ static char cprt[] = "\ -Copyright (c) 2001-2011 Python Software Foundation.\n\ +Copyright (c) 2001-2012 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 2000 BeOpen.com.\n\ diff --git a/README b/README --- a/README +++ b/README @@ -1,8 +1,8 @@ This is Python version 3.2.2 ============================ -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -Python Software Foundation. All rights reserved. +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012 Python Software Foundation. All rights reserved. Python 3.x is a new version of the language, which is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 05:45:47 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 01 Jan 2012 05:45:47 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/c68bb5e41755 changeset: 74213:c68bb5e41755 branch: 3.2 parent: 74212:879798e70473 parent: 74209:ed4f7d9e0e96 user: Benjamin Peterson date: Sat Dec 31 22:42:45 2011 -0600 summary: merge heads files: Doc/howto/functional.rst | 6 ++-- Doc/howto/webservers.rst | 10 +++--- Doc/library/atexit.rst | 2 - Doc/library/multiprocessing.rst | 28 ++++++++++---------- Doc/using/unix.rst | 4 +- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst --- a/Doc/howto/functional.rst +++ b/Doc/howto/functional.rst @@ -1151,9 +1151,9 @@ Mertz also wrote a 3-part series of articles on functional programming for IBM's DeveloperWorks site; see -`part 1 `__, -`part 2 `__, and -`part 3 `__, +`part 1 `__, +`part 2 `__, and +`part 3 `__, Python documentation diff --git a/Doc/howto/webservers.rst b/Doc/howto/webservers.rst --- a/Doc/howto/webservers.rst +++ b/Doc/howto/webservers.rst @@ -274,7 +274,7 @@ Each web server requires a specific module. * Apache has both `mod_fastcgi `_ and `mod_fcgid - `_. ``mod_fastcgi`` is the original one, but it + `_. ``mod_fastcgi`` is the original one, but it has some licensing issues, which is why it is sometimes considered non-free. ``mod_fcgid`` is a smaller, compatible alternative. One of these modules needs to be loaded by Apache. @@ -365,7 +365,7 @@ A really great WSGI feature is middleware. Middleware is a layer around your program which can add various functionality to it. There is quite a bit of -`middleware `_ already +`middleware `_ already available. For example, instead of writing your own session management (HTTP is a stateless protocol, so to associate multiple HTTP requests with a single user your application must create and manage such state via a session), you can @@ -396,9 +396,9 @@ .. seealso:: - A good overview of WSGI-related code can be found in the `WSGI wiki - `_, which contains an extensive list of `WSGI servers - `_ which can be used by *any* application + A good overview of WSGI-related code can be found in the `WSGI homepage + `_, which contains an extensive list of `WSGI servers + `_ which can be used by *any* application supporting WSGI. You might be interested in some WSGI-supporting modules already contained in diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst --- a/Doc/library/atexit.rst +++ b/Doc/library/atexit.rst @@ -6,9 +6,6 @@ .. moduleauthor:: Skip Montanaro .. sectionauthor:: Skip Montanaro -**Source code:** :source:`Lib/atexit.py` - --------------- The :mod:`atexit` module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -472,7 +472,7 @@ If you use :class:`JoinableQueue` then you **must** call :meth:`JoinableQueue.task_done` for each task removed from the queue or else the -semaphore used to count the number of unfinished tasks may eventually overflow +semaphore used to count the number of unfinished tasks may eventually overflow, raising an exception. Note that one can also create a shared queue by using a manager object -- see @@ -490,7 +490,7 @@ If a process is killed using :meth:`Process.terminate` or :func:`os.kill` while it is trying to use a :class:`Queue`, then the data in the queue is - likely to become corrupted. This may cause any other processes to get an + likely to become corrupted. This may cause any other process to get an exception when it tries to use the queue later on. .. warning:: @@ -692,7 +692,7 @@ (By default :data:`sys.executable` is used). Embedders will probably need to do some thing like :: - setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe')) + set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe')) before they can create child processes. (Windows only) @@ -711,7 +711,7 @@ Connection objects allow the sending and receiving of picklable objects or strings. They can be thought of as message oriented connected sockets. -Connection objects usually created using :func:`Pipe` -- see also +Connection objects are usually created using :func:`Pipe` -- see also :ref:`multiprocessing-listeners-clients`. .. class:: Connection @@ -732,7 +732,7 @@ .. method:: fileno() - Returns the file descriptor or handle used by the connection. + Return the file descriptor or handle used by the connection. .. method:: close() @@ -756,7 +756,7 @@ If *offset* is given then data is read from that position in *buffer*. If *size* is given then that many bytes will be read from buffer. Very large buffers (approximately 32 MB+, though it depends on the OS) may raise a - ValueError exception + :exc:`ValueError` exception .. method:: recv_bytes([maxlength]) @@ -1329,7 +1329,7 @@ >>>>>>>>>>>>>>>>>>> To create one's own manager, one creates a subclass of :class:`BaseManager` and -use the :meth:`~BaseManager.register` classmethod to register new types or +uses the :meth:`~BaseManager.register` classmethod to register new types or callables with the manager class. For example:: from multiprocessing.managers import BaseManager @@ -1580,9 +1580,9 @@ .. method:: apply(func[, args[, kwds]]) Call *func* with arguments *args* and keyword arguments *kwds*. It blocks - till the result is ready. Given this blocks, :meth:`apply_async` is better - suited for performing work in parallel. Additionally, the passed in - function is only executed in one of the workers of the pool. + until the result is ready. Given this blocks, :meth:`apply_async` is + better suited for performing work in parallel. Additionally, *func* + is only executed in one of the workers of the pool. .. method:: apply_async(func[, args[, kwds[, callback[, error_callback]]]]) @@ -1603,7 +1603,7 @@ .. method:: map(func, iterable[, chunksize]) A parallel equivalent of the :func:`map` built-in function (it supports only - one *iterable* argument though). It blocks till the result is ready. + one *iterable* argument though). It blocks until the result is ready. This method chops the iterable into a number of chunks which it submits to the process pool as separate tasks. The (approximate) size of these @@ -2060,7 +2060,7 @@ On Windows many types from :mod:`multiprocessing` need to be picklable so that child processes can use them. However, one should generally avoid sending shared objects to other processes using pipes or queues. Instead - you should arrange the program so that a process which need access to a + you should arrange the program so that a process which needs access to a shared resource created elsewhere can inherit it from an ancestor process. Avoid terminating processes @@ -2139,7 +2139,7 @@ for i in range(10): Process(target=f, args=(lock,)).start() -Beware replacing sys.stdin with a "file like object" +Beware of replacing :data:`sys.stdin` with a "file like object" :mod:`multiprocessing` originally unconditionally called:: @@ -2257,7 +2257,7 @@ An example showing how to use queues to feed tasks to a collection of worker -process and collect the results: +processes and collect the results: .. literalinclude:: ../includes/mp_workers.py diff --git a/Doc/using/unix.rst b/Doc/using/unix.rst --- a/Doc/using/unix.rst +++ b/Doc/using/unix.rst @@ -26,11 +26,11 @@ .. seealso:: - http://www.linux.com/articles/60383 + http://www.debian.org/doc/manuals/maint-guide/first.en.html for Debian users http://linuxmafia.com/pub/linux/suse-linux-internals/chapter35.html for OpenSuse users - http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-creating-rpms.html + http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-creating-rpms.html for Fedora users http://www.slackbook.org/html/package-management-making-packages.html for Slackware users -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 05:45:48 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 01 Jan 2012 05:45:48 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/262b755ac786 changeset: 74214:262b755ac786 parent: 74211:0ddb0bb63550 parent: 74213:c68bb5e41755 user: Benjamin Peterson date: Sat Dec 31 22:43:01 2011 -0600 summary: merge 3.2 files: Doc/README.txt | 2 +- Doc/copyright.rst | 2 +- Doc/license.rst | 2 +- LICENSE | 2 +- Python/getcopyright.c | 2 +- README | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/README.txt b/Doc/README.txt --- a/Doc/README.txt +++ b/Doc/README.txt @@ -135,7 +135,7 @@ as long as you don't change or remove the copyright notice: ---------------------------------------------------------------------- -Copyright (c) 2000-2011 Python Software Foundation. +Copyright (c) 2000-2012 Python Software Foundation. All rights reserved. Copyright (c) 2000 BeOpen.com. diff --git a/Doc/copyright.rst b/Doc/copyright.rst --- a/Doc/copyright.rst +++ b/Doc/copyright.rst @@ -4,7 +4,7 @@ Python and this documentation is: -Copyright ? 2001-2011 Python Software Foundation. All rights reserved. +Copyright ? 2001-2012 Python Software Foundation. All rights reserved. Copyright ? 2000 BeOpen.com. All rights reserved. diff --git a/Doc/license.rst b/Doc/license.rst --- a/Doc/license.rst +++ b/Doc/license.rst @@ -148,7 +148,7 @@ analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python |release| alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of - copyright, i.e., "Copyright ? 2001-2011 Python Software Foundation; All Rights + copyright, i.e., "Copyright ? 2001-2012 Python Software Foundation; All Rights Reserved" are retained in Python |release| alone or in any derivative version prepared by Licensee. diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -109,7 +109,7 @@ distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011 Python Software Foundation; All Rights Reserved" are retained in Python +2011, 2012 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on diff --git a/Python/getcopyright.c b/Python/getcopyright.c --- a/Python/getcopyright.c +++ b/Python/getcopyright.c @@ -4,7 +4,7 @@ static char cprt[] = "\ -Copyright (c) 2001-2011 Python Software Foundation.\n\ +Copyright (c) 2001-2012 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 2000 BeOpen.com.\n\ diff --git a/README b/README --- a/README +++ b/README @@ -1,8 +1,8 @@ This is Python version 3.3 alpha 0 ================================== -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -Python Software Foundation. All rights reserved. +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012 Python Software Foundation. All rights reserved. Python 3.x is a new version of the language, which is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 05:45:48 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 01 Jan 2012 05:45:48 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_add_another_yea?= =?utf8?q?r_to_glorious_PSF_IP?= Message-ID: http://hg.python.org/cpython/rev/01cd6db4147d changeset: 74215:01cd6db4147d branch: 2.7 parent: 74210:e9f517f8ee87 user: Benjamin Peterson date: Sat Dec 31 22:42:26 2011 -0600 summary: add another year to glorious PSF IP files: Doc/README.txt | 2 +- Doc/copyright.rst | 2 +- Doc/license.rst | 2 +- LICENSE | 6 +++--- Python/getcopyright.c | 2 +- README | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Doc/README.txt b/Doc/README.txt --- a/Doc/README.txt +++ b/Doc/README.txt @@ -127,7 +127,7 @@ as long as you don't change or remove the copyright notice: ---------------------------------------------------------------------- -Copyright (c) 2000-2008 Python Software Foundation. +Copyright (c) 2000-2012 Python Software Foundation. All rights reserved. Copyright (c) 2000 BeOpen.com. diff --git a/Doc/copyright.rst b/Doc/copyright.rst --- a/Doc/copyright.rst +++ b/Doc/copyright.rst @@ -4,7 +4,7 @@ Python and this documentation is: -Copyright ? 2001-2010 Python Software Foundation. All rights reserved. +Copyright ? 2001-2012 Python Software Foundation. All rights reserved. Copyright ? 2000 BeOpen.com. All rights reserved. diff --git a/Doc/license.rst b/Doc/license.rst --- a/Doc/license.rst +++ b/Doc/license.rst @@ -132,7 +132,7 @@ analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python |release| alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of - copyright, i.e., "Copyright ? 2001-2010 Python Software Foundation; All Rights + copyright, i.e., "Copyright ? 2001-2012 Python Software Foundation; All Rights Reserved" are retained in Python |release| alone or in any derivative version prepared by Licensee. diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -98,9 +98,9 @@ analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -Python Software Foundation; All Rights Reserved" are retained in Python alone or -in any derivative version prepared by Licensee. +i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +2011, 2012 Python Software Foundation; All Rights Reserved" are retained in Python +alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make diff --git a/Python/getcopyright.c b/Python/getcopyright.c --- a/Python/getcopyright.c +++ b/Python/getcopyright.c @@ -4,7 +4,7 @@ static char cprt[] = "\ -Copyright (c) 2001-2011 Python Software Foundation.\n\ +Copyright (c) 2001-2012 Python Software Foundation.\n\ All Rights Reserved.\n\ \n\ Copyright (c) 2000 BeOpen.com.\n\ diff --git a/README b/README --- a/README +++ b/README @@ -1,8 +1,8 @@ This is Python version 2.7.2 ============================ -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -Python Software Foundation. All rights reserved. +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, +2012 Python Software Foundation. All rights reserved. Copyright (c) 2000 BeOpen.com. All rights reserved. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 10:11:46 2012 From: python-checkins at python.org (ned.deily) Date: Sun, 01 Jan 2012 10:11:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Update_copyrigh?= =?utf8?q?t_dates_in_Mac_plists=2E?= Message-ID: http://hg.python.org/cpython/rev/5024cf122795 changeset: 74216:5024cf122795 branch: 2.7 user: Ned Deily date: Sun Jan 01 01:08:08 2012 -0800 summary: Update copyright dates in Mac plists. files: Mac/IDLE/Info.plist.in | 2 +- Mac/PythonLauncher/Info.plist.in | 2 +- Mac/Resources/app/Info.plist.in | 6 +++--- Mac/Resources/framework/Info.plist.in | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Mac/IDLE/Info.plist.in b/Mac/IDLE/Info.plist.in --- a/Mac/IDLE/Info.plist.in +++ b/Mac/IDLE/Info.plist.in @@ -36,7 +36,7 @@ CFBundleExecutable IDLE CFBundleGetInfoString - %VERSION%, ? 2001-2011 Python Software Foundation + %VERSION%, ? 2001-2012 Python Software Foundation CFBundleIconFile IDLE.icns CFBundleIdentifier diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in --- a/Mac/PythonLauncher/Info.plist.in +++ b/Mac/PythonLauncher/Info.plist.in @@ -40,7 +40,7 @@ CFBundleExecutable PythonLauncher CFBundleGetInfoString - %VERSION%, ? 2001-2011 Python Software Foundation + %VERSION%, ? 2001-2012 Python Software Foundation CFBundleIconFile PythonLauncher.icns CFBundleIdentifier diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in --- a/Mac/Resources/app/Info.plist.in +++ b/Mac/Resources/app/Info.plist.in @@ -20,7 +20,7 @@ CFBundleExecutable Python CFBundleGetInfoString - %version%, (c) 2004-2011 Python Software Foundation. + %version%, (c) 2004-2012 Python Software Foundation. CFBundleHelpBookFolder Documentation @@ -37,7 +37,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleLongVersionString - %version%, (c) 2004-2011 Python Software Foundation. + %version%, (c) 2004-2012 Python Software Foundation. CFBundleName Python CFBundlePackageType @@ -55,6 +55,6 @@ NSAppleScriptEnabled NSHumanReadableCopyright - (c) 2011 Python Software Foundation. + (c) 2012 Python Software Foundation. diff --git a/Mac/Resources/framework/Info.plist.in b/Mac/Resources/framework/Info.plist.in --- a/Mac/Resources/framework/Info.plist.in +++ b/Mac/Resources/framework/Info.plist.in @@ -17,9 +17,9 @@ CFBundlePackageType FMWK CFBundleShortVersionString - %VERSION%, (c) 2004-2011 Python Software Foundation. + %VERSION%, (c) 2004-2012 Python Software Foundation. CFBundleLongVersionString - %VERSION%, (c) 2004-2011 Python Software Foundation. + %VERSION%, (c) 2004-2012 Python Software Foundation. CFBundleSignature ???? CFBundleVersion -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 10:11:47 2012 From: python-checkins at python.org (ned.deily) Date: Sun, 01 Jan 2012 10:11:47 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Update_copyrigh?= =?utf8?q?t_dates_in_Mac_plists=2E?= Message-ID: http://hg.python.org/cpython/rev/e0a4e6538182 changeset: 74217:e0a4e6538182 branch: 3.2 parent: 74213:c68bb5e41755 user: Ned Deily date: Sun Jan 01 01:09:19 2012 -0800 summary: Update copyright dates in Mac plists. files: Mac/IDLE/IDLE.app/Contents/Info.plist | 2 +- Mac/PythonLauncher/Info.plist.in | 2 +- Mac/Resources/app/Info.plist.in | 6 +++--- Mac/Resources/framework/Info.plist.in | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist --- a/Mac/IDLE/IDLE.app/Contents/Info.plist +++ b/Mac/IDLE/IDLE.app/Contents/Info.plist @@ -36,7 +36,7 @@ CFBundleExecutable IDLE CFBundleGetInfoString - %version%, ? 2001-2011 Python Software Foundation + %version%, ? 2001-2012 Python Software Foundation CFBundleIconFile IDLE.icns CFBundleIdentifier diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in --- a/Mac/PythonLauncher/Info.plist.in +++ b/Mac/PythonLauncher/Info.plist.in @@ -40,7 +40,7 @@ CFBundleExecutable PythonLauncher CFBundleGetInfoString - %VERSION%, ? 2001-2011 Python Software Foundation + %VERSION%, ? 2001-2012 Python Software Foundation CFBundleIconFile PythonLauncher.icns CFBundleIdentifier diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in --- a/Mac/Resources/app/Info.plist.in +++ b/Mac/Resources/app/Info.plist.in @@ -20,7 +20,7 @@ CFBundleExecutable Python CFBundleGetInfoString - %version%, (c) 2004-2011 Python Software Foundation. + %version%, (c) 2004-2012 Python Software Foundation. CFBundleHelpBookFolder Documentation @@ -37,7 +37,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleLongVersionString - %version%, (c) 2004-2011 Python Software Foundation. + %version%, (c) 2004-2012 Python Software Foundation. CFBundleName Python CFBundlePackageType @@ -55,6 +55,6 @@ NSAppleScriptEnabled NSHumanReadableCopyright - (c) 2011 Python Software Foundation. + (c) 2012 Python Software Foundation. diff --git a/Mac/Resources/framework/Info.plist.in b/Mac/Resources/framework/Info.plist.in --- a/Mac/Resources/framework/Info.plist.in +++ b/Mac/Resources/framework/Info.plist.in @@ -17,9 +17,9 @@ CFBundlePackageType FMWK CFBundleShortVersionString - %VERSION%, (c) 2004-2011 Python Software Foundation. + %VERSION%, (c) 2004-2012 Python Software Foundation. CFBundleLongVersionString - %VERSION%, (c) 2004-2011 Python Software Foundation. + %VERSION%, (c) 2004-2012 Python Software Foundation. CFBundleSignature ???? CFBundleVersion -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 10:11:47 2012 From: python-checkins at python.org (ned.deily) Date: Sun, 01 Jan 2012 10:11:47 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/0780b7c3d231 changeset: 74218:0780b7c3d231 parent: 74214:262b755ac786 parent: 74217:e0a4e6538182 user: Ned Deily date: Sun Jan 01 01:10:35 2012 -0800 summary: merge 3.2 files: Mac/IDLE/IDLE.app/Contents/Info.plist | 2 +- Mac/PythonLauncher/Info.plist.in | 2 +- Mac/Resources/app/Info.plist.in | 6 +++--- Mac/Resources/framework/Info.plist.in | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Mac/IDLE/IDLE.app/Contents/Info.plist b/Mac/IDLE/IDLE.app/Contents/Info.plist --- a/Mac/IDLE/IDLE.app/Contents/Info.plist +++ b/Mac/IDLE/IDLE.app/Contents/Info.plist @@ -36,7 +36,7 @@ CFBundleExecutable IDLE CFBundleGetInfoString - %version%, ? 2001-2011 Python Software Foundation + %version%, ? 2001-2012 Python Software Foundation CFBundleIconFile IDLE.icns CFBundleIdentifier diff --git a/Mac/PythonLauncher/Info.plist.in b/Mac/PythonLauncher/Info.plist.in --- a/Mac/PythonLauncher/Info.plist.in +++ b/Mac/PythonLauncher/Info.plist.in @@ -40,7 +40,7 @@ CFBundleExecutable PythonLauncher CFBundleGetInfoString - %VERSION%, ? 2001-2011 Python Software Foundation + %VERSION%, ? 2001-2012 Python Software Foundation CFBundleIconFile PythonLauncher.icns CFBundleIdentifier diff --git a/Mac/Resources/app/Info.plist.in b/Mac/Resources/app/Info.plist.in --- a/Mac/Resources/app/Info.plist.in +++ b/Mac/Resources/app/Info.plist.in @@ -20,7 +20,7 @@ CFBundleExecutable Python CFBundleGetInfoString - %version%, (c) 2004-2011 Python Software Foundation. + %version%, (c) 2004-2012 Python Software Foundation. CFBundleHelpBookFolder Documentation @@ -37,7 +37,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleLongVersionString - %version%, (c) 2004-2011 Python Software Foundation. + %version%, (c) 2004-2012 Python Software Foundation. CFBundleName Python CFBundlePackageType @@ -55,6 +55,6 @@ NSAppleScriptEnabled NSHumanReadableCopyright - (c) 2011 Python Software Foundation. + (c) 2012 Python Software Foundation. diff --git a/Mac/Resources/framework/Info.plist.in b/Mac/Resources/framework/Info.plist.in --- a/Mac/Resources/framework/Info.plist.in +++ b/Mac/Resources/framework/Info.plist.in @@ -17,9 +17,9 @@ CFBundlePackageType FMWK CFBundleShortVersionString - %VERSION%, (c) 2004-2011 Python Software Foundation. + %VERSION%, (c) 2004-2012 Python Software Foundation. CFBundleLongVersionString - %VERSION%, (c) 2004-2011 Python Software Foundation. + %VERSION%, (c) 2004-2012 Python Software Foundation. CFBundleSignature ???? CFBundleVersion -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 12:18:43 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 12:18:43 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjgz?= =?utf8?q?=3A_raise_with_no_exception_in_scope_throws_a_RuntimeError=3B_fi?= =?utf8?q?x_by?= Message-ID: http://hg.python.org/cpython/rev/420e01156272 changeset: 74219:420e01156272 branch: 3.2 parent: 74217:e0a4e6538182 user: Sandro Tosi date: Sun Jan 01 12:17:15 2012 +0100 summary: Issue #13683: raise with no exception in scope throws a RuntimeError; fix by Ramchandra Apte files: Doc/reference/simple_stmts.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -495,8 +495,8 @@ If no expressions are present, :keyword:`raise` re-raises the last exception that was active in the current scope. If no exception is active in the current -scope, a :exc:`TypeError` exception is raised indicating that this is an error -(if running under IDLE, a :exc:`queue.Empty` exception is raised instead). +scope, a :exc:`RuntimeError` exception is raised indicating that this is an +error. Otherwise, :keyword:`raise` evaluates the first expression as the exception object. It must be either a subclass or an instance of :class:`BaseException`. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 12:18:44 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 12:18:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/8633cf8e8b20 changeset: 74220:8633cf8e8b20 parent: 74218:0780b7c3d231 parent: 74219:420e01156272 user: Sandro Tosi date: Sun Jan 01 12:17:36 2012 +0100 summary: merge with 3.2 files: Doc/reference/simple_stmts.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -495,8 +495,8 @@ If no expressions are present, :keyword:`raise` re-raises the last exception that was active in the current scope. If no exception is active in the current -scope, a :exc:`TypeError` exception is raised indicating that this is an error -(if running under IDLE, a :exc:`queue.Empty` exception is raised instead). +scope, a :exc:`RuntimeError` exception is raised indicating that this is an +error. Otherwise, :keyword:`raise` evaluates the first expression as the exception object. It must be either a subclass or an instance of :class:`BaseException`. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 12:57:27 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 12:57:27 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNjkw?= =?utf8?q?=3A_add_re=2EDEBUG=3B_patch_by_Filip_Gruszczy=C5=84ski?= Message-ID: http://hg.python.org/cpython/rev/9aebb4d07ddf changeset: 74221:9aebb4d07ddf branch: 2.7 parent: 74216:5024cf122795 user: Sandro Tosi date: Sun Jan 01 12:52:24 2012 +0100 summary: Issue #13690: add re.DEBUG; patch by Filip Gruszczy?ski files: Doc/library/re.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -462,6 +462,11 @@ about compiling regular expressions. +.. data:: DEBUG + + Display debug information about compiled expression. + + .. data:: I IGNORECASE -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 12:57:28 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 12:57:28 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjkw?= =?utf8?q?=3A_add_re=2EDEBUG=3B_patch_by_Filip_Gruszczy=C5=84ski?= Message-ID: http://hg.python.org/cpython/rev/f4a9c7cf98dd changeset: 74222:f4a9c7cf98dd branch: 3.2 parent: 74219:420e01156272 user: Sandro Tosi date: Sun Jan 01 12:55:20 2012 +0100 summary: Issue #13690: add re.DEBUG; patch by Filip Gruszczy?ski files: Doc/library/re.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -498,6 +498,11 @@ isn't allowed for bytes). +.. data:: DEBUG + + Display debug information about compiled expression. + + .. data:: I IGNORECASE -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 12:57:28 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 12:57:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/3cc47ed7a291 changeset: 74223:3cc47ed7a291 parent: 74220:8633cf8e8b20 parent: 74222:f4a9c7cf98dd user: Sandro Tosi date: Sun Jan 01 12:56:04 2012 +0100 summary: merge with 3.2 files: Doc/library/re.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -498,6 +498,11 @@ isn't allowed for bytes). +.. data:: DEBUG + + Display debug information about compiled expression. + + .. data:: I IGNORECASE -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 18:06:03 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 18:06:03 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjgw?= =?utf8?q?=3A_add_lowecase_compression_type_to_write_header=3B_patch_by_Ol?= =?utf8?q?eg?= Message-ID: http://hg.python.org/cpython/rev/a9cdc3ff2b8e changeset: 74224:a9cdc3ff2b8e branch: 3.2 parent: 74222:f4a9c7cf98dd user: Sandro Tosi date: Sun Jan 01 18:04:37 2012 +0100 summary: Issue #13680: add lowecase compression type to write header; patch by Oleg Plakhotnyuk files: Lib/aifc.py | 12 ++---------- Lib/test/test_aifc.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -716,18 +716,12 @@ def _ensure_header_written(self, datasize): if not self._nframeswritten: - if self._comptype in (b'ULAW', b'ALAW'): + if self._comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): if not self._sampwidth: self._sampwidth = 2 if self._sampwidth != 2: raise Error('sample width must be 2 when compressing ' - 'with ulaw/ULAW or alaw/ALAW') - if self._comptype == b'G722': - if not self._sampwidth: - self._sampwidth = 2 - if self._sampwidth != 2: - raise Error('sample width must be 2 when compressing ' - 'with G7.22 (ADPCM)') + 'with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)') if not self._nchannels: raise Error('# channels not specified') if not self._sampwidth: @@ -743,8 +737,6 @@ self._convert = self._lin2ulaw elif self._comptype in (b'alaw', b'ALAW'): self._convert = self._lin2alaw - else: - raise Error('unsupported compression type') def _write_header(self, initlength): if self._aifc and self._comptype != b'NONE': diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -1,6 +1,7 @@ from test.support import findfile, run_unittest, TESTFN import unittest import os +import io import aifc @@ -109,6 +110,16 @@ f.close() self.assertEqual(testfile.closed, True) + def test_write_header_comptype_sampwidth(self): + for comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): + fout = self.fout = aifc.open(io.BytesIO(), 'wb') + fout.setnchannels(1) + fout.setframerate(1) + fout.setcomptype(comptype, b'') + fout.close() + self.assertEqual(fout.getsampwidth(), 2) + fout.initfp(None) + def test_main(): run_unittest(AIFCTest) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 18:06:04 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 18:06:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/93c5908bf89b changeset: 74225:93c5908bf89b parent: 74223:3cc47ed7a291 parent: 74224:a9cdc3ff2b8e user: Sandro Tosi date: Sun Jan 01 18:05:06 2012 +0100 summary: merge with 3.2 files: Lib/aifc.py | 12 ++---------- Lib/test/test_aifc.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -716,18 +716,12 @@ def _ensure_header_written(self, datasize): if not self._nframeswritten: - if self._comptype in (b'ULAW', b'ALAW'): + if self._comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): if not self._sampwidth: self._sampwidth = 2 if self._sampwidth != 2: raise Error('sample width must be 2 when compressing ' - 'with ulaw/ULAW or alaw/ALAW') - if self._comptype == b'G722': - if not self._sampwidth: - self._sampwidth = 2 - if self._sampwidth != 2: - raise Error('sample width must be 2 when compressing ' - 'with G7.22 (ADPCM)') + 'with ulaw/ULAW, alaw/ALAW or G7.22 (ADPCM)') if not self._nchannels: raise Error('# channels not specified') if not self._sampwidth: @@ -743,8 +737,6 @@ self._convert = self._lin2ulaw elif self._comptype in (b'alaw', b'ALAW'): self._convert = self._lin2alaw - else: - raise Error('unsupported compression type') def _write_header(self, initlength): if self._aifc and self._comptype != b'NONE': diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -1,6 +1,7 @@ from test.support import findfile, run_unittest, TESTFN import unittest import os +import io import aifc @@ -109,6 +110,16 @@ f.close() self.assertEqual(testfile.closed, True) + def test_write_header_comptype_sampwidth(self): + for comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'): + fout = self.fout = aifc.open(io.BytesIO(), 'wb') + fout.setnchannels(1) + fout.setframerate(1) + fout.setcomptype(comptype, b'') + fout.close() + self.assertEqual(fout.getsampwidth(), 2) + fout.initfp(None) + def test_main(): run_unittest(AIFCTest) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 18:35:40 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 18:35:40 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313640=3A_add_appli?= =?utf8?q?cation/vnd=2Eapple=2Empegurl_MIME_type=3B_=28partial=29_patch_by?= Message-ID: http://hg.python.org/cpython/rev/7926f594e333 changeset: 74226:7926f594e333 user: Sandro Tosi date: Sun Jan 01 18:34:29 2012 +0100 summary: Issue #13640: add application/vnd.apple.mpegurl MIME type; (partial) patch by Hiroaki Kawai files: Lib/mimetypes.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -433,6 +433,8 @@ '.ksh' : 'text/plain', '.latex' : 'application/x-latex', '.m1v' : 'video/mpeg', + '.m3u' : 'application/vnd.apple.mpegurl', + '.m3u8' : 'application/vnd.apple.mpegurl', '.man' : 'application/x-troff-man', '.me' : 'application/x-troff-me', '.mht' : 'message/rfc822', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 22:54:24 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 22:54:24 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNTk0?= =?utf8?q?=3A_various_fixes_to_aifc_module=3B_patch_by_Oleg_Plakhotnyuk?= Message-ID: http://hg.python.org/cpython/rev/c7a4405835e8 changeset: 74227:c7a4405835e8 branch: 3.2 parent: 74224:a9cdc3ff2b8e user: Sandro Tosi date: Sun Jan 01 22:53:08 2012 +0100 summary: Issue #13594: various fixes to aifc module; patch by Oleg Plakhotnyuk files: Lib/aifc.py | 35 +++++++++++++++--------------- Lib/test/test_aifc.py | 23 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -539,8 +539,7 @@ self._aifc = 1 # AIFF-C is default def __del__(self): - if self._file: - self.close() + self.close() # # User visible methods. @@ -643,8 +642,8 @@ raise Error('marker ID must be > 0') if pos < 0: raise Error('marker position must be >= 0') - if not isinstance(name, str): - raise Error('marker name must be a string') + if not isinstance(name, bytes): + raise Error('marker name must be bytes') for i in range(len(self._markers)): if id == self._markers[i][0]: self._markers[i] = id, pos, name @@ -681,19 +680,21 @@ self._patchheader() def close(self): - self._ensure_header_written(0) - if self._datawritten & 1: - # quick pad to even size - self._file.write(b'\x00') - self._datawritten = self._datawritten + 1 - self._writemarkers() - if self._nframeswritten != self._nframes or \ - self._datalength != self._datawritten or \ - self._marklength: - self._patchheader() - # Prevent ref cycles - self._convert = None - self._file.close() + if self._file: + self._ensure_header_written(0) + if self._datawritten & 1: + # quick pad to even size + self._file.write(b'\x00') + self._datawritten = self._datawritten + 1 + self._writemarkers() + if self._nframeswritten != self._nframes or \ + self._datalength != self._datawritten or \ + self._marklength: + self._patchheader() + # Prevent ref cycles + self._convert = None + self._file.close() + self._file = None # # Internal methods. diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -120,6 +120,29 @@ self.assertEqual(fout.getsampwidth(), 2) fout.initfp(None) + def test_write_markers_values(self): + fout = self.fout = aifc.open(io.BytesIO(), 'wb') + self.assertEqual(fout.getmarkers(), None) + fout.setmark(1, 0, b'foo1') + fout.setmark(1, 1, b'foo2') + self.assertEqual(fout.getmark(1), (1, 1, b'foo2')) + self.assertEqual(fout.getmarkers(), [(1, 1, b'foo2')]) + fout.initfp(None) + + def test_read_markers(self): + fout = self.fout = aifc.open(TESTFN, 'wb') + fout.aiff() + fout.setparams((1, 1, 1, 1, b'NONE', b'')) + fout.setmark(1, 0, b'odd') + fout.setmark(2, 0, b'even') + fout.writeframes(b'\x00') + fout.close() + f = self.f = aifc.open(TESTFN, 'rb') + self.assertEqual(f.getmarkers(), [(1, 0, b'odd'), (2, 0, b'even')]) + self.assertEqual(f.getmark(1), (1, 0, b'odd')) + self.assertEqual(f.getmark(2), (2, 0, b'even')) + self.assertRaises(aifc.Error, f.getmark, 3) + def test_main(): run_unittest(AIFCTest) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 22:54:25 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 22:54:25 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/4dbb5b1b156c changeset: 74228:4dbb5b1b156c parent: 74226:7926f594e333 parent: 74227:c7a4405835e8 user: Sandro Tosi date: Sun Jan 01 22:53:29 2012 +0100 summary: merge with 3.2 files: Lib/aifc.py | 35 +++++++++++++++--------------- Lib/test/test_aifc.py | 23 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -539,8 +539,7 @@ self._aifc = 1 # AIFF-C is default def __del__(self): - if self._file: - self.close() + self.close() # # User visible methods. @@ -643,8 +642,8 @@ raise Error('marker ID must be > 0') if pos < 0: raise Error('marker position must be >= 0') - if not isinstance(name, str): - raise Error('marker name must be a string') + if not isinstance(name, bytes): + raise Error('marker name must be bytes') for i in range(len(self._markers)): if id == self._markers[i][0]: self._markers[i] = id, pos, name @@ -681,19 +680,21 @@ self._patchheader() def close(self): - self._ensure_header_written(0) - if self._datawritten & 1: - # quick pad to even size - self._file.write(b'\x00') - self._datawritten = self._datawritten + 1 - self._writemarkers() - if self._nframeswritten != self._nframes or \ - self._datalength != self._datawritten or \ - self._marklength: - self._patchheader() - # Prevent ref cycles - self._convert = None - self._file.close() + if self._file: + self._ensure_header_written(0) + if self._datawritten & 1: + # quick pad to even size + self._file.write(b'\x00') + self._datawritten = self._datawritten + 1 + self._writemarkers() + if self._nframeswritten != self._nframes or \ + self._datalength != self._datawritten or \ + self._marklength: + self._patchheader() + # Prevent ref cycles + self._convert = None + self._file.close() + self._file = None # # Internal methods. diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -120,6 +120,29 @@ self.assertEqual(fout.getsampwidth(), 2) fout.initfp(None) + def test_write_markers_values(self): + fout = self.fout = aifc.open(io.BytesIO(), 'wb') + self.assertEqual(fout.getmarkers(), None) + fout.setmark(1, 0, b'foo1') + fout.setmark(1, 1, b'foo2') + self.assertEqual(fout.getmark(1), (1, 1, b'foo2')) + self.assertEqual(fout.getmarkers(), [(1, 1, b'foo2')]) + fout.initfp(None) + + def test_read_markers(self): + fout = self.fout = aifc.open(TESTFN, 'wb') + fout.aiff() + fout.setparams((1, 1, 1, 1, b'NONE', b'')) + fout.setmark(1, 0, b'odd') + fout.setmark(2, 0, b'even') + fout.writeframes(b'\x00') + fout.close() + f = self.f = aifc.open(TESTFN, 'rb') + self.assertEqual(f.getmarkers(), [(1, 0, b'odd'), (2, 0, b'even')]) + self.assertEqual(f.getmark(1), (1, 0, b'odd')) + self.assertEqual(f.getmark(2), (2, 0, b'even')) + self.assertRaises(aifc.Error, f.getmark, 3) + def test_main(): run_unittest(AIFCTest) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 22:56:32 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 01 Jan 2012 22:56:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_make_switch_more_robust?= Message-ID: http://hg.python.org/cpython/rev/86e2603f6adb changeset: 74229:86e2603f6adb user: Benjamin Peterson date: Sun Jan 01 15:56:20 2012 -0600 summary: make switch more robust files: Objects/unicodeobject.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9799,10 +9799,11 @@ for (; i_ < (length); ++i_, ++to_) *to_ = (value); \ break; \ } \ - default: { \ + case PyUnicode_4BYTE_KIND: { \ Py_UCS4 * to_ = (Py_UCS4 *)((data)) + (start); \ for (; i_ < (length); ++i_, ++to_) *to_ = (value); \ break; \ + default: assert(0); \ } \ } \ } while (0) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 1 23:43:00 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 01 Jan 2012 23:43:00 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzMzAy?= =?utf8?q?=3A_backport_part_of_3ed28f28466f?= Message-ID: http://hg.python.org/cpython/rev/b2b7104691c9 changeset: 74230:b2b7104691c9 branch: 2.7 parent: 74221:9aebb4d07ddf user: Sandro Tosi date: Sun Jan 01 23:41:44 2012 +0100 summary: Issue #13302: backport part of 3ed28f28466f files: Doc/c-api/arg.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -24,6 +24,11 @@ that matches the format unit; and the entry in [square] brackets is the type of the C variable(s) whose address should be passed. +These formats allow to access an object as a contiguous chunk of memory. +You don't have to provide raw storage for the returned unicode or bytes +area. Also, you won't have to release any memory yourself, except with the +``es``, ``es#``, ``et`` and ``et#`` formats. + ``s`` (string or Unicode) [const char \*] Convert a Python string or Unicode object to a C pointer to a character string. You must not provide storage for the string itself; a pointer to -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 01:25:14 2012 From: python-checkins at python.org (nadeem.vawda) Date: Mon, 02 Jan 2012 01:25:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_note_on_memory_usage_to?= =?utf8?q?_LZMACompressor_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/ca36b2b66500 changeset: 74231:ca36b2b66500 parent: 74229:86e2603f6adb user: Nadeem Vawda date: Mon Jan 02 02:24:20 2012 +0200 summary: Add note on memory usage to LZMACompressor doc. files: Doc/library/lzma.rst | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst --- a/Doc/library/lzma.rst +++ b/Doc/library/lzma.rst @@ -120,8 +120,16 @@ ``9`` (inclusive), optionally OR-ed with the constant :const:`PRESET_EXTREME`. If neither *preset* nor *filters* are given, the default behavior is to use :const:`PRESET_DEFAULT` (preset level ``6``). - Higher presets produce smaller output, but make compression more CPU- and - memory-intensive, and also increase the memory required for decompression. + Higher presets produce smaller output, but make the compression process + slower. + + .. note:: + + In addition to being more CPU-intensive, compression with higher presets + also requires much more memory (and produces output that needs more memory + to decompress). With preset ``9`` for example, the overhead for an + :class:`LZMACompressor` object can be as high as 800MiB. For this reason, + it is generally best to stick with the default preset. The *filters* argument (if provided) should be a filter chain specifier. See :ref:`filter-chain-specs` for details. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jan 2 05:30:41 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 02 Jan 2012 05:30:41 +0100 Subject: [Python-checkins] Daily reference leaks (ca36b2b66500): sum=0 Message-ID: results for ca36b2b66500 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogOX7TQI', '-x'] From python-checkins at python.org Mon Jan 2 15:58:01 2012 From: python-checkins at python.org (charles-francois.natali) Date: Mon, 02 Jan 2012 15:58:01 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzk5NzU6?= =?utf8?q?_socket=3A_Fix_incorrect_use_of_flowinfo_and_scope=5Fid=2E_Patch?= =?utf8?q?_by?= Message-ID: http://hg.python.org/cpython/rev/0c10061df711 changeset: 74232:0c10061df711 branch: 2.7 parent: 74230:b2b7104691c9 user: Charles-Fran?ois Natali date: Mon Jan 02 15:38:27 2012 +0100 summary: Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. files: Lib/test/test_socket.py | 10 ++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/socketmodule.c | 29 +++++++++++++++++++++-------- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -706,6 +706,16 @@ srv.listen(0) srv.close() + @unittest.skipUnless(SUPPORTS_IPV6, 'IPv6 required for this test.') + def test_flowinfo(self): + self.assertRaises(OverflowError, socket.getnameinfo, + ('::1',0, 0xffffffff), 0) + s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) + try: + self.assertRaises(OverflowError, s.bind, ('::1', 0, -10)) + finally: + s.close() + @unittest.skipUnless(thread, 'Threading required for this test.') class BasicTCPTest(SocketConnectedTest): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -590,6 +590,7 @@ Takahiro Nakayama Travers Naran Charles-Fran?ois Natali +Vilmos Nebehaj Fredrik Nehr Trent Nelson Tony Nelson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -368,6 +368,9 @@ Extension Modules ----------------- +- Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by + Vilmos Nebehaj. + - Issue #13159: FileIO, BZ2File, and the built-in file class now use a linear-time buffer growth strategy instead of a quadratic one. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1028,10 +1028,10 @@ PyObject *ret = NULL; if (addrobj) { a = (struct sockaddr_in6 *)addr; - ret = Py_BuildValue("Oiii", + ret = Py_BuildValue("OiII", addrobj, ntohs(a->sin6_port), - a->sin6_flowinfo, + ntohl(a->sin6_flowinfo), a->sin6_scope_id); Py_DECREF(addrobj); } @@ -1282,7 +1282,8 @@ { struct sockaddr_in6* addr; char *host; - int port, flowinfo, scope_id, result; + int port, result; + unsigned int flowinfo, scope_id; flowinfo = scope_id = 0; if (!PyTuple_Check(args)) { PyErr_Format( @@ -1292,7 +1293,7 @@ Py_TYPE(args)->tp_name); return 0; } - if (!PyArg_ParseTuple(args, "eti|ii", + if (!PyArg_ParseTuple(args, "eti|II", "idna", &host, &port, &flowinfo, &scope_id)) { return 0; @@ -1309,9 +1310,15 @@ "getsockaddrarg: port must be 0-65535."); return 0; } + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString( + PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return 0; + } addr->sin6_family = s->sock_family; addr->sin6_port = htons((short)port); - addr->sin6_flowinfo = flowinfo; + addr->sin6_flowinfo = htonl(flowinfo); addr->sin6_scope_id = scope_id; *len_ret = sizeof *addr; return 1; @@ -4156,7 +4163,8 @@ PyObject *sa = (PyObject *)NULL; int flags; char *hostp; - int port, flowinfo, scope_id; + int port; + unsigned int flowinfo, scope_id; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct addrinfo hints, *res = NULL; int error; @@ -4170,9 +4178,14 @@ "getnameinfo() argument 1 must be a tuple"); return NULL; } - if (!PyArg_ParseTuple(sa, "si|ii", + if (!PyArg_ParseTuple(sa, "si|II", &hostp, &port, &flowinfo, &scope_id)) return NULL; + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString(PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return NULL; + } PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; @@ -4206,7 +4219,7 @@ { struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)res->ai_addr; - sin6->sin6_flowinfo = flowinfo; + sin6->sin6_flowinfo = htonl(flowinfo); sin6->sin6_scope_id = scope_id; break; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 15:58:03 2012 From: python-checkins at python.org (charles-francois.natali) Date: Mon, 02 Jan 2012 15:58:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=239975=3A_socket=3A_Fix_incorrect_use_of_flowinfo_and?= =?utf8?q?_scope=5Fid=2E_Patch_by?= Message-ID: http://hg.python.org/cpython/rev/9222b8e7a7bc changeset: 74234:9222b8e7a7bc parent: 74231:ca36b2b66500 parent: 74233:cc346a672091 user: Charles-Fran?ois Natali date: Mon Jan 02 15:57:30 2012 +0100 summary: Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. files: Lib/test/test_socket.py | 7 +++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/socketmodule.c | 29 +++++++++++++++++++++-------- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1248,6 +1248,13 @@ srv.listen(0) srv.close() + @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') + def test_flowinfo(self): + self.assertRaises(OverflowError, socket.getnameinfo, + ('::1',0, 0xffffffff), 0) + with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s: + self.assertRaises(OverflowError, s.bind, ('::1', 0, -10)) + @unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.') class BasicCANTest(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -698,6 +698,7 @@ Takahiro Nakayama Travers Naran Charles-Fran?ois Natali +Vilmos Nebehaj Fredrik Nehr Tony Nelson Trent Nelson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1744,6 +1744,9 @@ Extension Modules ----------------- +- Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by + Vilmos Nebehaj. + - Issue #7777: socket: Add Reliable Datagram Sockets (PF_RDS) support. - Issue #13159: FileIO and BZ2Compressor/BZ2Decompressor now use a linear-time diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1095,10 +1095,10 @@ PyObject *ret = NULL; if (addrobj) { a = (struct sockaddr_in6 *)addr; - ret = Py_BuildValue("Oiii", + ret = Py_BuildValue("OiII", addrobj, ntohs(a->sin6_port), - a->sin6_flowinfo, + ntohl(a->sin6_flowinfo), a->sin6_scope_id); Py_DECREF(addrobj); } @@ -1386,7 +1386,8 @@ { struct sockaddr_in6* addr; char *host; - int port, flowinfo, scope_id, result; + int port, result; + unsigned int flowinfo, scope_id; flowinfo = scope_id = 0; if (!PyTuple_Check(args)) { PyErr_Format( @@ -1396,7 +1397,7 @@ Py_TYPE(args)->tp_name); return 0; } - if (!PyArg_ParseTuple(args, "eti|ii", + if (!PyArg_ParseTuple(args, "eti|II", "idna", &host, &port, &flowinfo, &scope_id)) { return 0; @@ -1413,9 +1414,15 @@ "getsockaddrarg: port must be 0-65535."); return 0; } + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString( + PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return 0; + } addr->sin6_family = s->sock_family; addr->sin6_port = htons((short)port); - addr->sin6_flowinfo = flowinfo; + addr->sin6_flowinfo = htonl(flowinfo); addr->sin6_scope_id = scope_id; *len_ret = sizeof *addr; return 1; @@ -4939,7 +4946,8 @@ PyObject *sa = (PyObject *)NULL; int flags; char *hostp; - int port, flowinfo, scope_id; + int port; + unsigned int flowinfo, scope_id; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct addrinfo hints, *res = NULL; int error; @@ -4953,9 +4961,14 @@ "getnameinfo() argument 1 must be a tuple"); return NULL; } - if (!PyArg_ParseTuple(sa, "si|ii", + if (!PyArg_ParseTuple(sa, "si|II", &hostp, &port, &flowinfo, &scope_id)) return NULL; + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString(PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return NULL; + } PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; @@ -4990,7 +5003,7 @@ { struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)res->ai_addr; - sin6->sin6_flowinfo = flowinfo; + sin6->sin6_flowinfo = htonl(flowinfo); sin6->sin6_scope_id = scope_id; break; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 15:58:02 2012 From: python-checkins at python.org (charles-francois.natali) Date: Mon, 02 Jan 2012 15:58:02 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzk5NzU6?= =?utf8?q?_socket=3A_Fix_incorrect_use_of_flowinfo_and_scope=5Fid=2E_Patch?= =?utf8?q?_by?= Message-ID: http://hg.python.org/cpython/rev/cc346a672091 changeset: 74233:cc346a672091 branch: 3.2 parent: 74227:c7a4405835e8 user: Charles-Fran?ois Natali date: Mon Jan 02 15:47:29 2012 +0100 summary: Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. files: Lib/test/test_socket.py | 7 +++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/socketmodule.c | 29 +++++++++++++++++++++-------- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -846,6 +846,13 @@ srv.listen(0) srv.close() + @unittest.skipUnless(SUPPORTS_IPV6, 'IPv6 required for this test.') + def test_flowinfo(self): + self.assertRaises(OverflowError, socket.getnameinfo, + ('::1',0, 0xffffffff), 0) + with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s: + self.assertRaises(OverflowError, s.bind, ('::1', 0, -10)) + @unittest.skipUnless(thread, 'Threading required for this test.') class BasicTCPTest(SocketConnectedTest): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -643,6 +643,7 @@ Takahiro Nakayama Travers Naran Charles-Fran?ois Natali +Vilmos Nebehaj Fredrik Nehr Trent Nelson Tony Nelson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -345,6 +345,9 @@ Extension Modules ----------------- +- Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by + Vilmos Nebehaj. + - Issue #13159: FileIO and BZ2File now use a linear-time buffer growth strategy instead of a quadratic-time one. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1065,10 +1065,10 @@ PyObject *ret = NULL; if (addrobj) { a = (struct sockaddr_in6 *)addr; - ret = Py_BuildValue("Oiii", + ret = Py_BuildValue("OiII", addrobj, ntohs(a->sin6_port), - a->sin6_flowinfo, + ntohl(a->sin6_flowinfo), a->sin6_scope_id); Py_DECREF(addrobj); } @@ -1319,7 +1319,8 @@ { struct sockaddr_in6* addr; char *host; - int port, flowinfo, scope_id, result; + int port, result; + unsigned int flowinfo, scope_id; flowinfo = scope_id = 0; if (!PyTuple_Check(args)) { PyErr_Format( @@ -1329,7 +1330,7 @@ Py_TYPE(args)->tp_name); return 0; } - if (!PyArg_ParseTuple(args, "eti|ii", + if (!PyArg_ParseTuple(args, "eti|II", "idna", &host, &port, &flowinfo, &scope_id)) { return 0; @@ -1346,9 +1347,15 @@ "getsockaddrarg: port must be 0-65535."); return 0; } + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString( + PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return 0; + } addr->sin6_family = s->sock_family; addr->sin6_port = htons((short)port); - addr->sin6_flowinfo = flowinfo; + addr->sin6_flowinfo = htonl(flowinfo); addr->sin6_scope_id = scope_id; *len_ret = sizeof *addr; return 1; @@ -4104,7 +4111,8 @@ PyObject *sa = (PyObject *)NULL; int flags; char *hostp; - int port, flowinfo, scope_id; + int port; + unsigned int flowinfo, scope_id; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct addrinfo hints, *res = NULL; int error; @@ -4118,9 +4126,14 @@ "getnameinfo() argument 1 must be a tuple"); return NULL; } - if (!PyArg_ParseTuple(sa, "si|ii", + if (!PyArg_ParseTuple(sa, "si|II", &hostp, &port, &flowinfo, &scope_id)) return NULL; + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString(PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return NULL; + } PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; @@ -4155,7 +4168,7 @@ { struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)res->ai_addr; - sin6->sin6_flowinfo = flowinfo; + sin6->sin6_flowinfo = htonl(flowinfo); sin6->sin6_scope_id = scope_id; break; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 16:00:49 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 02 Jan 2012 16:00:49 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_=3D=3D_-1_is_convention?= Message-ID: http://hg.python.org/cpython/rev/bea974c88faf changeset: 74235:bea974c88faf parent: 74229:86e2603f6adb user: Benjamin Peterson date: Sun Jan 01 16:04:29 2012 -0600 summary: == -1 is convention files: Objects/unicodeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8770,7 +8770,7 @@ collstart, collend, &newpos); if (repunicode == NULL) goto onError; - if (PyUnicode_READY(repunicode) < 0) { + if (PyUnicode_READY(repunicode) == -1) { Py_DECREF(repunicode); goto onError; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 16:00:50 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 02 Jan 2012 16:00:50 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_some_possible_refleaks_?= =?utf8?q?from_PyUnicode=5FREADY_error_conditions?= Message-ID: http://hg.python.org/cpython/rev/d5cda62d0f8c changeset: 74236:d5cda62d0f8c user: Benjamin Peterson date: Mon Jan 02 09:00:30 2012 -0600 summary: fix some possible refleaks from PyUnicode_READY error conditions files: Objects/unicodeobject.c | 80 ++++++++++++++++++++-------- 1 files changed, 56 insertions(+), 24 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9132,10 +9132,15 @@ Py_ssize_t len1, len2; str_obj = PyUnicode_FromObject(str); - if (!str_obj || PyUnicode_READY(str_obj) == -1) + if (!str_obj) return -1; sub_obj = PyUnicode_FromObject(substr); - if (!sub_obj || PyUnicode_READY(sub_obj) == -1) { + if (!sub_obj) { + Py_DECREF(str_obj); + return -1; + } + if (PyUnicode_READY(substr) == -1 || PyUnicode_READY(str_obj) == -1) { + Py_DECREF(substr); Py_DECREF(str_obj); return -1; } @@ -9215,10 +9220,15 @@ Py_ssize_t result; str = PyUnicode_FromObject(str); - if (!str || PyUnicode_READY(str) == -1) + if (!str) return -2; sub = PyUnicode_FromObject(sub); - if (!sub || PyUnicode_READY(sub) == -1) { + if (!sub) { + Py_DECREF(str); + return -2; + } + if (PyUnicode_READY(sub) == -1 || PyUnicode_READY(str) == -1) { + Py_DECREF(sub); Py_DECREF(str); return -2; } @@ -9857,8 +9867,12 @@ PyObject *list; string = PyUnicode_FromObject(string); - if (string == NULL || PyUnicode_READY(string) == -1) - return NULL; + if (string == NULL) + return NULL; + if (PyUnicode_READY(string) == -1) { + Py_DECREF(string); + return NULL; + } switch (PyUnicode_KIND(string)) { case PyUnicode_1BYTE_KIND: @@ -10650,14 +10664,16 @@ element->ob_type->tp_name); return -1; } - if (PyUnicode_READY(sub) == -1) - return -1; str = PyUnicode_FromObject(container); - if (!str || PyUnicode_READY(str) == -1) { + if (!str) { Py_DECREF(sub); return -1; } + if (PyUnicode_READY(sub) == -1 || PyUnicode_READY(str) == -1) { + Py_DECREF(sub); + Py_DECREF(str); + } kind1 = PyUnicode_KIND(str); kind2 = PyUnicode_KIND(sub); @@ -11936,20 +11952,25 @@ PyObject *result; self = PyUnicode_FromObject(obj); - if (self == NULL || PyUnicode_READY(self) == -1) + if (self == NULL) return NULL; str1 = PyUnicode_FromObject(subobj); - if (str1 == NULL || PyUnicode_READY(str1) == -1) { + if (str1 == NULL) { Py_DECREF(self); return NULL; } str2 = PyUnicode_FromObject(replobj); - if (str2 == NULL || PyUnicode_READY(str2)) { + if (str2 == NULL) { Py_DECREF(self); Py_DECREF(str1); return NULL; } - result = replace(self, str1, str2, maxcount); + if (PyUnicode_READY(self) == -1 || + PyUnicode_READY(str1) == -1 || + PyUnicode_READY(str2) == -1) + result = NULL; + else + result = replace(self, str1, str2, maxcount); Py_DECREF(self); Py_DECREF(str1); Py_DECREF(str2); @@ -11973,18 +11994,20 @@ if (!PyArg_ParseTuple(args, "OO|n:replace", &str1, &str2, &maxcount)) return NULL; - if (!PyUnicode_READY(self) == -1) + if (PyUnicode_READY(self) == -1) return NULL; str1 = PyUnicode_FromObject(str1); - if (str1 == NULL || PyUnicode_READY(str1) == -1) + if (str1 == NULL) return NULL; str2 = PyUnicode_FromObject(str2); - if (str2 == NULL || PyUnicode_READY(str2) == -1) { + if (str2 == NULL) { Py_DECREF(str1); return NULL; } - - result = replace(self, str1, str2, maxcount); + if (PyUnicode_READY(str1) == -1 || PyUnicode_READY(str2) == -1) + result = NULL; + else + result = replace(self, str1, str2, maxcount); Py_DECREF(str1); Py_DECREF(str2); @@ -12299,10 +12322,15 @@ Py_ssize_t len1, len2; str_obj = PyUnicode_FromObject(str_in); - if (!str_obj || PyUnicode_READY(str_obj) == -1) + if (!str_obj) return NULL; sep_obj = PyUnicode_FromObject(sep_in); - if (!sep_obj || PyUnicode_READY(sep_obj) == -1) { + if (!sep_obj) { + Py_DECREF(str_obj); + return NULL; + } + if (PyUnicode_READY(sep_obj) == -1 || PyUnicode_READY(str_obj) == -1) { + Py_DECREF(sep_obj); Py_DECREF(str_obj); return NULL; } @@ -13227,8 +13255,10 @@ return NULL; } uformat = PyUnicode_FromObject(format); - if (uformat == NULL || PyUnicode_READY(uformat) == -1) - return NULL; + if (uformat == NULL) + return NULL; + if (PyUnicode_READY(uformat) == -1) + Py_DECREF(uformat); if (_PyAccu_Init(&acc)) goto onError; fmt = PyUnicode_DATA(uformat); @@ -13729,8 +13759,10 @@ if (unicode == NULL) return NULL; assert(_PyUnicode_CHECK(unicode)); - if (PyUnicode_READY(unicode)) - return NULL; + if (PyUnicode_READY(unicode)) { + Py_DECREF(unicode); + return NULL; + } self = type->tp_alloc(type, 0); if (self == NULL) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 16:00:54 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 02 Jan 2012 16:00:54 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/025ea01d6a26 changeset: 74237:025ea01d6a26 parent: 74236:d5cda62d0f8c parent: 74234:9222b8e7a7bc user: Benjamin Peterson date: Mon Jan 02 09:00:38 2012 -0600 summary: merge heads files: Doc/library/lzma.rst | 12 ++++++++++-- Lib/test/test_socket.py | 7 +++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/socketmodule.c | 29 +++++++++++++++++++++-------- 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst --- a/Doc/library/lzma.rst +++ b/Doc/library/lzma.rst @@ -120,8 +120,16 @@ ``9`` (inclusive), optionally OR-ed with the constant :const:`PRESET_EXTREME`. If neither *preset* nor *filters* are given, the default behavior is to use :const:`PRESET_DEFAULT` (preset level ``6``). - Higher presets produce smaller output, but make compression more CPU- and - memory-intensive, and also increase the memory required for decompression. + Higher presets produce smaller output, but make the compression process + slower. + + .. note:: + + In addition to being more CPU-intensive, compression with higher presets + also requires much more memory (and produces output that needs more memory + to decompress). With preset ``9`` for example, the overhead for an + :class:`LZMACompressor` object can be as high as 800MiB. For this reason, + it is generally best to stick with the default preset. The *filters* argument (if provided) should be a filter chain specifier. See :ref:`filter-chain-specs` for details. diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1248,6 +1248,13 @@ srv.listen(0) srv.close() + @unittest.skipUnless(support.IPV6_ENABLED, 'IPv6 required for this test.') + def test_flowinfo(self): + self.assertRaises(OverflowError, socket.getnameinfo, + ('::1',0, 0xffffffff), 0) + with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s: + self.assertRaises(OverflowError, s.bind, ('::1', 0, -10)) + @unittest.skipUnless(HAVE_SOCKET_CAN, 'SocketCan required for this test.') class BasicCANTest(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -698,6 +698,7 @@ Takahiro Nakayama Travers Naran Charles-Fran?ois Natali +Vilmos Nebehaj Fredrik Nehr Tony Nelson Trent Nelson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1744,6 +1744,9 @@ Extension Modules ----------------- +- Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by + Vilmos Nebehaj. + - Issue #7777: socket: Add Reliable Datagram Sockets (PF_RDS) support. - Issue #13159: FileIO and BZ2Compressor/BZ2Decompressor now use a linear-time diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1095,10 +1095,10 @@ PyObject *ret = NULL; if (addrobj) { a = (struct sockaddr_in6 *)addr; - ret = Py_BuildValue("Oiii", + ret = Py_BuildValue("OiII", addrobj, ntohs(a->sin6_port), - a->sin6_flowinfo, + ntohl(a->sin6_flowinfo), a->sin6_scope_id); Py_DECREF(addrobj); } @@ -1386,7 +1386,8 @@ { struct sockaddr_in6* addr; char *host; - int port, flowinfo, scope_id, result; + int port, result; + unsigned int flowinfo, scope_id; flowinfo = scope_id = 0; if (!PyTuple_Check(args)) { PyErr_Format( @@ -1396,7 +1397,7 @@ Py_TYPE(args)->tp_name); return 0; } - if (!PyArg_ParseTuple(args, "eti|ii", + if (!PyArg_ParseTuple(args, "eti|II", "idna", &host, &port, &flowinfo, &scope_id)) { return 0; @@ -1413,9 +1414,15 @@ "getsockaddrarg: port must be 0-65535."); return 0; } + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString( + PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return 0; + } addr->sin6_family = s->sock_family; addr->sin6_port = htons((short)port); - addr->sin6_flowinfo = flowinfo; + addr->sin6_flowinfo = htonl(flowinfo); addr->sin6_scope_id = scope_id; *len_ret = sizeof *addr; return 1; @@ -4939,7 +4946,8 @@ PyObject *sa = (PyObject *)NULL; int flags; char *hostp; - int port, flowinfo, scope_id; + int port; + unsigned int flowinfo, scope_id; char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct addrinfo hints, *res = NULL; int error; @@ -4953,9 +4961,14 @@ "getnameinfo() argument 1 must be a tuple"); return NULL; } - if (!PyArg_ParseTuple(sa, "si|ii", + if (!PyArg_ParseTuple(sa, "si|II", &hostp, &port, &flowinfo, &scope_id)) return NULL; + if (flowinfo < 0 || flowinfo > 0xfffff) { + PyErr_SetString(PyExc_OverflowError, + "getsockaddrarg: flowinfo must be 0-1048575."); + return NULL; + } PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; @@ -4990,7 +5003,7 @@ { struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)res->ai_addr; - sin6->sin6_flowinfo = flowinfo; + sin6->sin6_flowinfo = htonl(flowinfo); sin6->sin6_scope_id = scope_id; break; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 16:07:50 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 02 Jan 2012 16:07:50 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_ready_the_correct_string?= Message-ID: http://hg.python.org/cpython/rev/5a75ce7e5d49 changeset: 74238:5a75ce7e5d49 user: Benjamin Peterson date: Mon Jan 02 09:07:38 2012 -0600 summary: ready the correct string files: Objects/unicodeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9139,7 +9139,7 @@ Py_DECREF(str_obj); return -1; } - if (PyUnicode_READY(substr) == -1 || PyUnicode_READY(str_obj) == -1) { + if (PyUnicode_READY(sub_obj) == -1 || PyUnicode_READY(str_obj) == -1) { Py_DECREF(substr); Py_DECREF(str_obj); return -1; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 17:12:26 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 02 Jan 2012 17:12:26 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_also_decref_the_right_thing?= Message-ID: http://hg.python.org/cpython/rev/c0f64baad88d changeset: 74239:c0f64baad88d user: Benjamin Peterson date: Mon Jan 02 10:12:13 2012 -0600 summary: also decref the right thing files: Objects/unicodeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9140,7 +9140,7 @@ return -1; } if (PyUnicode_READY(sub_obj) == -1 || PyUnicode_READY(str_obj) == -1) { - Py_DECREF(substr); + Py_DECREF(sub_obj); Py_DECREF(str_obj); return -1; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 2 19:20:56 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 02 Jan 2012 19:20:56 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Mock_the_rename_failure_a_b?= =?utf8?q?it_better?= Message-ID: http://hg.python.org/cpython/rev/3ed5a6030c9b changeset: 74240:3ed5a6030c9b user: Antoine Pitrou date: Mon Jan 02 19:18:02 2012 +0100 summary: Mock the rename failure a bit better files: Lib/test/test_shutil.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -7,6 +7,7 @@ import stat import os import os.path +import errno import functools from test import support from test.support import TESTFN @@ -46,7 +47,7 @@ def _fake_rename(*args, **kwargs): # Pretend the destination path is on a different filesystem. - raise OSError() + raise OSError(getattr(errno, 'EXDEV', 18), "Invalid cross-device link") def mock_rename(func): @functools.wraps(func) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 02:09:03 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 02:09:03 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_we_welcome_all_bracing_styles?= Message-ID: http://hg.python.org/peps/rev/8280e184ad18 changeset: 4010:8280e184ad18 user: Benjamin Peterson date: Mon Jan 02 19:08:51 2012 -0600 summary: we welcome all bracing styles files: pep-0007.txt | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/pep-0007.txt b/pep-0007.txt --- a/pep-0007.txt +++ b/pep-0007.txt @@ -72,7 +72,8 @@ } - Code structure: one space between keywords like 'if', 'for' and - the following left paren; no spaces inside the paren; braces as + the following left paren; no spaces inside the paren; braces may be + omitted where C permits but when present, they should be formatted as shown: if (mro != NULL) { -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Jan 3 05:26:19 2012 From: python-checkins at python.org (eli.bendersky) Date: Tue, 03 Jan 2012 05:26:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_use_io=2ESEEK=5F*_constants?= =?utf8?q?_instead_of_os=2ESEEK=5F*_where_an_IO_stream_is_seeked=2C?= Message-ID: http://hg.python.org/cpython/rev/120a79b8bb11 changeset: 74241:120a79b8bb11 user: Eli Bendersky date: Tue Jan 03 06:26:13 2012 +0200 summary: use io.SEEK_* constants instead of os.SEEK_* where an IO stream is seeked, leaving the os.SEEK_* constants only for os.lseek, as documented files: Lib/tarfile.py | 9 +++++---- Lib/test/test_fileio.py | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -40,6 +40,7 @@ #--------- import sys import os +import io import shutil import stat import time @@ -833,20 +834,20 @@ return self.position - def seek(self, pos, whence=os.SEEK_SET): + def seek(self, pos, whence=io.SEEK_SET): """Seek to a position in the file. """ if self.closed: raise ValueError("I/O operation on closed file") - if whence == os.SEEK_SET: + if whence == io.SEEK_SET: self.position = min(max(pos, 0), self.size) - elif whence == os.SEEK_CUR: + elif whence == io.SEEK_CUR: if pos < 0: self.position = max(self.position + pos, 0) else: self.position = min(self.position + pos, self.size) - elif whence == os.SEEK_END: + elif whence == io.SEEK_END: self.position = max(min(self.size + pos, self.size), 0) else: raise ValueError("Invalid argument") diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -2,6 +2,7 @@ import sys import os +import io import errno import unittest from array import array @@ -334,10 +335,10 @@ self.assertEqual(f.tell(), 10) f.truncate(5) self.assertEqual(f.tell(), 10) - self.assertEqual(f.seek(0, os.SEEK_END), 5) + self.assertEqual(f.seek(0, io.SEEK_END), 5) f.truncate(15) self.assertEqual(f.tell(), 5) - self.assertEqual(f.seek(0, os.SEEK_END), 15) + self.assertEqual(f.seek(0, io.SEEK_END), 15) f.close() def testTruncateOnWindows(self): -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jan 3 05:30:17 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 03 Jan 2012 05:30:17 +0100 Subject: [Python-checkins] Daily reference leaks (3ed5a6030c9b): sum=0 Message-ID: results for 3ed5a6030c9b on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogOaluG_', '-x'] From python-checkins at python.org Tue Jan 3 18:39:09 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 03 Jan 2012 18:39:09 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzkzNDk6?= =?utf8?q?_add_argparse=2ESUPPRESS_to_help_doc?= Message-ID: http://hg.python.org/cpython/rev/572ddf2770bc changeset: 74242:572ddf2770bc branch: 3.2 parent: 74233:cc346a672091 user: Sandro Tosi date: Tue Jan 03 18:37:03 2012 +0100 summary: Issue #9349: add argparse.SUPPRESS to help doc files: Doc/library/argparse.rst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1051,6 +1051,17 @@ optional arguments: -h, --help show this help message and exit +:mod:`argparse` supports silencing the help entry for certain options, by +setting the ``help`` value to ``argparse.SUPPRESS``:: + + >>> parser = argparse.ArgumentParser(prog='frobble') + >>> parser.add_argument('--foo', help=argparse.SUPPRESS) + >>> parser.print_help() + usage: frobble [-h] + + optional arguments: + -h, --help show this help message and exit + metavar ^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 18:39:10 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 03 Jan 2012 18:39:10 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzkzNDk6?= =?utf8?q?_add_argparse=2ESUPPRESS_to_help_doc?= Message-ID: http://hg.python.org/cpython/rev/17b7b856cbe8 changeset: 74243:17b7b856cbe8 branch: 2.7 parent: 74232:0c10061df711 user: Sandro Tosi date: Tue Jan 03 18:31:51 2012 +0100 summary: Issue #9349: add argparse.SUPPRESS to help doc files: Doc/library/argparse.rst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1049,6 +1049,17 @@ optional arguments: -h, --help show this help message and exit +:mod:`argparse` supports silencing the help entry for certain options, by +setting the ``help`` value to ``argparse.SUPPRESS``:: + + >>> parser = argparse.ArgumentParser(prog='frobble') + >>> parser.add_argument('--foo', help=argparse.SUPPRESS) + >>> parser.print_help() + usage: frobble [-h] + + optional arguments: + -h, --help show this help message and exit + metavar ^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 18:39:11 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 03 Jan 2012 18:39:11 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/f38182db6c7a changeset: 74244:f38182db6c7a parent: 74241:120a79b8bb11 parent: 74242:572ddf2770bc user: Sandro Tosi date: Tue Jan 03 18:37:46 2012 +0100 summary: merge with 3.2 files: Doc/library/argparse.rst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1070,6 +1070,17 @@ optional arguments: -h, --help show this help message and exit +:mod:`argparse` supports silencing the help entry for certain options, by +setting the ``help`` value to ``argparse.SUPPRESS``:: + + >>> parser = argparse.ArgumentParser(prog='frobble') + >>> parser.add_argument('--foo', help=argparse.SUPPRESS) + >>> parser.print_help() + usage: frobble [-h] + + optional arguments: + -h, --help show this help message and exit + metavar ^^^^^^^ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:48:49 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 03 Jan 2012 22:48:49 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzYwMzE6?= =?utf8?q?_improve_serve=5Fforever=28=29_description?= Message-ID: http://hg.python.org/cpython/rev/4fad6b811c8b changeset: 74245:4fad6b811c8b branch: 2.7 parent: 74243:17b7b856cbe8 user: Sandro Tosi date: Tue Jan 03 22:35:41 2012 +0100 summary: Issue #6031: improve serve_forever() description files: Doc/library/socketserver.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -158,13 +158,14 @@ .. method:: BaseServer.serve_forever(poll_interval=0.5) - Handle requests until an explicit :meth:`shutdown` request. Polls for - shutdown every *poll_interval* seconds. + Handle requests until an explicit :meth:`shutdown` request. + Poll for shutdown every *poll_interval* seconds. Ignores :attr:`self.timeout`. + If you need to do periodic tasks, do them in another thread. .. method:: BaseServer.shutdown() - Tells the :meth:`serve_forever` loop to stop and waits until it does. + Tell the :meth:`serve_forever` loop to stop and wait until it does. .. versionadded:: 2.6 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:48:50 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 03 Jan 2012 22:48:50 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzYwMzE6?= =?utf8?q?_improve_serve=5Fforever=28=29_description?= Message-ID: http://hg.python.org/cpython/rev/4a30d36a9c69 changeset: 74246:4a30d36a9c69 branch: 3.2 parent: 74242:572ddf2770bc user: Sandro Tosi date: Tue Jan 03 22:35:54 2012 +0100 summary: Issue #6031: improve serve_forever() description files: Doc/library/socketserver.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -153,13 +153,14 @@ .. method:: BaseServer.serve_forever(poll_interval=0.5) - Handle requests until an explicit :meth:`shutdown` request. Polls for - shutdown every *poll_interval* seconds. + Handle requests until an explicit :meth:`shutdown` request. + Poll for shutdown every *poll_interval* seconds. Ignores :attr:`self.timeout`. + If you need to do periodic tasks, do them in another thread. .. method:: BaseServer.shutdown() - Tells the :meth:`serve_forever` loop to stop and waits until it does. + Tell the :meth:`serve_forever` loop to stop and wait until it does. .. attribute:: BaseServer.address_family -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:48:51 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 03 Jan 2012 22:48:51 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/4c243c8ecd10 changeset: 74247:4c243c8ecd10 parent: 74244:f38182db6c7a parent: 74246:4a30d36a9c69 user: Sandro Tosi date: Tue Jan 03 22:47:28 2012 +0100 summary: merge with 3.2 files: Doc/library/socketserver.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -153,8 +153,8 @@ .. method:: BaseServer.serve_forever(poll_interval=0.5) - Handle requests until an explicit :meth:`shutdown` request. Polls for - shutdown every *poll_interval* seconds. It also calls + Handle requests until an explicit :meth:`shutdown` request. + Poll for shutdown every *poll_interval* seconds. Ignores :attr:`self.timeout`. It also calls :meth:`service_actions` which may be used by a subclass or Mixin to provide various cleanup actions. For e.g. ForkingMixin class uses :meth:`service_actions` to cleanup the zombie child processes. @@ -172,7 +172,7 @@ .. method:: BaseServer.shutdown() - Tells the :meth:`serve_forever` loop to stop and waits until it does. + Tell the :meth:`serve_forever` loop to stop and waits until it does. .. attribute:: BaseServer.address_family -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:51:42 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 03 Jan 2012 22:51:42 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjM2?= =?utf8?q?=3A_Weak_ciphers_are_now_disabled_by_default_in_the_ssl_module?= Message-ID: http://hg.python.org/cpython/rev/25c2d24e1b11 changeset: 74248:25c2d24e1b11 branch: 3.2 parent: 74242:572ddf2770bc user: Antoine Pitrou date: Tue Jan 03 22:46:48 2012 +0100 summary: Issue #13636: Weak ciphers are now disabled by default in the ssl module (except when SSLv2 is explicitly asked for). files: Lib/ssl.py | 12 ++++++++++-- Lib/test/test_ssl.py | 22 +++++++++++++++++++++- Misc/NEWS | 3 +++ 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -86,8 +86,9 @@ } try: from _ssl import PROTOCOL_SSLv2 + _SSLv2_IF_EXISTS = PROTOCOL_SSLv2 except ImportError: - pass + _SSLv2_IF_EXISTS = None else: _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2" @@ -98,6 +99,10 @@ import traceback import errno +# Disable weak or insecure ciphers by default +# (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL') +_DEFAULT_CIPHERS = 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2' + class CertificateError(ValueError): pass @@ -165,7 +170,10 @@ __slots__ = ('protocol',) def __new__(cls, protocol, *args, **kwargs): - return _SSLContext.__new__(cls, protocol) + self = _SSLContext.__new__(cls, protocol) + if protocol != _SSLv2_IF_EXISTS: + self.set_ciphers(_DEFAULT_CIPHERS) + return self def __init__(self, protocol): self.protocol = protocol diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -762,10 +762,11 @@ try: self.sslconn = self.server.context.wrap_socket( self.sock, server_side=True) - except ssl.SSLError: + except ssl.SSLError as e: # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. + self.server.conn_errors.append(e) if self.server.chatty: handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n") self.running = False @@ -878,12 +879,14 @@ self.port = support.bind_port(self.sock) self.flag = None self.active = False + self.conn_errors = [] threading.Thread.__init__(self) self.daemon = True def __enter__(self): self.start(threading.Event()) self.flag.wait() + return self def __exit__(self, *args): self.stop() @@ -1004,6 +1007,7 @@ def __enter__(self): self.start(threading.Event()) self.flag.wait() + return self def __exit__(self, *args): if support.verbose: @@ -1604,6 +1608,22 @@ t.join() server.close() + def test_default_ciphers(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + try: + # Force a set of weak ciphers on our client context + context.set_ciphers("DES") + except ssl.SSLError: + self.skipTest("no DES cipher available") + with ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_SSLv23, + chatty=False) as server: + with socket.socket() as sock: + s = context.wrap_socket(sock) + with self.assertRaises((OSError, ssl.SSLError)): + s.connect((HOST, server.port)) + self.assertIn("no shared cipher", str(server.conn_errors[0])) + def test_main(verbose=False): if support.verbose: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,9 @@ Library ------- +- Issue #13636: Weak ciphers are now disabled by default in the ssl module + (except when SSLv2 is explicitly asked for). + - Issue #12798: Updated the mimetypes documentation. - Issue #11006: Don't issue low level warning in subprocess when pipe2() fails. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:51:42 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 03 Jan 2012 22:51:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313636=3A_Weak_ciphers_are_now_disabled_by_default_i?= =?utf8?q?n_the_ssl_module?= Message-ID: http://hg.python.org/cpython/rev/ace54f5e75d7 changeset: 74249:ace54f5e75d7 parent: 74244:f38182db6c7a parent: 74248:25c2d24e1b11 user: Antoine Pitrou date: Tue Jan 03 22:49:08 2012 +0100 summary: Issue #13636: Weak ciphers are now disabled by default in the ssl module (except when SSLv2 is explicitly asked for). files: Lib/ssl.py | 13 +++++++++++-- Lib/test/test_ssl.py | 22 +++++++++++++++++++++- Misc/NEWS | 3 +++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -98,8 +98,9 @@ } try: from _ssl import PROTOCOL_SSLv2 + _SSLv2_IF_EXISTS = PROTOCOL_SSLv2 except ImportError: - pass + _SSLv2_IF_EXISTS = None else: _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2" @@ -115,6 +116,11 @@ else: CHANNEL_BINDING_TYPES = [] +# Disable weak or insecure ciphers by default +# (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL') +_DEFAULT_CIPHERS = 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2' + + class CertificateError(ValueError): pass @@ -181,7 +187,10 @@ __slots__ = ('protocol',) def __new__(cls, protocol, *args, **kwargs): - return _SSLContext.__new__(cls, protocol) + self = _SSLContext.__new__(cls, protocol) + if protocol != _SSLv2_IF_EXISTS: + self.set_ciphers(_DEFAULT_CIPHERS) + return self def __init__(self, protocol): self.protocol = protocol diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -878,10 +878,11 @@ try: self.sslconn = self.server.context.wrap_socket( self.sock, server_side=True) - except ssl.SSLError: + except ssl.SSLError as e: # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. + self.server.conn_errors.append(e) if self.server.chatty: handle_error("\n server: bad connection attempt from " + repr(self.addr) + ":\n") self.running = False @@ -999,12 +1000,14 @@ self.port = support.bind_port(self.sock) self.flag = None self.active = False + self.conn_errors = [] threading.Thread.__init__(self) self.daemon = True def __enter__(self): self.start(threading.Event()) self.flag.wait() + return self def __exit__(self, *args): self.stop() @@ -1124,6 +1127,7 @@ def __enter__(self): self.start(threading.Event()) self.flag.wait() + return self def __exit__(self, *args): if support.verbose: @@ -1739,6 +1743,22 @@ t.join() server.close() + def test_default_ciphers(self): + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + try: + # Force a set of weak ciphers on our client context + context.set_ciphers("DES") + except ssl.SSLError: + self.skipTest("no DES cipher available") + with ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_SSLv23, + chatty=False) as server: + with socket.socket() as sock: + s = context.wrap_socket(sock) + with self.assertRaises((OSError, ssl.SSLError)): + s.connect((HOST, server.port)) + self.assertIn("no shared cipher", str(server.conn_errors[0])) + @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES, "'tls-unique' channel binding not available") def test_tls_unique_channel_binding(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -422,6 +422,9 @@ Library ------- +- Issue #13636: Weak ciphers are now disabled by default in the ssl module + (except when SSLv2 is explicitly asked for). + - Issue #12715: Add an optional symlinks argument to shutil functions (copyfile, copymode, copystat, copy, copy2). When that parameter is true, symlinks aren't dereferenced and the operation instead acts on the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:51:43 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 03 Jan 2012 22:51:43 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_Merge?= Message-ID: http://hg.python.org/cpython/rev/b4c203ee4306 changeset: 74250:b4c203ee4306 branch: 3.2 parent: 74248:25c2d24e1b11 parent: 74246:4a30d36a9c69 user: Antoine Pitrou date: Tue Jan 03 22:49:56 2012 +0100 summary: Merge files: Doc/library/socketserver.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -153,13 +153,14 @@ .. method:: BaseServer.serve_forever(poll_interval=0.5) - Handle requests until an explicit :meth:`shutdown` request. Polls for - shutdown every *poll_interval* seconds. + Handle requests until an explicit :meth:`shutdown` request. + Poll for shutdown every *poll_interval* seconds. Ignores :attr:`self.timeout`. + If you need to do periodic tasks, do them in another thread. .. method:: BaseServer.shutdown() - Tells the :meth:`serve_forever` loop to stop and waits until it does. + Tell the :meth:`serve_forever` loop to stop and wait until it does. .. attribute:: BaseServer.address_family -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 22:51:44 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 03 Jan 2012 22:51:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/65ac469d30e6 changeset: 74251:65ac469d30e6 parent: 74249:ace54f5e75d7 parent: 74247:4c243c8ecd10 user: Antoine Pitrou date: Tue Jan 03 22:50:16 2012 +0100 summary: Merge files: Doc/library/socketserver.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -153,8 +153,8 @@ .. method:: BaseServer.serve_forever(poll_interval=0.5) - Handle requests until an explicit :meth:`shutdown` request. Polls for - shutdown every *poll_interval* seconds. It also calls + Handle requests until an explicit :meth:`shutdown` request. + Poll for shutdown every *poll_interval* seconds. Ignores :attr:`self.timeout`. It also calls :meth:`service_actions` which may be used by a subclass or Mixin to provide various cleanup actions. For e.g. ForkingMixin class uses :meth:`service_actions` to cleanup the zombie child processes. @@ -172,7 +172,7 @@ .. method:: BaseServer.shutdown() - Tells the :meth:`serve_forever` loop to stop and waits until it does. + Tell the :meth:`serve_forever` loop to stop and waits until it does. .. attribute:: BaseServer.address_family -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:00:50 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 03 Jan 2012 23:00:50 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNjM2?= =?utf8?q?=3A_Weak_ciphers_are_now_disabled_by_default_in_the_ssl_module?= Message-ID: http://hg.python.org/cpython/rev/f9122975fd80 changeset: 74252:f9122975fd80 branch: 2.7 parent: 74245:4fad6b811c8b user: Antoine Pitrou date: Tue Jan 03 22:46:48 2012 +0100 summary: Issue #13636: Weak ciphers are now disabled by default in the ssl module (except when SSLv2 is explicitly asked for). files: Lib/ssl.py | 11 ++++++++++- Lib/test/test_ssl.py | 25 ++++++++++++++++++++++++- Misc/NEWS | 3 +++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Lib/ssl.py b/Lib/ssl.py --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -81,8 +81,9 @@ } try: from _ssl import PROTOCOL_SSLv2 + _SSLv2_IF_EXISTS = PROTOCOL_SSLv2 except ImportError: - pass + _SSLv2_IF_EXISTS = None else: _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2" @@ -91,6 +92,11 @@ import base64 # for DER-to-PEM translation import errno +# Disable weak or insecure ciphers by default +# (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL') +_DEFAULT_CIPHERS = 'DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2' + + class SSLSocket(socket): """This class implements a subtype of socket.socket that wraps @@ -112,6 +118,9 @@ except AttributeError: pass + if ciphers is None and ssl_version != _SSLv2_IF_EXISTS: + ciphers = _DEFAULT_CIPHERS + if certfile and not keyfile: keyfile = certfile # see if it's connected diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -417,10 +417,11 @@ ca_certs=self.server.cacerts, cert_reqs=self.server.certreqs, ciphers=self.server.ciphers) - except ssl.SSLError: + except ssl.SSLError as e: # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, # or a low-level bug. This should be made more discriminating. + self.server.conn_errors.append(e) if self.server.chatty: handle_error("\n server: bad connection attempt from " + str(self.sock.getpeername()) + ":\n") @@ -529,12 +530,14 @@ sys.stdout.write(' server: wrapped server socket as %s\n' % str(self.sock)) self.port = test_support.bind_port(self.sock) self.active = False + self.conn_errors = [] threading.Thread.__init__(self) self.daemon = True def __enter__(self): self.start(threading.Event()) self.flag.wait() + return self def __exit__(self, *args): self.stop() @@ -649,6 +652,7 @@ def __enter__(self): self.start(threading.Event()) self.flag.wait() + return self def __exit__(self, *args): if test_support.verbose: @@ -1310,6 +1314,25 @@ t.join() server.close() + def test_default_ciphers(self): + with ThreadedEchoServer(CERTFILE, + ssl_version=ssl.PROTOCOL_SSLv23, + chatty=False) as server: + sock = socket.socket() + try: + # Force a set of weak ciphers on our client socket + try: + s = ssl.wrap_socket(sock, + ssl_version=ssl.PROTOCOL_SSLv23, + ciphers="DES") + except ssl.SSLError: + self.skipTest("no DES cipher available") + with self.assertRaises((OSError, ssl.SSLError)): + s.connect((HOST, server.port)) + finally: + sock.close() + self.assertIn("no shared cipher", str(server.conn_errors[0])) + def test_main(verbose=False): global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -89,6 +89,9 @@ Library ------- +- Issue #13636: Weak ciphers are now disabled by default in the ssl module + (except when SSLv2 is explicitly asked for). + - Issue #12798: Updated the mimetypes documentation. - Issue #13639: Accept unicode filenames in tarfile.open(mode="w|gz"). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:28:53 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:28:53 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E1=29=3A_fix_this_to_not?= =?utf8?q?_depend_on_dictionary_order?= Message-ID: http://hg.python.org/cpython/rev/fb5707168351 changeset: 74253:fb5707168351 branch: 3.1 parent: 71565:1b3c21b12e92 user: Benjamin Peterson date: Tue Jan 03 16:23:11 2012 -0600 summary: fix this to not depend on dictionary order files: Lib/test/test_symtable.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -80,10 +80,10 @@ def test_function_info(self): func = self.spam - self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var")) - self.assertEqual(func.get_locals(), - ("a", "b", "bar", "glob", "internal", "kw", "var", "x")) - self.assertEqual(func.get_globals(), ("bar", "glob")) + self.assertEqual(sorted(func.get_parameters()), ["a", "b", "kw", "var"]) + expected = ["a", "b", "bar", "glob", "internal", "kw", "var", "x"] + self.assertEqual(sorted(func.get_locals()), expected) + self.assertEqual(sorted(func.get_globals()), ["bar", "glob"]) self.assertEqual(self.internal.get_frees(), ("x",)) def test_globals(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:28:54 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:28:54 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4xIC0+IDMuMik6?= =?utf8?q?_merge_3=2E1?= Message-ID: http://hg.python.org/cpython/rev/a78d7926c35d changeset: 74254:a78d7926c35d branch: 3.2 parent: 74250:b4c203ee4306 parent: 74253:fb5707168351 user: Benjamin Peterson date: Tue Jan 03 16:24:39 2012 -0600 summary: merge 3.1 files: Lib/test/test_symtable.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -80,10 +80,10 @@ def test_function_info(self): func = self.spam - self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var")) - self.assertEqual(func.get_locals(), - ("a", "b", "internal", "kw", "var", "x")) - self.assertEqual(func.get_globals(), ("bar", "glob")) + self.assertEqual(sorted(func.get_parameters()), ["a", "b", "kw", "var"]) + expected = ["a", "b", "internal", "kw", "var", "x"] + self.assertEqual(sorted(func.get_locals()), expected) + self.assertEqual(sorted(func.get_globals()), ["bar", "glob"]) self.assertEqual(self.internal.get_frees(), ("x",)) def test_globals(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:28:55 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:28:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/d2b4150c1885 changeset: 74255:d2b4150c1885 parent: 74251:65ac469d30e6 parent: 74254:a78d7926c35d user: Benjamin Peterson date: Tue Jan 03 16:26:34 2012 -0600 summary: merge 3.2 files: Doc/library/socketserver.rst | 2 +- Lib/test/test_symtable.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -172,7 +172,7 @@ .. method:: BaseServer.shutdown() - Tell the :meth:`serve_forever` loop to stop and waits until it does. + Tell the :meth:`serve_forever` loop to stop and wait until it does. .. attribute:: BaseServer.address_family diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -80,10 +80,10 @@ def test_function_info(self): func = self.spam - self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var")) - self.assertEqual(func.get_locals(), - ("a", "b", "internal", "kw", "var", "x")) - self.assertEqual(func.get_globals(), ("bar", "glob")) + self.assertEqual(sorted(func.get_parameters()), ["a", "b", "kw", "var"]) + expected = ["a", "b", "internal", "kw", "var", "x"] + self.assertEqual(sorted(func.get_locals()), expected) + self.assertEqual(sorted(func.get_globals()), ["bar", "glob"]) self.assertEqual(self.internal.get_frees(), ("x",)) def test_globals(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:28:59 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:28:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_fix_this_to_not?= =?utf8?q?_depend_on_dictionary_order?= Message-ID: http://hg.python.org/cpython/rev/789d59773801 changeset: 74256:789d59773801 branch: 2.7 parent: 74252:f9122975fd80 user: Benjamin Peterson date: Tue Jan 03 16:23:11 2012 -0600 summary: fix this to not depend on dictionary order files: Lib/test/test_symtable.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -88,10 +88,10 @@ def test_function_info(self): func = self.spam - self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var")) - self.assertEqual(func.get_locals(), - ("a", "b", "internal", "kw", "var", "x")) - self.assertEqual(func.get_globals(), ("bar", "glob")) + self.assertEqual(sorted(func.get_parameters()), ["a", "b", "kw", "var"]) + expected = ["a", "b", "internal", "kw", "var", "x"] + self.assertEqual(sorted(func.get_locals()), expected) + self.assertEqual(sorted(func.get_globals()), ["bar", "glob"]) self.assertEqual(self.internal.get_frees(), ("x",)) def test_globals(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:30:59 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:30:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_exception_suppo?= =?utf8?q?rt_is_correct_now_=28closes_=2313705=29?= Message-ID: http://hg.python.org/cpython/rev/c39fbb24b3f4 changeset: 74257:c39fbb24b3f4 branch: 3.2 parent: 74254:a78d7926c35d user: Benjamin Peterson date: Tue Jan 03 16:30:37 2012 -0600 summary: exception support is correct now (closes #13705) files: Doc/reference/compound_stmts.rst | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -310,8 +310,9 @@ is executed. If there is a saved exception, it is re-raised at the end of the :keyword:`finally` clause. If the :keyword:`finally` clause raises another exception or executes a :keyword:`return` or :keyword:`break` statement, the -saved exception is lost. The exception information is not available to the -program during execution of the :keyword:`finally` clause. +saved exception is set as the context of the new exception. The exception +information is not available to the program during execution of the +:keyword:`finally` clause. .. index:: statement: return -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:31:00 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:31:00 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/fdcb6935f3f2 changeset: 74258:fdcb6935f3f2 parent: 74255:d2b4150c1885 parent: 74257:c39fbb24b3f4 user: Benjamin Peterson date: Tue Jan 03 16:30:47 2012 -0600 summary: merge 3.2 files: Doc/reference/compound_stmts.rst | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -310,8 +310,9 @@ is executed. If there is a saved exception, it is re-raised at the end of the :keyword:`finally` clause. If the :keyword:`finally` clause raises another exception or executes a :keyword:`return` or :keyword:`break` statement, the -saved exception is lost. The exception information is not available to the -program during execution of the :keyword:`finally` clause. +saved exception is set as the context of the new exception. The exception +information is not available to the program during execution of the +:keyword:`finally` clause. .. index:: statement: return -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:48:34 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:48:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_fix_formatting?= Message-ID: http://hg.python.org/cpython/rev/7b01b88aae44 changeset: 74259:7b01b88aae44 branch: 3.2 parent: 74257:c39fbb24b3f4 user: Benjamin Peterson date: Tue Jan 03 16:47:22 2012 -0600 summary: fix formatting files: Python/bltinmodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -494,7 +494,7 @@ PyObject *format_spec = NULL; if (!PyArg_ParseTuple(args, "O|U:format", &value, &format_spec)) - return NULL; + return NULL; return PyObject_Format(value, format_spec); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 3 23:48:35 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 03 Jan 2012 23:48:35 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/f24faf5a6af2 changeset: 74260:f24faf5a6af2 parent: 74258:fdcb6935f3f2 parent: 74259:7b01b88aae44 user: Benjamin Peterson date: Tue Jan 03 16:48:14 2012 -0600 summary: merge 3.2 files: Python/bltinmodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -496,7 +496,7 @@ PyObject *format_spec = NULL; if (!PyArg_ParseTuple(args, "O|U:format", &value, &format_spec)) - return NULL; + return NULL; return PyObject_Format(value, format_spec); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 00:59:07 2012 From: python-checkins at python.org (victor.stinner) Date: Wed, 04 Jan 2012 00:59:07 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_a_new_PyUnicode=5FFill?= =?utf8?q?=28=29_function?= Message-ID: http://hg.python.org/cpython/rev/405f65676010 changeset: 74261:405f65676010 user: Victor Stinner date: Wed Jan 04 00:33:50 2012 +0100 summary: Add a new PyUnicode_Fill() function It is faster than the unicode_fill() function which was implemented in formatter_unicode.c. files: Doc/c-api/unicode.rst | 15 +++++++++++ Include/unicodeobject.h | 25 +++++++++++++++-- Objects/unicodeobject.c | 35 ++++++++++++++++++++++++++ Python/formatter_unicode.c | 21 ++++----------- 4 files changed, 77 insertions(+), 19 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -564,6 +564,21 @@ .. versionadded:: 3.3 +.. c:function:: int PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, \ + Py_ssize_t length, Py_UCS4 fill_char) + + Fill a string with a character: write *fill_char* into + ``unicode[start:start+length]``. + + Fail if *fill_char* is bigger than the string maximum character, or if the + string has more than 1 reference. + + Return the number of written character, or return ``-1`` and raise an + exception on error. + + .. versionadded:: 3.3 + + .. c:function:: int PyUnicode_WriteChar(PyObject *unicode, Py_ssize_t index, \ Py_UCS4 character) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -623,11 +623,11 @@ #endif /* Copy character from one unicode object into another, this function performs - character conversion when necessary and falls back to memcpy if possible. - - Fail if to is too small (smaller than how_many or smaller than + character conversion when necessary and falls back to memcpy() if possible. + + Fail if to is too small (smaller than *how_many* or smaller than len(from)-from_start), or if kind(from[from_start:from_start+how_many]) > - kind(to), or if to has more than 1 reference. + kind(to), or if *to* has more than 1 reference. Return the number of written character, or return -1 and raise an exception on error. @@ -650,6 +650,23 @@ ); #endif +/* Fill a string with a character: write fill_char into + unicode[start:start+length]. + + Fail if fill_char is bigger than the string maximum character, or if the + string has more than 1 reference. + + Return the number of written character, or return -1 and raise an exception + on error. */ +#ifndef Py_LIMITED_API +PyAPI_FUNC(Py_ssize_t) PyUnicode_Fill( + PyObject *unicode, + Py_ssize_t start, + Py_ssize_t length, + Py_UCS4 fill_char + ); +#endif + /* Create a Unicode Object from the Py_UNICODE buffer u of the given size. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9818,6 +9818,41 @@ } \ } while (0) +Py_ssize_t +PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, Py_ssize_t length, + Py_UCS4 fill_char) +{ + Py_ssize_t maxlen; + enum PyUnicode_Kind kind; + void *data; + + if (!PyUnicode_Check(unicode)) { + PyErr_BadInternalCall(); + return -1; + } + if (PyUnicode_READY(unicode) == -1) + return -1; + if (unicode_check_modifiable(unicode)) + return -1; + + if (fill_char > PyUnicode_MAX_CHAR_VALUE(unicode)) { + PyErr_SetString(PyExc_ValueError, + "fill character is bigger than " + "the string maximum character"); + return -1; + } + + maxlen = PyUnicode_GET_LENGTH(unicode) - start; + length = Py_MIN(maxlen, length); + if (length <= 0) + return 0; + + kind = PyUnicode_KIND(unicode); + data = PyUnicode_DATA(unicode); + FILL(kind, data, fill_char, start, length); + return length; +} + static PyObject * pad(PyObject *self, Py_ssize_t left, diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -317,15 +317,6 @@ *n_rpadding = *n_total - nchars - *n_lpadding; } -static void -unicode_fill(PyObject *str, Py_ssize_t start, Py_ssize_t end, Py_UCS4 ch) -{ - int kind = PyUnicode_KIND(str); - void *data = PyUnicode_DATA(str); - while (start < end) - PyUnicode_WRITE(kind, data, start++, ch); -} - /* Do the padding, and return a pointer to where the caller-supplied content goes. */ static Py_ssize_t @@ -335,12 +326,12 @@ { /* Pad on left. */ if (n_lpadding) - unicode_fill(s, start, start + n_lpadding, fill_char); + PyUnicode_Fill(s, start, start + n_lpadding, fill_char); /* Pad on right. */ if (n_rpadding) - unicode_fill(s, start + nchars + n_lpadding, - start + nchars + n_lpadding + n_rpadding, fill_char); + PyUnicode_Fill(s, start + nchars + n_lpadding, + start + nchars + n_lpadding + n_rpadding, fill_char); /* Pointer to the user content. */ return start + n_lpadding; @@ -557,7 +548,7 @@ #endif if (spec->n_lpadding) { - unicode_fill(out, pos, pos + spec->n_lpadding, fill_char); + PyUnicode_Fill(out, pos, pos + spec->n_lpadding, fill_char); pos += spec->n_lpadding; } if (spec->n_sign == 1) { @@ -581,7 +572,7 @@ pos += spec->n_prefix; } if (spec->n_spadding) { - unicode_fill(out, pos, pos + spec->n_spadding, fill_char); + PyUnicode_Fill(out, pos, pos + spec->n_spadding, fill_char); pos += spec->n_spadding; } @@ -640,7 +631,7 @@ } if (spec->n_rpadding) { - unicode_fill(out, pos, pos + spec->n_rpadding, fill_char); + PyUnicode_Fill(out, pos, pos + spec->n_rpadding, fill_char); pos += spec->n_rpadding; } return 0; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 02:56:04 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 04 Jan 2012 02:56:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Add_a_subsectio?= =?utf8?q?n_explaning_cipher_selection=2E?= Message-ID: http://hg.python.org/cpython/rev/b8f978aa2614 changeset: 74262:b8f978aa2614 branch: 3.2 parent: 74259:7b01b88aae44 user: Antoine Pitrou date: Wed Jan 04 02:53:44 2012 +0100 summary: Add a subsection explaning cipher selection. files: Doc/library/ssl.rst | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -984,6 +984,25 @@ The SSL context created above will allow SSLv3 and TLSv1 connections, but not SSLv2. +Cipher selection +^^^^^^^^^^^^^^^^ + +If you have advanced security requirements, fine-tuning of the ciphers +enabled when negotiating a SSL session is possible through the +:meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the +ssl module disables certain weak ciphers by default, but you may want +to further restrict the cipher choice. For example:: + + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.set_ciphers('HIGH:!aNULL:!eNULL') + +The ``!aNULL:!eNULL`` part of the cipher spec is necessary to disable ciphers +which don't provide both encryption and authentication. Be sure to read +OpenSSL's documentation about the `cipher list +format `_. +If you want to check which ciphers are enabled by a given cipher list, +use the ``openssl ciphers`` command on your system. + .. seealso:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 02:56:05 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 04 Jan 2012 02:56:05 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Add_a_subsection_explaning_cipher_selection=2E?= Message-ID: http://hg.python.org/cpython/rev/8f7c4b16c8d7 changeset: 74263:8f7c4b16c8d7 parent: 74261:405f65676010 parent: 74262:b8f978aa2614 user: Antoine Pitrou date: Wed Jan 04 02:54:12 2012 +0100 summary: Add a subsection explaning cipher selection. files: Doc/library/ssl.rst | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1174,6 +1174,25 @@ The SSL context created above will allow SSLv3 and TLSv1 connections, but not SSLv2. +Cipher selection +^^^^^^^^^^^^^^^^ + +If you have advanced security requirements, fine-tuning of the ciphers +enabled when negotiating a SSL session is possible through the +:meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the +ssl module disables certain weak ciphers by default, but you may want +to further restrict the cipher choice. For example:: + + context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + context.set_ciphers('HIGH:!aNULL:!eNULL') + +The ``!aNULL:!eNULL`` part of the cipher spec is necessary to disable ciphers +which don't provide both encryption and authentication. Be sure to read +OpenSSL's documentation about the `cipher list +format `_. +If you want to check which ciphers are enabled by a given cipher list, +use the ``openssl ciphers`` command on your system. + .. seealso:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 04:27:13 2012 From: python-checkins at python.org (victor.stinner) Date: Wed, 04 Jan 2012 04:27:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_PyUnicode=5FFill=28=29_?= =?utf8?q?doc=3A_return_type_is_Py=5Fssize=5Ft=2C_not_int?= Message-ID: http://hg.python.org/cpython/rev/547e918d7bf5 changeset: 74264:547e918d7bf5 user: Victor Stinner date: Wed Jan 04 03:59:16 2012 +0100 summary: Fix PyUnicode_Fill() doc: return type is Py_ssize_t, not int files: Doc/c-api/unicode.rst | 2 +- Doc/whatsnew/3.3.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -564,7 +564,7 @@ .. versionadded:: 3.3 -.. c:function:: int PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, \ +.. c:function:: Py_ssize_t PyUnicode_Fill(PyObject *unicode, Py_ssize_t start, \ Py_ssize_t length, Py_UCS4 fill_char) Fill a string with a character: write *fill_char* into diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -828,7 +828,7 @@ * :c:macro:`Py_UNICODE_strncmp`: use :c:func:`PyUnicode_Tailmatch` * :c:macro:`Py_UNICODE_strchr`, :c:macro:`Py_UNICODE_strrchr`: use :c:func:`PyUnicode_FindChar` - * :c:macro:`Py_UNICODE_FILL` + * :c:macro:`Py_UNICODE_FILL`: use :c:func:`PyUnicode_Fill` * :c:macro:`Py_UNICODE_MATCH` Encoders: -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jan 4 05:31:32 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 04 Jan 2012 05:31:32 +0100 Subject: [Python-checkins] Daily reference leaks (8f7c4b16c8d7): sum=0 Message-ID: results for 8f7c4b16c8d7 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/refloguaZB_e', '-x'] From python-checkins at python.org Wed Jan 4 07:47:44 2012 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 04 Jan 2012 07:47:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Issue13696_-_Fi?= =?utf8?q?x_302_Redirection_for_Relative_urls=2E?= Message-ID: http://hg.python.org/cpython/rev/86141d28b20d changeset: 74265:86141d28b20d branch: 3.2 parent: 74262:b8f978aa2614 user: Senthil Kumaran date: Wed Jan 04 13:46:59 2012 +0800 summary: Issue13696 - Fix 302 Redirection for Relative urls. files: Lib/test/test_urllib2.py | 13 +++++++++++++ Lib/urllib/request.py | 4 ++-- Misc/NEWS | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1059,6 +1059,19 @@ MockHeaders({"location": valid_url})) self.assertEqual(o.req.get_full_url(), valid_url) + def test_relative_redirect(self): + from_url = "http://example.com/a.html" + relative_url = "/b.html" + h = urllib.request.HTTPRedirectHandler() + o = h.parent = MockOpener() + req = Request(from_url) + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + + valid_url = urllib.parse.urljoin(from_url,relative_url) + h.http_error_302(req, MockFile(), 302, "That's fine", + MockHeaders({"location": valid_url})) + self.assertEqual(o.req.get_full_url(), valid_url) + def test_cookie_redirect(self): # cookies shouldn't leak into redirected requests from http.cookiejar import CookieJar diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -552,7 +552,7 @@ # For security reasons we don't allow redirection to anything other # than http, https or ftp. - if urlparts.scheme not in ('http', 'https', 'ftp'): + if urlparts.scheme not in ('http', 'https', 'ftp', ''): raise HTTPError( newurl, code, "%s - Redirection to url '%s' is not allowed" % (msg, newurl), @@ -1935,7 +1935,7 @@ # We are using newer HTTPError with older redirect_internal method # This older method will get deprecated in 3.3 - if urlparts.scheme not in ('http', 'https', 'ftp'): + if urlparts.scheme not in ('http', 'https', 'ftp', ''): raise HTTPError(newurl, errcode, errmsg + " Redirection to url '%s' is not allowed." % newurl, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,8 @@ Library ------- +- Issue #13696: Fix the 302 Relative URL Redirection problem. + - Issue #13636: Weak ciphers are now disabled by default in the ssl module (except when SSLv2 is explicitly asked for). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 07:47:45 2012 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 04 Jan 2012 07:47:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/19135974ddca changeset: 74266:19135974ddca parent: 74264:547e918d7bf5 parent: 74265:86141d28b20d user: Senthil Kumaran date: Wed Jan 04 14:47:30 2012 +0800 summary: merge from 3.2 files: Lib/test/test_urllib2.py | 13 +++++++++++++ Lib/urllib/request.py | 4 ++-- Misc/NEWS | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1076,6 +1076,19 @@ MockHeaders({"location": valid_url})) self.assertEqual(o.req.get_full_url(), valid_url) + def test_relative_redirect(self): + from_url = "http://example.com/a.html" + relative_url = "/b.html" + h = urllib.request.HTTPRedirectHandler() + o = h.parent = MockOpener() + req = Request(from_url) + req.timeout = socket._GLOBAL_DEFAULT_TIMEOUT + + valid_url = urllib.parse.urljoin(from_url,relative_url) + h.http_error_302(req, MockFile(), 302, "That's fine", + MockHeaders({"location": valid_url})) + self.assertEqual(o.req.get_full_url(), valid_url) + def test_cookie_redirect(self): # cookies shouldn't leak into redirected requests from http.cookiejar import CookieJar diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -572,7 +572,7 @@ # For security reasons we don't allow redirection to anything other # than http, https or ftp. - if urlparts.scheme not in ('http', 'https', 'ftp'): + if urlparts.scheme not in ('http', 'https', 'ftp', ''): raise HTTPError( newurl, code, "%s - Redirection to url '%s' is not allowed" % (msg, newurl), @@ -1963,7 +1963,7 @@ # We are using newer HTTPError with older redirect_internal method # This older method will get deprecated in 3.3 - if urlparts.scheme not in ('http', 'https', 'ftp'): + if urlparts.scheme not in ('http', 'https', 'ftp', ''): raise HTTPError(newurl, errcode, errmsg + " Redirection to url '%s' is not allowed." % newurl, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -422,6 +422,8 @@ Library ------- +- Issue #13696: Fix the 302 Relative URL Redirection problem. + - Issue #13636: Weak ciphers are now disabled by default in the ssl module (except when SSLv2 is explicitly asked for). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 13:02:42 2012 From: python-checkins at python.org (vinay.sajip) Date: Wed, 04 Jan 2012 13:02:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Refactored_logging_rotating?= =?utf8?q?_handlers_for_improved_flexibility=2E?= Message-ID: http://hg.python.org/cpython/rev/57295c4d81ac changeset: 74267:57295c4d81ac user: Vinay Sajip date: Wed Jan 04 12:02:26 2012 +0000 summary: Refactored logging rotating handlers for improved flexibility. files: Doc/howto/logging-cookbook.rst | 28 ++++++ Doc/library/logging.handlers.rst | 81 ++++++++++++++++++++ Lib/logging/handlers.py | 70 +++++++++++++--- Lib/test/test_logging.py | 53 ++++++++++++- 4 files changed, 215 insertions(+), 17 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1102,3 +1102,31 @@ For more information about this configuration, you can see the `relevant section `_ of the Django documentation. + +.. _cookbook-rotator-namer: + +Using a rotator and namer to customise log rotation processing +-------------------------------------------------------------- + +An example of how you can define a namer and rotator is given in the following +snippet, which shows zlib-based compression of the log file:: + + def namer(name): + return name + ".gz" + + def rotator(source, dest): + with open(source, "rb") as sf: + data = sf.read() + compressed = zlib.compress(data, 9) + with open(dest, "wb") as df: + df.write(compressed) + os.remove(source) + + rh = logging.handlers.RotatingFileHandler(...) + rh.rotator = rotator + rh.namer = namer + +These are not ?true? .gz files, as they are bare compressed data, with no +?container? such as you?d find in an actual gzip file. This snippet is just +for illustration purposes. + diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -164,6 +164,87 @@ changed. If it has, the existing stream is flushed and closed and the file opened again, before outputting the record to the file. +.. _base-rotating-handler: + +BaseRotatingHandler +^^^^^^^^^^^^^^^^^^^ + +The :class:`BaseRotatingHandler` class, located in the :mod:`logging.handlers` +module, is the base class for the rotating file handlers, +:class:`RotatingFileHandler` and :class:`TimedRotatingFileHandler`. You should +not need to instantiate this class, but it has attributes and methods you may +need to override. + +.. class:: BaseRotatingHandler(filename, mode, encoding=None, delay=False) + + The parameters are as for :class:`FileHandler`. The attributes are: + + .. attribute:: namer + + If this attribute is set to a callable, the :meth:`rotation_filename` + method delegates to this callable. The parameters passed to the callable + are those passed to :meth:`rotation_filename`. + + .. note:: The namer function is called quite a few times during rollover, + so it should be as simple and as fast as possible. It should also + return the same output every time for a given input, otherwise the + rollover behaviour may not work as expected. + + .. versionadded:: 3.3 + + + .. attribute:: BaseRotatingHandler.rotator + + If this attribute is set to a callable, the :meth:`rotate` method + delegates to this callable. The parameters passed to the callable are + those passed to :meth:`rotate`. + + .. versionadded:: 3.3 + + .. method:: BaseRotatingHandler.rotation_filename(default_name) + + Modify the filename of a log file when rotating. + + This is provided so that a custom filename can be provided. + + The default implementation calls the 'namer' attribute of the handler, + if it's callable, passing the default name to it. If the attribute isn't + callable (the default is `None`), the name is returned unchanged. + + :param default_name: The default name for the log file. + + .. versionadded:: 3.3 + + + .. method:: BaseRotatingHandler.rotate(source, dest) + + When rotating, rotate the current log. + + The default implementation calls the 'rotator' attribute of the handler, + if it's callable, passing the source and dest arguments to it. If the + attribute isn't callable (the default is `None`), the source is simply + renamed to the destination. + + :param source: The source filename. This is normally the base + filename, e.g. 'test.log' + :param dest: The destination filename. This is normally + what the source is rotated to, e.g. 'test.log.1'. + + .. versionadded:: 3.3 + +The reason the attributes exist is to save you having to subclass - you can use +the same callables for instances of :class:`RotatingFileHandler` and +:class:`TimedRotatingFileHandler`. If either the namer or rotator callable +raises an exception, this will be handled in the same way as any other +exception during an :meth:`emit` call, i.e. via the :meth:`handleError` method +of the handler. + +If you need to make more significant changes to rotation processing, you can +override the methods. + +For an example, see :ref:`cookbook-rotator-namer`. + + .. _rotating-file-handler: RotatingFileHandler diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -52,13 +52,15 @@ Not meant to be instantiated directly. Instead, use RotatingFileHandler or TimedRotatingFileHandler. """ - def __init__(self, filename, mode, encoding=None, delay=0): + def __init__(self, filename, mode, encoding=None, delay=False): """ Use the specified filename for streamed logging """ logging.FileHandler.__init__(self, filename, mode, encoding, delay) self.mode = mode self.encoding = encoding + self.namer = None + self.rotator = None def emit(self, record): """ @@ -76,12 +78,50 @@ except: self.handleError(record) + def rotation_filename(self, default_name): + """ + Modify the filename of a log file when rotating. + + This is provided so that a custom filename can be provided. + + The default implementation calls the 'namer' attribute of the + handler, if it's callable, passing the default name to + it. If the attribute isn't callable (the default is None), the name + is returned unchanged. + + :param default_name: The default name for the log file. + """ + if not callable(self.namer): + result = default_name + else: + result = self.namer(default_name) + return result + + def rotate(self, source, dest): + """ + When rotating, rotate the current log. + + The default implementation calls the 'rotator' attribute of the + handler, if it's callable, passing the source and dest arguments to + it. If the attribute isn't callable (the default is None), the source + is simply renamed to the destination. + + :param source: The source filename. This is normally the base + filename, e.g. 'test.log' + :param dest: The destination filename. This is normally + what the source is rotated to, e.g. 'test.log.1'. + """ + if not callable(self.rotator): + os.rename(source, dest) + else: + self.rotator(source, dest) + class RotatingFileHandler(BaseRotatingHandler): """ Handler for logging to a set of files, which switches from one file to the next when the current file reaches a certain size. """ - def __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=0): + def __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=False): """ Open the specified file and use it as the stream for logging. @@ -122,16 +162,17 @@ self.stream = None if self.backupCount > 0: for i in range(self.backupCount - 1, 0, -1): - sfn = "%s.%d" % (self.baseFilename, i) - dfn = "%s.%d" % (self.baseFilename, i + 1) + sfn = self.rotation_filename("%s.%d" % (self.baseFilename, i)) + dfn = self.rotation_filename("%s.%d" % (self.baseFilename, + i + 1)) if os.path.exists(sfn): if os.path.exists(dfn): os.remove(dfn) os.rename(sfn, dfn) - dfn = self.baseFilename + ".1" + dfn = self.rotation_filename(self.baseFilename + ".1") if os.path.exists(dfn): os.remove(dfn) - os.rename(self.baseFilename, dfn) + self.rotate(self.baseFilename, dfn) self.mode = 'w' self.stream = self._open() @@ -179,19 +220,19 @@ if self.when == 'S': self.interval = 1 # one second self.suffix = "%Y-%m-%d_%H-%M-%S" - self.extMatch = r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}$" + self.extMatch = r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}(\.\w+)?$" elif self.when == 'M': self.interval = 60 # one minute self.suffix = "%Y-%m-%d_%H-%M" - self.extMatch = r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}$" + self.extMatch = r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}(\.\w+)?$" elif self.when == 'H': self.interval = 60 * 60 # one hour self.suffix = "%Y-%m-%d_%H" - self.extMatch = r"^\d{4}-\d{2}-\d{2}_\d{2}$" + self.extMatch = r"^\d{4}-\d{2}-\d{2}_\d{2}(\.\w+)?$" elif self.when == 'D' or self.when == 'MIDNIGHT': self.interval = 60 * 60 * 24 # one day self.suffix = "%Y-%m-%d" - self.extMatch = r"^\d{4}-\d{2}-\d{2}$" + self.extMatch = r"^\d{4}-\d{2}-\d{2}(\.\w+)?$" elif self.when.startswith('W'): self.interval = 60 * 60 * 24 * 7 # one week if len(self.when) != 2: @@ -200,7 +241,7 @@ raise ValueError("Invalid day specified for weekly rollover: %s" % self.when) self.dayOfWeek = int(self.when[1]) self.suffix = "%Y-%m-%d" - self.extMatch = r"^\d{4}-\d{2}-\d{2}$" + self.extMatch = r"^\d{4}-\d{2}-\d{2}(\.\w+)?$" else: raise ValueError("Invalid rollover interval specified: %s" % self.when) @@ -323,10 +364,11 @@ timeTuple = time.gmtime(t) else: timeTuple = time.localtime(t) - dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple) + dfn = self.rotation_filename(self.baseFilename + "." + + time.strftime(self.suffix, timeTuple)) if os.path.exists(dfn): os.remove(dfn) - os.rename(self.baseFilename, dfn) + self.rotate(self.baseFilename, dfn) if self.backupCount > 0: for s in self.getFilesToDelete(): os.remove(s) @@ -367,7 +409,7 @@ This handler is based on a suggestion and patch by Chad J. Schroeder. """ - def __init__(self, filename, mode='a', encoding=None, delay=0): + def __init__(self, filename, mode='a', encoding=None, delay=False): logging.FileHandler.__init__(self, filename, mode, encoding, delay) if not os.path.exists(self.baseFilename): self.dev, self.ino = -1, -1 diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -46,6 +46,7 @@ import unittest import warnings import weakref +import zlib try: import threading # The following imports are needed only for tests which @@ -3587,15 +3588,61 @@ rh.close() def test_rollover_filenames(self): + def namer(name): + return name + ".test" rh = logging.handlers.RotatingFileHandler( self.fn, backupCount=2, maxBytes=1) + rh.namer = namer rh.emit(self.next_rec()) self.assertLogFile(self.fn) rh.emit(self.next_rec()) - self.assertLogFile(self.fn + ".1") + self.assertLogFile(namer(self.fn + ".1")) rh.emit(self.next_rec()) - self.assertLogFile(self.fn + ".2") - self.assertFalse(os.path.exists(self.fn + ".3")) + self.assertLogFile(namer(self.fn + ".2")) + self.assertFalse(os.path.exists(namer(self.fn + ".3"))) + rh.close() + + def test_rotator(self): + def namer(name): + return name + ".gz" + + def rotator(source, dest): + with open(source, "rb") as sf: + data = sf.read() + compressed = zlib.compress(data, 9) + with open(dest, "wb") as df: + df.write(compressed) + os.remove(source) + + rh = logging.handlers.RotatingFileHandler( + self.fn, backupCount=2, maxBytes=1) + rh.rotator = rotator + rh.namer = namer + m1 = self.next_rec() + rh.emit(m1) + self.assertLogFile(self.fn) + m2 = self.next_rec() + rh.emit(m2) + fn = namer(self.fn + ".1") + self.assertLogFile(fn) + with open(fn, "rb") as f: + compressed = f.read() + data = zlib.decompress(compressed) + self.assertEqual(data.decode("ascii"), m1.msg + "\n") + rh.emit(self.next_rec()) + fn = namer(self.fn + ".2") + self.assertLogFile(fn) + with open(fn, "rb") as f: + compressed = f.read() + data = zlib.decompress(compressed) + self.assertEqual(data.decode("ascii"), m1.msg + "\n") + rh.emit(self.next_rec()) + fn = namer(self.fn + ".2") + with open(fn, "rb") as f: + compressed = f.read() + data = zlib.decompress(compressed) + self.assertEqual(data.decode("ascii"), m2.msg + "\n") + self.assertFalse(os.path.exists(namer(self.fn + ".3"))) rh.close() class TimedRotatingFileHandlerTest(BaseFileTest): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 13:07:36 2012 From: python-checkins at python.org (vinay.sajip) Date: Wed, 04 Jan 2012 13:07:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Closes_=2313699=2E_Skipped_?= =?utf8?q?two_tests_if_Python_is_optimised=2E?= Message-ID: http://hg.python.org/cpython/rev/dfffb293f4b3 changeset: 74268:dfffb293f4b3 user: Vinay Sajip date: Wed Jan 04 12:07:30 2012 +0000 summary: Closes #13699. Skipped two tests if Python is optimised. files: Lib/test/test_gdb.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -662,6 +662,8 @@ self.assertMultilineMatches(bt, r".*\nlocal 'args' = \(1, 2, 3\)\n.*") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") def test_print_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), @@ -695,6 +697,8 @@ r".*\nargs = \(1, 2, 3\)\n.*") @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_locals_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), cmds_after_breakpoint=['py-up', 'py-locals']) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 16:20:59 2012 From: python-checkins at python.org (jason.coombs) Date: Wed, 04 Jan 2012 16:20:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Corrected_typo_in_install_d?= =?utf8?q?ocs?= Message-ID: http://hg.python.org/cpython/rev/f41ba8e5a3dd changeset: 74269:f41ba8e5a3dd user: Jason R. Coombs date: Wed Jan 04 10:20:37 2012 -0500 summary: Corrected typo in install docs files: Doc/install/install.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/install/install.rst b/Doc/install/install.rst --- a/Doc/install/install.rst +++ b/Doc/install/install.rst @@ -1,7 +1,7 @@ .. highlightlang:: none ==================================== -Installing Python projects: overwiew +Installing Python projects: overview ==================================== .. _packaging-install-intro: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 17:12:25 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 04 Jan 2012 17:12:25 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_convince_regrtest=2Epy_we_a?= =?utf8?q?ren=27t_modifying_=5FCONFIG=5FVARS?= Message-ID: http://hg.python.org/cpython/rev/d48d5fc44643 changeset: 74270:d48d5fc44643 user: Benjamin Peterson date: Wed Jan 04 10:12:14 2012 -0600 summary: convince regrtest.py we aren't modifying _CONFIG_VARS files: Lib/test/test_sysconfig.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -36,7 +36,8 @@ self.join = os.path.join self.isabs = os.path.isabs self.splitdrive = os.path.splitdrive - self._config_vars = copy(sysconfig._CONFIG_VARS) + self._config_vars = sysconfig._CONFIG_VARS + sysconfig._CONFIG_VARS = copy(sysconfig._CONFIG_VARS) self._added_envvars = [] self._changed_envvars = [] for var in ('MACOSX_DEPLOYMENT_TARGET', 'PATH'): @@ -59,7 +60,7 @@ os.path.join = self.join os.path.isabs = self.isabs os.path.splitdrive = self.splitdrive - sysconfig._CONFIG_VARS = copy(self._config_vars) + sysconfig._CONFIG_VARS = self._config_vars for var, value in self._changed_envvars: os.environ[var] = value for var in self._added_envvars: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 18:58:36 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 04 Jan 2012 18:58:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313713=3A_fix_a_reg?= =?utf8?q?ression_in_HTTP_chunked_reading_after_806cfe39f729?= Message-ID: http://hg.python.org/cpython/rev/4b21f651eeee changeset: 74271:4b21f651eeee user: Antoine Pitrou date: Wed Jan 04 18:57:22 2012 +0100 summary: Issue #13713: fix a regression in HTTP chunked reading after 806cfe39f729 (originally issue #13464: Add a readinto() method to http.client.HTTPResponse) files: Lib/http/client.py | 4 +- Lib/test/test_httplib.py | 64 +++++++++++++++++++++------ 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/Lib/http/client.py b/Lib/http/client.py --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -603,12 +603,12 @@ if len(mvb) < chunk_left: n = self._safe_readinto(mvb) self.chunk_left = chunk_left - n - return n + return total_bytes + n elif len(mvb) == chunk_left: n = self._safe_readinto(mvb) self._safe_read(2) # toss the CRLF at the end of the chunk self.chunk_left = None - return n + return total_bytes + n else: temp_mvb = mvb[0:chunk_left] n = self._safe_readinto(temp_mvb) diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -293,15 +293,28 @@ 'Transfer-Encoding: chunked\r\n\r\n' 'a\r\n' 'hello worl\r\n' - '1\r\n' - 'd\r\n' + '3\r\n' + 'd! \r\n' + '8\r\n' + 'and now \r\n' + '22\r\n' + 'for something completely different\r\n' ) + expected = b'hello world! and now for something completely different' sock = FakeSocket(chunked_start + '0\r\n') resp = client.HTTPResponse(sock, method="GET") resp.begin() - self.assertEqual(resp.read(), b'hello world') + self.assertEqual(resp.read(), expected) resp.close() + # Various read sizes + for n in range(1, 12): + sock = FakeSocket(chunked_start + '0\r\n') + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + self.assertEqual(resp.read(n) + resp.read(n) + resp.read(), expected) + resp.close() + for x in ('', 'foo\r\n'): sock = FakeSocket(chunked_start + x) resp = client.HTTPResponse(sock, method="GET") @@ -309,9 +322,10 @@ try: resp.read() except client.IncompleteRead as i: - self.assertEqual(i.partial, b'hello world') - self.assertEqual(repr(i),'IncompleteRead(11 bytes read)') - self.assertEqual(str(i),'IncompleteRead(11 bytes read)') + self.assertEqual(i.partial, expected) + expected_message = 'IncompleteRead(%d bytes read)' % len(expected) + self.assertEqual(repr(i), expected_message) + self.assertEqual(str(i), expected_message) else: self.fail('IncompleteRead expected') finally: @@ -323,29 +337,49 @@ 'Transfer-Encoding: chunked\r\n\r\n' 'a\r\n' 'hello worl\r\n' - '1\r\n' - 'd\r\n' + '3\r\n' + 'd! \r\n' + '8\r\n' + 'and now \r\n' + '22\r\n' + 'for something completely different\r\n' ) + expected = b'hello world! and now for something completely different' + nexpected = len(expected) + b = bytearray(128) + sock = FakeSocket(chunked_start + '0\r\n') resp = client.HTTPResponse(sock, method="GET") resp.begin() - b = bytearray(16) n = resp.readinto(b) - self.assertEqual(b[:11], b'hello world') - self.assertEqual(n, 11) + self.assertEqual(b[:nexpected], expected) + self.assertEqual(n, nexpected) resp.close() + # Various read sizes + for n in range(1, 12): + sock = FakeSocket(chunked_start + '0\r\n') + resp = client.HTTPResponse(sock, method="GET") + resp.begin() + m = memoryview(b) + i = resp.readinto(m[0:n]) + i += resp.readinto(m[i:n + i]) + i += resp.readinto(m[i:]) + self.assertEqual(b[:nexpected], expected) + self.assertEqual(i, nexpected) + resp.close() + for x in ('', 'foo\r\n'): sock = FakeSocket(chunked_start + x) resp = client.HTTPResponse(sock, method="GET") resp.begin() try: - b = bytearray(16) n = resp.readinto(b) except client.IncompleteRead as i: - self.assertEqual(i.partial, b'hello world') - self.assertEqual(repr(i),'IncompleteRead(11 bytes read)') - self.assertEqual(str(i),'IncompleteRead(11 bytes read)') + self.assertEqual(i.partial, expected) + expected_message = 'IncompleteRead(%d bytes read)' % len(expected) + self.assertEqual(repr(i), expected_message) + self.assertEqual(str(i), expected_message) else: self.fail('IncompleteRead expected') finally: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 23:26:40 2012 From: python-checkins at python.org (sandro.tosi) Date: Wed, 04 Jan 2012 23:26:40 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEwNzcy?= =?utf8?q?=3A_add_count_and_help_argparse_action=3B_patch_by_Marc_Sibson?= Message-ID: http://hg.python.org/cpython/rev/278fbd7b9608 changeset: 74272:278fbd7b9608 branch: 2.7 parent: 74256:789d59773801 user: Sandro Tosi date: Wed Jan 04 23:24:48 2012 +0100 summary: Issue #10772: add count and help argparse action; patch by Marc Sibson files: Doc/library/argparse.rst | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -703,6 +703,19 @@ >>> parser.parse_args('--str --int'.split()) Namespace(types=[, ]) +* ``'count'`` - This counts the number of times a keyword argument occurs. For + example, this is useful for increasing verbosity levels:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--verbose', '-v', action='count') + >>> parser.parse_args('-vvv'.split()) + Namespace(verbose=3) + +* ``'help'`` - This prints a complete help message for all the options in the + current parser and then exits. By default a help action is automatically + added to the parser. See :class:`ArgumentParser` for details of how the + output is created. + * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 23:26:41 2012 From: python-checkins at python.org (sandro.tosi) Date: Wed, 04 Jan 2012 23:26:41 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEwNzcy?= =?utf8?q?=3A_add_count_and_help_argparse_action=3B_patch_by_Marc_Sibson?= Message-ID: http://hg.python.org/cpython/rev/326f755962e3 changeset: 74273:326f755962e3 branch: 3.2 parent: 74265:86141d28b20d user: Sandro Tosi date: Wed Jan 04 23:25:04 2012 +0100 summary: Issue #10772: add count and help argparse action; patch by Marc Sibson files: Doc/library/argparse.rst | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -705,6 +705,19 @@ >>> parser.parse_args('--str --int'.split()) Namespace(types=[, ]) +* ``'count'`` - This counts the number of times a keyword argument occurs. For + example, this is useful for increasing verbosity levels:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--verbose', '-v', action='count') + >>> parser.parse_args('-vvv'.split()) + Namespace(verbose=3) + +* ``'help'`` - This prints a complete help message for all the options in the + current parser and then exits. By default a help action is automatically + added to the parser. See :class:`ArgumentParser` for details of how the + output is created. + * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 4 23:26:42 2012 From: python-checkins at python.org (sandro.tosi) Date: Wed, 04 Jan 2012 23:26:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/77fb6713037f changeset: 74274:77fb6713037f parent: 74271:4b21f651eeee parent: 74273:326f755962e3 user: Sandro Tosi date: Wed Jan 04 23:25:20 2012 +0100 summary: merge with 3.2 files: Doc/library/argparse.rst | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -724,6 +724,19 @@ >>> parser.parse_args('--str --int'.split()) Namespace(types=[, ]) +* ``'count'`` - This counts the number of times a keyword argument occurs. For + example, this is useful for increasing verbosity levels:: + + >>> parser = argparse.ArgumentParser() + >>> parser.add_argument('--verbose', '-v', action='count') + >>> parser.parse_args('-vvv'.split()) + Namespace(verbose=3) + +* ``'help'`` - This prints a complete help message for all the options in the + current parser and then exits. By default a help action is automatically + added to the parser. See :class:`ArgumentParser` for details of how the + output is created. + * ``'version'`` - This expects a ``version=`` keyword argument in the :meth:`~ArgumentParser.add_argument` call, and prints version information and exits when invoked. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Jan 5 05:31:25 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 05 Jan 2012 05:31:25 +0100 Subject: [Python-checkins] Daily reference leaks (77fb6713037f): sum=0 Message-ID: results for 77fb6713037f on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog5Y4Q4x', '-x'] From python-checkins at python.org Thu Jan 5 12:46:45 2012 From: python-checkins at python.org (vinay.sajip) Date: Thu, 05 Jan 2012 12:46:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Closes_=2313699?= =?utf8?q?=2E_Skipped_two_tests_if_Python_is_optimised=2E?= Message-ID: http://hg.python.org/cpython/rev/a3d4cde1c357 changeset: 74275:a3d4cde1c357 branch: 3.2 parent: 74273:326f755962e3 user: Vinay Sajip date: Thu Jan 05 11:45:31 2012 +0000 summary: Closes #13699. Skipped two tests if Python is optimised. files: Lib/test/test_gdb.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -662,6 +662,8 @@ self.assertMultilineMatches(bt, r".*\nlocal 'args' = \(1, 2, 3\)\n.*") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") def test_print_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), @@ -695,6 +697,8 @@ r".*\nargs = \(1, 2, 3\)\n.*") @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") + @unittest.skipIf(python_is_optimized(), + "Python was compiled with optimizations") def test_locals_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), cmds_after_breakpoint=['py-up', 'py-locals']) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 12:46:46 2012 From: python-checkins at python.org (vinay.sajip) Date: Thu, 05 Jan 2012 12:46:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Closes_=2313699=3A_merged_fix_from_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/7d87ebbbd718 changeset: 74276:7d87ebbbd718 parent: 74274:77fb6713037f parent: 74275:a3d4cde1c357 user: Vinay Sajip date: Thu Jan 05 11:46:20 2012 +0000 summary: Closes #13699: merged fix from 3.2. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 18:58:58 2012 From: python-checkins at python.org (lars.gustaebel) Date: Thu, 05 Jan 2012 18:58:58 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyOTI2?= =?utf8?q?=3A_Fix_a_bug_in_tarfile=27s_link_extraction=2E?= Message-ID: http://hg.python.org/cpython/rev/573fc99873bd changeset: 74277:573fc99873bd branch: 3.2 parent: 74275:a3d4cde1c357 user: Lars Gust?bel date: Thu Jan 05 18:48:06 2012 +0100 summary: Issue #12926: Fix a bug in tarfile's link extraction. On platforms that do not support (symbolic) links, tarfile offers a work-around and extracts a link in an archive as the regular file the link is pointing to. On other platforms, this code was accidentally executed even after the link had been successfully extracted which failed due to the already existing link. files: Lib/tarfile.py | 6 ------ Misc/NEWS | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2351,12 +2351,6 @@ self._extract_member(self._find_link_target(tarinfo), targetpath) except symlink_exception: - if tarinfo.issym(): - linkpath = os.path.join(os.path.dirname(tarinfo.name), - tarinfo.linkname) - else: - linkpath = tarinfo.linkname - else: try: self._extract_member(self._find_link_target(tarinfo), targetpath) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,8 @@ Library ------- +- Issue #12926: Fix a bug in tarfile's link extraction. + - Issue #13696: Fix the 302 Relative URL Redirection problem. - Issue #13636: Weak ciphers are now disabled by default in the ssl module -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 18:58:59 2012 From: python-checkins at python.org (lars.gustaebel) Date: Thu, 05 Jan 2012 18:58:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_from_3=2E2=3A_Issue_=2312926=3A_Fix_a_bug_in_tarfile?= =?utf8?q?=27s_link_extraction=2E?= Message-ID: http://hg.python.org/cpython/rev/5936c2005ab7 changeset: 74278:5936c2005ab7 parent: 74276:7d87ebbbd718 parent: 74277:573fc99873bd user: Lars Gust?bel date: Thu Jan 05 18:53:00 2012 +0100 summary: Merge from 3.2: Issue #12926: Fix a bug in tarfile's link extraction. On platforms that do not support (symbolic) links, tarfile offers a work-around and extracts a link in an archive as the regular file the link is pointing to. On other platforms, this code was accidentally executed even after the link had been successfully extracted which failed due to the already existing link. files: Lib/tarfile.py | 6 ------ Misc/NEWS | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2340,12 +2340,6 @@ self._extract_member(self._find_link_target(tarinfo), targetpath) except symlink_exception: - if tarinfo.issym(): - linkpath = os.path.join(os.path.dirname(tarinfo.name), - tarinfo.linkname) - else: - linkpath = tarinfo.linkname - else: try: self._extract_member(self._find_link_target(tarinfo), targetpath) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -422,6 +422,8 @@ Library ------- +- Issue #12926: Fix a bug in tarfile's link extraction. + - Issue #13696: Fix the 302 Relative URL Redirection problem. - Issue #13636: Weak ciphers are now disabled by default in the ssl module -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 19:08:37 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 05 Jan 2012 19:08:37 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExOTg0?= =?utf8?q?=3A_remove_reference_to_parser=2C_it=27s_not_showing_symbol_usag?= =?utf8?q?e_anymore?= Message-ID: http://hg.python.org/cpython/rev/d8102ccc5bf7 changeset: 74279:d8102ccc5bf7 branch: 2.7 parent: 74272:278fbd7b9608 user: Sandro Tosi date: Thu Jan 05 19:05:44 2012 +0100 summary: Issue #11984: remove reference to parser, it's not showing symbol usage anymore files: Doc/library/symbol.rst | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/Doc/library/symbol.rst b/Doc/library/symbol.rst --- a/Doc/library/symbol.rst +++ b/Doc/library/symbol.rst @@ -25,10 +25,3 @@ back to name strings, allowing more human-readable representation of parse trees to be generated. - -.. seealso:: - - Module :mod:`parser` - The second example for the :mod:`parser` module shows how to use the - :mod:`symbol` module. - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 19:08:38 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 05 Jan 2012 19:08:38 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzExOTg0?= =?utf8?q?=3A_remove_reference_to_parser=2C_it=27s_not_showing_symbol_usag?= =?utf8?q?e_anymore?= Message-ID: http://hg.python.org/cpython/rev/b326d90ce9c9 changeset: 74280:b326d90ce9c9 branch: 3.2 parent: 74277:573fc99873bd user: Sandro Tosi date: Thu Jan 05 19:06:25 2012 +0100 summary: Issue #11984: remove reference to parser, it's not showing symbol usage anymore files: Doc/library/symbol.rst | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/Doc/library/symbol.rst b/Doc/library/symbol.rst --- a/Doc/library/symbol.rst +++ b/Doc/library/symbol.rst @@ -24,11 +24,3 @@ Dictionary mapping the numeric values of the constants defined in this module back to name strings, allowing more human-readable representation of parse trees to be generated. - - -.. seealso:: - - Module :mod:`parser` - The second example for the :mod:`parser` module shows how to use the - :mod:`symbol` module. - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 19:08:39 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 05 Jan 2012 19:08:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2311984=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/f375a1be031c changeset: 74281:f375a1be031c parent: 74278:5936c2005ab7 parent: 74280:b326d90ce9c9 user: Sandro Tosi date: Thu Jan 05 19:06:56 2012 +0100 summary: Issue #11984: merge with 3.2 files: Doc/library/symbol.rst | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/Doc/library/symbol.rst b/Doc/library/symbol.rst --- a/Doc/library/symbol.rst +++ b/Doc/library/symbol.rst @@ -24,11 +24,3 @@ Dictionary mapping the numeric values of the constants defined in this module back to name strings, allowing more human-readable representation of parse trees to be generated. - - -.. seealso:: - - Module :mod:`parser` - The second example for the :mod:`parser` module shows how to use the - :mod:`symbol` module. - -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 19:51:03 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 05 Jan 2012 19:51:03 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMDQy?= =?utf8?q?=3A_a_queue_is_only_used_to_retrive_results=3B_preliminary_patch?= =?utf8?q?_by?= Message-ID: http://hg.python.org/cpython/rev/3353f9747a39 changeset: 74282:3353f9747a39 branch: 2.7 parent: 74279:d8102ccc5bf7 user: Sandro Tosi date: Thu Jan 05 19:48:30 2012 +0100 summary: Issue #12042: a queue is only used to retrive results; preliminary patch by Jordan Stadler files: Doc/whatsnew/2.6.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -611,8 +611,8 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the input parameter *N* and -the result. The :class:`Queue` object is stored in a global variable. +A :class:`Queue` is used to communicate the result of the factorial. +The :class:`Queue` object is stored in a global variable. The child process will use the value of the variable when the child was created; because it's a :class:`Queue`, parent and child can use the object to communicate. (If the parent were to change the value of -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 19:51:04 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 05 Jan 2012 19:51:04 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMDQy?= =?utf8?q?=3A_a_queue_is_only_used_to_retrive_results=3B_preliminary_patch?= =?utf8?q?_by?= Message-ID: http://hg.python.org/cpython/rev/0d4bb1356f39 changeset: 74283:0d4bb1356f39 branch: 3.2 parent: 74280:b326d90ce9c9 user: Sandro Tosi date: Thu Jan 05 19:48:56 2012 +0100 summary: Issue #12042: a queue is only used to retrive results; preliminary patch by Jordan Stadler files: Doc/whatsnew/2.6.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -615,8 +615,8 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the input parameter *N* and -the result. The :class:`Queue` object is stored in a global variable. +A :class:`Queue` is used to communicate the result of the factorial. +The :class:`Queue` object is stored in a global variable. The child process will use the value of the variable when the child was created; because it's a :class:`Queue`, parent and child can use the object to communicate. (If the parent were to change the value of -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 5 19:51:05 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 05 Jan 2012 19:51:05 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312042=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/e379617b4c4c changeset: 74284:e379617b4c4c parent: 74281:f375a1be031c parent: 74283:0d4bb1356f39 user: Sandro Tosi date: Thu Jan 05 19:49:27 2012 +0100 summary: Issue #12042: merge with 3.2 files: Doc/whatsnew/2.6.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -615,8 +615,8 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the input parameter *N* and -the result. The :class:`Queue` object is stored in a global variable. +A :class:`Queue` is used to communicate the result of the factorial. +The :class:`Queue` object is stored in a global variable. The child process will use the value of the variable when the child was created; because it's a :class:`Queue`, parent and child can use the object to communicate. (If the parent were to change the value of -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Thu Jan 5 23:45:33 2012 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 05 Jan 2012 17:45:33 -0500 Subject: [Python-checkins] cpython (2.7): Issue #12042: a queue is only used to retrive results; preliminary patch by In-Reply-To: References: Message-ID: <4F06280D.9060102@udel.edu> On 1/5/2012 1:51 PM, sandro.tosi wrote: > http://hg.python.org/cpython/rev/3353f9747a39 > changeset: 74282:3353f9747a39 > branch: 2.7 > Doc/whatsnew/2.6.rst | 4 ++-- should that have been whatsnew/2.7.rst? From solipsis at pitrou.net Fri Jan 6 05:32:30 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 06 Jan 2012 05:32:30 +0100 Subject: [Python-checkins] Daily reference leaks (e379617b4c4c): sum=0 Message-ID: results for e379617b4c4c on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog12saop', '-x'] From python-checkins at python.org Fri Jan 6 08:24:03 2012 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 06 Jan 2012 08:24:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Clarify_that_va?= =?utf8?q?rs=28=29_doesn=27t_place_extra_restrictions_on_=5F=5Fdict=5F=5F?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/f0666e56a552 changeset: 74285:f0666e56a552 branch: 2.7 parent: 74282:3353f9747a39 user: Raymond Hettinger date: Thu Jan 05 23:23:52 2012 -0800 summary: Clarify that vars() doesn't place extra restrictions on __dict__. files: Doc/library/functions.rst | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1447,15 +1447,17 @@ .. function:: vars([object]) - Without an argument, act like :func:`locals`. + Return the :attr:`__dict__` attribute for a module, class, instance, + or any other object with a :attr:`__dict__` attribute. - With a module, class or class instance object as argument (or anything else that - has a :attr:`__dict__` attribute), return that attribute. + Objects such as modules and instances have an updateable :attr:`__dict__` + attribute; however, other objects may have write restrictions on their + :attr:`__dict__` attributes (for example, new-style classes use a + dictproxy to prevent direct dictionary updates). - .. note:: - - The returned dictionary should not be modified: - the effects on the corresponding symbol table are undefined. [#]_ + Without an argument, :func:`vars` acts like :func:`locals`. Note, the + locals dictionary is only useful for reads since updates to the locals + dictionary are ignored. .. function:: xrange([start,] stop[, step]) -- Repository URL: http://hg.python.org/cpython From sandro.tosi at gmail.com Fri Jan 6 10:29:40 2012 From: sandro.tosi at gmail.com (Sandro Tosi) Date: Fri, 6 Jan 2012 10:29:40 +0100 Subject: [Python-checkins] cpython (2.7): Issue #12042: a queue is only used to retrive results; preliminary patch by In-Reply-To: <4F06280D.9060102@udel.edu> References: <4F06280D.9060102@udel.edu> Message-ID: On Thu, Jan 5, 2012 at 23:45, Terry Reedy wrote: > On 1/5/2012 1:51 PM, sandro.tosi wrote: >> >> http://hg.python.org/cpython/rev/3353f9747a39 >> changeset: ? 74282:3353f9747a39 >> branch: ? ? ?2.7 > > >> ? Doc/whatsnew/2.6.rst | ?4 ++-- > > > should that have been whatsnew/2.7.rst? The wording correction was in the 2.6 what's new, when describing multiprocessing (which was added in 2.6). -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi From python-checkins at python.org Fri Jan 6 20:10:51 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 06 Jan 2012 20:10:51 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Update_printout?= =?utf8?q?_of_SSL_certificate_examples_for_3=2E2+=2E?= Message-ID: http://hg.python.org/cpython/rev/b39b65cdf54e changeset: 74286:b39b65cdf54e branch: 3.2 parent: 74283:0d4bb1356f39 user: Antoine Pitrou date: Fri Jan 06 20:06:15 2012 +0100 summary: Update printout of SSL certificate examples for 3.2+. files: Doc/library/ssl.rst | 45 +++++++++++++++++++++++++++++--- 1 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -788,10 +788,19 @@ # note that closing the SSLSocket will also close the underlying socket ssl_sock.close() -As of October 6, 2010, the certificate printed by this program looks like +As of January 6, 2012, the certificate printed by this program looks like this:: - {'notAfter': 'May 25 23:59:59 2012 GMT', + {'issuer': ((('countryName', 'US'),), + (('organizationName', 'VeriSign, Inc.'),), + (('organizationalUnitName', 'VeriSign Trust Network'),), + (('organizationalUnitName', + 'Terms of use at https://www.verisign.com/rpa (c)06'),), + (('commonName', + 'VeriSign Class 3 Extended Validation SSL SGC CA'),)), + 'notAfter': 'May 25 23:59:59 2012 GMT', + 'notBefore': 'May 26 00:00:00 2010 GMT', + 'serialNumber': '53D2BEF924A7245E83CA01E46CAA2477', 'subject': ((('1.3.6.1.4.1.311.60.2.1.3', 'US'),), (('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),), (('businessCategory', 'V1.0, Clause 5.(b)'),), @@ -803,7 +812,16 @@ (('streetAddress', '487 East Middlefield Road'),), (('organizationName', 'VeriSign, Inc.'),), (('organizationalUnitName', ' Production Security Services'),), - (('commonName', 'www.verisign.com'),))} + (('commonName', 'www.verisign.com'),)), + 'subjectAltName': (('DNS', 'www.verisign.com'), + ('DNS', 'verisign.com'), + ('DNS', 'www.verisign.net'), + ('DNS', 'verisign.net'), + ('DNS', 'www.verisign.mobi'), + ('DNS', 'verisign.mobi'), + ('DNS', 'www.verisign.eu'), + ('DNS', 'verisign.eu')), + 'version': 3} This other example first creates an SSL context, instructs it to verify certificates sent by peers, and feeds it a set of recognized certificate @@ -834,9 +852,26 @@ (that is, the HTTPS host ``linuxfr.org``):: >>> pprint.pprint(cert) - {'notAfter': 'Jun 26 21:41:46 2011 GMT', + {'issuer': ((('organizationName', 'CAcert Inc.'),), + (('organizationalUnitName', 'http://www.CAcert.org'),), + (('commonName', 'CAcert Class 3 Root'),)), + 'notAfter': 'Jun 7 21:02:24 2013 GMT', + 'notBefore': 'Jun 8 21:02:24 2011 GMT', + 'serialNumber': 'D3E9', 'subject': ((('commonName', 'linuxfr.org'),),), - 'subjectAltName': (('DNS', 'linuxfr.org'), ('othername', ''))} + 'subjectAltName': (('DNS', 'linuxfr.org'), + ('othername', ''), + ('DNS', 'linuxfr.org'), + ('othername', ''), + ('DNS', 'dev.linuxfr.org'), + ('othername', ''), + ('DNS', 'prod.linuxfr.org'), + ('othername', ''), + ('DNS', 'alpha.linuxfr.org'), + ('othername', ''), + ('DNS', '*.linuxfr.org'), + ('othername', '')), + 'version': 3} Now that you are assured of its authenticity, you can proceed to talk with the server:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 6 20:10:52 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 06 Jan 2012 20:10:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Update_printout_of_SSL_certificate_examples_for_3=2E2+=2E?= Message-ID: http://hg.python.org/cpython/rev/a4c19a946a5d changeset: 74287:a4c19a946a5d parent: 74284:e379617b4c4c parent: 74286:b39b65cdf54e user: Antoine Pitrou date: Fri Jan 06 20:09:29 2012 +0100 summary: Update printout of SSL certificate examples for 3.2+. files: Doc/library/ssl.rst | 45 +++++++++++++++++++++++++++++--- 1 files changed, 40 insertions(+), 5 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -981,10 +981,19 @@ # note that closing the SSLSocket will also close the underlying socket ssl_sock.close() -As of October 6, 2010, the certificate printed by this program looks like +As of January 6, 2012, the certificate printed by this program looks like this:: - {'notAfter': 'May 25 23:59:59 2012 GMT', + {'issuer': ((('countryName', 'US'),), + (('organizationName', 'VeriSign, Inc.'),), + (('organizationalUnitName', 'VeriSign Trust Network'),), + (('organizationalUnitName', + 'Terms of use at https://www.verisign.com/rpa (c)06'),), + (('commonName', + 'VeriSign Class 3 Extended Validation SSL SGC CA'),)), + 'notAfter': 'May 25 23:59:59 2012 GMT', + 'notBefore': 'May 26 00:00:00 2010 GMT', + 'serialNumber': '53D2BEF924A7245E83CA01E46CAA2477', 'subject': ((('1.3.6.1.4.1.311.60.2.1.3', 'US'),), (('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),), (('businessCategory', 'V1.0, Clause 5.(b)'),), @@ -996,7 +1005,16 @@ (('streetAddress', '487 East Middlefield Road'),), (('organizationName', 'VeriSign, Inc.'),), (('organizationalUnitName', ' Production Security Services'),), - (('commonName', 'www.verisign.com'),))} + (('commonName', 'www.verisign.com'),)), + 'subjectAltName': (('DNS', 'www.verisign.com'), + ('DNS', 'verisign.com'), + ('DNS', 'www.verisign.net'), + ('DNS', 'verisign.net'), + ('DNS', 'www.verisign.mobi'), + ('DNS', 'verisign.mobi'), + ('DNS', 'www.verisign.eu'), + ('DNS', 'verisign.eu')), + 'version': 3} This other example first creates an SSL context, instructs it to verify certificates sent by peers, and feeds it a set of recognized certificate @@ -1027,9 +1045,26 @@ (that is, the HTTPS host ``linuxfr.org``):: >>> pprint.pprint(cert) - {'notAfter': 'Jun 26 21:41:46 2011 GMT', + {'issuer': ((('organizationName', 'CAcert Inc.'),), + (('organizationalUnitName', 'http://www.CAcert.org'),), + (('commonName', 'CAcert Class 3 Root'),)), + 'notAfter': 'Jun 7 21:02:24 2013 GMT', + 'notBefore': 'Jun 8 21:02:24 2011 GMT', + 'serialNumber': 'D3E9', 'subject': ((('commonName', 'linuxfr.org'),),), - 'subjectAltName': (('DNS', 'linuxfr.org'), ('othername', ''))} + 'subjectAltName': (('DNS', 'linuxfr.org'), + ('othername', ''), + ('DNS', 'linuxfr.org'), + ('othername', ''), + ('DNS', 'dev.linuxfr.org'), + ('othername', ''), + ('DNS', 'prod.linuxfr.org'), + ('othername', ''), + ('DNS', 'alpha.linuxfr.org'), + ('othername', ''), + ('DNS', '*.linuxfr.org'), + ('othername', '')), + 'version': 3} Now that you are assured of its authenticity, you can proceed to talk with the server:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 6 20:17:44 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 06 Jan 2012 20:17:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=239993=3A_When_the_s?= =?utf8?q?ource_and_destination_are_on_different_filesystems=2C?= Message-ID: http://hg.python.org/cpython/rev/1ea8b7233fd7 changeset: 74288:1ea8b7233fd7 user: Antoine Pitrou date: Fri Jan 06 20:16:19 2012 +0100 summary: Issue #9993: When the source and destination are on different filesystems, and the source is a symlink, shutil.move() now recreates a symlink on the destination instead of copying the file contents. Patch by Jonathan Niehof and Hynek Schlawack. files: Doc/library/shutil.rst | 7 ++++- Lib/shutil.py | 11 ++++++- Lib/test/test_shutil.py | 43 +++++++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 5 +++ 5 files changed, 64 insertions(+), 3 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -196,7 +196,12 @@ If the destination is on the current filesystem, then :func:`os.rename` is used. Otherwise, *src* is copied (using :func:`copy2`) to *dst* and then - removed. + removed. In case of symlinks, a new symlink pointing to the target of *src* + will be created in or as *dst* and *src* will be removed. + + .. versionchanged:: 3.3 + Added explicit symlink handling for foreign filesystems, thus adapting + it to the behavior of GNU's :program:`mv`. .. function:: disk_usage(path) diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -356,7 +356,10 @@ overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. - Otherwise, src is copied to the destination and then removed. + Otherwise, src is copied to the destination and then removed. Symlinks are + recreated under the new name if os.rename() fails because of cross + filesystem renames. + A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. @@ -375,7 +378,11 @@ try: os.rename(src, real_dst) except OSError: - if os.path.isdir(src): + if os.path.islink(src): + linkto = os.readlink(src) + os.symlink(linkto, real_dst) + os.unlink(src) + elif os.path.isdir(src): if _destinsrc(src, dst): raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst)) copytree(src, real_dst, symlinks=True) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1104,6 +1104,49 @@ finally: shutil.rmtree(TESTFN, ignore_errors=True) + @support.skip_unless_symlink + @mock_rename + def test_move_file_symlink(self): + dst = os.path.join(self.src_dir, 'bar') + os.symlink(self.src_file, dst) + shutil.move(dst, self.dst_file) + self.assertTrue(os.path.islink(self.dst_file)) + self.assertTrue(os.path.samefile(self.src_file, self.dst_file)) + + @support.skip_unless_symlink + @mock_rename + def test_move_file_symlink_to_dir(self): + filename = "bar" + dst = os.path.join(self.src_dir, filename) + os.symlink(self.src_file, dst) + shutil.move(dst, self.dst_dir) + final_link = os.path.join(self.dst_dir, filename) + self.assertTrue(os.path.islink(final_link)) + self.assertTrue(os.path.samefile(self.src_file, final_link)) + + @support.skip_unless_symlink + @mock_rename + def test_move_dangling_symlink(self): + src = os.path.join(self.src_dir, 'baz') + dst = os.path.join(self.src_dir, 'bar') + os.symlink(src, dst) + dst_link = os.path.join(self.dst_dir, 'quux') + shutil.move(dst, dst_link) + self.assertTrue(os.path.islink(dst_link)) + self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link)) + + @support.skip_unless_symlink + @mock_rename + def test_move_dir_symlink(self): + src = os.path.join(self.src_dir, 'baz') + dst = os.path.join(self.src_dir, 'bar') + os.mkdir(src) + os.symlink(src, dst) + dst_link = os.path.join(self.dst_dir, 'quux') + shutil.move(dst, dst_link) + self.assertTrue(os.path.islink(dst_link)) + self.assertTrue(os.path.samefile(src, dst_link)) + class TestCopyFile(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -707,6 +707,7 @@ George Neville-Neil Johannes Nicolai Samuel Nicolary +Jonathan Niehof Gustavo Niemeyer Oscar Nierstrasz Hrvoje Niksic diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -422,6 +422,11 @@ Library ------- +- Issue #9993: When the source and destination are on different filesystems, + and the source is a symlink, shutil.move() now recreates a symlink on the + destination instead of copying the file contents. Patch by Jonathan Niehof + and Hynek Schlawack. + - Issue #12926: Fix a bug in tarfile's link extraction. - Issue #13696: Fix the 302 Relative URL Redirection problem. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jan 7 05:31:50 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 07 Jan 2012 05:31:50 +0100 Subject: [Python-checkins] Daily reference leaks (1ea8b7233fd7): sum=0 Message-ID: results for 1ea8b7233fd7 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog7qFeNO', '-x'] From ncoghlan at gmail.com Sat Jan 7 14:22:44 2012 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sat, 7 Jan 2012 23:22:44 +1000 Subject: [Python-checkins] cpython: Issue #9993: When the source and destination are on different filesystems, In-Reply-To: References: Message-ID: On Sat, Jan 7, 2012 at 5:17 AM, antoine.pitrou wrote: > http://hg.python.org/cpython/rev/1ea8b7233fd7 > changeset: ? 74288:1ea8b7233fd7 > user: ? ? ? ?Antoine Pitrou > date: ? ? ? ?Fri Jan 06 20:16:19 2012 +0100 > summary: > ?Issue #9993: When the source and destination are on different filesystems, > and the source is a symlink, shutil.move() now recreates a symlink on the > destination instead of copying the file contents. > Patch by Jonathan Niehof and Hynek Schlawack. That seems like a fairly nasty backwards incompatibilty right there. While the old behaviour was different from mv, it was still perfectly well defined. Now, operations that used to work may fail - basically anything involving an absolute symlink will silently fail if being moved to removable media (it will create a symlink that is completely useless on the destination machine). Relative symlinks may or may not be broken depending on whether or not their target is *also* being copied to the destination media. The new help text also doesn't say what will happen if the destination doesn't even *support* symlinks (as is quite likely in the removable media case). Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Sat Jan 7 17:59:12 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 07 Jan 2012 17:59:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_clarify_recv*_a?= =?utf8?q?re_blocking_operations=3B_thanks_to_Chris_Kogelnik_from_docs=40?= Message-ID: http://hg.python.org/cpython/rev/1d8286235da5 changeset: 74289:1d8286235da5 branch: 3.2 parent: 74286:b39b65cdf54e user: Sandro Tosi date: Sat Jan 07 17:56:58 2012 +0100 summary: clarify recv* are blocking operations; thanks to Chris Kogelnik from docs@ files: Doc/library/multiprocessing.rst | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -727,7 +727,8 @@ .. method:: recv() Return an object sent from the other end of the connection using - :meth:`send`. Raises :exc:`EOFError` if there is nothing left to receive + :meth:`send`. Blocks until there its something to receive. Raises + :exc:`EOFError` if there is nothing left to receive and the other end was closed. .. method:: fileno() @@ -761,7 +762,8 @@ .. method:: recv_bytes([maxlength]) Return a complete message of byte data sent from the other end of the - connection as a string. Raises :exc:`EOFError` if there is nothing left + connection as a string. Blocks until there is something to receive. + Raises :exc:`EOFError` if there is nothing left to receive and the other end has closed. If *maxlength* is specified and the message is longer than *maxlength* @@ -771,7 +773,8 @@ .. method:: recv_bytes_into(buffer[, offset]) Read into *buffer* a complete message of byte data sent from the other end - of the connection and return the number of bytes in the message. Raises + of the connection and return the number of bytes in the message. Blocks + until there is something to receive. Raises :exc:`EOFError` if there is nothing left to receive and the other end was closed. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 17:59:13 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 07 Jan 2012 17:59:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_clarify_recv*_a?= =?utf8?q?re_blocking_operations=3B_thanks_to_Chris_Kogelnik_from_docs=40?= Message-ID: http://hg.python.org/cpython/rev/ae95154e0624 changeset: 74290:ae95154e0624 branch: 2.7 parent: 74285:f0666e56a552 user: Sandro Tosi date: Sat Jan 07 17:56:43 2012 +0100 summary: clarify recv* are blocking operations; thanks to Chris Kogelnik from docs@ files: Doc/library/multiprocessing.rst | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -727,7 +727,8 @@ .. method:: recv() Return an object sent from the other end of the connection using - :meth:`send`. Raises :exc:`EOFError` if there is nothing left to receive + :meth:`send`. Blocks until there its something to receive. Raises + :exc:`EOFError` if there is nothing left to receive and the other end was closed. .. method:: fileno() @@ -761,7 +762,8 @@ .. method:: recv_bytes([maxlength]) Return a complete message of byte data sent from the other end of the - connection as a string. Raises :exc:`EOFError` if there is nothing left + connection as a string. Blocks until there is something to receive. + Raises :exc:`EOFError` if there is nothing left to receive and the other end has closed. If *maxlength* is specified and the message is longer than *maxlength* @@ -771,7 +773,8 @@ .. method:: recv_bytes_into(buffer[, offset]) Read into *buffer* a complete message of byte data sent from the other end - of the connection and return the number of bytes in the message. Raises + of the connection and return the number of bytes in the message. Blocks + until there is something to receive. Raises :exc:`EOFError` if there is nothing left to receive and the other end was closed. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 17:59:14 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 07 Jan 2012 17:59:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/9f0728521731 changeset: 74291:9f0728521731 parent: 74288:1ea8b7233fd7 parent: 74289:1d8286235da5 user: Sandro Tosi date: Sat Jan 07 17:57:24 2012 +0100 summary: merge with 3.2 files: Doc/library/multiprocessing.rst | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -746,7 +746,8 @@ .. method:: recv() Return an object sent from the other end of the connection using - :meth:`send`. Raises :exc:`EOFError` if there is nothing left to receive + :meth:`send`. Blocks until there its something to receive. Raises + :exc:`EOFError` if there is nothing left to receive and the other end was closed. .. method:: fileno() @@ -780,7 +781,8 @@ .. method:: recv_bytes([maxlength]) Return a complete message of byte data sent from the other end of the - connection as a string. Raises :exc:`EOFError` if there is nothing left + connection as a string. Blocks until there is something to receive. + Raises :exc:`EOFError` if there is nothing left to receive and the other end has closed. If *maxlength* is specified and the message is longer than *maxlength* @@ -795,7 +797,8 @@ .. method:: recv_bytes_into(buffer[, offset]) Read into *buffer* a complete message of byte data sent from the other end - of the connection and return the number of bytes in the message. Raises + of the connection and return the number of bytes in the message. Blocks + until there is something to receive. Raises :exc:`EOFError` if there is nothing left to receive and the other end was closed. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 18:27:06 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 07 Jan 2012 18:27:06 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNTAy?= =?utf8?q?=3A_threading=3A_Fix_a_race_condition_in_Event=2Ewait=28=29_that?= =?utf8?q?_made_it?= Message-ID: http://hg.python.org/cpython/rev/eb39d862a250 changeset: 74292:eb39d862a250 branch: 3.2 parent: 74289:1d8286235da5 user: Charles-Fran?ois Natali date: Sat Jan 07 18:24:56 2012 +0100 summary: Issue #13502: threading: Fix a race condition in Event.wait() that made it return False when the event was set and cleared right after. files: Doc/library/threading.rst | 6 ++++-- Lib/test/lock_tests.py | 16 ++++++++++++++++ Lib/threading.py | 7 ++++--- Misc/NEWS | 3 +++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -782,8 +782,10 @@ floating point number specifying a timeout for the operation in seconds (or fractions thereof). - This method returns the internal flag on exit, so it will always return - ``True`` except if a timeout is given and the operation times out. + This method returns true if and only if the internal flag has been set to + true, either before the wait call or after the wait starts, so it will + always return ``True`` except if a timeout is given and the operation + times out. .. versionchanged:: 3.1 Previously, the method always returned ``None``. diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -351,6 +351,22 @@ for r, dt in results2: self.assertTrue(r) + def test_set_and_clear(self): + # Issue #13502: check that wait() returns true even when the event is + # cleared before the waiting thread is woken up. + evt = self.eventtype() + results = [] + N = 5 + def f(): + results.append(evt.wait(1)) + b = Bunch(f, N) + b.wait_for_started() + time.sleep(0.5) + evt.set() + evt.clear() + b.wait_for_finished() + self.assertEqual(results, [True] * N) + class ConditionTests(BaseTestCase): """ diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -418,9 +418,10 @@ def wait(self, timeout=None): self._cond.acquire() try: - if not self._flag: - self._cond.wait(timeout) - return self._flag + signaled = self._flag + if not signaled: + signaled = self._cond.wait(timeout) + return signaled finally: self._cond.release() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,9 @@ Library ------- +- Issue #13502: threading: Fix a race condition in Event.wait() that made it + return False when the event was set and cleared right after. + - Issue #12926: Fix a bug in tarfile's link extraction. - Issue #13696: Fix the 302 Relative URL Redirection problem. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 18:27:06 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 07 Jan 2012 18:27:06 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313502=3A_threading=3A_Fix_a_race_condition_in_Event?= =?utf8?q?=2Ewait=28=29_that_made_it?= Message-ID: http://hg.python.org/cpython/rev/0fe63bb20e74 changeset: 74293:0fe63bb20e74 parent: 74291:9f0728521731 parent: 74292:eb39d862a250 user: Charles-Fran?ois Natali date: Sat Jan 07 18:26:39 2012 +0100 summary: Issue #13502: threading: Fix a race condition in Event.wait() that made it return False when the event was set and cleared right after. files: Doc/library/threading.rst | 6 ++++-- Lib/test/lock_tests.py | 16 ++++++++++++++++ Lib/threading.py | 7 ++++--- Misc/NEWS | 3 +++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -804,8 +804,10 @@ floating point number specifying a timeout for the operation in seconds (or fractions thereof). - This method returns the internal flag on exit, so it will always return - ``True`` except if a timeout is given and the operation times out. + This method returns true if and only if the internal flag has been set to + true, either before the wait call or after the wait starts, so it will + always return ``True`` except if a timeout is given and the operation + times out. .. versionchanged:: 3.1 Previously, the method always returned ``None``. diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py --- a/Lib/test/lock_tests.py +++ b/Lib/test/lock_tests.py @@ -353,6 +353,22 @@ for r, dt in results2: self.assertTrue(r) + def test_set_and_clear(self): + # Issue #13502: check that wait() returns true even when the event is + # cleared before the waiting thread is woken up. + evt = self.eventtype() + results = [] + N = 5 + def f(): + results.append(evt.wait(1)) + b = Bunch(f, N) + b.wait_for_started() + time.sleep(0.5) + evt.set() + evt.clear() + b.wait_for_finished() + self.assertEqual(results, [True] * N) + class ConditionTests(BaseTestCase): """ diff --git a/Lib/threading.py b/Lib/threading.py --- a/Lib/threading.py +++ b/Lib/threading.py @@ -408,9 +408,10 @@ def wait(self, timeout=None): self._cond.acquire() try: - if not self._flag: - self._cond.wait(timeout) - return self._flag + signaled = self._flag + if not signaled: + signaled = self._cond.wait(timeout) + return signaled finally: self._cond.release() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -422,6 +422,9 @@ Library ------- +- Issue #13502: threading: Fix a race condition in Event.wait() that made it + return False when the event was set and cleared right after. + - Issue #9993: When the source and destination are on different filesystems, and the source is a symlink, shutil.move() now recreates a symlink on the destination instead of copying the file contents. Patch by Jonathan Niehof -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 18:36:13 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 07 Jan 2012 18:36:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Py=5FSetPythonH?= =?utf8?q?ome=28=29_can_be_called_before_Py=5FInitialize=28=29=3B_thanks_t?= =?utf8?q?o_Cody_Smith?= Message-ID: http://hg.python.org/cpython/rev/56e9d025078d changeset: 74294:56e9d025078d branch: 2.7 parent: 74290:ae95154e0624 user: Sandro Tosi date: Sat Jan 07 18:32:06 2012 +0100 summary: Py_SetPythonHome() can be called before Py_Initialize(); thanks to Cody Smith from docs@ files: Doc/c-api/init.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -31,7 +31,7 @@ Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; with the - exception of :cfunc:`Py_SetProgramName`, :cfunc:`PyEval_InitThreads`, + exception of :cfunc:`Py_SetProgramName`, :cfunc:`Py_SetPythonHome`, :cfunc:`PyEval_InitThreads`, :cfunc:`PyEval_ReleaseLock`, and :cfunc:`PyEval_AcquireLock`. This initializes the table of loaded modules (``sys.modules``), and creates the fundamental modules :mod:`__builtin__`, :mod:`__main__` and :mod:`sys`. It also initializes -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 18:36:14 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 07 Jan 2012 18:36:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Py=5FSetPythonH?= =?utf8?q?ome=28=29_can_be_called_before_Py=5FInitialize=28=29=3B_thanks_t?= =?utf8?q?o_Cody_Smith?= Message-ID: http://hg.python.org/cpython/rev/69527695eff8 changeset: 74295:69527695eff8 branch: 3.2 parent: 74292:eb39d862a250 user: Sandro Tosi date: Sat Jan 07 18:34:07 2012 +0100 summary: Py_SetPythonHome() can be called before Py_Initialize(); thanks to Cody Smith from docs@ files: Doc/c-api/init.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -29,7 +29,7 @@ Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; with the - exception of :c:func:`Py_SetProgramName` and :c:func:`Py_SetPath`. This initializes + exception of :c:func:`Py_SetProgramName`, :c:func:`Py_SetPythonHome` and :c:func:`Py_SetPath`. This initializes the table of loaded modules (``sys.modules``), and creates the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes the module search path (``sys.path``). It does not set ``sys.argv``; use -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 7 18:36:15 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 07 Jan 2012 18:36:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/694110bc91d8 changeset: 74296:694110bc91d8 parent: 74293:0fe63bb20e74 parent: 74295:69527695eff8 user: Sandro Tosi date: Sat Jan 07 18:34:24 2012 +0100 summary: merge with 3.2 files: Doc/c-api/init.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -29,7 +29,7 @@ Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; with the - exception of :c:func:`Py_SetProgramName` and :c:func:`Py_SetPath`. This initializes + exception of :c:func:`Py_SetProgramName`, :c:func:`Py_SetPythonHome` and :c:func:`Py_SetPath`. This initializes the table of loaded modules (``sys.modules``), and creates the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It also initializes the module search path (``sys.path``). It does not set ``sys.argv``; use -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jan 7 19:00:31 2012 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sat, 7 Jan 2012 19:00:31 +0100 Subject: [Python-checkins] cpython: Issue #9993: When the source and destination are on different filesystems, References: Message-ID: <20120107190031.2f59ca63@pitrou.net> On Sat, 7 Jan 2012 23:22:44 +1000 Nick Coghlan wrote: > On Sat, Jan 7, 2012 at 5:17 AM, antoine.pitrou > wrote: > > http://hg.python.org/cpython/rev/1ea8b7233fd7 > > changeset: ? 74288:1ea8b7233fd7 > > user: ? ? ? ?Antoine Pitrou > > date: ? ? ? ?Fri Jan 06 20:16:19 2012 +0100 > > summary: > > ?Issue #9993: When the source and destination are on different filesystems, > > and the source is a symlink, shutil.move() now recreates a symlink on the > > destination instead of copying the file contents. > > Patch by Jonathan Niehof and Hynek Schlawack. > > That seems like a fairly nasty backwards incompatibilty right there. That's why it made it in 3.3 only. > While the old behaviour was different from mv, it was still perfectly > well defined. I'm not sure it was *well* defined (or even defined at all). It seems more of a by-product of the implementation. It's not only different from mv, but it's inconsistent with itself (the semantics are different depending on whether the paths are on the same filesystem or not; also, it copied the *file* but erased the *link*). Regards Antoine. From python-checkins at python.org Sun Jan 8 00:26:23 2012 From: python-checkins at python.org (vinay.sajip) Date: Sun, 08 Jan 2012 00:26:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Closes_=2313732=3A_now_use_?= =?utf8?q?os=2Elinesep_instead_of_a_literal_newline=2E?= Message-ID: http://hg.python.org/cpython/rev/870f8fdfbada changeset: 74297:870f8fdfbada user: Vinay Sajip date: Sat Jan 07 23:26:17 2012 +0000 summary: Closes #13732: now use os.linesep instead of a literal newline. files: Lib/test/test_logging.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3625,23 +3625,24 @@ rh.emit(m2) fn = namer(self.fn + ".1") self.assertLogFile(fn) + newline = os.linesep with open(fn, "rb") as f: compressed = f.read() data = zlib.decompress(compressed) - self.assertEqual(data.decode("ascii"), m1.msg + "\n") + self.assertEqual(data.decode("ascii"), m1.msg + newline) rh.emit(self.next_rec()) fn = namer(self.fn + ".2") self.assertLogFile(fn) with open(fn, "rb") as f: compressed = f.read() data = zlib.decompress(compressed) - self.assertEqual(data.decode("ascii"), m1.msg + "\n") + self.assertEqual(data.decode("ascii"), m1.msg + newline) rh.emit(self.next_rec()) fn = namer(self.fn + ".2") with open(fn, "rb") as f: compressed = f.read() data = zlib.decompress(compressed) - self.assertEqual(data.decode("ascii"), m2.msg + "\n") + self.assertEqual(data.decode("ascii"), m2.msg + newline) self.assertFalse(os.path.exists(namer(self.fn + ".3"))) rh.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 8 00:33:01 2012 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 08 Jan 2012 00:33:01 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Simplify_the_code_using_wit?= =?utf8?q?h-statements=2E?= Message-ID: http://hg.python.org/cpython/rev/c68426b241ca changeset: 74298:c68426b241ca user: Raymond Hettinger date: Sat Jan 07 15:32:52 2012 -0800 summary: Simplify the code using with-statements. files: Lib/queue.py | 42 +++++++++++++-------------------------- 1 files changed, 14 insertions(+), 28 deletions(-) diff --git a/Lib/queue.py b/Lib/queue.py --- a/Lib/queue.py +++ b/Lib/queue.py @@ -26,17 +26,21 @@ def __init__(self, maxsize=0): self.maxsize = maxsize self._init(maxsize) + # mutex must be held whenever the queue is mutating. All methods # that acquire mutex must release it before returning. mutex # is shared between the three conditions, so acquiring and # releasing the conditions also acquires and releases mutex. self.mutex = _threading.Lock() + # Notify not_empty whenever an item is added to the queue; a # thread waiting to get is notified then. self.not_empty = _threading.Condition(self.mutex) + # Notify not_full whenever an item is removed from the queue; # a thread waiting to put is notified then. self.not_full = _threading.Condition(self.mutex) + # Notify all_tasks_done whenever the number of unfinished tasks # drops to zero; thread waiting to join() is notified to resume self.all_tasks_done = _threading.Condition(self.mutex) @@ -56,16 +60,13 @@ Raises a ValueError if called more times than there were items placed in the queue. """ - self.all_tasks_done.acquire() - try: + with self.all_tasks_done: unfinished = self.unfinished_tasks - 1 if unfinished <= 0: if unfinished < 0: raise ValueError('task_done() called too many times') self.all_tasks_done.notify_all() self.unfinished_tasks = unfinished - finally: - self.all_tasks_done.release() def join(self): """Blocks until all items in the Queue have been gotten and processed. @@ -76,19 +77,14 @@ When the count of unfinished tasks drops to zero, join() unblocks. """ - self.all_tasks_done.acquire() - try: + with self.all_tasks_done: while self.unfinished_tasks: self.all_tasks_done.wait() - finally: - self.all_tasks_done.release() def qsize(self): """Return the approximate size of the queue (not reliable!).""" - self.mutex.acquire() - n = self._qsize() - self.mutex.release() - return n + with self.mutex: + return self._qsize() def empty(self): """Return True if the queue is empty, False otherwise (not reliable!). @@ -102,10 +98,8 @@ completed, the preferred technique is to use the join() method. """ - self.mutex.acquire() - n = not self._qsize() - self.mutex.release() - return n + with self.mutex: + return not self._qsize() def full(self): """Return True if the queue is full, False otherwise (not reliable!). @@ -116,10 +110,8 @@ qsize() can be used. """ - self.mutex.acquire() - n = 0 < self.maxsize <= self._qsize() - self.mutex.release() - return n + with self.mutex: + return 0 < self.maxsize <= self._qsize() def put(self, item, block=True, timeout=None): """Put an item into the queue. @@ -132,8 +124,7 @@ is immediately available, else raise the Full exception ('timeout' is ignored in that case). """ - self.not_full.acquire() - try: + with self.not_full: if self.maxsize > 0: if not block: if self._qsize() >= self.maxsize: @@ -153,8 +144,6 @@ self._put(item) self.unfinished_tasks += 1 self.not_empty.notify() - finally: - self.not_full.release() def put_nowait(self, item): """Put an item into the queue without blocking. @@ -175,8 +164,7 @@ available, else raise the Empty exception ('timeout' is ignored in that case). """ - self.not_empty.acquire() - try: + with self.not_empty: if not block: if not self._qsize(): raise Empty @@ -195,8 +183,6 @@ item = self._get() self.not_full.notify() return item - finally: - self.not_empty.release() def get_nowait(self): """Remove and return an item from the queue without blocking. -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Sun Jan 8 01:32:10 2012 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 8 Jan 2012 10:32:10 +1000 Subject: [Python-checkins] cpython: Issue #9993: When the source and destination are on different filesystems, In-Reply-To: <20120107190031.2f59ca63@pitrou.net> References: <20120107190031.2f59ca63@pitrou.net> Message-ID: On Sun, Jan 8, 2012 at 4:00 AM, Antoine Pitrou wrote: > I'm not sure it was *well* defined (or even defined at all). It seems > more of a by-product of the implementation. It's not only different > from mv, but it's inconsistent with itself (the semantics are different > depending on whether the paths are on the same filesystem or not; > also, it copied the *file* but erased the *link*). Yeah, Hynek's explanation pointing out the existing inconsistencies made sense to me. I have to agree with the point that symlinks+removable media are almost inevitably going to create weirdness that isn't easily handled by any means other than "symlinks=False" :P Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Sun Jan 8 05:13:45 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 08 Jan 2012 05:13:45 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_add_myself_to_unicode?= Message-ID: http://hg.python.org/devguide/rev/a4eb52cfd728 changeset: 468:a4eb52cfd728 user: Benjamin Peterson date: Sat Jan 07 23:13:41 2012 -0500 summary: add myself to unicode files: experts.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/experts.rst b/experts.rst --- a/experts.rst +++ b/experts.rst @@ -320,6 +320,6 @@ test coverage ncoghlan, giampaolo.rodola threads pitrou time and dates lemburg, belopolsky -unicode lemburg, ezio.melotti, haypo +unicode lemburg, ezio.melotti, haypo, benjamin.peterson version control eric.araujo ================== =========== -- Repository URL: http://hg.python.org/devguide From solipsis at pitrou.net Sun Jan 8 05:32:18 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 08 Jan 2012 05:32:18 +0100 Subject: [Python-checkins] Daily reference leaks (c68426b241ca): sum=0 Message-ID: results for c68426b241ca on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogJqf6IE', '-x'] From python-checkins at python.org Sun Jan 8 06:55:24 2012 From: python-checkins at python.org (terry.reedy) Date: Sun, 08 Jan 2012 06:55:24 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Correct_VC++2008_Express_l?= =?utf8?q?ink=3B_add_limitations_link=2E?= Message-ID: http://hg.python.org/devguide/rev/03d87d119085 changeset: 469:03d87d119085 parent: 467:f3843e932e3b user: Terry Jan Reedy date: Sun Jan 08 00:31:30 2012 -0500 summary: Correct VC++2008 Express link; add limitations link. files: setup.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -160,8 +160,10 @@ For Microsoft Visual Studio 2008 (also named Visual C++ 9), the ``PCbuild`` directory contains the build files (for older versions of Visual Studio, see the ``PC`` directory). The full version of Visual Studio is not necessary -for common tasks; gratis versions from http://www.microsoft.com/express/ are -sufficient. +for common tasks with 32-bit builds; the gratis C++ version from +https://www.microsoft.com/visualstudio/en-us/products/2008-editions/express +is sufficient. Its limitations are given at +http://msdn.microsoft.com/en-us/library/hs24szh9%28v=VS.90%29.aspx . To build from the Visual Studio GUI, load the project files and press F7. Make sure you have chosen the "Debug" build first. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sun Jan 8 06:55:28 2012 From: python-checkins at python.org (terry.reedy) Date: Sun, 08 Jan 2012 06:55:28 +0100 Subject: [Python-checkins] =?utf8?q?devguide_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/devguide/rev/356dd8007f65 changeset: 470:356dd8007f65 parent: 468:a4eb52cfd728 parent: 469:03d87d119085 user: Terry Jan Reedy date: Sun Jan 08 00:54:02 2012 -0500 summary: Merge files: setup.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -160,8 +160,10 @@ For Microsoft Visual Studio 2008 (also named Visual C++ 9), the ``PCbuild`` directory contains the build files (for older versions of Visual Studio, see the ``PC`` directory). The full version of Visual Studio is not necessary -for common tasks; gratis versions from http://www.microsoft.com/express/ are -sufficient. +for common tasks with 32-bit builds; the gratis C++ version from +https://www.microsoft.com/visualstudio/en-us/products/2008-editions/express +is sufficient. Its limitations are given at +http://msdn.microsoft.com/en-us/library/hs24szh9%28v=VS.90%29.aspx . To build from the Visual Studio GUI, load the project files and press F7. Make sure you have chosen the "Debug" build first. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sun Jan 8 07:43:53 2012 From: python-checkins at python.org (ross.lagerwall) Date: Sun, 08 Jan 2012 07:43:53 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyMzY0?= =?utf8?q?=3A_Fix_a_hang_in_concurrent=2Efutures=2EProcessPoolExecutor=2E?= Message-ID: http://hg.python.org/cpython/rev/26389e9efa9c changeset: 74299:26389e9efa9c branch: 3.2 parent: 74295:69527695eff8 user: Ross Lagerwall date: Sun Jan 08 08:29:40 2012 +0200 summary: Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor. files: Lib/concurrent/futures/process.py | 7 +------ Lib/test/test_concurrent_futures.py | 6 ++++++ Misc/NEWS | 4 ++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -213,9 +213,7 @@ work_item.future.set_exception(result_item.exception) else: work_item.future.set_result(result_item.result) - continue - # If we come here, we either got a timeout or were explicitly woken up. - # In either case, check whether we should start shutting down. + # Check whether we should start shutting down. executor = executor_reference() # No more work items can be added if: # - The interpreter is shutting down OR @@ -234,9 +232,6 @@ p.join() call_queue.close() return - else: - # Start shutting down by telling a process it can exit. - shutdown_one_process() del executor _system_limits_checked = False diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -109,6 +109,12 @@ self.assertFalse(err) self.assertEqual(out.strip(), b"apple") + def test_hang_issue12364(self): + fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)] + self.executor.shutdown() + for f in fs: + f.result() + class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest): def _prime_executor(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,10 @@ Library ------- +- Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor. + The hang would occur when retrieving the result of a scheduled future after + the executor had been shut down. + - Issue #13502: threading: Fix a race condition in Event.wait() that made it return False when the event was set and cleared right after. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 8 07:43:53 2012 From: python-checkins at python.org (ross.lagerwall) Date: Sun, 08 Jan 2012 07:43:53 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2_for_=2312364=2E?= Message-ID: http://hg.python.org/cpython/rev/25f879011102 changeset: 74300:25f879011102 parent: 74298:c68426b241ca parent: 74299:26389e9efa9c user: Ross Lagerwall date: Sun Jan 08 08:42:03 2012 +0200 summary: Merge with 3.2 for #12364. files: Lib/concurrent/futures/process.py | 3 --- Lib/test/test_concurrent_futures.py | 6 ++++++ Misc/NEWS | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -273,9 +273,6 @@ if not pending_work_items: shutdown_worker() return - else: - # Start shutting down by telling a process it can exit. - call_queue.put_nowait(None) except Full: # This is not a problem: we will eventually be woken up (in # result_queue.get()) and be able to send a sentinel again. diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -109,6 +109,12 @@ self.assertFalse(err) self.assertEqual(out.strip(), b"apple") + def test_hang_issue12364(self): + fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)] + self.executor.shutdown() + for f in fs: + f.result() + class ThreadPoolShutdownTest(ThreadPoolMixin, ExecutorShutdownTest): def _prime_executor(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -422,6 +422,10 @@ Library ------- +- Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor. + The hang would occur when retrieving the result of a scheduled future after + the executor had been shut down. + - Issue #13502: threading: Fix a race condition in Event.wait() that made it return False when the event was set and cleared right after. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 8 16:44:55 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 08 Jan 2012 16:44:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313738=3A_Simplify_?= =?utf8?q?implementation_of_bytes=2Elower=28=29_and_bytes=2Eupper=28=29=2E?= Message-ID: http://hg.python.org/cpython/rev/9683d59170ee changeset: 74301:9683d59170ee user: Antoine Pitrou date: Sun Jan 08 16:22:46 2012 +0100 summary: Issue #13738: Simplify implementation of bytes.lower() and bytes.upper(). files: Misc/NEWS | 2 ++ Objects/bytes_methods.c | 12 ++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #13738: Simplify implementation of bytes.lower() and bytes.upper(). + - Issue #13577: Built-in methods and functions now have a __qualname__. Patch by sbt. diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c --- a/Objects/bytes_methods.c +++ b/Objects/bytes_methods.c @@ -248,12 +248,8 @@ { Py_ssize_t i; - Py_MEMCPY(result, cptr, len); - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISUPPER(c)) - result[i] = Py_TOLOWER(c); + result[i] = Py_TOLOWER((unsigned char) cptr[i]); } } @@ -268,12 +264,8 @@ { Py_ssize_t i; - Py_MEMCPY(result, cptr, len); - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISLOWER(c)) - result[i] = Py_TOUPPER(c); + result[i] = Py_TOUPPER((unsigned char) cptr[i]); } } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 8 18:34:43 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 08 Jan 2012 18:34:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313739=3A_In_os=2El?= =?utf8?q?istdir=28=29=2C_rewind_the_directory_stream_=28so_that_listdir?= =?utf8?b?KCk=?= Message-ID: http://hg.python.org/cpython/rev/7b2a178c028b changeset: 74302:7b2a178c028b user: Charles-Fran?ois Natali date: Sun Jan 08 18:34:06 2012 +0100 summary: Issue #13739: In os.listdir(), rewind the directory stream (so that listdir() can be called again on the same open file). files: Lib/test/test_posix.py | 12 ++++++++++-- Modules/posixmodule.c | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -454,14 +454,22 @@ @unittest.skipUnless(hasattr(posix, 'fdlistdir'), "test needs posix.fdlistdir()") def test_fdlistdir(self): f = posix.open(posix.getcwd(), posix.O_RDONLY) + self.addCleanup(posix.close, f) + f1 = posix.dup(f) self.assertEqual( sorted(posix.listdir('.')), - sorted(posix.fdlistdir(f)) + sorted(posix.fdlistdir(f1)) ) # Check the fd was closed by fdlistdir with self.assertRaises(OSError) as ctx: - posix.close(f) + posix.close(f1) self.assertEqual(ctx.exception.errno, errno.EBADF) + # Check that the fd offset was reset (issue #13739) + f2 = posix.dup(f) + self.assertEqual( + sorted(posix.listdir('.')), + sorted(posix.fdlistdir(f2)) + ) def test_access(self): if hasattr(posix, 'access'): diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2906,6 +2906,7 @@ break; } else { Py_BEGIN_ALLOW_THREADS + rewinddir(dirp); closedir(dirp); Py_END_ALLOW_THREADS Py_DECREF(d); @@ -2929,6 +2930,7 @@ Py_DECREF(v); } Py_BEGIN_ALLOW_THREADS + rewinddir(dirp); closedir(dirp); Py_END_ALLOW_THREADS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 8 19:07:41 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 08 Jan 2012 19:07:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313739=3A_It=27s_si?= =?utf8?q?mpler_and_more_direct_to_call_rewinddir=28=29_at_the?= Message-ID: http://hg.python.org/cpython/rev/36f2e236c601 changeset: 74303:36f2e236c601 user: Charles-Fran?ois Natali date: Sun Jan 08 19:07:18 2012 +0100 summary: Issue #13739: It's simpler and more direct to call rewinddir() at the beginning. files: Modules/posixmodule.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2890,6 +2890,7 @@ close(fd); return posix_error(); } + rewinddir(dirp); if ((d = PyList_New(0)) == NULL) { Py_BEGIN_ALLOW_THREADS closedir(dirp); @@ -2906,7 +2907,6 @@ break; } else { Py_BEGIN_ALLOW_THREADS - rewinddir(dirp); closedir(dirp); Py_END_ALLOW_THREADS Py_DECREF(d); @@ -2930,7 +2930,6 @@ Py_DECREF(v); } Py_BEGIN_ALLOW_THREADS - rewinddir(dirp); closedir(dirp); Py_END_ALLOW_THREADS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 8 20:31:15 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 08 Jan 2012 20:31:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Backed_out_changeset_36f2e2?= =?utf8?q?36c601=3A_For_some_reason=2C_rewinddir=28=29_doesn=27t_work_as?= Message-ID: http://hg.python.org/cpython/rev/c14c60628714 changeset: 74304:c14c60628714 user: Charles-Fran?ois Natali date: Sun Jan 08 20:30:47 2012 +0100 summary: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as it should on OpenIndiana. files: Modules/posixmodule.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2890,7 +2890,6 @@ close(fd); return posix_error(); } - rewinddir(dirp); if ((d = PyList_New(0)) == NULL) { Py_BEGIN_ALLOW_THREADS closedir(dirp); @@ -2907,6 +2906,7 @@ break; } else { Py_BEGIN_ALLOW_THREADS + rewinddir(dirp); closedir(dirp); Py_END_ALLOW_THREADS Py_DECREF(d); @@ -2930,6 +2930,7 @@ Py_DECREF(v); } Py_BEGIN_ALLOW_THREADS + rewinddir(dirp); closedir(dirp); Py_END_ALLOW_THREADS -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Mon Jan 9 01:40:18 2012 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 9 Jan 2012 10:40:18 +1000 Subject: [Python-checkins] cpython: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as In-Reply-To: References: Message-ID: On Mon, Jan 9, 2012 at 5:31 AM, charles-francois.natali wrote: > ?Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as > it should on OpenIndiana. Can rewinddir() end up touching the filesystem to retrieve data? I noticed that your previous change (the one this checkin reverted) moved it outside the GIL release macros. Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From benjamin at python.org Mon Jan 9 01:43:33 2012 From: benjamin at python.org (Benjamin Peterson) Date: Sun, 8 Jan 2012 19:43:33 -0500 Subject: [Python-checkins] [Python-Dev] cpython: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as In-Reply-To: References: Message-ID: 2012/1/8 Nick Coghlan : > On Mon, Jan 9, 2012 at 5:31 AM, charles-francois.natali > wrote: >> ?Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as >> it should on OpenIndiana. > > Can rewinddir() end up touching the filesystem to retrieve data? I > noticed that your previous change (the one this checkin reverted) > moved it outside the GIL release macros. It just resets a position count. (in glibc). -- Regards, Benjamin From solipsis at pitrou.net Mon Jan 9 05:33:39 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 09 Jan 2012 05:33:39 +0100 Subject: [Python-checkins] Daily reference leaks (c14c60628714): sum=0 Message-ID: results for c14c60628714 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogdCsS_O', '-x'] From python-checkins at python.org Mon Jan 9 06:32:09 2012 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 09 Jan 2012 06:32:09 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Minor_code_clean-ups_and_be?= =?utf8?q?autifications=2E?= Message-ID: http://hg.python.org/cpython/rev/190ad17f5a87 changeset: 74305:190ad17f5a87 user: Raymond Hettinger date: Mon Jan 09 05:32:01 2012 +0000 summary: Minor code clean-ups and beautifications. files: Lib/queue.py | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Lib/queue.py b/Lib/queue.py --- a/Lib/queue.py +++ b/Lib/queue.py @@ -1,12 +1,12 @@ """A multi-producer, multi-consumer queue.""" -from time import time as _time try: - import threading as _threading + import threading except ImportError: - import dummy_threading as _threading + import dummythreading as threading from collections import deque -import heapq +from heapq import heappush, heappop +from time import time __all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue'] @@ -31,19 +31,19 @@ # that acquire mutex must release it before returning. mutex # is shared between the three conditions, so acquiring and # releasing the conditions also acquires and releases mutex. - self.mutex = _threading.Lock() + self.mutex = threading.Lock() # Notify not_empty whenever an item is added to the queue; a # thread waiting to get is notified then. - self.not_empty = _threading.Condition(self.mutex) + self.not_empty = threading.Condition(self.mutex) # Notify not_full whenever an item is removed from the queue; # a thread waiting to put is notified then. - self.not_full = _threading.Condition(self.mutex) + self.not_full = threading.Condition(self.mutex) # Notify all_tasks_done whenever the number of unfinished tasks # drops to zero; thread waiting to join() is notified to resume - self.all_tasks_done = _threading.Condition(self.mutex) + self.all_tasks_done = threading.Condition(self.mutex) self.unfinished_tasks = 0 def task_done(self): @@ -135,9 +135,9 @@ elif timeout < 0: raise ValueError("'timeout' must be a positive number") else: - endtime = _time() + timeout + endtime = time() + timeout while self._qsize() >= self.maxsize: - remaining = endtime - _time() + remaining = endtime - time() if remaining <= 0.0: raise Full self.not_full.wait(remaining) @@ -174,9 +174,9 @@ elif timeout < 0: raise ValueError("'timeout' must be a positive number") else: - endtime = _time() + timeout + endtime = time() + timeout while not self._qsize(): - remaining = endtime - _time() + remaining = endtime - time() if remaining <= 0.0: raise Empty self.not_empty.wait(remaining) @@ -200,7 +200,7 @@ def _init(self, maxsize): self.queue = deque() - def _qsize(self, len=len): + def _qsize(self): return len(self.queue) # Put a new item in the queue @@ -221,13 +221,13 @@ def _init(self, maxsize): self.queue = [] - def _qsize(self, len=len): + def _qsize(self): return len(self.queue) - def _put(self, item, heappush=heapq.heappush): + def _put(self, item): heappush(self.queue, item) - def _get(self, heappop=heapq.heappop): + def _get(self): return heappop(self.queue) @@ -237,7 +237,7 @@ def _init(self, maxsize): self.queue = [] - def _qsize(self, len=len): + def _qsize(self): return len(self.queue) def _put(self, item): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 07:02:15 2012 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 09 Jan 2012 07:02:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Improve_clarity_with_keywor?= =?utf8?q?d_argument_for_block=2E__Move_nowait_methods_together=2E?= Message-ID: http://hg.python.org/cpython/rev/07608e67bc01 changeset: 74306:07608e67bc01 user: Raymond Hettinger date: Mon Jan 09 06:02:08 2012 +0000 summary: Improve clarity with keyword argument for block. Move nowait methods together. files: Lib/queue.py | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/queue.py b/Lib/queue.py --- a/Lib/queue.py +++ b/Lib/queue.py @@ -145,14 +145,6 @@ self.unfinished_tasks += 1 self.not_empty.notify() - def put_nowait(self, item): - """Put an item into the queue without blocking. - - Only enqueue the item if a free slot is immediately available. - Otherwise raise the Full exception. - """ - return self.put(item, False) - def get(self, block=True, timeout=None): """Remove and return an item from the queue. @@ -184,13 +176,21 @@ self.not_full.notify() return item + def put_nowait(self, item): + """Put an item into the queue without blocking. + + Only enqueue the item if a free slot is immediately available. + Otherwise raise the Full exception. + """ + return self.put(item, block=False) + def get_nowait(self): """Remove and return an item from the queue without blocking. Only get an item if one is immediately available. Otherwise raise the Empty exception. """ - return self.get(False) + return self.get(block=False) # Override these methods to implement other queue organizations # (e.g. stack or priority queue). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 07:17:44 2012 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 09 Jan 2012 07:17:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Make_the_docstring_style_co?= =?utf8?q?nsistent=2E?= Message-ID: http://hg.python.org/cpython/rev/ca2a35140e6a changeset: 74307:ca2a35140e6a user: Raymond Hettinger date: Mon Jan 09 06:17:39 2012 +0000 summary: Make the docstring style consistent. files: Lib/queue.py | 47 +++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Lib/queue.py b/Lib/queue.py --- a/Lib/queue.py +++ b/Lib/queue.py @@ -1,4 +1,4 @@ -"""A multi-producer, multi-consumer queue.""" +'''A multi-producer, multi-consumer queue.''' try: import threading @@ -11,18 +11,19 @@ __all__ = ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue'] class Empty(Exception): - "Exception raised by Queue.get(block=0)/get_nowait()." + 'Exception raised by Queue.get(block=0)/get_nowait().' pass class Full(Exception): - "Exception raised by Queue.put(block=0)/put_nowait()." + 'Exception raised by Queue.put(block=0)/put_nowait().' pass class Queue: - """Create a queue object with a given maximum size. + '''Create a queue object with a given maximum size. If maxsize is <= 0, the queue size is infinite. - """ + ''' + def __init__(self, maxsize=0): self.maxsize = maxsize self._init(maxsize) @@ -47,7 +48,7 @@ self.unfinished_tasks = 0 def task_done(self): - """Indicate that a formerly enqueued task is complete. + '''Indicate that a formerly enqueued task is complete. Used by Queue consumer threads. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing @@ -59,7 +60,7 @@ Raises a ValueError if called more times than there were items placed in the queue. - """ + ''' with self.all_tasks_done: unfinished = self.unfinished_tasks - 1 if unfinished <= 0: @@ -69,25 +70,25 @@ self.unfinished_tasks = unfinished def join(self): - """Blocks until all items in the Queue have been gotten and processed. + '''Blocks until all items in the Queue have been gotten and processed. The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer thread calls task_done() to indicate the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks. - """ + ''' with self.all_tasks_done: while self.unfinished_tasks: self.all_tasks_done.wait() def qsize(self): - """Return the approximate size of the queue (not reliable!).""" + '''Return the approximate size of the queue (not reliable!).''' with self.mutex: return self._qsize() def empty(self): - """Return True if the queue is empty, False otherwise (not reliable!). + '''Return True if the queue is empty, False otherwise (not reliable!). This method is likely to be removed at some point. Use qsize() == 0 as a direct substitute, but be aware that either approach risks a race @@ -96,25 +97,23 @@ To create code that needs to wait for all queued tasks to be completed, the preferred technique is to use the join() method. - - """ + ''' with self.mutex: return not self._qsize() def full(self): - """Return True if the queue is full, False otherwise (not reliable!). + '''Return True if the queue is full, False otherwise (not reliable!). This method is likely to be removed at some point. Use qsize() >= n as a direct substitute, but be aware that either approach risks a race condition where a queue can shrink before the result of full() or qsize() can be used. - - """ + ''' with self.mutex: return 0 < self.maxsize <= self._qsize() def put(self, item, block=True, timeout=None): - """Put an item into the queue. + '''Put an item into the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until a free slot is available. If 'timeout' is @@ -123,7 +122,7 @@ Otherwise ('block' is false), put an item on the queue if a free slot is immediately available, else raise the Full exception ('timeout' is ignored in that case). - """ + ''' with self.not_full: if self.maxsize > 0: if not block: @@ -146,7 +145,7 @@ self.not_empty.notify() def get(self, block=True, timeout=None): - """Remove and return an item from the queue. + '''Remove and return an item from the queue. If optional args 'block' is true and 'timeout' is None (the default), block if necessary until an item is available. If 'timeout' is @@ -155,7 +154,7 @@ Otherwise ('block' is false), return an item if one is immediately available, else raise the Empty exception ('timeout' is ignored in that case). - """ + ''' with self.not_empty: if not block: if not self._qsize(): @@ -177,19 +176,19 @@ return item def put_nowait(self, item): - """Put an item into the queue without blocking. + '''Put an item into the queue without blocking. Only enqueue the item if a free slot is immediately available. Otherwise raise the Full exception. - """ + ''' return self.put(item, block=False) def get_nowait(self): - """Remove and return an item from the queue without blocking. + '''Remove and return an item from the queue without blocking. Only get an item if one is immediately available. Otherwise raise the Empty exception. - """ + ''' return self.get(block=False) # Override these methods to implement other queue organizations -- Repository URL: http://hg.python.org/cpython From benjamin at python.org Mon Jan 9 14:02:53 2012 From: benjamin at python.org (Benjamin Peterson) Date: Mon, 9 Jan 2012 08:02:53 -0500 Subject: [Python-checkins] [Python-Dev] cpython: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as In-Reply-To: References: Message-ID: 2012/1/9 Charles-Fran?ois Natali : >>> Can rewinddir() end up touching the filesystem to retrieve data? I >>> noticed that your previous change (the one this checkin reverted) >>> moved it outside the GIL release macros. >> >> It just resets a position count. (in glibc). > > Actually, it also calls lseek() on the directory FD: > http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/rewinddir.c;hb=HEAD > > But lseek() doesn't (normally) perform I/O, it just sets an offset in > the kernel file structure: > http://lxr.free-electrons.com/source/fs/read_write.c#L38 Sorry, I should have implied I looked at the kernel source, too. :) -- Regards, Benjamin From python-checkins at python.org Mon Jan 9 17:10:21 2012 From: python-checkins at python.org (giampaolo.rodola) Date: Mon, 09 Jan 2012 17:10:21 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_provide_a_common_method_to_?= =?utf8?q?check_for_RETR=5FDATA_validity=2C_first_checking_the?= Message-ID: http://hg.python.org/cpython/rev/53a5a5b8859d changeset: 74308:53a5a5b8859d user: Giampaolo Rodola' date: Mon Jan 09 17:10:10 2012 +0100 summary: provide a common method to check for RETR_DATA validity, first checking the expected len and then the actual data content; this way we get a failure on len mismatch rather than content mismatch (which is very long and unreadable) files: Lib/test/test_ftplib.py | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py --- a/Lib/test/test_ftplib.py +++ b/Lib/test/test_ftplib.py @@ -461,6 +461,10 @@ self.client.close() self.server.stop() + def check_data(self, received, expected): + self.assertEqual(len(received), len(expected)) + self.assertEqual(received, expected) + def test_getwelcome(self): self.assertEqual(self.client.getwelcome(), '220 welcome') @@ -542,7 +546,7 @@ received.append(data.decode('ascii')) received = [] self.client.retrbinary('retr', callback) - self.assertEqual(''.join(received), RETR_DATA) + self.check_data(''.join(received), RETR_DATA) def test_retrbinary_rest(self): def callback(data): @@ -550,20 +554,17 @@ for rest in (0, 10, 20): received = [] self.client.retrbinary('retr', callback, rest=rest) - self.assertEqual(''.join(received), RETR_DATA[rest:], - msg='rest test case %d %d %d' % (rest, - len(''.join(received)), - len(RETR_DATA[rest:]))) + self.check_data(''.join(received), RETR_DATA[rest:]) def test_retrlines(self): received = [] self.client.retrlines('retr', received.append) - self.assertEqual(''.join(received), RETR_DATA.replace('\r\n', '')) + self.check_data(''.join(received), RETR_DATA.replace('\r\n', '')) def test_storbinary(self): f = io.BytesIO(RETR_DATA.encode('ascii')) self.client.storbinary('stor', f) - self.assertEqual(self.server.handler_instance.last_received_data, RETR_DATA) + self.check_data(self.server.handler_instance.last_received_data, RETR_DATA) # test new callback arg flag = [] f.seek(0) @@ -580,7 +581,7 @@ def test_storlines(self): f = io.BytesIO(RETR_DATA.replace('\r\n', '\n').encode('ascii')) self.client.storlines('stor', f) - self.assertEqual(self.server.handler_instance.last_received_data, RETR_DATA) + self.check_data(self.server.handler_instance.last_received_data, RETR_DATA) # test new callback arg flag = [] f.seek(0) @@ -781,6 +782,7 @@ received.append(data.decode('ascii')) received = [] self.client.retrbinary('retr', callback) + self.assertEqual(len(''.join(received)), len(RETR_DATA)) self.assertEqual(''.join(received), RETR_DATA) self.client.set_pasv(True) retr() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:02:59 2012 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 09 Jan 2012 21:02:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_nasty_typo?= Message-ID: http://hg.python.org/cpython/rev/32eae3c48631 changeset: 74309:32eae3c48631 user: Raymond Hettinger date: Mon Jan 09 20:02:24 2012 +0000 summary: Fix nasty typo files: Lib/queue.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/queue.py b/Lib/queue.py --- a/Lib/queue.py +++ b/Lib/queue.py @@ -3,7 +3,7 @@ try: import threading except ImportError: - import dummythreading as threading + import dummy_threading as threading from collections import deque from heapq import heappush, heappop from time import time -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:44:56 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 09 Jan 2012 21:44:56 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNzQ3?= =?utf8?q?=3A_fix_documentation_error_about_the_default_SSL_version=2E?= Message-ID: http://hg.python.org/cpython/rev/3db0abf3058b changeset: 74310:3db0abf3058b branch: 2.7 parent: 74294:56e9d025078d user: Antoine Pitrou date: Mon Jan 09 21:35:11 2012 +0100 summary: Issue #13747: fix documentation error about the default SSL version. files: Doc/library/ssl.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -103,9 +103,8 @@ The parameter ``ssl_version`` specifies which version of the SSL protocol to use. Typically, the server chooses a particular protocol version, and the client must adapt to the server's choice. Most of the versions are not - interoperable with the other versions. If not specified, for client-side - operation, the default SSL version is SSLv3; for server-side operation, - SSLv23. These version selections provide the most compatibility with other + interoperable with the other versions. If not specified, the default is + :data:`PROTOCOL_SSLv23`; it provides the most compatibility with other versions. Here's a table showing which versions in a client (down the side) can connect -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:44:57 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 09 Jan 2012 21:44:57 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNzQ3?= =?utf8?q?=3A_fix_SSL_compatibility_table=2E?= Message-ID: http://hg.python.org/cpython/rev/4f14c249f3de changeset: 74311:4f14c249f3de branch: 2.7 user: Antoine Pitrou date: Mon Jan 09 21:43:18 2012 +0100 summary: Issue #13747: fix SSL compatibility table. files: Doc/library/ssl.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -116,7 +116,7 @@ *client* / **server** **SSLv2** **SSLv3** **SSLv23** **TLSv1** ------------------------ --------- --------- ---------- --------- *SSLv2* yes no yes no - *SSLv3* yes yes yes no + *SSLv3* no yes yes no *SSLv23* yes no yes no *TLSv1* no no yes yes ======================== ========= ========= ========== ========= -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:47:37 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 09 Jan 2012 21:47:37 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzQ3?= =?utf8?q?=3A_fix_documentation_error_about_the_default_SSL_version=2E?= Message-ID: http://hg.python.org/cpython/rev/7ae0f71862f9 changeset: 74312:7ae0f71862f9 branch: 3.2 parent: 74299:26389e9efa9c user: Antoine Pitrou date: Mon Jan 09 21:35:11 2012 +0100 summary: Issue #13747: fix documentation error about the default SSL version. files: Doc/library/ssl.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -108,9 +108,8 @@ The parameter ``ssl_version`` specifies which version of the SSL protocol to use. Typically, the server chooses a particular protocol version, and the client must adapt to the server's choice. Most of the versions are not - interoperable with the other versions. If not specified, for client-side - operation, the default SSL version is SSLv3; for server-side operation, - SSLv23. These version selections provide the most compatibility with other + interoperable with the other versions. If not specified, the default is + :data:`PROTOCOL_SSLv23`; it provides the most compatibility with other versions. Here's a table showing which versions in a client (down the side) can connect -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:47:38 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 09 Jan 2012 21:47:38 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzQ3?= =?utf8?q?=3A_fix_SSL_compatibility_table=2E?= Message-ID: http://hg.python.org/cpython/rev/b4194af97948 changeset: 74313:b4194af97948 branch: 3.2 user: Antoine Pitrou date: Mon Jan 09 21:43:18 2012 +0100 summary: Issue #13747: fix SSL compatibility table. files: Doc/library/ssl.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -121,7 +121,7 @@ *client* / **server** **SSLv2** **SSLv3** **SSLv23** **TLSv1** ------------------------ --------- --------- ---------- --------- *SSLv2* yes no yes no - *SSLv3* yes yes yes no + *SSLv3* no yes yes no *SSLv23* yes no yes no *TLSv1* no no yes yes ======================== ========= ========= ========== ========= -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:47:39 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 09 Jan 2012 21:47:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_SSL_doc_fixes_=28issue_=2313747=29=2E?= Message-ID: http://hg.python.org/cpython/rev/d2a47650031a changeset: 74314:d2a47650031a parent: 74309:32eae3c48631 parent: 74313:b4194af97948 user: Antoine Pitrou date: Mon Jan 09 21:46:11 2012 +0100 summary: Merge SSL doc fixes (issue #13747). files: Doc/library/ssl.rst | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -152,9 +152,8 @@ The parameter ``ssl_version`` specifies which version of the SSL protocol to use. Typically, the server chooses a particular protocol version, and the client must adapt to the server's choice. Most of the versions are not - interoperable with the other versions. If not specified, for client-side - operation, the default SSL version is SSLv3; for server-side operation, - SSLv23. These version selections provide the most compatibility with other + interoperable with the other versions. If not specified, the default is + :data:`PROTOCOL_SSLv23`; it provides the most compatibility with other versions. Here's a table showing which versions in a client (down the side) can connect @@ -166,7 +165,7 @@ *client* / **server** **SSLv2** **SSLv3** **SSLv23** **TLSv1** ------------------------ --------- --------- ---------- --------- *SSLv2* yes no yes no - *SSLv3* yes yes yes no + *SSLv3* no yes yes no *SSLv23* yes no yes no *TLSv1* no no yes yes ======================== ========= ========= ========== ========= -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 9 21:58:29 2012 From: python-checkins at python.org (terry.reedy) Date: Mon, 09 Jan 2012 21:58:29 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Backporting_is_obsolete=2E?= =?utf8?q?_Add_details_that_I_had_to_learn=2E?= Message-ID: http://hg.python.org/devguide/rev/7848c29f58c6 changeset: 471:7848c29f58c6 user: Terry Jan Reedy date: Mon Jan 09 15:57:50 2012 -0500 summary: Backporting is obsolete. Add details that I had to learn. (Loading project files otherwise generates an error/warning with Express.) files: devcycle.rst | 8 ++++---- faq.rst | 5 +++-- setup.rst | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/devcycle.rst b/devcycle.rst --- a/devcycle.rst +++ b/devcycle.rst @@ -30,10 +30,10 @@ Branches '''''''' -Different branches are used at a time to represent different *minor versions* -in which development is made. All development should be done **first** in the -:ref:`in-development ` branch, and selectively backported -to other branches when necessary. +There is a branch for each *minor version*. Development is done separately +for Python 2 and Python 3. For each *major version*, each change should be made +**first** in the oldest branch to which it applies and forward-ported as +appropriate. .. _indevbranch: diff --git a/faq.rst b/faq.rst --- a/faq.rst +++ b/faq.rst @@ -174,8 +174,9 @@ If you have push rights, you need to configure Mercurial to work with your SSH keys. For that, open your Mercurial configuration file -(you can do so by opening the TortoiseHg configuration dialog and then -clicking *"Edit File"*). In the ``[ui]`` section, add the following line:: +(you can do so by opening the TortoiseHg Global Settings dialog and then +clicking *"Edit File"*). If there is no ``[ui]`` section, create it by +typing just that on a line by itself. Then add the following line:: ssh = TortoisePlink.exe -ssh -2 -C -i C:\path\to\yourkey.ppk diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -165,8 +165,8 @@ is sufficient. Its limitations are given at http://msdn.microsoft.com/en-us/library/hs24szh9%28v=VS.90%29.aspx . -To build from the Visual Studio GUI, load the project files and press F7. Make -sure you have chosen the "Debug" build first. +To build from the Visual Studio GUI, open pcbuild.sln to load the project +files and press F7. Make sure you have chosen the "Debug" build first. Once built you might want to set Python as a startup project. Pressing F5 in Visual Studio will launch the interpreter. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Mon Jan 9 22:40:38 2012 From: python-checkins at python.org (charles-francois.natali) Date: Mon, 09 Jan 2012 22:40:38 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312760=3A_Add_a_cre?= =?utf8?q?ate_mode_to_open=28=29=2E_Patch_by_David_Townshend=2E?= Message-ID: http://hg.python.org/cpython/rev/bf609baff4d3 changeset: 74315:bf609baff4d3 user: Charles-Fran?ois Natali date: Mon Jan 09 22:40:02 2012 +0100 summary: Issue #12760: Add a create mode to open(). Patch by David Townshend. files: Doc/library/io.rst | 12 ++++++--- Doc/library/os.rst | 5 +++- Doc/whatsnew/3.3.rst | 9 ++++++ Lib/_pyio.py | 34 ++++++++++++++----------- Lib/test/test_io.py | 13 +++++++++ Misc/ACKS | 1 + Misc/NEWS | 2 + Modules/_io/_iomodule.c | 28 ++++++++++++-------- Modules/_io/fileio.c | 38 +++++++++++++++++++++------- 9 files changed, 101 insertions(+), 41 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -471,10 +471,13 @@ * an integer representing the number of an existing OS-level file descriptor to which the resulting :class:`FileIO` object will give access. - The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing, - or appending. The file will be created if it doesn't exist when opened for - writing or appending; it will be truncated when opened for writing. Add a - ``'+'`` to the mode to allow simultaneous reading and writing. + The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading + (default), writing, creating or appending. The file will be created if it + doesn't exist when opened for writing or appending; it will be truncated + when opened for writing. :exc:`FileExistsError` will be raised if it already + exists when opened for creating. Opening a file for creating implies + writing, so this mode behaves in a similar way to ``'w'``. Add a ``'+'`` to + the mode to allow simultaneous reading and writing. The :meth:`read` (when called with a positive argument), :meth:`readinto` and :meth:`write` methods on this class will only make one system call. @@ -487,6 +490,7 @@ .. versionchanged:: 3.3 The *opener* parameter was added. + The ``'x'`` mode was added. In addition to the attributes and methods from :class:`IOBase` and :class:`RawIOBase`, :class:`FileIO` provides the following data diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -591,7 +591,8 @@ the built-in :func:`open` function. When specified, the *mode* argument must start with one of the letters - ``'r'``, ``'w'``, or ``'a'``, otherwise a :exc:`ValueError` is raised. + ``'r'``, ``'w'``, ``'x'`` or ``'a'``, otherwise a :exc:`ValueError` is + raised. On Unix, when the *mode* argument starts with ``'a'``, the *O_APPEND* flag is set on the file descriptor (which the :c:func:`fdopen` implementation already @@ -599,6 +600,8 @@ Availability: Unix, Windows. + .. versionchanged:: 3.3 + The ``'x'`` mode was added. .. _os-fd-ops: diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -408,6 +408,15 @@ (Contributed by Sijin Joseph in :issue:`8808`) +io +-- + +The :func:`~io.open` function has a new ``'x'`` mode that can be used to create +a new file, and raise a :exc:`FileExistsError` if the file already exists. + +(Contributed by David Townshend in :issue:`12760`) + + lzma ---- diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -38,21 +38,22 @@ wrapped. (If a file descriptor is given, it is closed when the returned I/O object is closed, unless closefd is set to False.) - mode is an optional string that specifies the mode in which the file - is opened. It defaults to 'r' which means open for reading in text - mode. Other common values are 'w' for writing (truncating the file if - it already exists), and 'a' for appending (which on some Unix systems, - means that all writes append to the end of the file regardless of the - current seek position). In text mode, if encoding is not specified the - encoding used is platform dependent. (For reading and writing raw - bytes use binary mode and leave encoding unspecified.) The available - modes are: + mode is an optional string that specifies the mode in which the file is + opened. It defaults to 'r' which means open for reading in text mode. Other + common values are 'w' for writing (truncating the file if it already + exists), 'x' for creating and writing to a new file, and 'a' for appending + (which on some Unix systems, means that all writes append to the end of the + file regardless of the current seek position). In text mode, if encoding is + not specified the encoding used is platform dependent. (For reading and + writing raw bytes use binary mode and leave encoding unspecified.) The + available modes are: ========= =============================================================== Character Meaning --------- --------------------------------------------------------------- 'r' open for reading (default) 'w' open for writing, truncating the file first + 'x' create a new file and open it for writing 'a' open for writing, appending to the end of the file if it exists 'b' binary mode 't' text mode (default) @@ -63,7 +64,8 @@ The default mode is 'rt' (open for reading text). For binary random access, the mode 'w+b' opens and truncates the file to 0 bytes, while - 'r+b' opens the file without truncation. + 'r+b' opens the file without truncation. The 'x' mode implies 'w' and + raises an `FileExistsError` if the file already exists. Python distinguishes between files opened in binary and text modes, even when the underlying operating system doesn't. Files opened in @@ -154,8 +156,9 @@ if errors is not None and not isinstance(errors, str): raise TypeError("invalid errors: %r" % errors) modes = set(mode) - if modes - set("arwb+tU") or len(mode) > len(modes): + if modes - set("axrwb+tU") or len(mode) > len(modes): raise ValueError("invalid mode: %r" % mode) + creating = "x" in modes reading = "r" in modes writing = "w" in modes appending = "a" in modes @@ -163,14 +166,14 @@ text = "t" in modes binary = "b" in modes if "U" in modes: - if writing or appending: + if creating or writing or appending: raise ValueError("can't use U and writing mode at once") reading = True if text and binary: raise ValueError("can't have text and binary mode at once") - if reading + writing + appending > 1: + if creating + reading + writing + appending > 1: raise ValueError("can't have read/write/append mode at once") - if not (reading or writing or appending): + if not (creating or reading or writing or appending): raise ValueError("must have exactly one of read/write/append mode") if binary and encoding is not None: raise ValueError("binary mode doesn't take an encoding argument") @@ -179,6 +182,7 @@ if binary and newline is not None: raise ValueError("binary mode doesn't take a newline argument") raw = FileIO(file, + (creating and "x" or "") + (reading and "r" or "") + (writing and "w" or "") + (appending and "a" or "") + @@ -205,7 +209,7 @@ raise ValueError("can't have unbuffered text I/O") if updating: buffer = BufferedRandom(raw, buffering) - elif writing or appending: + elif creating or writing or appending: buffer = BufferedWriter(raw, buffering) elif reading: buffer = BufferedReader(raw, buffering) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2825,6 +2825,19 @@ self.assertTrue(wf.closed) self.assertTrue(rf.closed) + def test_create_fail(self): + # 'x' mode fails if file is existing + with self.open(support.TESTFN, 'w'): + pass + self.assertRaises(FileExistsError, self.open, support.TESTFN, 'x') + + def test_create_writes(self): + # 'x' mode opens for writing + with self.open(support.TESTFN, 'xb') as f: + f.write(b"spam") + with self.open(support.TESTFN, 'rb') as f: + self.assertEqual(b"spam", f.read()) + class CMiscIOTest(MiscIOTest): io = io diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -996,6 +996,7 @@ Matias Torchinsky Sandro Tosi Richard Townsend +David Townshend Laurence Tratt Matthias Troffaes John Tromp diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #12760: Add a create mode to open(). Patch by David Townshend. + - Issue #13738: Simplify implementation of bytes.lower() and bytes.upper(). - Issue #13577: Built-in methods and functions now have a __qualname__. diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -108,18 +108,19 @@ "mode is an optional string that specifies the mode in which the file\n" "is opened. It defaults to 'r' which means open for reading in text\n" "mode. Other common values are 'w' for writing (truncating the file if\n" -"it already exists), and 'a' for appending (which on some Unix systems,\n" -"means that all writes append to the end of the file regardless of the\n" -"current seek position). In text mode, if encoding is not specified the\n" -"encoding used is platform dependent. (For reading and writing raw\n" -"bytes use binary mode and leave encoding unspecified.) The available\n" -"modes are:\n" +"it already exists), 'x' for creating and writing to a new file, and\n" +"'a' for appending (which on some Unix systems, means that all writes\n" +"append to the end of the file regardless of the current seek position).\n" +"In text mode, if encoding is not specified the encoding used is platform\n" +"dependent. (For reading and writing raw bytes use binary mode and leave\n" +"encoding unspecified.) The available modes are:\n" "\n" "========= ===============================================================\n" "Character Meaning\n" "--------- ---------------------------------------------------------------\n" "'r' open for reading (default)\n" "'w' open for writing, truncating the file first\n" +"'x' create a new file and open it for writing\n" "'a' open for writing, appending to the end of the file if it exists\n" "'b' binary mode\n" "'t' text mode (default)\n" @@ -130,7 +131,8 @@ "\n" "The default mode is 'rt' (open for reading text). For binary random\n" "access, the mode 'w+b' opens and truncates the file to 0 bytes, while\n" -"'r+b' opens the file without truncation.\n" +"'r+b' opens the file without truncation. The 'x' mode implies 'w' and\n" +"raises an `FileExistsError` if the file already exists.\n" "\n" "Python distinguishes between files opened in binary and text modes,\n" "even when the underlying operating system doesn't. Files opened in\n" @@ -223,7 +225,7 @@ char *encoding = NULL, *errors = NULL, *newline = NULL; unsigned i; - int reading = 0, writing = 0, appending = 0, updating = 0; + int creating = 0, reading = 0, writing = 0, appending = 0, updating = 0; int text = 0, binary = 0, universal = 0; char rawmode[5], *m; @@ -254,6 +256,9 @@ char c = mode[i]; switch (c) { + case 'x': + creating = 1; + break; case 'r': reading = 1; break; @@ -290,6 +295,7 @@ } m = rawmode; + if (creating) *(m++) = 'x'; if (reading) *(m++) = 'r'; if (writing) *(m++) = 'w'; if (appending) *(m++) = 'a'; @@ -312,9 +318,9 @@ return NULL; } - if (reading + writing + appending > 1) { + if (creating + reading + writing + appending > 1) { PyErr_SetString(PyExc_ValueError, - "must have exactly one of read/write/append mode"); + "must have exactly one of create/read/write/append mode"); return NULL; } @@ -408,7 +414,7 @@ if (updating) Buffered_class = (PyObject *)&PyBufferedRandom_Type; - else if (writing || appending) + else if (creating || writing || appending) Buffered_class = (PyObject *)&PyBufferedWriter_Type; else if (reading) Buffered_class = (PyObject *)&PyBufferedReader_Type; diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -46,6 +46,7 @@ typedef struct { PyObject_HEAD int fd; + unsigned int created : 1; unsigned int readable : 1; unsigned int writable : 1; signed int seekable : 2; /* -1 means unknown */ @@ -152,6 +153,7 @@ self = (fileio *) type->tp_alloc(type, 0); if (self != NULL) { self->fd = -1; + self->created = 0; self->readable = 0; self->writable = 0; self->seekable = -1; @@ -290,15 +292,23 @@ s = mode; while (*s) { switch (*s++) { - case 'r': + case 'x': if (rwa) { bad_mode: PyErr_SetString(PyExc_ValueError, - "Must have exactly one of read/write/append " + "Must have exactly one of create/read/write/append " "mode and at most one plus"); goto error; } rwa = 1; + self->created = 1; + self->writable = 1; + flags |= O_EXCL | O_CREAT; + break; + case 'r': + if (rwa) + goto bad_mode; + rwa = 1; self->readable = 1; break; case 'w': @@ -988,6 +998,12 @@ static char * mode_string(fileio *self) { + if (self->created) { + if (self->readable) + return "xb+"; + else + return "xb"; + } if (self->readable) { if (self->writable) return "rb+"; @@ -1049,15 +1065,17 @@ PyDoc_STRVAR(fileio_doc, "file(name: str[, mode: str][, opener: None]) -> file IO object\n" "\n" -"Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n" -"writing or appending. The file will be created if it doesn't exist\n" -"when opened for writing or appending; it will be truncated when\n" -"opened for writing. Add a '+' to the mode to allow simultaneous\n" -"reading and writing. A custom opener can be used by passing a\n" -"callable as *opener*. The underlying file descriptor for the file\n" +"Open a file. The mode can be 'r', 'w', 'x' or 'a' for reading (default),\n" +"writing, creating or appending. The file will be created if it doesn't\n" +"exist when opened for writing or appending; it will be truncated when\n" +"opened for writing. A `FileExistsError` will be raised if it already\n" +"exists when opened for creating. Opening a file for creating implies\n" +"writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode\n" +"to allow simultaneous reading and writing. A custom opener can be used by\n" +"passing a callable as *opener*. The underlying file descriptor for the file\n" "object is then obtained by calling opener with (*name*, *flags*).\n" -"*opener* must return an open file descriptor (passing os.open as\n" -"*opener* results in functionality similar to passing None)."); +"*opener* must return an open file descriptor (passing os.open as *opener*\n" +"results in functionality similar to passing None)."); PyDoc_STRVAR(read_doc, "read(size: int) -> bytes. read at most size bytes, returned as bytes.\n" -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Mon Jan 9 23:20:32 2012 From: tjreedy at udel.edu (Terry Reedy) Date: Mon, 09 Jan 2012 17:20:32 -0500 Subject: [Python-checkins] cpython: Issue #12760: Add a create mode to open(). Patch by David Townshend. In-Reply-To: References: Message-ID: <4F0B6830.9050406@udel.edu> On 1/9/2012 4:40 PM, charles-francois.natali wrote: > http://hg.python.org/cpython/rev/bf609baff4d3 > changeset: 74315:bf609baff4d3 > user: Charles-Fran?ois Natali > date: Mon Jan 09 22:40:02 2012 +0100 > summary: > Issue #12760: Add a create mode to open(). Patch by David Townshend. > + if creating + reading + writing + appending> 1: > raise ValueError("can't have read/write/append mode at once") > - if not (reading or writing or appending): > + if not (creating or reading or writing or appending): > raise ValueError("must have exactly one of read/write/append mode") I think the error message(s) should be updated with 'create' as you did in the C Code below. Would not if creating + reading + writing + appending != 1: raise ValueError( "must have exactly one of create/read/write/append mode") be sufficient? > PyErr_SetString(PyExc_ValueError, > - "must have exactly one of read/write/append mode"); > + "must have exactly one of create/read/write/append mode"); > PyErr_SetString(PyExc_ValueError, > - "Must have exactly one of read/write/append " > + "Must have exactly one of create/read/write/append " > "mode and at most one plus"); Terry From python-checkins at python.org Tue Jan 10 00:34:29 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 10 Jan 2012 00:34:29 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_=2311906_Make_t?= =?utf8?q?est=5Fargparse_work_interactively_by_removing_extra_space?= Message-ID: http://hg.python.org/cpython/rev/b950267efd59 changeset: 74316:b950267efd59 branch: 3.2 parent: 74313:b4194af97948 user: Terry Jan Reedy date: Mon Jan 09 18:20:09 2012 -0500 summary: #11906 Make test_argparse work interactively by removing extra space in comparison string that argparse does not add when program name is blank. files: Lib/test/test_argparse.py | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2170,8 +2170,9 @@ parents = [self.abcd_parent, self.wxyz_parent] parser = ErrorRaisingArgumentParser(parents=parents) parser_help = parser.format_help() + progname = self.main_program self.assertEqual(parser_help, textwrap.dedent('''\ - usage: {} [-h] [-b B] [--d D] [--w W] [-y Y] a z + usage: {}{}[-h] [-b B] [--d D] [--w W] [-y Y] a z positional arguments: a @@ -2187,7 +2188,7 @@ x: -y Y - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) def test_groups_parents(self): parent = ErrorRaisingArgumentParser(add_help=False) @@ -2203,8 +2204,9 @@ ['-y', 'Y', '-z', 'Z']) parser_help = parser.format_help() + progname = self.main_program self.assertEqual(parser_help, textwrap.dedent('''\ - usage: {} [-h] [-w W] [-x X] [-y Y | -z Z] + usage: {}{}[-h] [-w W] [-x X] [-y Y | -z Z] optional arguments: -h, --help show this help message and exit @@ -2216,7 +2218,7 @@ -w W -x X - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) # ============================== # Mutually exclusive group tests -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 00:34:30 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 10 Jan 2012 00:34:30 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/4f8c24830a5c changeset: 74317:4f8c24830a5c parent: 74315:bf609baff4d3 parent: 74316:b950267efd59 user: Terry Jan Reedy date: Mon Jan 09 18:33:27 2012 -0500 summary: Merge with 3.2 files: Lib/test/test_argparse.py | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2170,8 +2170,9 @@ parents = [self.abcd_parent, self.wxyz_parent] parser = ErrorRaisingArgumentParser(parents=parents) parser_help = parser.format_help() + progname = self.main_program self.assertEqual(parser_help, textwrap.dedent('''\ - usage: {} [-h] [-b B] [--d D] [--w W] [-y Y] a z + usage: {}{}[-h] [-b B] [--d D] [--w W] [-y Y] a z positional arguments: a @@ -2187,7 +2188,7 @@ x: -y Y - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) def test_groups_parents(self): parent = ErrorRaisingArgumentParser(add_help=False) @@ -2203,8 +2204,9 @@ ['-y', 'Y', '-z', 'Z']) parser_help = parser.format_help() + progname = self.main_program self.assertEqual(parser_help, textwrap.dedent('''\ - usage: {} [-h] [-w W] [-x X] [-y Y | -z Z] + usage: {}{}[-h] [-w W] [-x X] [-y Y | -z Z] optional arguments: -h, --help show this help message and exit @@ -2216,7 +2218,7 @@ -w W -x X - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) # ============================== # Mutually exclusive group tests -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 01:20:21 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 10 Jan 2012 01:20:21 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_=2311906_Make_t?= =?utf8?q?est=5Fargparse_work_interactively_by_removing_extra_space?= Message-ID: http://hg.python.org/cpython/rev/ec32e6ec16fc changeset: 74318:ec32e6ec16fc branch: 2.7 parent: 74311:4f14c249f3de user: Terry Jan Reedy date: Mon Jan 09 18:20:09 2012 -0500 summary: #11906 Make test_argparse work interactively by removing extra space in comparison string that argparse does not add when program name is blank. files: Lib/test/test_argparse.py | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2135,8 +2135,9 @@ parents = [self.abcd_parent, self.wxyz_parent] parser = ErrorRaisingArgumentParser(parents=parents) parser_help = parser.format_help() + progname = self.main_program self.assertEqual(parser_help, textwrap.dedent('''\ - usage: {} [-h] [-b B] [--d D] [--w W] [-y Y] a z + usage: {}{}[-h] [-b B] [--d D] [--w W] [-y Y] a z positional arguments: a @@ -2152,7 +2153,7 @@ x: -y Y - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) def test_groups_parents(self): parent = ErrorRaisingArgumentParser(add_help=False) @@ -2168,8 +2169,9 @@ ['-y', 'Y', '-z', 'Z']) parser_help = parser.format_help() + progname = self.main_program self.assertEqual(parser_help, textwrap.dedent('''\ - usage: {} [-h] [-w W] [-x X] [-y Y | -z Z] + usage: {}{}[-h] [-w W] [-x X] [-y Y | -z Z] optional arguments: -h, --help show this help message and exit @@ -2181,7 +2183,7 @@ -w W -x X - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) # ============================== # Mutually exclusive group tests -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jan 10 05:31:08 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 10 Jan 2012 05:31:08 +0100 Subject: [Python-checkins] Daily reference leaks (4f8c24830a5c): sum=0 Message-ID: results for 4f8c24830a5c on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogMtaei6', '-x'] From python-checkins at python.org Tue Jan 10 08:55:32 2012 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 10 Jan 2012 08:55:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Update_the_sort?= =?utf8?q?ing_howto_to_reflect_the_PEP_8_advisory_to_define_all_six_rich?= Message-ID: http://hg.python.org/cpython/rev/11a8a6c8cdd9 changeset: 74319:11a8a6c8cdd9 branch: 2.7 user: Raymond Hettinger date: Tue Jan 10 07:55:17 2012 +0000 summary: Update the sorting howto to reflect the PEP 8 advisory to define all six rich comparisons. files: Doc/howto/sorting.rst | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Doc/howto/sorting.rst b/Doc/howto/sorting.rst --- a/Doc/howto/sorting.rst +++ b/Doc/howto/sorting.rst @@ -276,11 +276,15 @@ >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] >>> assert sorted(data, reverse=True) == list(reversed(sorted(reversed(data)))) -* The sort routines are guaranteed to use :meth:`__lt__` when making comparisons - between two objects. So, it is easy to add a standard sort order to a class by - defining an :meth:`__lt__` method:: +* To create a standard sort order for a class, just add the appropriate rich + comparison methods: + >>> Student.__eq__ = lambda self, other: self.age == other.age + >>> Student.__ne__ = lambda self, other: self.age != other.age >>> Student.__lt__ = lambda self, other: self.age < other.age + >>> Student.__le__ = lambda self, other: self.age <= other.age + >>> Student.__gt__ = lambda self, other: self.age > other.age + >>> Student.__ge__ = lambda self, other: self.age >= other.age >>> sorted(student_objects) [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Tue Jan 10 09:50:11 2012 From: ncoghlan at gmail.com (Nick Coghlan) Date: Tue, 10 Jan 2012 18:50:11 +1000 Subject: [Python-checkins] cpython: Issue #12760: Add a create mode to open(). Patch by David Townshend. In-Reply-To: References: Message-ID: On Tue, Jan 10, 2012 at 7:40 AM, charles-francois.natali wrote: > http://hg.python.org/cpython/rev/bf609baff4d3 > changeset: ? 74315:bf609baff4d3 > user: ? ? ? ?Charles-Fran?ois Natali > date: ? ? ? ?Mon Jan 09 22:40:02 2012 +0100 > summary: > ?Issue #12760: Add a create mode to open(). Patch by David Townshend. To help make the 'x' more intuitive, it would be helpful if the mode was referred to as "exclusive create" in the docs (at least once, anyway), and the What's New entry stated explicitly that 'x' is used based on the C11 precedent. Otherwise, I'm sure I'll be far from the only one thinking "why not 'c'?". People shouldn't have to go read the tracker item to find out the reason 'x' is used instead of 'c'. Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Tue Jan 10 10:51:57 2012 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 10 Jan 2012 10:51:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_stock_symbo?= =?utf8?q?l_for_Microsoft?= Message-ID: http://hg.python.org/cpython/rev/068ce5d7f7e7 changeset: 74320:068ce5d7f7e7 branch: 2.7 user: Raymond Hettinger date: Tue Jan 10 09:51:51 2012 +0000 summary: Fix stock symbol for Microsoft files: Doc/library/sqlite3.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -66,7 +66,7 @@ # Larger example for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00), - ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00), + ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00), ('2006-04-06', 'SELL', 'IBM', 500, 53.00), ]: c.execute('insert into stocks values (?,?,?,?,?)', t) @@ -86,7 +86,7 @@ (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14) (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0) (u'2006-04-06', u'SELL', u'IBM', 500, 53.0) - (u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0) + (u'2006-04-05', u'BUY', u'MSFT', 1000, 72.0) >>> -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 14:29:30 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 10 Jan 2012 14:29:30 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Clarify_terminology_and_de?= =?utf8?q?velopment_cycle=2E?= Message-ID: http://hg.python.org/devguide/rev/f39d063ab3dd changeset: 472:f39d063ab3dd user: Antoine Pitrou date: Tue Jan 10 14:28:04 2012 +0100 summary: Clarify terminology and development cycle. I hope I didn't get too wordy. files: devcycle.rst | 49 ++++++++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 14 deletions(-) diff --git a/devcycle.rst b/devcycle.rst --- a/devcycle.rst +++ b/devcycle.rst @@ -30,10 +30,18 @@ Branches '''''''' -There is a branch for each *minor version*. Development is done separately -for Python 2 and Python 3. For each *major version*, each change should be made -**first** in the oldest branch to which it applies and forward-ported as -appropriate. +There is a branch for each *feature version*, whether released or not (e.g. +2.7, 3.2, 3.3). Development is handled separately for Python 2 and Python 3: +no merging happens between 2.x and 3.x branches. + +In each of the 2.x and 3.x realms, the branch for a feature version is +always a descendant of the previous feature version: for example, the ``3.2`` +branch is a descendant of the ``3.1`` branch. + +Therefore, each change change should be made **first** in the oldest branch +to which it applies and forward-ported as appropriate: if a bug must be +fixed in both Python 3.2 and 3.3, first fix it in ``3.2`` and then merge ``3.2`` +into ``default`` (which holds the future 3.3). .. _indevbranch: @@ -41,12 +49,12 @@ In-development (main) branch ---------------------------- -The branch for the next minor version; it is under active development for -all kinds of changes: new features, semantic changes, performance improvements, -bug fixes. It can be :ref:`checked out ` from -http://hg.python.org/cpython#py3k. +The ``default`` branch is the branch for the next feature release; it is +under active development for all kinds of changes: new features, semantic +changes, performance improvements, bug fixes. As the name indicates, it +is the branch :ref:`checked out ` by default by Mercurial. -Once a :ref:`final` release is made from the in-development branch (say, 3.2), a +Once a :ref:`final` release (say, 3.2) is made from the in-development branch, a new :ref:`maintenance branch ` is created to host all bug fixing activity for further micro versions (3.2.1, 3.2.2, etc.). @@ -56,10 +64,10 @@ Maintenance branches -------------------- -A branch currently being maintained for bug fixes. There are currently -two of them in activity: one for Python 3.x and one for Python 2.x. At -some point in the future, Python 2.x will be closed for bug fixes and there -will be only one maintenance branch left. +A branch for a previous feature release, currently being maintained for bug +fixes. There are currently two of them in activity: one for Python 3.x and +one for Python 2.x. At some point in the future, Python 2.x will be closed +for bug fixes and there will be only one maintenance branch left. The only changes allowed to occur in a maintenance branch without debate are bug fixes. Also, a general rule for maintenance branches is that compatibility @@ -71,7 +79,6 @@ released), the old maintenance branch on that major version (e.g. 3.1.x after 3.2 gets released) goes into :ref:`security mode `. - .. _secbranch: Security branches @@ -87,6 +94,20 @@ actual security patches have been applied to the branch. +Summary +------- + +There are 5 open branches right now in the Mercurial repository: + +- the ``default`` branch holds the future 3.3 version and descends from ``3.2`` +- the ``3.2`` branch holds bug fixes for future 3.2.x maintenance releases + and descends from ``3.1`` +- the ``3.1`` branch holds security fixes for future 3.1.x security releases +- the ``2.7`` branch holds bug fixes for future 2.7.x maintenance releases and + descends from ``2.6`` +- the ``2.6`` branch holds security fixes for future 2.6.x security releases + + .. _stages: Stages -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 10 17:09:52 2012 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 10 Jan 2012 17:09:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_-_Issue_=231364?= =?utf8?q?2=3A_Unquote_before_b64encoding_user=3Apassword_during_Basic?= Message-ID: http://hg.python.org/cpython/rev/01ef13e9e225 changeset: 74321:01ef13e9e225 branch: 2.7 user: Senthil Kumaran date: Wed Jan 11 00:09:24 2012 +0800 summary: - Issue #13642: Unquote before b64encoding user:password during Basic Authentication. Patch contributed by Joonas Kuorilehto and Michele Orr?. files: Lib/test/test_urllib.py | 54 +++++++++++++++++++++++++++- Lib/urllib.py | 11 +++-- Misc/NEWS | 3 + 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -3,13 +3,16 @@ import urllib import httplib import unittest -from test import test_support import os import sys import mimetools import tempfile import StringIO +from test import test_support +from base64 import b64encode + + def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() @@ -22,8 +25,9 @@ def fakehttp(self, fakedata): class FakeSocket(StringIO.StringIO): - def sendall(self, str): - pass + def sendall(self, data): + FakeHTTPConnection.buf = data + def makefile(self, *args, **kwds): return self @@ -38,9 +42,15 @@ return StringIO.StringIO.readline(self, length) class FakeHTTPConnection(httplib.HTTPConnection): + + # buffer to store data for verification in urlopen tests. + buf = "" + def connect(self): self.sock = FakeSocket(fakedata) + assert httplib.HTTP._connection_class == httplib.HTTPConnection + httplib.HTTP._connection_class = FakeHTTPConnection def unfakehttp(self): @@ -209,6 +219,41 @@ finally: self.unfakehttp() + def test_userpass_inurl(self): + self.fakehttp('Hello!') + try: + fakehttp_wrapper = httplib.HTTP._connection_class + fp = urllib.urlopen("http://user:pass at python.org/") + authorization = ("Authorization: Basic %s\r\n" % + b64encode('user:pass')) + # The authorization header must be in place + self.assertIn(authorization, fakehttp_wrapper.buf) + self.assertEqual(fp.readline(), "Hello!") + self.assertEqual(fp.readline(), "") + self.assertEqual(fp.geturl(), 'http://user:pass at python.org/') + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + + def test_userpass_with_spaces_inurl(self): + self.fakehttp('Hello!') + try: + url = "http://a b:c d at python.org/" + fakehttp_wrapper = httplib.HTTP._connection_class + authorization = ("Authorization: Basic %s\r\n" % + b64encode('a b:c d')) + fp = urllib.urlopen(url) + # The authorization header must be in place + self.assertIn(authorization, fakehttp_wrapper.buf) + self.assertEqual(fp.readline(), "Hello!") + self.assertEqual(fp.readline(), "") + # the spaces are quoted in URL so no match + self.assertNotEqual(fp.geturl(), url) + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + + class urlretrieve_FileTests(unittest.TestCase): """Test urllib.urlretrieve() on local files""" @@ -716,6 +761,9 @@ self.assertEqual(('user', 'a\fb'),urllib.splitpasswd('user:a\fb')) self.assertEqual(('user', 'a\vb'),urllib.splitpasswd('user:a\vb')) self.assertEqual(('user', 'a:b'),urllib.splitpasswd('user:a:b')) + self.assertEqual(('user', 'a b'),urllib.splitpasswd('user:a b')) + self.assertEqual(('user 2', 'ab'),urllib.splitpasswd('user 2:ab')) + self.assertEqual(('user+1', 'a+b'),urllib.splitpasswd('user+1:a+b')) class URLopener_Tests(unittest.TestCase): diff --git a/Lib/urllib.py b/Lib/urllib.py --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -27,6 +27,8 @@ import os import time import sys +import base64 + from urlparse import urljoin as basejoin __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", @@ -318,13 +320,13 @@ if not host: raise IOError, ('http error', 'no host given') if proxy_passwd: - import base64 + proxy_passwd = unquote(proxy_passwd) proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: - import base64 + user_passwd = unquote(user_passwd) auth = base64.b64encode(user_passwd).strip() else: auth = None @@ -408,12 +410,12 @@ #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if proxy_passwd: - import base64 + proxy_passwd = unquote(proxy_passwd) proxy_auth = base64.b64encode(proxy_passwd).strip() else: proxy_auth = None if user_passwd: - import base64 + user_passwd = unquote(user_passwd) auth = base64.b64encode(user_passwd).strip() else: auth = None @@ -589,7 +591,6 @@ time.gmtime(time.time()))) msg.append('Content-type: %s' % type) if encoding == 'base64': - import base64 data = base64.decodestring(data) else: data = unquote(data) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -89,6 +89,9 @@ Library ------- +- Issue #13642: Unquote before b64encoding user:password during Basic + Authentication. Patch contributed by Joonas Kuorilehto and Michele Orr?. + - Issue #13636: Weak ciphers are now disabled by default in the ssl module (except when SSLv2 is explicitly asked for). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 18:30:39 2012 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 10 Jan 2012 18:30:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Issue9637_-_Exp?= =?utf8?q?lain_in_getproxies=5Fenvironment_that_=3Cscheme=3E=5Fproxy_envir?= =?utf8?q?on?= Message-ID: http://hg.python.org/cpython/rev/3370fa13ed73 changeset: 74322:3370fa13ed73 branch: 3.2 parent: 74316:b950267efd59 user: Senthil Kumaran date: Wed Jan 11 01:29:08 2012 +0800 summary: Issue9637 - Explain in getproxies_environment that _proxy environ variable case does not matter. files: Doc/library/urllib.request.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -124,10 +124,10 @@ .. function:: getproxies() This helper function returns a dictionary of scheme to proxy server URL - mappings. It scans the environment for variables named ``_proxy`` - for all operating systems first, and when it cannot find it, looks for proxy - information from Mac OSX System Configuration for Mac OS X and Windows - Systems Registry for Windows. + mappings. It scans the environment for variables named ``_proxy``, + in a case insensitive approach, for all operating systems first, and when it + cannot find it, looks for proxy information from Mac OSX System + Configuration for Mac OS X and Windows Systems Registry for Windows. The following classes are provided: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 18:30:40 2012 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 10 Jan 2012 18:30:40 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_from_3=2E2_-_Issue9637_-_Explain_in_getproxies=5Fenvir?= =?utf8?q?onment_that?= Message-ID: http://hg.python.org/cpython/rev/eb028b3c62c9 changeset: 74323:eb028b3c62c9 parent: 74317:4f8c24830a5c parent: 74322:3370fa13ed73 user: Senthil Kumaran date: Wed Jan 11 01:30:23 2012 +0800 summary: Merge from 3.2 - Issue9637 - Explain in getproxies_environment that _proxy environ variable case does not matter. files: Doc/library/urllib.request.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -124,10 +124,10 @@ .. function:: getproxies() This helper function returns a dictionary of scheme to proxy server URL - mappings. It scans the environment for variables named ``_proxy`` - for all operating systems first, and when it cannot find it, looks for proxy - information from Mac OSX System Configuration for Mac OS X and Windows - Systems Registry for Windows. + mappings. It scans the environment for variables named ``_proxy``, + in a case insensitive approach, for all operating systems first, and when it + cannot find it, looks for proxy information from Mac OSX System + Configuration for Mac OS X and Windows Systems Registry for Windows. The following classes are provided: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 18:35:21 2012 From: python-checkins at python.org (senthil.kumaran) Date: Tue, 10 Jan 2012 18:35:21 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_port_to_2=2E7_-?= =?utf8?q?_Issue9637_-_Details_that_case_of_Proxy_env_var_does_not_matter?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/4a30eae3b945 changeset: 74324:4a30eae3b945 branch: 2.7 parent: 74321:01ef13e9e225 user: Senthil Kumaran date: Wed Jan 11 01:35:02 2012 +0800 summary: port to 2.7 - Issue9637 - Details that case of Proxy env var does not matter. files: Doc/library/urllib.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -274,10 +274,10 @@ .. function:: getproxies() This helper function returns a dictionary of scheme to proxy server URL - mappings. It scans the environment for variables named ``_proxy`` - for all operating systems first, and when it cannot find it, looks for proxy - information from Mac OSX System Configuration for Mac OS X and Windows - Systems Registry for Windows. + mappings. It scans the environment for variables named ``_proxy``, + in case insensitive way, for all operating systems first, and when it cannot + find it, looks for proxy information from Mac OSX System Configuration for + Mac OS X and Windows Systems Registry for Windows. URL Opener objects -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 20:25:45 2012 From: python-checkins at python.org (charles-francois.natali) Date: Tue, 10 Jan 2012 20:25:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313757=3A_Change_os?= =?utf8?q?=2Efdlistdir=28=29_so_that_it_duplicates_the_passed_file?= Message-ID: http://hg.python.org/cpython/rev/6d395ed03f95 changeset: 74325:6d395ed03f95 parent: 74323:eb028b3c62c9 user: Charles-Fran?ois Natali date: Tue Jan 10 20:25:09 2012 +0100 summary: Issue #13757: Change os.fdlistdir() so that it duplicates the passed file descriptor (instead of closing it). files: Doc/library/os.rst | 2 +- Lib/test/test_posix.py | 10 ++-------- Modules/posixmodule.c | 7 +++++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -772,7 +772,7 @@ .. function:: fdlistdir(fd) Like :func:`listdir`, but uses a file descriptor instead and always returns - strings. After execution of this function, *fd* will be closed. + strings. Availability: Unix. diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -455,20 +455,14 @@ def test_fdlistdir(self): f = posix.open(posix.getcwd(), posix.O_RDONLY) self.addCleanup(posix.close, f) - f1 = posix.dup(f) self.assertEqual( sorted(posix.listdir('.')), - sorted(posix.fdlistdir(f1)) + sorted(posix.fdlistdir(f)) ) - # Check the fd was closed by fdlistdir - with self.assertRaises(OSError) as ctx: - posix.close(f1) - self.assertEqual(ctx.exception.errno, errno.EBADF) # Check that the fd offset was reset (issue #13739) - f2 = posix.dup(f) self.assertEqual( sorted(posix.listdir('.')), - sorted(posix.fdlistdir(f2)) + sorted(posix.fdlistdir(f)) ) def test_access(self): diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -2869,8 +2869,7 @@ #ifdef HAVE_FDOPENDIR PyDoc_STRVAR(posix_fdlistdir__doc__, "fdlistdir(fd) -> list_of_strings\n\n\ -Like listdir(), but uses a file descriptor instead.\n\ -After succesful execution of this function, fd will be closed."); +Like listdir(), but uses a file descriptor instead."); static PyObject * posix_fdlistdir(PyObject *self, PyObject *args) @@ -2883,6 +2882,10 @@ errno = 0; if (!PyArg_ParseTuple(args, "i:fdlistdir", &fd)) return NULL; + /* closedir() closes the FD, so we duplicate it */ + fd = dup(fd); + if (fd < 0) + return posix_error(); Py_BEGIN_ALLOW_THREADS dirp = fdopendir(fd); Py_END_ALLOW_THREADS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 23:06:01 2012 From: python-checkins at python.org (victor.stinner) Date: Tue, 10 Jan 2012 23:06:01 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_=5FPyFaulthandler=5FFin?= =?utf8?q?i=28=29_so_it_can_be_called_before_=5FPyFaulthandler=5FInit=28?= =?utf8?q?=29?= Message-ID: http://hg.python.org/cpython/rev/75def95e93d4 changeset: 74326:75def95e93d4 user: Victor Stinner date: Tue Jan 10 22:44:11 2012 +0100 summary: Fix _PyFaulthandler_Fini() so it can be called before _PyFaulthandler_Init() files: Modules/faulthandler.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1282,8 +1282,8 @@ #ifdef FAULTHANDLER_LATER /* later */ - cancel_dump_tracebacks_later(); if (thread.cancel_event) { + cancel_dump_tracebacks_later(); PyThread_release_lock(thread.cancel_event); PyThread_free_lock(thread.cancel_event); thread.cancel_event = NULL; @@ -1296,8 +1296,8 @@ #ifdef FAULTHANDLER_WATCHDOG /* file watchdog */ - cancel_file_watchdog(); if (watchdog.cancel_event) { + cancel_file_watchdog(); PyThread_release_lock(watchdog.cancel_event); PyThread_free_lock(watchdog.cancel_event); watchdog.cancel_event = NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 23:54:18 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 10 Jan 2012 23:54:18 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Remove_unused_c?= =?utf8?q?ertificate_from_the_test_directory=2E?= Message-ID: http://hg.python.org/cpython/rev/e40e9866bb4d changeset: 74327:e40e9866bb4d branch: 3.2 parent: 74322:3370fa13ed73 user: Antoine Pitrou date: Tue Jan 10 23:45:54 2012 +0100 summary: Remove unused certificate from the test directory. files: Lib/test/svn_python_org_https_cert.pem | 29 -------------- 1 files changed, 0 insertions(+), 29 deletions(-) diff --git a/Lib/test/svn_python_org_https_cert.pem b/Lib/test/svn_python_org_https_cert.pem deleted file mode 100644 --- a/Lib/test/svn_python_org_https_cert.pem +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFQTCCBCmgAwIBAgIQL2qw7lpsHqTLcBh1PVjsaTANBgkqhkiG9w0BAQUFADCB -lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt -SGFyZHdhcmUwHhcNMDcwNDEwMDAwMDAwWhcNMTAwNDA5MjM1OTU5WjCBvjELMAkG -A1UEBhMCVVMxDjAMBgNVBBETBTAxOTM4MRYwFAYDVQQIEw1NYXNzYWNodXNldHRz -MREwDwYDVQQHEwhJcHN3aXRjaDEMMAoGA1UECRMDbi9hMQwwCgYDVQQSEwM2NTMx -IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMRowGAYDVQQLExFD -b21vZG8gSW5zdGFudFNTTDEXMBUGA1UEAxMOc3ZuLnB5dGhvbi5vcmcwgZ8wDQYJ -KoZIhvcNAQEBBQADgY0AMIGJAoGBAMFOfFeLpiIN9UzTCehCgQ4W3ufaq524qPoX -00iNDiI/ehd6kC0BXIP5/y9lPoMn7nRsjdjczUaVmlPWG8BhvADK3ZZIm7m/3mZW -O/+C5vGE9YuOqIKe0VoNz/cZaYkz+C2xmOwDTp6a+ls29jjUfoxMd9gtGtuOp7s+ -IouVD3wZAgMBAAGjggHiMIIB3jAfBgNVHSMEGDAWgBShcl8mGyiYQ5VdBzfVhZad -S9LDRTAdBgNVHQ4EFgQUkeNAqLbnKq86W/ghBV9xfC+7h9swDgYDVR0PAQH/BAQD -AgWgMAwGA1UdEwEB/wQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC -MBEGCWCGSAGG+EIBAQQEAwIGwDBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEDBDAr -MCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8ubmV0L0NQUzB7BgNV -HR8EdDByMDigNqA0hjJodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9VVE4tVVNFUkZp -cnN0LUhhcmR3YXJlLmNybDA2oDSgMoYwaHR0cDovL2NybC5jb21vZG8ubmV0L1VU -Ti1VU0VSRmlyc3QtSGFyZHdhcmUuY3JsMIGGBggrBgEFBQcBAQR6MHgwOwYIKwYB -BQUHMAKGL2h0dHA6Ly9jcnQuY29tb2RvY2EuY29tL1VUTkFkZFRydXN0U2VydmVy -Q0EuY3J0MDkGCCsGAQUFBzAChi1odHRwOi8vY3J0LmNvbW9kby5uZXQvVVROQWRk -VHJ1c3RTZXJ2ZXJDQS5jcnQwDQYJKoZIhvcNAQEFBQADggEBAFBxEOeKr5+vurzE -6DiP4THhQsp+LA0+tnZ5rkV7RODAmF6strjONl3FKWGSqrucWNnFTo/HMgrgZJHQ -CunxrJf4J5CVz/CvGlfdBDmCpYz5agc8b7EJhmM2WoWSqC+5CYIXuRzUuYcKWjPt -3LV312Zil4BaeZ+wv4SKR8cL8jsB/sj8QxLxrZjOGXtVX3J95AnrY7BMDjuCBDxx -dUUOUJpdJ4undAG1of0ZsPOGJ5viSJYNeJ9iOjSua24mfZ2aQ/mULirnqF8Gkr38 -CMlC8io5ct5NnLgkWmPr0FS5UyalLeWXiopS6hMofvu952VGLyacLgMl7d9S5AaL -mxMHHeo= ------END CERTIFICATE----- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 10 23:54:19 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 10 Jan 2012 23:54:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Remove_unused_certificate_from_the_test_directory=2E?= Message-ID: http://hg.python.org/cpython/rev/0c5266390992 changeset: 74328:0c5266390992 parent: 74326:75def95e93d4 parent: 74327:e40e9866bb4d user: Antoine Pitrou date: Tue Jan 10 23:46:26 2012 +0100 summary: Remove unused certificate from the test directory. files: Lib/test/svn_python_org_https_cert.pem | 29 -------------- 1 files changed, 0 insertions(+), 29 deletions(-) diff --git a/Lib/test/svn_python_org_https_cert.pem b/Lib/test/svn_python_org_https_cert.pem deleted file mode 100644 --- a/Lib/test/svn_python_org_https_cert.pem +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFQTCCBCmgAwIBAgIQL2qw7lpsHqTLcBh1PVjsaTANBgkqhkiG9w0BAQUFADCB -lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt -SGFyZHdhcmUwHhcNMDcwNDEwMDAwMDAwWhcNMTAwNDA5MjM1OTU5WjCBvjELMAkG -A1UEBhMCVVMxDjAMBgNVBBETBTAxOTM4MRYwFAYDVQQIEw1NYXNzYWNodXNldHRz -MREwDwYDVQQHEwhJcHN3aXRjaDEMMAoGA1UECRMDbi9hMQwwCgYDVQQSEwM2NTMx -IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMRowGAYDVQQLExFD -b21vZG8gSW5zdGFudFNTTDEXMBUGA1UEAxMOc3ZuLnB5dGhvbi5vcmcwgZ8wDQYJ -KoZIhvcNAQEBBQADgY0AMIGJAoGBAMFOfFeLpiIN9UzTCehCgQ4W3ufaq524qPoX -00iNDiI/ehd6kC0BXIP5/y9lPoMn7nRsjdjczUaVmlPWG8BhvADK3ZZIm7m/3mZW -O/+C5vGE9YuOqIKe0VoNz/cZaYkz+C2xmOwDTp6a+ls29jjUfoxMd9gtGtuOp7s+ -IouVD3wZAgMBAAGjggHiMIIB3jAfBgNVHSMEGDAWgBShcl8mGyiYQ5VdBzfVhZad -S9LDRTAdBgNVHQ4EFgQUkeNAqLbnKq86W/ghBV9xfC+7h9swDgYDVR0PAQH/BAQD -AgWgMAwGA1UdEwEB/wQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC -MBEGCWCGSAGG+EIBAQQEAwIGwDBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEDBDAr -MCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8ubmV0L0NQUzB7BgNV -HR8EdDByMDigNqA0hjJodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9VVE4tVVNFUkZp -cnN0LUhhcmR3YXJlLmNybDA2oDSgMoYwaHR0cDovL2NybC5jb21vZG8ubmV0L1VU -Ti1VU0VSRmlyc3QtSGFyZHdhcmUuY3JsMIGGBggrBgEFBQcBAQR6MHgwOwYIKwYB -BQUHMAKGL2h0dHA6Ly9jcnQuY29tb2RvY2EuY29tL1VUTkFkZFRydXN0U2VydmVy -Q0EuY3J0MDkGCCsGAQUFBzAChi1odHRwOi8vY3J0LmNvbW9kby5uZXQvVVROQWRk -VHJ1c3RTZXJ2ZXJDQS5jcnQwDQYJKoZIhvcNAQEFBQADggEBAFBxEOeKr5+vurzE -6DiP4THhQsp+LA0+tnZ5rkV7RODAmF6strjONl3FKWGSqrucWNnFTo/HMgrgZJHQ -CunxrJf4J5CVz/CvGlfdBDmCpYz5agc8b7EJhmM2WoWSqC+5CYIXuRzUuYcKWjPt -3LV312Zil4BaeZ+wv4SKR8cL8jsB/sj8QxLxrZjOGXtVX3J95AnrY7BMDjuCBDxx -dUUOUJpdJ4undAG1of0ZsPOGJ5viSJYNeJ9iOjSua24mfZ2aQ/mULirnqF8Gkr38 -CMlC8io5ct5NnLgkWmPr0FS5UyalLeWXiopS6hMofvu952VGLyacLgMl7d9S5AaL -mxMHHeo= ------END CERTIFICATE----- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 00:00:22 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 11 Jan 2012 00:00:22 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Remove_unused_c?= =?utf8?q?ertificate_from_the_test_directory=2E?= Message-ID: http://hg.python.org/cpython/rev/d22f13bb58c6 changeset: 74329:d22f13bb58c6 branch: 2.7 parent: 74324:4a30eae3b945 user: Antoine Pitrou date: Tue Jan 10 23:45:54 2012 +0100 summary: Remove unused certificate from the test directory. files: Lib/test/svn_python_org_https_cert.pem | 29 -------------- 1 files changed, 0 insertions(+), 29 deletions(-) diff --git a/Lib/test/svn_python_org_https_cert.pem b/Lib/test/svn_python_org_https_cert.pem deleted file mode 100644 --- a/Lib/test/svn_python_org_https_cert.pem +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFQTCCBCmgAwIBAgIQL2qw7lpsHqTLcBh1PVjsaTANBgkqhkiG9w0BAQUFADCB -lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt -SGFyZHdhcmUwHhcNMDcwNDEwMDAwMDAwWhcNMTAwNDA5MjM1OTU5WjCBvjELMAkG -A1UEBhMCVVMxDjAMBgNVBBETBTAxOTM4MRYwFAYDVQQIEw1NYXNzYWNodXNldHRz -MREwDwYDVQQHEwhJcHN3aXRjaDEMMAoGA1UECRMDbi9hMQwwCgYDVQQSEwM2NTMx -IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMRowGAYDVQQLExFD -b21vZG8gSW5zdGFudFNTTDEXMBUGA1UEAxMOc3ZuLnB5dGhvbi5vcmcwgZ8wDQYJ -KoZIhvcNAQEBBQADgY0AMIGJAoGBAMFOfFeLpiIN9UzTCehCgQ4W3ufaq524qPoX -00iNDiI/ehd6kC0BXIP5/y9lPoMn7nRsjdjczUaVmlPWG8BhvADK3ZZIm7m/3mZW -O/+C5vGE9YuOqIKe0VoNz/cZaYkz+C2xmOwDTp6a+ls29jjUfoxMd9gtGtuOp7s+ -IouVD3wZAgMBAAGjggHiMIIB3jAfBgNVHSMEGDAWgBShcl8mGyiYQ5VdBzfVhZad -S9LDRTAdBgNVHQ4EFgQUkeNAqLbnKq86W/ghBV9xfC+7h9swDgYDVR0PAQH/BAQD -AgWgMAwGA1UdEwEB/wQCMAAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMC -MBEGCWCGSAGG+EIBAQQEAwIGwDBGBgNVHSAEPzA9MDsGDCsGAQQBsjEBAgEDBDAr -MCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21vZG8ubmV0L0NQUzB7BgNV -HR8EdDByMDigNqA0hjJodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9VVE4tVVNFUkZp -cnN0LUhhcmR3YXJlLmNybDA2oDSgMoYwaHR0cDovL2NybC5jb21vZG8ubmV0L1VU -Ti1VU0VSRmlyc3QtSGFyZHdhcmUuY3JsMIGGBggrBgEFBQcBAQR6MHgwOwYIKwYB -BQUHMAKGL2h0dHA6Ly9jcnQuY29tb2RvY2EuY29tL1VUTkFkZFRydXN0U2VydmVy -Q0EuY3J0MDkGCCsGAQUFBzAChi1odHRwOi8vY3J0LmNvbW9kby5uZXQvVVROQWRk -VHJ1c3RTZXJ2ZXJDQS5jcnQwDQYJKoZIhvcNAQEFBQADggEBAFBxEOeKr5+vurzE -6DiP4THhQsp+LA0+tnZ5rkV7RODAmF6strjONl3FKWGSqrucWNnFTo/HMgrgZJHQ -CunxrJf4J5CVz/CvGlfdBDmCpYz5agc8b7EJhmM2WoWSqC+5CYIXuRzUuYcKWjPt -3LV312Zil4BaeZ+wv4SKR8cL8jsB/sj8QxLxrZjOGXtVX3J95AnrY7BMDjuCBDxx -dUUOUJpdJ4undAG1of0ZsPOGJ5viSJYNeJ9iOjSua24mfZ2aQ/mULirnqF8Gkr38 -CMlC8io5ct5NnLgkWmPr0FS5UyalLeWXiopS6hMofvu952VGLyacLgMl7d9S5AaL -mxMHHeo= ------END CERTIFICATE----- -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jan 11 05:31:06 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 11 Jan 2012 05:31:06 +0100 Subject: [Python-checkins] Daily reference leaks (0c5266390992): sum=0 Message-ID: results for 0c5266390992 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogFifXmA', '-x'] From python-checkins at python.org Wed Jan 11 09:33:42 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 09:33:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Closes_=2313754?= =?utf8?q?_String_returned_if_less_than_*or_equal_to*_x_3?= Message-ID: http://hg.python.org/cpython/rev/3aed8787ce5c changeset: 74330:3aed8787ce5c branch: 2.7 user: Terry Jan Reedy date: Wed Jan 11 03:19:28 2012 -0500 summary: Closes #13754 String returned if less than *or equal to* x 3 files: Doc/library/stdtypes.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1049,7 +1049,7 @@ Return the string left justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. versionchanged:: 2.4 Support for the *fillchar* argument. @@ -1113,7 +1113,7 @@ Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. versionchanged:: 2.4 Support for the *fillchar* argument. @@ -1293,7 +1293,7 @@ Return the numeric string left filled with zeros in a string of length *width*. A sign prefix is handled correctly. The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. versionadded:: 2.2.2 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 09:33:43 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 09:33:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_=2313754_String?= =?utf8?q?_returned_if_less_than_*or_equal_to*_x_3?= Message-ID: http://hg.python.org/cpython/rev/3f2e5fd17b76 changeset: 74331:3f2e5fd17b76 branch: 3.2 parent: 74327:e40e9866bb4d user: Terry Jan Reedy date: Wed Jan 11 03:29:42 2012 -0500 summary: #13754 String returned if less than *or equal to* x 3 Close *13753 'seq' now 'iterable' files: Doc/library/stdtypes.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1189,7 +1189,7 @@ Return a string which is the concatenation of the strings in the :term:`iterable` *iterable*. A :exc:`TypeError` will be raised if there are - any non-string values in *seq*, including :class:`bytes` objects. The + any non-string values in *iterable*, including :class:`bytes` objects. The separator between elements is the string providing this method. @@ -1197,7 +1197,7 @@ Return the string left justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. method:: str.lower() @@ -1266,7 +1266,7 @@ Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. method:: str.rpartition(sep) @@ -1414,7 +1414,7 @@ Return the numeric string left filled with zeros in a string of length *width*. A sign prefix is handled correctly. The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 09:33:44 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 09:33:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/0df85a2ebe4d changeset: 74332:0df85a2ebe4d parent: 74328:0c5266390992 parent: 74331:3f2e5fd17b76 user: Terry Jan Reedy date: Wed Jan 11 03:32:43 2012 -0500 summary: Merge with 3.2 #13754 String returned if less than *or equal to* x 3 *13753 'seq' now 'iterable' files: Doc/library/stdtypes.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1193,7 +1193,7 @@ Return a string which is the concatenation of the strings in the :term:`iterable` *iterable*. A :exc:`TypeError` will be raised if there are - any non-string values in *seq*, including :class:`bytes` objects. The + any non-string values in *iterable*, including :class:`bytes` objects. The separator between elements is the string providing this method. @@ -1201,7 +1201,7 @@ Return the string left justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. method:: str.lower() @@ -1270,7 +1270,7 @@ Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. method:: str.rpartition(sep) @@ -1418,7 +1418,7 @@ Return the numeric string left filled with zeros in a string of length *width*. A sign prefix is handled correctly. The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 20:15:15 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 20:15:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Closes_=2311633?= =?utf8?q?_Clarify_print_buffering=2E?= Message-ID: http://hg.python.org/cpython/rev/bc043cef94f2 changeset: 74333:bc043cef94f2 branch: 3.2 parent: 74331:3f2e5fd17b76 user: Terry Jan Reedy date: Wed Jan 11 14:09:49 2012 -0500 summary: Closes #11633 Clarify print buffering. files: Doc/library/functions.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -954,7 +954,9 @@ *end*. The *file* argument must be an object with a ``write(string)`` method; if it - is not present or ``None``, :data:`sys.stdout` will be used. + is not present or ``None``, :data:`sys.stdout` will be used. Output buffering + is determined by *file*. Use ``sys.stdout.flush()`` to ensure immediate + appearance on a screen. .. function:: property(fget=None, fset=None, fdel=None, doc=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 20:15:16 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 20:15:16 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/fb0d61fd1753 changeset: 74334:fb0d61fd1753 parent: 74332:0df85a2ebe4d parent: 74333:bc043cef94f2 user: Terry Jan Reedy date: Wed Jan 11 14:14:14 2012 -0500 summary: Merge with 3.2 #11633 Clarify print buffering (will change again if 13761 adds flush param). files: Doc/library/functions.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -959,7 +959,9 @@ *end*. The *file* argument must be an object with a ``write(string)`` method; if it - is not present or ``None``, :data:`sys.stdout` will be used. + is not present or ``None``, :data:`sys.stdout` will be used. Output buffering + is determined by *file*. Use ``sys.stdout.flush()`` to ensure immediate + appearance on a screen. .. function:: property(fget=None, fset=None, fdel=None, doc=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 20:57:45 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 20:57:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Minor_correctio?= =?utf8?q?n=2E_Closes_=2311418?= Message-ID: http://hg.python.org/cpython/rev/10a5165103f9 changeset: 74335:10a5165103f9 branch: 2.7 parent: 74330:3aed8787ce5c user: Terry Jan Reedy date: Wed Jan 11 14:51:07 2012 -0500 summary: Minor correction. Closes #11418 files: Doc/tutorial/classes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -409,8 +409,8 @@ self.add(x) Methods may reference global names in the same way as ordinary functions. The -global scope associated with a method is the module containing the class -definition. (The class itself is never used as a global scope.) While one +global scope associated with a method is the module containing its +definition. (A class is never used as a global scope.) While one rarely encounters a good reason for using global data in a method, there are many legitimate uses of the global scope: for one thing, functions and modules imported into the global scope can be used by methods, as well as functions and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 20:57:46 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 20:57:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Minor_correctio?= =?utf8?b?bi4gIzExNDE4?= Message-ID: http://hg.python.org/cpython/rev/32ea3675fba2 changeset: 74336:32ea3675fba2 branch: 3.2 parent: 74333:bc043cef94f2 user: Terry Jan Reedy date: Wed Jan 11 14:54:34 2012 -0500 summary: Minor correction. #11418 files: Doc/tutorial/classes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -458,8 +458,8 @@ self.add(x) Methods may reference global names in the same way as ordinary functions. The -global scope associated with a method is the module containing the class -definition. (The class itself is never used as a global scope.) While one +global scope associated with a method is the module containing its +definition. (A class is never used as a global scope.) While one rarely encounters a good reason for using global data in a method, there are many legitimate uses of the global scope: for one thing, functions and modules imported into the global scope can be used by methods, as well as functions and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 11 20:57:47 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 11 Jan 2012 20:57:47 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/7568134ac6cf changeset: 74337:7568134ac6cf parent: 74334:fb0d61fd1753 parent: 74336:32ea3675fba2 user: Terry Jan Reedy date: Wed Jan 11 14:56:22 2012 -0500 summary: Merge with 3.2 files: Doc/tutorial/classes.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -458,8 +458,8 @@ self.add(x) Methods may reference global names in the same way as ordinary functions. The -global scope associated with a method is the module containing the class -definition. (The class itself is never used as a global scope.) While one +global scope associated with a method is the module containing its +definition. (A class is never used as a global scope.) While one rarely encounters a good reason for using global data in a method, there are many legitimate uses of the global scope: for one thing, functions and modules imported into the global scope can be used by methods, as well as functions and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 00:17:46 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 00:17:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_use_full_unicode_mappings_f?= =?utf8?q?or_upper/lower/title_case_=28=2312736=29?= Message-ID: http://hg.python.org/cpython/rev/f7e05d205a52 changeset: 74338:f7e05d205a52 parent: 74328:0c5266390992 user: Benjamin Peterson date: Wed Jan 11 18:17:06 2012 -0500 summary: use full unicode mappings for upper/lower/title case (#12736) Also broaden the category of characters that count as lowercase/uppercase. files: Doc/c-api/unicode.rst | 9 + Doc/library/stdtypes.rst | 3 +- Include/unicodeobject.h | 23 + Lib/test/string_tests.py | 2 +- Lib/test/test_unicode.py | 44 + Lib/test/test_unicodedata.py | 2 +- Misc/NEWS | 2 + Objects/unicodectype.c | 97 +- Objects/unicodeobject.c | 413 +- Objects/unicodetype_db.h | 6529 ++++++++++++----- Tools/unicode/makeunicodedata.py | 101 +- 11 files changed, 5051 insertions(+), 2174 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -318,16 +318,25 @@ Return the character *ch* converted to lower case. + .. deprecated:: 3.3 + This function uses simple case mappings. + .. c:function:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch) Return the character *ch* converted to upper case. + .. deprecated:: 3.3 + This function uses simple case mappings. + .. c:function:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch) Return the character *ch* converted to title case. + .. deprecated:: 3.3 + This function uses simple case mappings. + .. c:function:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1360,7 +1360,8 @@ .. method:: str.swapcase() Return a copy of the string with uppercase characters converted to lowercase and - vice versa. + vice versa. Note that it is not necessarily true that + ``s.swapcase().swapcase() == s``. .. method:: str.title() diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2008,6 +2008,29 @@ Py_UCS4 ch /* Unicode character */ ); +PyAPI_FUNC(int) _PyUnicode_ToLowerFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_ToTitleFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_ToUpperFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + +PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable( + const Py_UCS4 ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsCased( + const Py_UCS4 ch /* Unicode character */ + ); + PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( Py_UCS4 ch /* Unicode character */ ); diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -669,7 +669,7 @@ # check that titlecased chars are lowered correctly # \u1ffc is the titlecased char - self.checkequal('\u1ffc\u1ff3\u1ff3\u1ff3', + self.checkequal('\u03a9\u0399\u1ff3\u1ff3\u1ff3', '\u1ff3\u1ff3\u1ffc\u1ffc', 'capitalize') # check with cased non-letter chars self.checkequal('\u24c5\u24e8\u24e3\u24d7\u24de\u24dd', diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -369,6 +369,8 @@ def test_islower(self): string_tests.MixinStrUnicodeUserStringTest.test_islower(self) self.checkequalnofix(False, '\u1FFc', 'islower') + self.assertFalse('\u2167'.islower()) + self.assertTrue('\u2177'.islower()) # non-BMP, uppercase self.assertFalse('\U00010401'.islower()) self.assertFalse('\U00010427'.islower()) @@ -383,6 +385,8 @@ string_tests.MixinStrUnicodeUserStringTest.test_isupper(self) if not sys.platform.startswith('java'): self.checkequalnofix(False, '\u1FFc', 'isupper') + self.assertTrue('\u2167'.isupper()) + self.assertFalse('\u2177'.isupper()) # non-BMP, uppercase self.assertTrue('\U00010401'.isupper()) self.assertTrue('\U00010427'.isupper()) @@ -548,6 +552,18 @@ '\U0001044F\U0001044F') self.assertEqual('X\U00010427x\U0001044F'.lower(), 'x\U0001044Fx\U0001044F') + self.assertEqual('?'.lower(), '?') + self.assertEqual('\u0130'.lower(), '\u0069\u0307') + # Special case for GREEK CAPITAL LETTER SIGMA U+03A3 + self.assertEqual('\u03a3'.lower(), '\u03c3') + self.assertEqual('\u0345\u03a3'.lower(), '\u0345\u03c3') + self.assertEqual('A\u0345\u03a3'.lower(), 'a\u0345\u03c2') + self.assertEqual('A\u0345\u03a3a'.lower(), 'a\u0345\u03c3a') + self.assertEqual('A\u0345\u03a3'.lower(), 'a\u0345\u03c2') + self.assertEqual('A\u03a3\u0345'.lower(), 'a\u03c2\u0345') + self.assertEqual('\u03a3\u0345 '.lower(), '\u03c3\u0345 ') + self.assertEqual('\U0008fffe'.lower(), '\U0008fffe') + self.assertEqual('\u2177'.lower(), '\u2177') def test_upper(self): string_tests.CommonTest.test_upper(self) @@ -558,6 +574,13 @@ '\U00010427\U00010427') self.assertEqual('X\U00010427x\U0001044F'.upper(), 'X\U00010427X\U00010427') + self.assertEqual('?'.upper(), 'FI') + self.assertEqual('\u0130'.upper(), '\u0130') + self.assertEqual('\u03a3'.upper(), '\u03a3') + self.assertEqual('?'.upper(), 'SS') + self.assertEqual('\u1fd2'.upper(), '\u0399\u0308\u0300') + self.assertEqual('\U0008fffe'.upper(), '\U0008fffe') + self.assertEqual('\u2177'.upper(), '\u2167') def test_capitalize(self): string_tests.CommonTest.test_capitalize(self) @@ -570,6 +593,11 @@ '\U00010427\U0001044F') self.assertEqual('X\U00010427x\U0001044F'.capitalize(), 'X\U0001044Fx\U0001044F') + self.assertEqual('h\u0130'.capitalize(), 'H\u0069\u0307') + exp = '\u0399\u0308\u0300\u0069\u0307' + self.assertEqual('\u1fd2\u0130'.capitalize(), exp) + self.assertEqual('?nnish'.capitalize(), 'FInnish') + self.assertEqual('A\u0345\u03a3'.capitalize(), 'A\u0345\u03c2') def test_title(self): string_tests.MixinStrUnicodeUserStringTest.test_title(self) @@ -584,6 +612,9 @@ '\U00010427\U0001044F \U00010427\U0001044F') self.assertEqual('X\U00010427x\U0001044F X\U00010427x\U0001044F'.title(), 'X\U0001044Fx\U0001044F X\U0001044Fx\U0001044F') + self.assertEqual('?NNISH'.title(), 'Finnish') + self.assertEqual('A\u03a3 \u1fa1xy'.title(), 'A\u03c2 \u1fa9xy') + self.assertEqual('A\u03a3A'.title(), 'A\u03c3a') def test_swapcase(self): string_tests.CommonTest.test_swapcase(self) @@ -597,6 +628,19 @@ '\U00010427\U0001044F') self.assertEqual('X\U00010427x\U0001044F'.swapcase(), 'x\U0001044FX\U00010427') + self.assertEqual('?'.swapcase(), 'FI') + self.assertEqual('\u0130'.swapcase(), '\u0069\u0307') + # Special case for GREEK CAPITAL LETTER SIGMA U+03A3 + self.assertEqual('\u03a3'.swapcase(), '\u03c3') + self.assertEqual('\u0345\u03a3'.swapcase(), '\u0399\u03c3') + self.assertEqual('A\u0345\u03a3'.swapcase(), 'a\u0399\u03c2') + self.assertEqual('A\u0345\u03a3a'.swapcase(), 'a\u0399\u03c3A') + self.assertEqual('A\u0345\u03a3'.swapcase(), 'a\u0399\u03c2') + self.assertEqual('A\u03a3\u0345'.swapcase(), 'a\u03c2\u0399') + self.assertEqual('\u03a3\u0345 '.swapcase(), '\u03c3\u0399 ') + self.assertEqual('\u03a3'.swapcase(), '\u03c3') + self.assertEqual('?'.swapcase(), 'SS') + self.assertEqual('\u1fd2'.swapcase(), '\u0399\u0308\u0300') def test_contains(self): # Testing Unicode contains method diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py --- a/Lib/test/test_unicodedata.py +++ b/Lib/test/test_unicodedata.py @@ -21,7 +21,7 @@ class UnicodeMethodsTest(unittest.TestCase): # update this, if the database changes - expectedchecksum = '21b90f1aed00081b81ca7942b22196af090015a0' + expectedchecksum = 'df0b3ca6785a070b21f837b227dbdbdff3c2e921' def test_method_checksum(self): h = hashlib.sha1() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #12736: Use full unicode case mappings for upper, lower, and title case. + - Issue #12760: Add a create mode to open(). Patch by David Townshend. - Issue #13738: Simplify implementation of bytes.lower() and bytes.upper(). diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -21,8 +21,10 @@ #define XID_START_MASK 0x100 #define XID_CONTINUE_MASK 0x200 #define PRINTABLE_MASK 0x400 -#define NODELTA_MASK 0x800 -#define NUMERIC_MASK 0x1000 +#define NUMERIC_MASK 0x800 +#define CASE_IGNORABLE_MASK 0x1000 +#define CASED_MASK 0x2000 +#define EXTENDED_CASE_MASK 0x4000 typedef struct { const Py_UCS4 upper; @@ -57,15 +59,8 @@ Py_UCS4 _PyUnicode_ToTitlecase(register Py_UCS4 ch) { const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - int delta = ctype->title; - if (ctype->flags & NODELTA_MASK) - return delta; - - if (delta >= 32768) - delta -= 65536; - - return ch + delta; + return ctype->title ? ctype->title : ch; } /* Returns 1 for Unicode characters having the category 'Lt', 0 @@ -188,12 +183,10 @@ Py_UCS4 _PyUnicode_ToUppercase(Py_UCS4 ch) { const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - int delta = ctype->upper; - if (ctype->flags & NODELTA_MASK) - return delta; - if (delta >= 32768) - delta -= 65536; - return ch + delta; + + if (ctype->flags & EXTENDED_CASE_MASK) + return _PyUnicode_ExtendedCase[ctype->upper & 0xFFFFFF]; + return ctype->upper ? ctype->upper : ch; } /* Returns the lowercase Unicode characters corresponding to ch or just @@ -202,12 +195,72 @@ Py_UCS4 _PyUnicode_ToLowercase(Py_UCS4 ch) { const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - int delta = ctype->lower; - if (ctype->flags & NODELTA_MASK) - return delta; - if (delta >= 32768) - delta -= 65536; - return ch + delta; + + if (ctype->flags & EXTENDED_CASE_MASK) + return _PyUnicode_ExtendedCase[ctype->lower & 0xFFFFFF]; + return ctype->lower ? ctype->lower : ch; +} + +int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + if (ctype->flags & EXTENDED_CASE_MASK) { + int index = ctype->lower & 0xFFFFFF; + int n = ctype->lower >> 24; + int i; + for (i = 0; i < n; i++) + res[i] = _PyUnicode_ExtendedCase[index + i]; + return n; + } + res[0] = ctype->lower ? ctype->lower : ch; + return 1; +} + +int _PyUnicode_ToTitleFull(Py_UCS4 ch, Py_UCS4 *res) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + if (ctype->flags & EXTENDED_CASE_MASK) { + int index = ctype->title & 0xFFFFFF; + int n = ctype->title >> 24; + int i; + for (i = 0; i < n; i++) + res[i] = _PyUnicode_ExtendedCase[index + i]; + return n; + } + res[0] = ctype->title ? ctype->title : ch; + return 1; +} + +int _PyUnicode_ToUpperFull(Py_UCS4 ch, Py_UCS4 *res) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + if (ctype->flags & EXTENDED_CASE_MASK) { + int index = ctype->upper & 0xFFFFFF; + int n = ctype->upper >> 24; + int i; + for (i = 0; i < n; i++) + res[i] = _PyUnicode_ExtendedCase[index + i]; + return n; + } + res[0] = ctype->upper ? ctype->upper : ch; + return 1; +} + +int _PyUnicode_IsCased(Py_UCS4 ch) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + return (ctype->flags & CASED_MASK) != 0; +} + +int _PyUnicode_IsCaseIgnorable(Py_UCS4 ch) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + return (ctype->flags & CASE_IGNORABLE_MASK) != 0; } /* Returns 1 for Unicode characters having the category 'Ll', 'Lu', 'Lt', diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -41,6 +41,7 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "ucnhash.h" +#include "bytes_methods.h" #ifdef MS_WINDOWS #include @@ -9428,188 +9429,222 @@ return v; } +static PyObject * +ascii_upper_or_lower(PyObject *self, int lower) +{ + Py_ssize_t len = PyUnicode_GET_LENGTH(self); + char *resdata, *data = PyUnicode_DATA(self); + PyObject *res; + + res = PyUnicode_New(len, 127); + if (res == NULL) + return NULL; + resdata = PyUnicode_DATA(res); + if (lower) + _Py_bytes_lower(resdata, data, len); + else + _Py_bytes_upper(resdata, data, len); + return res; +} + static Py_UCS4 -fixupper(PyObject *self) -{ - /* No need to call PyUnicode_READY(self) because this function is only - called as a callback from fixup() which does it already. */ - const Py_ssize_t len = PyUnicode_GET_LENGTH(self); - const int kind = PyUnicode_KIND(self); - void *data = PyUnicode_DATA(self); - int touched = 0; - Py_UCS4 maxchar = 0; - Py_ssize_t i; - - for (i = 0; i < len; ++i) { - const Py_UCS4 ch = PyUnicode_READ(kind, data, i); - const Py_UCS4 up = Py_UNICODE_TOUPPER(ch); - if (up != ch) { - if (up > maxchar) - maxchar = up; - PyUnicode_WRITE(kind, data, i, up); - touched = 1; - } - else if (ch > maxchar) - maxchar = ch; - } - - if (touched) - return maxchar; - else - return 0; -} - -static Py_UCS4 -fixlower(PyObject *self) -{ - /* No need to call PyUnicode_READY(self) because fixup() which does it. */ - const Py_ssize_t len = PyUnicode_GET_LENGTH(self); - const int kind = PyUnicode_KIND(self); - void *data = PyUnicode_DATA(self); - int touched = 0; - Py_UCS4 maxchar = 0; - Py_ssize_t i; - - for(i = 0; i < len; ++i) { - const Py_UCS4 ch = PyUnicode_READ(kind, data, i); - const Py_UCS4 lo = Py_UNICODE_TOLOWER(ch); - if (lo != ch) { - if (lo > maxchar) - maxchar = lo; - PyUnicode_WRITE(kind, data, i, lo); - touched = 1; - } - else if (ch > maxchar) - maxchar = ch; - } - - if (touched) - return maxchar; - else - return 0; -} - -static Py_UCS4 -fixswapcase(PyObject *self) -{ - /* No need to call PyUnicode_READY(self) because fixup() which does it. */ - const Py_ssize_t len = PyUnicode_GET_LENGTH(self); - const int kind = PyUnicode_KIND(self); - void *data = PyUnicode_DATA(self); - int touched = 0; - Py_UCS4 maxchar = 0; - Py_ssize_t i; - - for(i = 0; i < len; ++i) { - const Py_UCS4 ch = PyUnicode_READ(kind, data, i); - Py_UCS4 nu = 0; - - if (Py_UNICODE_ISUPPER(ch)) - nu = Py_UNICODE_TOLOWER(ch); - else if (Py_UNICODE_ISLOWER(ch)) - nu = Py_UNICODE_TOUPPER(ch); - - if (nu != 0) { - if (nu > maxchar) - maxchar = nu; - PyUnicode_WRITE(kind, data, i, nu); - touched = 1; - } - else if (ch > maxchar) - maxchar = ch; - } - - if (touched) - return maxchar; - else - return 0; -} - -static Py_UCS4 -fixcapitalize(PyObject *self) -{ - /* No need to call PyUnicode_READY(self) because fixup() which does it. */ - const Py_ssize_t len = PyUnicode_GET_LENGTH(self); - const int kind = PyUnicode_KIND(self); - void *data = PyUnicode_DATA(self); - int touched = 0; - Py_UCS4 maxchar = 0; - Py_ssize_t i = 0; - Py_UCS4 ch; - - if (len == 0) - return 0; - - ch = PyUnicode_READ(kind, data, i); - if (!Py_UNICODE_ISUPPER(ch)) { - maxchar = Py_UNICODE_TOUPPER(ch); - PyUnicode_WRITE(kind, data, i, maxchar); - touched = 1; - } - ++i; - for(; i < len; ++i) { - ch = PyUnicode_READ(kind, data, i); - if (!Py_UNICODE_ISLOWER(ch)) { - const Py_UCS4 lo = Py_UNICODE_TOLOWER(ch); - if (lo > maxchar) - maxchar = lo; - PyUnicode_WRITE(kind, data, i, lo); - touched = 1; - } - else if (ch > maxchar) - maxchar = ch; - } - - if (touched) - return maxchar; - else - return 0; -} - -static Py_UCS4 -fixtitle(PyObject *self) -{ - /* No need to call PyUnicode_READY(self) because fixup() which does it. */ - const Py_ssize_t len = PyUnicode_GET_LENGTH(self); - const int kind = PyUnicode_KIND(self); - void *data = PyUnicode_DATA(self); - Py_UCS4 maxchar = 0; - Py_ssize_t i = 0; +handle_capital_sigma(int kind, void *data, Py_ssize_t length, Py_ssize_t i) +{ + Py_ssize_t j; + int final_sigma; + Py_UCS4 c; + /* U+03A3 is in the Final_Sigma context when, it is found like this: + + \p{cased}\p{case-ignorable}*U+03A3!(\p{case-ignorable}*\p{cased}) + + where ! is a negation and \p{xxx} is a character with property xxx. + */ + for (j = i - 1; j >= 0; j--) { + c = PyUnicode_READ(kind, data, j); + if (!_PyUnicode_IsCaseIgnorable(c)) + break; + } + final_sigma = j >= 0 && _PyUnicode_IsCased(c); + if (final_sigma) { + for (j = i + 1; j < length; j++) { + c = PyUnicode_READ(kind, data, j); + if (!_PyUnicode_IsCaseIgnorable(c)) + break; + } + final_sigma = j == length || !_PyUnicode_IsCased(c); + } + return (final_sigma) ? 0x3C2 : 0x3C3; +} + +static int +lower_ucs4(int kind, void *data, Py_ssize_t length, Py_ssize_t i, + Py_UCS4 c, Py_UCS4 *mapped) +{ + /* Obscure special case. */ + if (c == 0x3A3) { + mapped[0] = handle_capital_sigma(kind, data, length, i); + return 1; + } + return _PyUnicode_ToLowerFull(c, mapped); +} + +static Py_ssize_t +do_capitalize(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) +{ + Py_ssize_t i, k = 0; + int n_res, j; + Py_UCS4 c, mapped[3]; + + c = PyUnicode_READ(kind, data, 0); + n_res = _PyUnicode_ToUpperFull(c, mapped); + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + for (i = 1; i < length; i++) { + c = PyUnicode_READ(kind, data, i); + n_res = lower_ucs4(kind, data, length, i, c, mapped); + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + } + return k; +} + +static Py_ssize_t +do_swapcase(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) { + Py_ssize_t i, k = 0; + + for (i = 0; i < length; i++) { + Py_UCS4 c = PyUnicode_READ(kind, data, i), mapped[3]; + int n_res, j; + if (Py_UNICODE_ISUPPER(c)) { + n_res = lower_ucs4(kind, data, length, i, c, mapped); + } + else if (Py_UNICODE_ISLOWER(c)) { + n_res = _PyUnicode_ToUpperFull(c, mapped); + } + else { + n_res = 1; + mapped[0] = c; + } + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + } + return k; +} + +static Py_ssize_t +do_upper_or_lower(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, + Py_UCS4 *maxchar, int lower) +{ + Py_ssize_t i, k = 0; + + for (i = 0; i < length; i++) { + Py_UCS4 c = PyUnicode_READ(kind, data, i), mapped[3]; + int n_res, j; + if (lower) + n_res = lower_ucs4(kind, data, length, i, c, mapped); + else + n_res = _PyUnicode_ToUpperFull(c, mapped); + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + } + return k; +} + +static Py_ssize_t +do_upper(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) +{ + return do_upper_or_lower(kind, data, length, res, maxchar, 0); +} + +static Py_ssize_t +do_lower(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) +{ + return do_upper_or_lower(kind, data, length, res, maxchar, 1); +} + +static PyObject * +case_operation(PyObject *self, + Py_ssize_t (*perform)(int, void *, Py_ssize_t, Py_UCS4 *, Py_UCS4 *)) +{ + PyObject *res = NULL; + Py_ssize_t length, newlength = 0; + int kind, outkind; + void *data, *outdata; + Py_UCS4 maxchar = 0, *tmp, *tmpend; + + if (PyUnicode_READY(self) == -1) + return NULL; + + kind = PyUnicode_KIND(self); + data = PyUnicode_DATA(self); + length = PyUnicode_GET_LENGTH(self); + tmp = PyMem_MALLOC(sizeof(Py_UCS4) * 3 * length); + if (tmp == NULL) + return PyErr_NoMemory(); + newlength = perform(kind, data, length, tmp, &maxchar); + res = PyUnicode_New(newlength, maxchar); + if (res == NULL) + goto leave; + tmpend = tmp + newlength; + outdata = PyUnicode_DATA(res); + outkind = PyUnicode_KIND(res); + switch (outkind) { + case PyUnicode_1BYTE_KIND: + _PyUnicode_CONVERT_BYTES(Py_UCS4, Py_UCS1, tmp, tmpend, outdata); + break; + case PyUnicode_2BYTE_KIND: + _PyUnicode_CONVERT_BYTES(Py_UCS4, Py_UCS2, tmp, tmpend, outdata); + break; + case PyUnicode_4BYTE_KIND: + memcpy(outdata, tmp, sizeof(Py_UCS4) * newlength); + break; + default: + assert(0); + break; + } + leave: + PyMem_FREE(tmp); + return res; +} + +static Py_ssize_t +do_title(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) +{ + Py_ssize_t i, k = 0; int previous_is_cased; - /* Shortcut for single character strings */ - if (len == 1) { - const Py_UCS4 ch = PyUnicode_READ(kind, data, i); - const Py_UCS4 ti = Py_UNICODE_TOTITLE(ch); - if (ti != ch) { - PyUnicode_WRITE(kind, data, i, ti); - return ti; - } + previous_is_cased = 0; + for (i = 0; i < length; i++) { + const Py_UCS4 c = PyUnicode_READ(kind, data, i); + Py_UCS4 mapped[3]; + int n_res, j; + + if (previous_is_cased) + n_res = lower_ucs4(kind, data, length, i, c, mapped); else - return 0; - } - previous_is_cased = 0; - for(; i < len; ++i) { - const Py_UCS4 ch = PyUnicode_READ(kind, data, i); - Py_UCS4 nu; - - if (previous_is_cased) - nu = Py_UNICODE_TOLOWER(ch); - else - nu = Py_UNICODE_TOTITLE(ch); - - if (nu > maxchar) - maxchar = nu; - PyUnicode_WRITE(kind, data, i, nu); - - if (Py_UNICODE_ISLOWER(ch) || - Py_UNICODE_ISUPPER(ch) || - Py_UNICODE_ISTITLE(ch)) - previous_is_cased = 1; - else - previous_is_cased = 0; - } - return maxchar; + n_res = _PyUnicode_ToTitleFull(c, mapped); + + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + + previous_is_cased = _PyUnicode_IsCased(c); + } + return k; } PyObject * @@ -10445,7 +10480,7 @@ static PyObject* unicode_title(PyObject *self) { - return fixup(self, fixtitle); + return case_operation(self, do_title); } PyDoc_STRVAR(capitalize__doc__, @@ -10457,7 +10492,11 @@ static PyObject* unicode_capitalize(PyObject *self) { - return fixup(self, fixcapitalize); + if (PyUnicode_READY(self) == -1) + return NULL; + if (PyUnicode_GET_LENGTH(self) == 0) + return unicode_result_unchanged(self); + return case_operation(self, do_capitalize); } #if 0 @@ -11715,7 +11754,11 @@ static PyObject* unicode_lower(PyObject *self) { - return fixup(self, fixlower); + if (PyUnicode_READY(self) == -1) + return NULL; + if (PyUnicode_IS_ASCII(self)) + return ascii_upper_or_lower(self, 1); + return case_operation(self, do_lower); } #define LEFTSTRIP 0 @@ -12604,7 +12647,7 @@ static PyObject* unicode_swapcase(PyObject *self) { - return fixup(self, fixswapcase); + return case_operation(self, do_swapcase); } PyDoc_STRVAR(maketrans__doc__, @@ -12750,7 +12793,11 @@ static PyObject* unicode_upper(PyObject *self) { - return fixup(self, fixupper); + if (PyUnicode_READY(self) == -1) + return NULL; + if (PyUnicode_IS_ASCII(self)) + return ascii_upper_or_lower(self, 0); + return case_operation(self, do_upper); } PyDoc_STRVAR(zfill__doc__, diff --git a/Objects/unicodetype_db.h b/Objects/unicodetype_db.h --- a/Objects/unicodetype_db.h +++ b/Objects/unicodetype_db.h @@ -8,184 +8,2616 @@ {0, 0, 0, 0, 0, 48}, {0, 0, 0, 0, 0, 1056}, {0, 0, 0, 0, 0, 1024}, - {0, 0, 0, 0, 0, 5638}, - {0, 0, 0, 1, 1, 5638}, - {0, 0, 0, 2, 2, 5638}, - {0, 0, 0, 3, 3, 5638}, - {0, 0, 0, 4, 4, 5638}, - {0, 0, 0, 5, 5, 5638}, - {0, 0, 0, 6, 6, 5638}, - {0, 0, 0, 7, 7, 5638}, - {0, 0, 0, 8, 8, 5638}, - {0, 0, 0, 9, 9, 5638}, - {0, 32, 0, 0, 0, 1921}, + {0, 0, 0, 0, 0, 5120}, + {0, 0, 0, 0, 0, 3590}, + {0, 0, 0, 1, 1, 3590}, + {0, 0, 0, 2, 2, 3590}, + {0, 0, 0, 3, 3, 3590}, + {0, 0, 0, 4, 4, 3590}, + {0, 0, 0, 5, 5, 3590}, + {0, 0, 0, 6, 6, 3590}, + {0, 0, 0, 7, 7, 3590}, + {0, 0, 0, 8, 8, 3590}, + {0, 0, 0, 9, 9, 3590}, + {65, 97, 65, 0, 0, 10113}, + {66, 98, 66, 0, 0, 10113}, + {67, 99, 67, 0, 0, 10113}, + {68, 100, 68, 0, 0, 10113}, + {69, 101, 69, 0, 0, 10113}, + {70, 102, 70, 0, 0, 10113}, + {71, 103, 71, 0, 0, 10113}, + {72, 104, 72, 0, 0, 10113}, + {73, 105, 73, 0, 0, 10113}, + {74, 106, 74, 0, 0, 10113}, + {75, 107, 75, 0, 0, 10113}, + {76, 108, 76, 0, 0, 10113}, + {77, 109, 77, 0, 0, 10113}, + {78, 110, 78, 0, 0, 10113}, + {79, 111, 79, 0, 0, 10113}, + {80, 112, 80, 0, 0, 10113}, + {81, 113, 81, 0, 0, 10113}, + {82, 114, 82, 0, 0, 10113}, + {83, 115, 83, 0, 0, 10113}, + {84, 116, 84, 0, 0, 10113}, + {85, 117, 85, 0, 0, 10113}, + {86, 118, 86, 0, 0, 10113}, + {87, 119, 87, 0, 0, 10113}, + {88, 120, 88, 0, 0, 10113}, + {89, 121, 89, 0, 0, 10113}, + {90, 122, 90, 0, 0, 10113}, {0, 0, 0, 0, 0, 1536}, - {65504, 0, 65504, 0, 0, 1801}, - {0, 0, 0, 0, 0, 1801}, - {0, 0, 0, 0, 2, 5124}, - {0, 0, 0, 0, 3, 5124}, - {743, 0, 743, 0, 0, 1801}, - {0, 0, 0, 0, 1, 5124}, - {0, 0, 0, 0, 0, 5120}, - {121, 0, 121, 0, 0, 1801}, - {0, 1, 0, 0, 0, 1921}, - {65535, 0, 65535, 0, 0, 1801}, - {0, 65337, 0, 0, 0, 1921}, - {65304, 0, 65304, 0, 0, 1801}, - {0, 65415, 0, 0, 0, 1921}, - {65236, 0, 65236, 0, 0, 1801}, - {195, 0, 195, 0, 0, 1801}, - {0, 210, 0, 0, 0, 1921}, - {0, 206, 0, 0, 0, 1921}, - {0, 205, 0, 0, 0, 1921}, - {0, 79, 0, 0, 0, 1921}, - {0, 202, 0, 0, 0, 1921}, - {0, 203, 0, 0, 0, 1921}, - {0, 207, 0, 0, 0, 1921}, - {97, 0, 97, 0, 0, 1801}, - {0, 211, 0, 0, 0, 1921}, - {0, 209, 0, 0, 0, 1921}, - {163, 0, 163, 0, 0, 1801}, - {0, 213, 0, 0, 0, 1921}, - {130, 0, 130, 0, 0, 1801}, - {0, 214, 0, 0, 0, 1921}, - {0, 218, 0, 0, 0, 1921}, - {0, 217, 0, 0, 0, 1921}, - {0, 219, 0, 0, 0, 1921}, + {65, 97, 65, 0, 0, 9993}, + {66, 98, 66, 0, 0, 9993}, + {67, 99, 67, 0, 0, 9993}, + {68, 100, 68, 0, 0, 9993}, + {69, 101, 69, 0, 0, 9993}, + {70, 102, 70, 0, 0, 9993}, + {71, 103, 71, 0, 0, 9993}, + {72, 104, 72, 0, 0, 9993}, + {73, 105, 73, 0, 0, 9993}, + {74, 106, 74, 0, 0, 9993}, + {75, 107, 75, 0, 0, 9993}, + {76, 108, 76, 0, 0, 9993}, + {77, 109, 77, 0, 0, 9993}, + {78, 110, 78, 0, 0, 9993}, + {79, 111, 79, 0, 0, 9993}, + {80, 112, 80, 0, 0, 9993}, + {81, 113, 81, 0, 0, 9993}, + {82, 114, 82, 0, 0, 9993}, + {83, 115, 83, 0, 0, 9993}, + {84, 116, 84, 0, 0, 9993}, + {85, 117, 85, 0, 0, 9993}, + {86, 118, 86, 0, 0, 9993}, + {87, 119, 87, 0, 0, 9993}, + {88, 120, 88, 0, 0, 9993}, + {89, 121, 89, 0, 0, 9993}, + {90, 122, 90, 0, 0, 9993}, + {0, 0, 0, 0, 0, 9993}, + {0, 0, 0, 0, 0, 4096}, + {0, 0, 0, 0, 2, 3076}, + {0, 0, 0, 0, 3, 3076}, + {924, 181, 924, 0, 0, 9993}, + {0, 0, 0, 0, 0, 5632}, + {0, 0, 0, 0, 1, 3076}, + {0, 0, 0, 0, 0, 3072}, + {192, 224, 192, 0, 0, 10113}, + {193, 225, 193, 0, 0, 10113}, + {194, 226, 194, 0, 0, 10113}, + {195, 227, 195, 0, 0, 10113}, + {196, 228, 196, 0, 0, 10113}, + {197, 229, 197, 0, 0, 10113}, + {198, 230, 198, 0, 0, 10113}, + {199, 231, 199, 0, 0, 10113}, + {200, 232, 200, 0, 0, 10113}, + {201, 233, 201, 0, 0, 10113}, + {202, 234, 202, 0, 0, 10113}, + {203, 235, 203, 0, 0, 10113}, + {204, 236, 204, 0, 0, 10113}, + {205, 237, 205, 0, 0, 10113}, + {206, 238, 206, 0, 0, 10113}, + {207, 239, 207, 0, 0, 10113}, + {208, 240, 208, 0, 0, 10113}, + {209, 241, 209, 0, 0, 10113}, + {210, 242, 210, 0, 0, 10113}, + {211, 243, 211, 0, 0, 10113}, + {212, 244, 212, 0, 0, 10113}, + {213, 245, 213, 0, 0, 10113}, + {214, 246, 214, 0, 0, 10113}, + {216, 248, 216, 0, 0, 10113}, + {217, 249, 217, 0, 0, 10113}, + {218, 250, 218, 0, 0, 10113}, + {219, 251, 219, 0, 0, 10113}, + {220, 252, 220, 0, 0, 10113}, + {221, 253, 221, 0, 0, 10113}, + {222, 254, 222, 0, 0, 10113}, + {33554433, 16777216, 33554435, 0, 0, 26377}, + {192, 224, 192, 0, 0, 9993}, + {193, 225, 193, 0, 0, 9993}, + {194, 226, 194, 0, 0, 9993}, + {195, 227, 195, 0, 0, 9993}, + {196, 228, 196, 0, 0, 9993}, + {197, 229, 197, 0, 0, 9993}, + {198, 230, 198, 0, 0, 9993}, + {199, 231, 199, 0, 0, 9993}, + {200, 232, 200, 0, 0, 9993}, + {201, 233, 201, 0, 0, 9993}, + {202, 234, 202, 0, 0, 9993}, + {203, 235, 203, 0, 0, 9993}, + {204, 236, 204, 0, 0, 9993}, + {205, 237, 205, 0, 0, 9993}, + {206, 238, 206, 0, 0, 9993}, + {207, 239, 207, 0, 0, 9993}, + {208, 240, 208, 0, 0, 9993}, + {209, 241, 209, 0, 0, 9993}, + {210, 242, 210, 0, 0, 9993}, + {211, 243, 211, 0, 0, 9993}, + {212, 244, 212, 0, 0, 9993}, + {213, 245, 213, 0, 0, 9993}, + {214, 246, 214, 0, 0, 9993}, + {216, 248, 216, 0, 0, 9993}, + {217, 249, 217, 0, 0, 9993}, + {218, 250, 218, 0, 0, 9993}, + {219, 251, 219, 0, 0, 9993}, + {220, 252, 220, 0, 0, 9993}, + {221, 253, 221, 0, 0, 9993}, + {222, 254, 222, 0, 0, 9993}, + {376, 255, 376, 0, 0, 9993}, + {256, 257, 256, 0, 0, 10113}, + {256, 257, 256, 0, 0, 9993}, + {258, 259, 258, 0, 0, 10113}, + {258, 259, 258, 0, 0, 9993}, + {260, 261, 260, 0, 0, 10113}, + {260, 261, 260, 0, 0, 9993}, + {262, 263, 262, 0, 0, 10113}, + {262, 263, 262, 0, 0, 9993}, + {264, 265, 264, 0, 0, 10113}, + {264, 265, 264, 0, 0, 9993}, + {266, 267, 266, 0, 0, 10113}, + {266, 267, 266, 0, 0, 9993}, + {268, 269, 268, 0, 0, 10113}, + {268, 269, 268, 0, 0, 9993}, + {270, 271, 270, 0, 0, 10113}, + {270, 271, 270, 0, 0, 9993}, + {272, 273, 272, 0, 0, 10113}, + {272, 273, 272, 0, 0, 9993}, + {274, 275, 274, 0, 0, 10113}, + {274, 275, 274, 0, 0, 9993}, + {276, 277, 276, 0, 0, 10113}, + {276, 277, 276, 0, 0, 9993}, + {278, 279, 278, 0, 0, 10113}, + {278, 279, 278, 0, 0, 9993}, + {280, 281, 280, 0, 0, 10113}, + {280, 281, 280, 0, 0, 9993}, + {282, 283, 282, 0, 0, 10113}, + {282, 283, 282, 0, 0, 9993}, + {284, 285, 284, 0, 0, 10113}, + {284, 285, 284, 0, 0, 9993}, + {286, 287, 286, 0, 0, 10113}, + {286, 287, 286, 0, 0, 9993}, + {288, 289, 288, 0, 0, 10113}, + {288, 289, 288, 0, 0, 9993}, + {290, 291, 290, 0, 0, 10113}, + {290, 291, 290, 0, 0, 9993}, + {292, 293, 292, 0, 0, 10113}, + {292, 293, 292, 0, 0, 9993}, + {294, 295, 294, 0, 0, 10113}, + {294, 295, 294, 0, 0, 9993}, + {296, 297, 296, 0, 0, 10113}, + {296, 297, 296, 0, 0, 9993}, + {298, 299, 298, 0, 0, 10113}, + {298, 299, 298, 0, 0, 9993}, + {300, 301, 300, 0, 0, 10113}, + {300, 301, 300, 0, 0, 9993}, + {302, 303, 302, 0, 0, 10113}, + {302, 303, 302, 0, 0, 9993}, + {16777223, 33554437, 16777223, 0, 0, 26497}, + {73, 305, 73, 0, 0, 9993}, + {306, 307, 306, 0, 0, 10113}, + {306, 307, 306, 0, 0, 9993}, + {308, 309, 308, 0, 0, 10113}, + {308, 309, 308, 0, 0, 9993}, + {310, 311, 310, 0, 0, 10113}, + {310, 311, 310, 0, 0, 9993}, + {313, 314, 313, 0, 0, 10113}, + {313, 314, 313, 0, 0, 9993}, + {315, 316, 315, 0, 0, 10113}, + {315, 316, 315, 0, 0, 9993}, + {317, 318, 317, 0, 0, 10113}, + {317, 318, 317, 0, 0, 9993}, + {319, 320, 319, 0, 0, 10113}, + {319, 320, 319, 0, 0, 9993}, + {321, 322, 321, 0, 0, 10113}, + {321, 322, 321, 0, 0, 9993}, + {323, 324, 323, 0, 0, 10113}, + {323, 324, 323, 0, 0, 9993}, + {325, 326, 325, 0, 0, 10113}, + {325, 326, 325, 0, 0, 9993}, + {327, 328, 327, 0, 0, 10113}, + {327, 328, 327, 0, 0, 9993}, + {33554441, 16777224, 33554441, 0, 0, 26377}, + {330, 331, 330, 0, 0, 10113}, + {330, 331, 330, 0, 0, 9993}, + {332, 333, 332, 0, 0, 10113}, + {332, 333, 332, 0, 0, 9993}, + {334, 335, 334, 0, 0, 10113}, + {334, 335, 334, 0, 0, 9993}, + {336, 337, 336, 0, 0, 10113}, + {336, 337, 336, 0, 0, 9993}, + {338, 339, 338, 0, 0, 10113}, + {338, 339, 338, 0, 0, 9993}, + {340, 341, 340, 0, 0, 10113}, + {340, 341, 340, 0, 0, 9993}, + {342, 343, 342, 0, 0, 10113}, + {342, 343, 342, 0, 0, 9993}, + {344, 345, 344, 0, 0, 10113}, + {344, 345, 344, 0, 0, 9993}, + {346, 347, 346, 0, 0, 10113}, + {346, 347, 346, 0, 0, 9993}, + {348, 349, 348, 0, 0, 10113}, + {348, 349, 348, 0, 0, 9993}, + {350, 351, 350, 0, 0, 10113}, + {350, 351, 350, 0, 0, 9993}, + {352, 353, 352, 0, 0, 10113}, + {352, 353, 352, 0, 0, 9993}, + {354, 355, 354, 0, 0, 10113}, + {354, 355, 354, 0, 0, 9993}, + {356, 357, 356, 0, 0, 10113}, + {356, 357, 356, 0, 0, 9993}, + {358, 359, 358, 0, 0, 10113}, + {358, 359, 358, 0, 0, 9993}, + {360, 361, 360, 0, 0, 10113}, + {360, 361, 360, 0, 0, 9993}, + {362, 363, 362, 0, 0, 10113}, + {362, 363, 362, 0, 0, 9993}, + {364, 365, 364, 0, 0, 10113}, + {364, 365, 364, 0, 0, 9993}, + {366, 367, 366, 0, 0, 10113}, + {366, 367, 366, 0, 0, 9993}, + {368, 369, 368, 0, 0, 10113}, + {368, 369, 368, 0, 0, 9993}, + {370, 371, 370, 0, 0, 10113}, + {370, 371, 370, 0, 0, 9993}, + {372, 373, 372, 0, 0, 10113}, + {372, 373, 372, 0, 0, 9993}, + {374, 375, 374, 0, 0, 10113}, + {374, 375, 374, 0, 0, 9993}, + {376, 255, 376, 0, 0, 10113}, + {377, 378, 377, 0, 0, 10113}, + {377, 378, 377, 0, 0, 9993}, + {379, 380, 379, 0, 0, 10113}, + {379, 380, 379, 0, 0, 9993}, + {381, 382, 381, 0, 0, 10113}, + {381, 382, 381, 0, 0, 9993}, + {83, 383, 83, 0, 0, 9993}, + {579, 384, 579, 0, 0, 9993}, + {385, 595, 385, 0, 0, 10113}, + {386, 387, 386, 0, 0, 10113}, + {386, 387, 386, 0, 0, 9993}, + {388, 389, 388, 0, 0, 10113}, + {388, 389, 388, 0, 0, 9993}, + {390, 596, 390, 0, 0, 10113}, + {391, 392, 391, 0, 0, 10113}, + {391, 392, 391, 0, 0, 9993}, + {393, 598, 393, 0, 0, 10113}, + {394, 599, 394, 0, 0, 10113}, + {395, 396, 395, 0, 0, 10113}, + {395, 396, 395, 0, 0, 9993}, + {398, 477, 398, 0, 0, 10113}, + {399, 601, 399, 0, 0, 10113}, + {400, 603, 400, 0, 0, 10113}, + {401, 402, 401, 0, 0, 10113}, + {401, 402, 401, 0, 0, 9993}, + {403, 608, 403, 0, 0, 10113}, + {404, 611, 404, 0, 0, 10113}, + {502, 405, 502, 0, 0, 9993}, + {406, 617, 406, 0, 0, 10113}, + {407, 616, 407, 0, 0, 10113}, + {408, 409, 408, 0, 0, 10113}, + {408, 409, 408, 0, 0, 9993}, + {573, 410, 573, 0, 0, 9993}, + {412, 623, 412, 0, 0, 10113}, + {413, 626, 413, 0, 0, 10113}, + {544, 414, 544, 0, 0, 9993}, + {415, 629, 415, 0, 0, 10113}, + {416, 417, 416, 0, 0, 10113}, + {416, 417, 416, 0, 0, 9993}, + {418, 419, 418, 0, 0, 10113}, + {418, 419, 418, 0, 0, 9993}, + {420, 421, 420, 0, 0, 10113}, + {420, 421, 420, 0, 0, 9993}, + {422, 640, 422, 0, 0, 10113}, + {423, 424, 423, 0, 0, 10113}, + {423, 424, 423, 0, 0, 9993}, + {425, 643, 425, 0, 0, 10113}, + {428, 429, 428, 0, 0, 10113}, + {428, 429, 428, 0, 0, 9993}, + {430, 648, 430, 0, 0, 10113}, + {431, 432, 431, 0, 0, 10113}, + {431, 432, 431, 0, 0, 9993}, + {433, 650, 433, 0, 0, 10113}, + {434, 651, 434, 0, 0, 10113}, + {435, 436, 435, 0, 0, 10113}, + {435, 436, 435, 0, 0, 9993}, + {437, 438, 437, 0, 0, 10113}, + {437, 438, 437, 0, 0, 9993}, + {439, 658, 439, 0, 0, 10113}, + {440, 441, 440, 0, 0, 10113}, + {440, 441, 440, 0, 0, 9993}, {0, 0, 0, 0, 0, 1793}, - {56, 0, 56, 0, 0, 1801}, - {0, 2, 1, 0, 0, 1921}, - {65535, 1, 0, 0, 0, 1857}, - {65534, 0, 65535, 0, 0, 1801}, - {65457, 0, 65457, 0, 0, 1801}, - {0, 65439, 0, 0, 0, 1921}, - {0, 65480, 0, 0, 0, 1921}, - {0, 65406, 0, 0, 0, 1921}, - {0, 10795, 0, 0, 0, 1921}, - {0, 65373, 0, 0, 0, 1921}, - {0, 10792, 0, 0, 0, 1921}, - {10815, 0, 10815, 0, 0, 1801}, - {0, 65341, 0, 0, 0, 1921}, - {0, 69, 0, 0, 0, 1921}, - {0, 71, 0, 0, 0, 1921}, - {10783, 0, 10783, 0, 0, 1801}, - {10780, 0, 10780, 0, 0, 1801}, - {10782, 0, 10782, 0, 0, 1801}, - {65326, 0, 65326, 0, 0, 1801}, - {65330, 0, 65330, 0, 0, 1801}, - {65331, 0, 65331, 0, 0, 1801}, - {65334, 0, 65334, 0, 0, 1801}, - {65333, 0, 65333, 0, 0, 1801}, - {65329, 0, 65329, 0, 0, 1801}, - {42893, 613, 42893, 0, 0, 3849}, - {65327, 0, 65327, 0, 0, 1801}, - {65325, 0, 65325, 0, 0, 1801}, - {10743, 0, 10743, 0, 0, 1801}, - {10749, 0, 10749, 0, 0, 1801}, - {65323, 0, 65323, 0, 0, 1801}, - {65322, 0, 65322, 0, 0, 1801}, - {10727, 0, 10727, 0, 0, 1801}, - {65318, 0, 65318, 0, 0, 1801}, - {65467, 0, 65467, 0, 0, 1801}, - {65319, 0, 65319, 0, 0, 1801}, - {65465, 0, 65465, 0, 0, 1801}, - {65317, 0, 65317, 0, 0, 1801}, - {84, 0, 84, 0, 0, 1536}, + {444, 445, 444, 0, 0, 10113}, + {444, 445, 444, 0, 0, 9993}, + {503, 447, 503, 0, 0, 9993}, + {452, 454, 453, 0, 0, 10113}, + {452, 454, 453, 0, 0, 10049}, + {452, 454, 453, 0, 0, 9993}, + {455, 457, 456, 0, 0, 10113}, + {455, 457, 456, 0, 0, 10049}, + {455, 457, 456, 0, 0, 9993}, + {458, 460, 459, 0, 0, 10113}, + {458, 460, 459, 0, 0, 10049}, + {458, 460, 459, 0, 0, 9993}, + {461, 462, 461, 0, 0, 10113}, + {461, 462, 461, 0, 0, 9993}, + {463, 464, 463, 0, 0, 10113}, + {463, 464, 463, 0, 0, 9993}, + {465, 466, 465, 0, 0, 10113}, + {465, 466, 465, 0, 0, 9993}, + {467, 468, 467, 0, 0, 10113}, + {467, 468, 467, 0, 0, 9993}, + {469, 470, 469, 0, 0, 10113}, + {469, 470, 469, 0, 0, 9993}, + {471, 472, 471, 0, 0, 10113}, + {471, 472, 471, 0, 0, 9993}, + {473, 474, 473, 0, 0, 10113}, + {473, 474, 473, 0, 0, 9993}, + {475, 476, 475, 0, 0, 10113}, + {475, 476, 475, 0, 0, 9993}, + {398, 477, 398, 0, 0, 9993}, + {478, 479, 478, 0, 0, 10113}, + {478, 479, 478, 0, 0, 9993}, + {480, 481, 480, 0, 0, 10113}, + {480, 481, 480, 0, 0, 9993}, + {482, 483, 482, 0, 0, 10113}, + {482, 483, 482, 0, 0, 9993}, + {484, 485, 484, 0, 0, 10113}, + {484, 485, 484, 0, 0, 9993}, + {486, 487, 486, 0, 0, 10113}, + {486, 487, 486, 0, 0, 9993}, + {488, 489, 488, 0, 0, 10113}, + {488, 489, 488, 0, 0, 9993}, + {490, 491, 490, 0, 0, 10113}, + {490, 491, 490, 0, 0, 9993}, + {492, 493, 492, 0, 0, 10113}, + {492, 493, 492, 0, 0, 9993}, + {494, 495, 494, 0, 0, 10113}, + {494, 495, 494, 0, 0, 9993}, + {33554444, 16777227, 33554444, 0, 0, 26377}, + {497, 499, 498, 0, 0, 10113}, + {497, 499, 498, 0, 0, 10049}, + {497, 499, 498, 0, 0, 9993}, + {500, 501, 500, 0, 0, 10113}, + {500, 501, 500, 0, 0, 9993}, + {502, 405, 502, 0, 0, 10113}, + {503, 447, 503, 0, 0, 10113}, + {504, 505, 504, 0, 0, 10113}, + {504, 505, 504, 0, 0, 9993}, + {506, 507, 506, 0, 0, 10113}, + {506, 507, 506, 0, 0, 9993}, + {508, 509, 508, 0, 0, 10113}, + {508, 509, 508, 0, 0, 9993}, + {510, 511, 510, 0, 0, 10113}, + {510, 511, 510, 0, 0, 9993}, + {512, 513, 512, 0, 0, 10113}, + {512, 513, 512, 0, 0, 9993}, + {514, 515, 514, 0, 0, 10113}, + {514, 515, 514, 0, 0, 9993}, + {516, 517, 516, 0, 0, 10113}, + {516, 517, 516, 0, 0, 9993}, + {518, 519, 518, 0, 0, 10113}, + {518, 519, 518, 0, 0, 9993}, + {520, 521, 520, 0, 0, 10113}, + {520, 521, 520, 0, 0, 9993}, + {522, 523, 522, 0, 0, 10113}, + {522, 523, 522, 0, 0, 9993}, + {524, 525, 524, 0, 0, 10113}, + {524, 525, 524, 0, 0, 9993}, + {526, 527, 526, 0, 0, 10113}, + {526, 527, 526, 0, 0, 9993}, + {528, 529, 528, 0, 0, 10113}, + {528, 529, 528, 0, 0, 9993}, + {530, 531, 530, 0, 0, 10113}, + {530, 531, 530, 0, 0, 9993}, + {532, 533, 532, 0, 0, 10113}, + {532, 533, 532, 0, 0, 9993}, + {534, 535, 534, 0, 0, 10113}, + {534, 535, 534, 0, 0, 9993}, + {536, 537, 536, 0, 0, 10113}, + {536, 537, 536, 0, 0, 9993}, + {538, 539, 538, 0, 0, 10113}, + {538, 539, 538, 0, 0, 9993}, + {540, 541, 540, 0, 0, 10113}, + {540, 541, 540, 0, 0, 9993}, + {542, 543, 542, 0, 0, 10113}, + {542, 543, 542, 0, 0, 9993}, + {544, 414, 544, 0, 0, 10113}, + {546, 547, 546, 0, 0, 10113}, + {546, 547, 546, 0, 0, 9993}, + {548, 549, 548, 0, 0, 10113}, + {548, 549, 548, 0, 0, 9993}, + {550, 551, 550, 0, 0, 10113}, + {550, 551, 550, 0, 0, 9993}, + {552, 553, 552, 0, 0, 10113}, + {552, 553, 552, 0, 0, 9993}, + {554, 555, 554, 0, 0, 10113}, + {554, 555, 554, 0, 0, 9993}, + {556, 557, 556, 0, 0, 10113}, + {556, 557, 556, 0, 0, 9993}, + {558, 559, 558, 0, 0, 10113}, + {558, 559, 558, 0, 0, 9993}, + {560, 561, 560, 0, 0, 10113}, + {560, 561, 560, 0, 0, 9993}, + {562, 563, 562, 0, 0, 10113}, + {562, 563, 562, 0, 0, 9993}, + {570, 11365, 570, 0, 0, 10113}, + {571, 572, 571, 0, 0, 10113}, + {571, 572, 571, 0, 0, 9993}, + {573, 410, 573, 0, 0, 10113}, + {574, 11366, 574, 0, 0, 10113}, + {11390, 575, 11390, 0, 0, 9993}, + {11391, 576, 11391, 0, 0, 9993}, + {577, 578, 577, 0, 0, 10113}, + {577, 578, 577, 0, 0, 9993}, + {579, 384, 579, 0, 0, 10113}, + {580, 649, 580, 0, 0, 10113}, + {581, 652, 581, 0, 0, 10113}, + {582, 583, 582, 0, 0, 10113}, + {582, 583, 582, 0, 0, 9993}, + {584, 585, 584, 0, 0, 10113}, + {584, 585, 584, 0, 0, 9993}, + {586, 587, 586, 0, 0, 10113}, + {586, 587, 586, 0, 0, 9993}, + {588, 589, 588, 0, 0, 10113}, + {588, 589, 588, 0, 0, 9993}, + {590, 591, 590, 0, 0, 10113}, + {590, 591, 590, 0, 0, 9993}, + {11375, 592, 11375, 0, 0, 9993}, + {11373, 593, 11373, 0, 0, 9993}, + {11376, 594, 11376, 0, 0, 9993}, + {385, 595, 385, 0, 0, 9993}, + {390, 596, 390, 0, 0, 9993}, + {393, 598, 393, 0, 0, 9993}, + {394, 599, 394, 0, 0, 9993}, + {399, 601, 399, 0, 0, 9993}, + {400, 603, 400, 0, 0, 9993}, + {403, 608, 403, 0, 0, 9993}, + {404, 611, 404, 0, 0, 9993}, + {42893, 613, 42893, 0, 0, 9993}, + {407, 616, 407, 0, 0, 9993}, + {406, 617, 406, 0, 0, 9993}, + {11362, 619, 11362, 0, 0, 9993}, + {412, 623, 412, 0, 0, 9993}, + {11374, 625, 11374, 0, 0, 9993}, + {413, 626, 413, 0, 0, 9993}, + {415, 629, 415, 0, 0, 9993}, + {11364, 637, 11364, 0, 0, 9993}, + {422, 640, 422, 0, 0, 9993}, + {425, 643, 425, 0, 0, 9993}, + {430, 648, 430, 0, 0, 9993}, + {580, 649, 580, 0, 0, 9993}, + {433, 650, 433, 0, 0, 9993}, + {434, 651, 434, 0, 0, 9993}, + {581, 652, 581, 0, 0, 9993}, + {439, 658, 439, 0, 0, 9993}, + {0, 0, 0, 0, 0, 14089}, + {0, 0, 0, 0, 0, 5889}, + {921, 837, 921, 0, 0, 13832}, + {880, 881, 880, 0, 0, 10113}, + {880, 881, 880, 0, 0, 9993}, + {882, 883, 882, 0, 0, 10113}, + {882, 883, 882, 0, 0, 9993}, + {886, 887, 886, 0, 0, 10113}, + {886, 887, 886, 0, 0, 9993}, + {0, 0, 0, 0, 0, 13321}, + {1021, 891, 1021, 0, 0, 9993}, + {1022, 892, 1022, 0, 0, 9993}, + {1023, 893, 1023, 0, 0, 9993}, + {902, 940, 902, 0, 0, 10113}, + {904, 941, 904, 0, 0, 10113}, + {905, 942, 905, 0, 0, 10113}, + {906, 943, 906, 0, 0, 10113}, + {908, 972, 908, 0, 0, 10113}, + {910, 973, 910, 0, 0, 10113}, + {911, 974, 911, 0, 0, 10113}, + {50331663, 16777230, 50331663, 0, 0, 26377}, + {913, 945, 913, 0, 0, 10113}, + {914, 946, 914, 0, 0, 10113}, + {915, 947, 915, 0, 0, 10113}, + {916, 948, 916, 0, 0, 10113}, + {917, 949, 917, 0, 0, 10113}, + {918, 950, 918, 0, 0, 10113}, + {919, 951, 919, 0, 0, 10113}, + {920, 952, 920, 0, 0, 10113}, + {921, 953, 921, 0, 0, 10113}, + {922, 954, 922, 0, 0, 10113}, + {923, 955, 923, 0, 0, 10113}, + {924, 956, 924, 0, 0, 10113}, + {925, 957, 925, 0, 0, 10113}, + {926, 958, 926, 0, 0, 10113}, + {927, 959, 927, 0, 0, 10113}, + {928, 960, 928, 0, 0, 10113}, + {929, 961, 929, 0, 0, 10113}, + {931, 963, 931, 0, 0, 10113}, + {932, 964, 932, 0, 0, 10113}, + {933, 965, 933, 0, 0, 10113}, + {934, 966, 934, 0, 0, 10113}, + {935, 967, 935, 0, 0, 10113}, + {936, 968, 936, 0, 0, 10113}, + {937, 969, 937, 0, 0, 10113}, + {938, 970, 938, 0, 0, 10113}, + {939, 971, 939, 0, 0, 10113}, + {902, 940, 902, 0, 0, 9993}, + {904, 941, 904, 0, 0, 9993}, + {905, 942, 905, 0, 0, 9993}, + {906, 943, 906, 0, 0, 9993}, + {50331667, 16777234, 50331667, 0, 0, 26377}, + {913, 945, 913, 0, 0, 9993}, + {914, 946, 914, 0, 0, 9993}, + {915, 947, 915, 0, 0, 9993}, + {916, 948, 916, 0, 0, 9993}, + {917, 949, 917, 0, 0, 9993}, + {918, 950, 918, 0, 0, 9993}, + {919, 951, 919, 0, 0, 9993}, + {920, 952, 920, 0, 0, 9993}, + {921, 953, 921, 0, 0, 9993}, + {922, 954, 922, 0, 0, 9993}, + {923, 955, 923, 0, 0, 9993}, + {924, 956, 924, 0, 0, 9993}, + {925, 957, 925, 0, 0, 9993}, + {926, 958, 926, 0, 0, 9993}, + {927, 959, 927, 0, 0, 9993}, + {928, 960, 928, 0, 0, 9993}, + {929, 961, 929, 0, 0, 9993}, + {931, 962, 931, 0, 0, 9993}, + {931, 963, 931, 0, 0, 9993}, + {932, 964, 932, 0, 0, 9993}, + {933, 965, 933, 0, 0, 9993}, + {934, 966, 934, 0, 0, 9993}, + {935, 967, 935, 0, 0, 9993}, + {936, 968, 936, 0, 0, 9993}, + {937, 969, 937, 0, 0, 9993}, + {938, 970, 938, 0, 0, 9993}, + {939, 971, 939, 0, 0, 9993}, + {908, 972, 908, 0, 0, 9993}, + {910, 973, 910, 0, 0, 9993}, + {911, 974, 911, 0, 0, 9993}, + {975, 983, 975, 0, 0, 10113}, + {914, 976, 914, 0, 0, 9993}, + {920, 977, 920, 0, 0, 9993}, + {0, 0, 0, 0, 0, 10113}, + {934, 981, 934, 0, 0, 9993}, + {928, 982, 928, 0, 0, 9993}, + {975, 983, 975, 0, 0, 9993}, + {984, 985, 984, 0, 0, 10113}, + {984, 985, 984, 0, 0, 9993}, + {986, 987, 986, 0, 0, 10113}, + {986, 987, 986, 0, 0, 9993}, + {988, 989, 988, 0, 0, 10113}, + {988, 989, 988, 0, 0, 9993}, + {990, 991, 990, 0, 0, 10113}, + {990, 991, 990, 0, 0, 9993}, + {992, 993, 992, 0, 0, 10113}, + {992, 993, 992, 0, 0, 9993}, + {994, 995, 994, 0, 0, 10113}, + {994, 995, 994, 0, 0, 9993}, + {996, 997, 996, 0, 0, 10113}, + {996, 997, 996, 0, 0, 9993}, + {998, 999, 998, 0, 0, 10113}, + {998, 999, 998, 0, 0, 9993}, + {1000, 1001, 1000, 0, 0, 10113}, + {1000, 1001, 1000, 0, 0, 9993}, + {1002, 1003, 1002, 0, 0, 10113}, + {1002, 1003, 1002, 0, 0, 9993}, + {1004, 1005, 1004, 0, 0, 10113}, + {1004, 1005, 1004, 0, 0, 9993}, + {1006, 1007, 1006, 0, 0, 10113}, + {1006, 1007, 1006, 0, 0, 9993}, + {922, 1008, 922, 0, 0, 9993}, + {929, 1009, 929, 0, 0, 9993}, + {1017, 1010, 1017, 0, 0, 9993}, + {1012, 952, 1012, 0, 0, 10113}, + {917, 1013, 917, 0, 0, 9993}, + {1015, 1016, 1015, 0, 0, 10113}, + {1015, 1016, 1015, 0, 0, 9993}, + {1017, 1010, 1017, 0, 0, 10113}, + {1018, 1019, 1018, 0, 0, 10113}, + {1018, 1019, 1018, 0, 0, 9993}, + {1021, 891, 1021, 0, 0, 10113}, + {1022, 892, 1022, 0, 0, 10113}, + {1023, 893, 1023, 0, 0, 10113}, + {1024, 1104, 1024, 0, 0, 10113}, + {1025, 1105, 1025, 0, 0, 10113}, + {1026, 1106, 1026, 0, 0, 10113}, + {1027, 1107, 1027, 0, 0, 10113}, + {1028, 1108, 1028, 0, 0, 10113}, + {1029, 1109, 1029, 0, 0, 10113}, + {1030, 1110, 1030, 0, 0, 10113}, + {1031, 1111, 1031, 0, 0, 10113}, + {1032, 1112, 1032, 0, 0, 10113}, + {1033, 1113, 1033, 0, 0, 10113}, + {1034, 1114, 1034, 0, 0, 10113}, + {1035, 1115, 1035, 0, 0, 10113}, + {1036, 1116, 1036, 0, 0, 10113}, + {1037, 1117, 1037, 0, 0, 10113}, + {1038, 1118, 1038, 0, 0, 10113}, + {1039, 1119, 1039, 0, 0, 10113}, + {1040, 1072, 1040, 0, 0, 10113}, + {1041, 1073, 1041, 0, 0, 10113}, + {1042, 1074, 1042, 0, 0, 10113}, + {1043, 1075, 1043, 0, 0, 10113}, + {1044, 1076, 1044, 0, 0, 10113}, + {1045, 1077, 1045, 0, 0, 10113}, + {1046, 1078, 1046, 0, 0, 10113}, + {1047, 1079, 1047, 0, 0, 10113}, + {1048, 1080, 1048, 0, 0, 10113}, + {1049, 1081, 1049, 0, 0, 10113}, + {1050, 1082, 1050, 0, 0, 10113}, + {1051, 1083, 1051, 0, 0, 10113}, + {1052, 1084, 1052, 0, 0, 10113}, + {1053, 1085, 1053, 0, 0, 10113}, + {1054, 1086, 1054, 0, 0, 10113}, + {1055, 1087, 1055, 0, 0, 10113}, + {1056, 1088, 1056, 0, 0, 10113}, + {1057, 1089, 1057, 0, 0, 10113}, + {1058, 1090, 1058, 0, 0, 10113}, + {1059, 1091, 1059, 0, 0, 10113}, + {1060, 1092, 1060, 0, 0, 10113}, + {1061, 1093, 1061, 0, 0, 10113}, + {1062, 1094, 1062, 0, 0, 10113}, + {1063, 1095, 1063, 0, 0, 10113}, + {1064, 1096, 1064, 0, 0, 10113}, + {1065, 1097, 1065, 0, 0, 10113}, + {1066, 1098, 1066, 0, 0, 10113}, + {1067, 1099, 1067, 0, 0, 10113}, + {1068, 1100, 1068, 0, 0, 10113}, + {1069, 1101, 1069, 0, 0, 10113}, + {1070, 1102, 1070, 0, 0, 10113}, + {1071, 1103, 1071, 0, 0, 10113}, + {1040, 1072, 1040, 0, 0, 9993}, + {1041, 1073, 1041, 0, 0, 9993}, + {1042, 1074, 1042, 0, 0, 9993}, + {1043, 1075, 1043, 0, 0, 9993}, + {1044, 1076, 1044, 0, 0, 9993}, + {1045, 1077, 1045, 0, 0, 9993}, + {1046, 1078, 1046, 0, 0, 9993}, + {1047, 1079, 1047, 0, 0, 9993}, + {1048, 1080, 1048, 0, 0, 9993}, + {1049, 1081, 1049, 0, 0, 9993}, + {1050, 1082, 1050, 0, 0, 9993}, + {1051, 1083, 1051, 0, 0, 9993}, + {1052, 1084, 1052, 0, 0, 9993}, + {1053, 1085, 1053, 0, 0, 9993}, + {1054, 1086, 1054, 0, 0, 9993}, + {1055, 1087, 1055, 0, 0, 9993}, + {1056, 1088, 1056, 0, 0, 9993}, + {1057, 1089, 1057, 0, 0, 9993}, + {1058, 1090, 1058, 0, 0, 9993}, + {1059, 1091, 1059, 0, 0, 9993}, + {1060, 1092, 1060, 0, 0, 9993}, + {1061, 1093, 1061, 0, 0, 9993}, + {1062, 1094, 1062, 0, 0, 9993}, + {1063, 1095, 1063, 0, 0, 9993}, + {1064, 1096, 1064, 0, 0, 9993}, + {1065, 1097, 1065, 0, 0, 9993}, + {1066, 1098, 1066, 0, 0, 9993}, + {1067, 1099, 1067, 0, 0, 9993}, + {1068, 1100, 1068, 0, 0, 9993}, + {1069, 1101, 1069, 0, 0, 9993}, + {1070, 1102, 1070, 0, 0, 9993}, + {1071, 1103, 1071, 0, 0, 9993}, + {1024, 1104, 1024, 0, 0, 9993}, + {1025, 1105, 1025, 0, 0, 9993}, + {1026, 1106, 1026, 0, 0, 9993}, + {1027, 1107, 1027, 0, 0, 9993}, + {1028, 1108, 1028, 0, 0, 9993}, + {1029, 1109, 1029, 0, 0, 9993}, + {1030, 1110, 1030, 0, 0, 9993}, + {1031, 1111, 1031, 0, 0, 9993}, + {1032, 1112, 1032, 0, 0, 9993}, + {1033, 1113, 1033, 0, 0, 9993}, + {1034, 1114, 1034, 0, 0, 9993}, + {1035, 1115, 1035, 0, 0, 9993}, + {1036, 1116, 1036, 0, 0, 9993}, + {1037, 1117, 1037, 0, 0, 9993}, + {1038, 1118, 1038, 0, 0, 9993}, + {1039, 1119, 1039, 0, 0, 9993}, + {1120, 1121, 1120, 0, 0, 10113}, + {1120, 1121, 1120, 0, 0, 9993}, + {1122, 1123, 1122, 0, 0, 10113}, + {1122, 1123, 1122, 0, 0, 9993}, + {1124, 1125, 1124, 0, 0, 10113}, + {1124, 1125, 1124, 0, 0, 9993}, + {1126, 1127, 1126, 0, 0, 10113}, + {1126, 1127, 1126, 0, 0, 9993}, + {1128, 1129, 1128, 0, 0, 10113}, + {1128, 1129, 1128, 0, 0, 9993}, + {1130, 1131, 1130, 0, 0, 10113}, + {1130, 1131, 1130, 0, 0, 9993}, + {1132, 1133, 1132, 0, 0, 10113}, + {1132, 1133, 1132, 0, 0, 9993}, + {1134, 1135, 1134, 0, 0, 10113}, + {1134, 1135, 1134, 0, 0, 9993}, + {1136, 1137, 1136, 0, 0, 10113}, + {1136, 1137, 1136, 0, 0, 9993}, + {1138, 1139, 1138, 0, 0, 10113}, + {1138, 1139, 1138, 0, 0, 9993}, + {1140, 1141, 1140, 0, 0, 10113}, + {1140, 1141, 1140, 0, 0, 9993}, + {1142, 1143, 1142, 0, 0, 10113}, + {1142, 1143, 1142, 0, 0, 9993}, + {1144, 1145, 1144, 0, 0, 10113}, + {1144, 1145, 1144, 0, 0, 9993}, + {1146, 1147, 1146, 0, 0, 10113}, + {1146, 1147, 1146, 0, 0, 9993}, + {1148, 1149, 1148, 0, 0, 10113}, + {1148, 1149, 1148, 0, 0, 9993}, + {1150, 1151, 1150, 0, 0, 10113}, + {1150, 1151, 1150, 0, 0, 9993}, + {1152, 1153, 1152, 0, 0, 10113}, + {1152, 1153, 1152, 0, 0, 9993}, + {1162, 1163, 1162, 0, 0, 10113}, + {1162, 1163, 1162, 0, 0, 9993}, + {1164, 1165, 1164, 0, 0, 10113}, + {1164, 1165, 1164, 0, 0, 9993}, + {1166, 1167, 1166, 0, 0, 10113}, + {1166, 1167, 1166, 0, 0, 9993}, + {1168, 1169, 1168, 0, 0, 10113}, + {1168, 1169, 1168, 0, 0, 9993}, + {1170, 1171, 1170, 0, 0, 10113}, + {1170, 1171, 1170, 0, 0, 9993}, + {1172, 1173, 1172, 0, 0, 10113}, + {1172, 1173, 1172, 0, 0, 9993}, + {1174, 1175, 1174, 0, 0, 10113}, + {1174, 1175, 1174, 0, 0, 9993}, + {1176, 1177, 1176, 0, 0, 10113}, + {1176, 1177, 1176, 0, 0, 9993}, + {1178, 1179, 1178, 0, 0, 10113}, + {1178, 1179, 1178, 0, 0, 9993}, + {1180, 1181, 1180, 0, 0, 10113}, + {1180, 1181, 1180, 0, 0, 9993}, + {1182, 1183, 1182, 0, 0, 10113}, + {1182, 1183, 1182, 0, 0, 9993}, + {1184, 1185, 1184, 0, 0, 10113}, + {1184, 1185, 1184, 0, 0, 9993}, + {1186, 1187, 1186, 0, 0, 10113}, + {1186, 1187, 1186, 0, 0, 9993}, + {1188, 1189, 1188, 0, 0, 10113}, + {1188, 1189, 1188, 0, 0, 9993}, + {1190, 1191, 1190, 0, 0, 10113}, + {1190, 1191, 1190, 0, 0, 9993}, + {1192, 1193, 1192, 0, 0, 10113}, + {1192, 1193, 1192, 0, 0, 9993}, + {1194, 1195, 1194, 0, 0, 10113}, + {1194, 1195, 1194, 0, 0, 9993}, + {1196, 1197, 1196, 0, 0, 10113}, + {1196, 1197, 1196, 0, 0, 9993}, + {1198, 1199, 1198, 0, 0, 10113}, + {1198, 1199, 1198, 0, 0, 9993}, + {1200, 1201, 1200, 0, 0, 10113}, + {1200, 1201, 1200, 0, 0, 9993}, + {1202, 1203, 1202, 0, 0, 10113}, + {1202, 1203, 1202, 0, 0, 9993}, + {1204, 1205, 1204, 0, 0, 10113}, + {1204, 1205, 1204, 0, 0, 9993}, + {1206, 1207, 1206, 0, 0, 10113}, + {1206, 1207, 1206, 0, 0, 9993}, + {1208, 1209, 1208, 0, 0, 10113}, + {1208, 1209, 1208, 0, 0, 9993}, + {1210, 1211, 1210, 0, 0, 10113}, + {1210, 1211, 1210, 0, 0, 9993}, + {1212, 1213, 1212, 0, 0, 10113}, + {1212, 1213, 1212, 0, 0, 9993}, + {1214, 1215, 1214, 0, 0, 10113}, + {1214, 1215, 1214, 0, 0, 9993}, + {1216, 1231, 1216, 0, 0, 10113}, + {1217, 1218, 1217, 0, 0, 10113}, + {1217, 1218, 1217, 0, 0, 9993}, + {1219, 1220, 1219, 0, 0, 10113}, + {1219, 1220, 1219, 0, 0, 9993}, + {1221, 1222, 1221, 0, 0, 10113}, + {1221, 1222, 1221, 0, 0, 9993}, + {1223, 1224, 1223, 0, 0, 10113}, + {1223, 1224, 1223, 0, 0, 9993}, + {1225, 1226, 1225, 0, 0, 10113}, + {1225, 1226, 1225, 0, 0, 9993}, + {1227, 1228, 1227, 0, 0, 10113}, + {1227, 1228, 1227, 0, 0, 9993}, + {1229, 1230, 1229, 0, 0, 10113}, + {1229, 1230, 1229, 0, 0, 9993}, + {1216, 1231, 1216, 0, 0, 9993}, + {1232, 1233, 1232, 0, 0, 10113}, + {1232, 1233, 1232, 0, 0, 9993}, + {1234, 1235, 1234, 0, 0, 10113}, + {1234, 1235, 1234, 0, 0, 9993}, + {1236, 1237, 1236, 0, 0, 10113}, + {1236, 1237, 1236, 0, 0, 9993}, + {1238, 1239, 1238, 0, 0, 10113}, + {1238, 1239, 1238, 0, 0, 9993}, + {1240, 1241, 1240, 0, 0, 10113}, + {1240, 1241, 1240, 0, 0, 9993}, + {1242, 1243, 1242, 0, 0, 10113}, + {1242, 1243, 1242, 0, 0, 9993}, + {1244, 1245, 1244, 0, 0, 10113}, + {1244, 1245, 1244, 0, 0, 9993}, + {1246, 1247, 1246, 0, 0, 10113}, + {1246, 1247, 1246, 0, 0, 9993}, + {1248, 1249, 1248, 0, 0, 10113}, + {1248, 1249, 1248, 0, 0, 9993}, + {1250, 1251, 1250, 0, 0, 10113}, + {1250, 1251, 1250, 0, 0, 9993}, + {1252, 1253, 1252, 0, 0, 10113}, + {1252, 1253, 1252, 0, 0, 9993}, + {1254, 1255, 1254, 0, 0, 10113}, + {1254, 1255, 1254, 0, 0, 9993}, + {1256, 1257, 1256, 0, 0, 10113}, + {1256, 1257, 1256, 0, 0, 9993}, + {1258, 1259, 1258, 0, 0, 10113}, + {1258, 1259, 1258, 0, 0, 9993}, + {1260, 1261, 1260, 0, 0, 10113}, + {1260, 1261, 1260, 0, 0, 9993}, + {1262, 1263, 1262, 0, 0, 10113}, + {1262, 1263, 1262, 0, 0, 9993}, + {1264, 1265, 1264, 0, 0, 10113}, + {1264, 1265, 1264, 0, 0, 9993}, + {1266, 1267, 1266, 0, 0, 10113}, + {1266, 1267, 1266, 0, 0, 9993}, + {1268, 1269, 1268, 0, 0, 10113}, + {1268, 1269, 1268, 0, 0, 9993}, + {1270, 1271, 1270, 0, 0, 10113}, + {1270, 1271, 1270, 0, 0, 9993}, + {1272, 1273, 1272, 0, 0, 10113}, + {1272, 1273, 1272, 0, 0, 9993}, + {1274, 1275, 1274, 0, 0, 10113}, + {1274, 1275, 1274, 0, 0, 9993}, + {1276, 1277, 1276, 0, 0, 10113}, + {1276, 1277, 1276, 0, 0, 9993}, + {1278, 1279, 1278, 0, 0, 10113}, + {1278, 1279, 1278, 0, 0, 9993}, + {1280, 1281, 1280, 0, 0, 10113}, + {1280, 1281, 1280, 0, 0, 9993}, + {1282, 1283, 1282, 0, 0, 10113}, + {1282, 1283, 1282, 0, 0, 9993}, + {1284, 1285, 1284, 0, 0, 10113}, + {1284, 1285, 1284, 0, 0, 9993}, + {1286, 1287, 1286, 0, 0, 10113}, + {1286, 1287, 1286, 0, 0, 9993}, + {1288, 1289, 1288, 0, 0, 10113}, + {1288, 1289, 1288, 0, 0, 9993}, + {1290, 1291, 1290, 0, 0, 10113}, + {1290, 1291, 1290, 0, 0, 9993}, + {1292, 1293, 1292, 0, 0, 10113}, + {1292, 1293, 1292, 0, 0, 9993}, + {1294, 1295, 1294, 0, 0, 10113}, + {1294, 1295, 1294, 0, 0, 9993}, + {1296, 1297, 1296, 0, 0, 10113}, + {1296, 1297, 1296, 0, 0, 9993}, + {1298, 1299, 1298, 0, 0, 10113}, + {1298, 1299, 1298, 0, 0, 9993}, + {1300, 1301, 1300, 0, 0, 10113}, + {1300, 1301, 1300, 0, 0, 9993}, + {1302, 1303, 1302, 0, 0, 10113}, + {1302, 1303, 1302, 0, 0, 9993}, + {1304, 1305, 1304, 0, 0, 10113}, + {1304, 1305, 1304, 0, 0, 9993}, + {1306, 1307, 1306, 0, 0, 10113}, + {1306, 1307, 1306, 0, 0, 9993}, + {1308, 1309, 1308, 0, 0, 10113}, + {1308, 1309, 1308, 0, 0, 9993}, + {1310, 1311, 1310, 0, 0, 10113}, + {1310, 1311, 1310, 0, 0, 9993}, + {1312, 1313, 1312, 0, 0, 10113}, + {1312, 1313, 1312, 0, 0, 9993}, + {1314, 1315, 1314, 0, 0, 10113}, + {1314, 1315, 1314, 0, 0, 9993}, + {1316, 1317, 1316, 0, 0, 10113}, + {1316, 1317, 1316, 0, 0, 9993}, + {1318, 1319, 1318, 0, 0, 10113}, + {1318, 1319, 1318, 0, 0, 9993}, + {1329, 1377, 1329, 0, 0, 10113}, + {1330, 1378, 1330, 0, 0, 10113}, + {1331, 1379, 1331, 0, 0, 10113}, + {1332, 1380, 1332, 0, 0, 10113}, + {1333, 1381, 1333, 0, 0, 10113}, + {1334, 1382, 1334, 0, 0, 10113}, + {1335, 1383, 1335, 0, 0, 10113}, + {1336, 1384, 1336, 0, 0, 10113}, + {1337, 1385, 1337, 0, 0, 10113}, + {1338, 1386, 1338, 0, 0, 10113}, + {1339, 1387, 1339, 0, 0, 10113}, + {1340, 1388, 1340, 0, 0, 10113}, + {1341, 1389, 1341, 0, 0, 10113}, + {1342, 1390, 1342, 0, 0, 10113}, + {1343, 1391, 1343, 0, 0, 10113}, + {1344, 1392, 1344, 0, 0, 10113}, + {1345, 1393, 1345, 0, 0, 10113}, + {1346, 1394, 1346, 0, 0, 10113}, + {1347, 1395, 1347, 0, 0, 10113}, + {1348, 1396, 1348, 0, 0, 10113}, + {1349, 1397, 1349, 0, 0, 10113}, + {1350, 1398, 1350, 0, 0, 10113}, + {1351, 1399, 1351, 0, 0, 10113}, + {1352, 1400, 1352, 0, 0, 10113}, + {1353, 1401, 1353, 0, 0, 10113}, + {1354, 1402, 1354, 0, 0, 10113}, + {1355, 1403, 1355, 0, 0, 10113}, + {1356, 1404, 1356, 0, 0, 10113}, + {1357, 1405, 1357, 0, 0, 10113}, + {1358, 1406, 1358, 0, 0, 10113}, + {1359, 1407, 1359, 0, 0, 10113}, + {1360, 1408, 1360, 0, 0, 10113}, + {1361, 1409, 1361, 0, 0, 10113}, + {1362, 1410, 1362, 0, 0, 10113}, + {1363, 1411, 1363, 0, 0, 10113}, + {1364, 1412, 1364, 0, 0, 10113}, + {1365, 1413, 1365, 0, 0, 10113}, + {1366, 1414, 1366, 0, 0, 10113}, + {1329, 1377, 1329, 0, 0, 9993}, + {1330, 1378, 1330, 0, 0, 9993}, + {1331, 1379, 1331, 0, 0, 9993}, + {1332, 1380, 1332, 0, 0, 9993}, + {1333, 1381, 1333, 0, 0, 9993}, + {1334, 1382, 1334, 0, 0, 9993}, + {1335, 1383, 1335, 0, 0, 9993}, + {1336, 1384, 1336, 0, 0, 9993}, + {1337, 1385, 1337, 0, 0, 9993}, + {1338, 1386, 1338, 0, 0, 9993}, + {1339, 1387, 1339, 0, 0, 9993}, + {1340, 1388, 1340, 0, 0, 9993}, + {1341, 1389, 1341, 0, 0, 9993}, + {1342, 1390, 1342, 0, 0, 9993}, + {1343, 1391, 1343, 0, 0, 9993}, + {1344, 1392, 1344, 0, 0, 9993}, + {1345, 1393, 1345, 0, 0, 9993}, + {1346, 1394, 1346, 0, 0, 9993}, + {1347, 1395, 1347, 0, 0, 9993}, + {1348, 1396, 1348, 0, 0, 9993}, + {1349, 1397, 1349, 0, 0, 9993}, + {1350, 1398, 1350, 0, 0, 9993}, + {1351, 1399, 1351, 0, 0, 9993}, + {1352, 1400, 1352, 0, 0, 9993}, + {1353, 1401, 1353, 0, 0, 9993}, + {1354, 1402, 1354, 0, 0, 9993}, + {1355, 1403, 1355, 0, 0, 9993}, + {1356, 1404, 1356, 0, 0, 9993}, + {1357, 1405, 1357, 0, 0, 9993}, + {1358, 1406, 1358, 0, 0, 9993}, + {1359, 1407, 1359, 0, 0, 9993}, + {1360, 1408, 1360, 0, 0, 9993}, + {1361, 1409, 1361, 0, 0, 9993}, + {1362, 1410, 1362, 0, 0, 9993}, + {1363, 1411, 1363, 0, 0, 9993}, + {1364, 1412, 1364, 0, 0, 9993}, + {1365, 1413, 1365, 0, 0, 9993}, + {1366, 1414, 1366, 0, 0, 9993}, + {33554455, 16777238, 33554457, 0, 0, 26377}, + {0, 0, 0, 0, 0, 1537}, + {4256, 11520, 4256, 0, 0, 10113}, + {4257, 11521, 4257, 0, 0, 10113}, + {4258, 11522, 4258, 0, 0, 10113}, + {4259, 11523, 4259, 0, 0, 10113}, + {4260, 11524, 4260, 0, 0, 10113}, + {4261, 11525, 4261, 0, 0, 10113}, + {4262, 11526, 4262, 0, 0, 10113}, + {4263, 11527, 4263, 0, 0, 10113}, + {4264, 11528, 4264, 0, 0, 10113}, + {4265, 11529, 4265, 0, 0, 10113}, + {4266, 11530, 4266, 0, 0, 10113}, + {4267, 11531, 4267, 0, 0, 10113}, + {4268, 11532, 4268, 0, 0, 10113}, + {4269, 11533, 4269, 0, 0, 10113}, + {4270, 11534, 4270, 0, 0, 10113}, + {4271, 11535, 4271, 0, 0, 10113}, + {4272, 11536, 4272, 0, 0, 10113}, + {4273, 11537, 4273, 0, 0, 10113}, + {4274, 11538, 4274, 0, 0, 10113}, + {4275, 11539, 4275, 0, 0, 10113}, + {4276, 11540, 4276, 0, 0, 10113}, + {4277, 11541, 4277, 0, 0, 10113}, + {4278, 11542, 4278, 0, 0, 10113}, + {4279, 11543, 4279, 0, 0, 10113}, + {4280, 11544, 4280, 0, 0, 10113}, + {4281, 11545, 4281, 0, 0, 10113}, + {4282, 11546, 4282, 0, 0, 10113}, + {4283, 11547, 4283, 0, 0, 10113}, + {4284, 11548, 4284, 0, 0, 10113}, + {4285, 11549, 4285, 0, 0, 10113}, + {4286, 11550, 4286, 0, 0, 10113}, + {4287, 11551, 4287, 0, 0, 10113}, + {4288, 11552, 4288, 0, 0, 10113}, + {4289, 11553, 4289, 0, 0, 10113}, + {4290, 11554, 4290, 0, 0, 10113}, + {4291, 11555, 4291, 0, 0, 10113}, + {4292, 11556, 4292, 0, 0, 10113}, + {4293, 11557, 4293, 0, 0, 10113}, + {0, 0, 0, 0, 1, 3588}, + {0, 0, 0, 0, 2, 3588}, + {0, 0, 0, 0, 3, 3588}, + {0, 0, 0, 0, 4, 3588}, + {0, 0, 0, 0, 5, 3588}, + {0, 0, 0, 0, 6, 3588}, + {0, 0, 0, 0, 7, 3588}, + {0, 0, 0, 0, 8, 3588}, + {0, 0, 0, 0, 9, 3588}, + {0, 0, 0, 0, 0, 3840}, + {42877, 7545, 42877, 0, 0, 9993}, + {11363, 7549, 11363, 0, 0, 9993}, + {7680, 7681, 7680, 0, 0, 10113}, + {7680, 7681, 7680, 0, 0, 9993}, + {7682, 7683, 7682, 0, 0, 10113}, + {7682, 7683, 7682, 0, 0, 9993}, + {7684, 7685, 7684, 0, 0, 10113}, + {7684, 7685, 7684, 0, 0, 9993}, + {7686, 7687, 7686, 0, 0, 10113}, + {7686, 7687, 7686, 0, 0, 9993}, + {7688, 7689, 7688, 0, 0, 10113}, + {7688, 7689, 7688, 0, 0, 9993}, + {7690, 7691, 7690, 0, 0, 10113}, + {7690, 7691, 7690, 0, 0, 9993}, + {7692, 7693, 7692, 0, 0, 10113}, + {7692, 7693, 7692, 0, 0, 9993}, + {7694, 7695, 7694, 0, 0, 10113}, + {7694, 7695, 7694, 0, 0, 9993}, + {7696, 7697, 7696, 0, 0, 10113}, + {7696, 7697, 7696, 0, 0, 9993}, + {7698, 7699, 7698, 0, 0, 10113}, + {7698, 7699, 7698, 0, 0, 9993}, + {7700, 7701, 7700, 0, 0, 10113}, + {7700, 7701, 7700, 0, 0, 9993}, + {7702, 7703, 7702, 0, 0, 10113}, + {7702, 7703, 7702, 0, 0, 9993}, + {7704, 7705, 7704, 0, 0, 10113}, + {7704, 7705, 7704, 0, 0, 9993}, + {7706, 7707, 7706, 0, 0, 10113}, + {7706, 7707, 7706, 0, 0, 9993}, + {7708, 7709, 7708, 0, 0, 10113}, + {7708, 7709, 7708, 0, 0, 9993}, + {7710, 7711, 7710, 0, 0, 10113}, + {7710, 7711, 7710, 0, 0, 9993}, + {7712, 7713, 7712, 0, 0, 10113}, + {7712, 7713, 7712, 0, 0, 9993}, + {7714, 7715, 7714, 0, 0, 10113}, + {7714, 7715, 7714, 0, 0, 9993}, + {7716, 7717, 7716, 0, 0, 10113}, + {7716, 7717, 7716, 0, 0, 9993}, + {7718, 7719, 7718, 0, 0, 10113}, + {7718, 7719, 7718, 0, 0, 9993}, + {7720, 7721, 7720, 0, 0, 10113}, + {7720, 7721, 7720, 0, 0, 9993}, + {7722, 7723, 7722, 0, 0, 10113}, + {7722, 7723, 7722, 0, 0, 9993}, + {7724, 7725, 7724, 0, 0, 10113}, + {7724, 7725, 7724, 0, 0, 9993}, + {7726, 7727, 7726, 0, 0, 10113}, + {7726, 7727, 7726, 0, 0, 9993}, + {7728, 7729, 7728, 0, 0, 10113}, + {7728, 7729, 7728, 0, 0, 9993}, + {7730, 7731, 7730, 0, 0, 10113}, + {7730, 7731, 7730, 0, 0, 9993}, + {7732, 7733, 7732, 0, 0, 10113}, + {7732, 7733, 7732, 0, 0, 9993}, + {7734, 7735, 7734, 0, 0, 10113}, + {7734, 7735, 7734, 0, 0, 9993}, + {7736, 7737, 7736, 0, 0, 10113}, + {7736, 7737, 7736, 0, 0, 9993}, + {7738, 7739, 7738, 0, 0, 10113}, + {7738, 7739, 7738, 0, 0, 9993}, + {7740, 7741, 7740, 0, 0, 10113}, + {7740, 7741, 7740, 0, 0, 9993}, + {7742, 7743, 7742, 0, 0, 10113}, + {7742, 7743, 7742, 0, 0, 9993}, + {7744, 7745, 7744, 0, 0, 10113}, + {7744, 7745, 7744, 0, 0, 9993}, + {7746, 7747, 7746, 0, 0, 10113}, + {7746, 7747, 7746, 0, 0, 9993}, + {7748, 7749, 7748, 0, 0, 10113}, + {7748, 7749, 7748, 0, 0, 9993}, + {7750, 7751, 7750, 0, 0, 10113}, + {7750, 7751, 7750, 0, 0, 9993}, + {7752, 7753, 7752, 0, 0, 10113}, + {7752, 7753, 7752, 0, 0, 9993}, + {7754, 7755, 7754, 0, 0, 10113}, + {7754, 7755, 7754, 0, 0, 9993}, + {7756, 7757, 7756, 0, 0, 10113}, + {7756, 7757, 7756, 0, 0, 9993}, + {7758, 7759, 7758, 0, 0, 10113}, + {7758, 7759, 7758, 0, 0, 9993}, + {7760, 7761, 7760, 0, 0, 10113}, + {7760, 7761, 7760, 0, 0, 9993}, + {7762, 7763, 7762, 0, 0, 10113}, + {7762, 7763, 7762, 0, 0, 9993}, + {7764, 7765, 7764, 0, 0, 10113}, + {7764, 7765, 7764, 0, 0, 9993}, + {7766, 7767, 7766, 0, 0, 10113}, + {7766, 7767, 7766, 0, 0, 9993}, + {7768, 7769, 7768, 0, 0, 10113}, + {7768, 7769, 7768, 0, 0, 9993}, + {7770, 7771, 7770, 0, 0, 10113}, + {7770, 7771, 7770, 0, 0, 9993}, + {7772, 7773, 7772, 0, 0, 10113}, + {7772, 7773, 7772, 0, 0, 9993}, + {7774, 7775, 7774, 0, 0, 10113}, + {7774, 7775, 7774, 0, 0, 9993}, + {7776, 7777, 7776, 0, 0, 10113}, + {7776, 7777, 7776, 0, 0, 9993}, + {7778, 7779, 7778, 0, 0, 10113}, + {7778, 7779, 7778, 0, 0, 9993}, + {7780, 7781, 7780, 0, 0, 10113}, + {7780, 7781, 7780, 0, 0, 9993}, + {7782, 7783, 7782, 0, 0, 10113}, + {7782, 7783, 7782, 0, 0, 9993}, + {7784, 7785, 7784, 0, 0, 10113}, + {7784, 7785, 7784, 0, 0, 9993}, + {7786, 7787, 7786, 0, 0, 10113}, + {7786, 7787, 7786, 0, 0, 9993}, + {7788, 7789, 7788, 0, 0, 10113}, + {7788, 7789, 7788, 0, 0, 9993}, + {7790, 7791, 7790, 0, 0, 10113}, + {7790, 7791, 7790, 0, 0, 9993}, + {7792, 7793, 7792, 0, 0, 10113}, + {7792, 7793, 7792, 0, 0, 9993}, + {7794, 7795, 7794, 0, 0, 10113}, + {7794, 7795, 7794, 0, 0, 9993}, + {7796, 7797, 7796, 0, 0, 10113}, + {7796, 7797, 7796, 0, 0, 9993}, + {7798, 7799, 7798, 0, 0, 10113}, + {7798, 7799, 7798, 0, 0, 9993}, + {7800, 7801, 7800, 0, 0, 10113}, + {7800, 7801, 7800, 0, 0, 9993}, + {7802, 7803, 7802, 0, 0, 10113}, + {7802, 7803, 7802, 0, 0, 9993}, + {7804, 7805, 7804, 0, 0, 10113}, + {7804, 7805, 7804, 0, 0, 9993}, + {7806, 7807, 7806, 0, 0, 10113}, + {7806, 7807, 7806, 0, 0, 9993}, + {7808, 7809, 7808, 0, 0, 10113}, + {7808, 7809, 7808, 0, 0, 9993}, + {7810, 7811, 7810, 0, 0, 10113}, + {7810, 7811, 7810, 0, 0, 9993}, + {7812, 7813, 7812, 0, 0, 10113}, + {7812, 7813, 7812, 0, 0, 9993}, + {7814, 7815, 7814, 0, 0, 10113}, + {7814, 7815, 7814, 0, 0, 9993}, + {7816, 7817, 7816, 0, 0, 10113}, + {7816, 7817, 7816, 0, 0, 9993}, + {7818, 7819, 7818, 0, 0, 10113}, + {7818, 7819, 7818, 0, 0, 9993}, + {7820, 7821, 7820, 0, 0, 10113}, + {7820, 7821, 7820, 0, 0, 9993}, + {7822, 7823, 7822, 0, 0, 10113}, + {7822, 7823, 7822, 0, 0, 9993}, + {7824, 7825, 7824, 0, 0, 10113}, + {7824, 7825, 7824, 0, 0, 9993}, + {7826, 7827, 7826, 0, 0, 10113}, + {7826, 7827, 7826, 0, 0, 9993}, + {7828, 7829, 7828, 0, 0, 10113}, + {7828, 7829, 7828, 0, 0, 9993}, + {33554460, 16777243, 33554460, 0, 0, 26377}, + {33554463, 16777246, 33554463, 0, 0, 26377}, + {33554466, 16777249, 33554466, 0, 0, 26377}, + {33554469, 16777252, 33554469, 0, 0, 26377}, + {33554472, 16777255, 33554472, 0, 0, 26377}, + {7776, 7835, 7776, 0, 0, 9993}, + {7838, 223, 7838, 0, 0, 10113}, + {7840, 7841, 7840, 0, 0, 10113}, + {7840, 7841, 7840, 0, 0, 9993}, + {7842, 7843, 7842, 0, 0, 10113}, + {7842, 7843, 7842, 0, 0, 9993}, + {7844, 7845, 7844, 0, 0, 10113}, + {7844, 7845, 7844, 0, 0, 9993}, + {7846, 7847, 7846, 0, 0, 10113}, + {7846, 7847, 7846, 0, 0, 9993}, + {7848, 7849, 7848, 0, 0, 10113}, + {7848, 7849, 7848, 0, 0, 9993}, + {7850, 7851, 7850, 0, 0, 10113}, + {7850, 7851, 7850, 0, 0, 9993}, + {7852, 7853, 7852, 0, 0, 10113}, + {7852, 7853, 7852, 0, 0, 9993}, + {7854, 7855, 7854, 0, 0, 10113}, + {7854, 7855, 7854, 0, 0, 9993}, + {7856, 7857, 7856, 0, 0, 10113}, + {7856, 7857, 7856, 0, 0, 9993}, + {7858, 7859, 7858, 0, 0, 10113}, + {7858, 7859, 7858, 0, 0, 9993}, + {7860, 7861, 7860, 0, 0, 10113}, + {7860, 7861, 7860, 0, 0, 9993}, + {7862, 7863, 7862, 0, 0, 10113}, + {7862, 7863, 7862, 0, 0, 9993}, + {7864, 7865, 7864, 0, 0, 10113}, + {7864, 7865, 7864, 0, 0, 9993}, + {7866, 7867, 7866, 0, 0, 10113}, + {7866, 7867, 7866, 0, 0, 9993}, + {7868, 7869, 7868, 0, 0, 10113}, + {7868, 7869, 7868, 0, 0, 9993}, + {7870, 7871, 7870, 0, 0, 10113}, + {7870, 7871, 7870, 0, 0, 9993}, + {7872, 7873, 7872, 0, 0, 10113}, + {7872, 7873, 7872, 0, 0, 9993}, + {7874, 7875, 7874, 0, 0, 10113}, + {7874, 7875, 7874, 0, 0, 9993}, + {7876, 7877, 7876, 0, 0, 10113}, + {7876, 7877, 7876, 0, 0, 9993}, + {7878, 7879, 7878, 0, 0, 10113}, + {7878, 7879, 7878, 0, 0, 9993}, + {7880, 7881, 7880, 0, 0, 10113}, + {7880, 7881, 7880, 0, 0, 9993}, + {7882, 7883, 7882, 0, 0, 10113}, + {7882, 7883, 7882, 0, 0, 9993}, + {7884, 7885, 7884, 0, 0, 10113}, + {7884, 7885, 7884, 0, 0, 9993}, + {7886, 7887, 7886, 0, 0, 10113}, + {7886, 7887, 7886, 0, 0, 9993}, + {7888, 7889, 7888, 0, 0, 10113}, + {7888, 7889, 7888, 0, 0, 9993}, + {7890, 7891, 7890, 0, 0, 10113}, + {7890, 7891, 7890, 0, 0, 9993}, + {7892, 7893, 7892, 0, 0, 10113}, + {7892, 7893, 7892, 0, 0, 9993}, + {7894, 7895, 7894, 0, 0, 10113}, + {7894, 7895, 7894, 0, 0, 9993}, + {7896, 7897, 7896, 0, 0, 10113}, + {7896, 7897, 7896, 0, 0, 9993}, + {7898, 7899, 7898, 0, 0, 10113}, + {7898, 7899, 7898, 0, 0, 9993}, + {7900, 7901, 7900, 0, 0, 10113}, + {7900, 7901, 7900, 0, 0, 9993}, + {7902, 7903, 7902, 0, 0, 10113}, + {7902, 7903, 7902, 0, 0, 9993}, + {7904, 7905, 7904, 0, 0, 10113}, + {7904, 7905, 7904, 0, 0, 9993}, + {7906, 7907, 7906, 0, 0, 10113}, + {7906, 7907, 7906, 0, 0, 9993}, + {7908, 7909, 7908, 0, 0, 10113}, + {7908, 7909, 7908, 0, 0, 9993}, + {7910, 7911, 7910, 0, 0, 10113}, + {7910, 7911, 7910, 0, 0, 9993}, + {7912, 7913, 7912, 0, 0, 10113}, + {7912, 7913, 7912, 0, 0, 9993}, + {7914, 7915, 7914, 0, 0, 10113}, + {7914, 7915, 7914, 0, 0, 9993}, + {7916, 7917, 7916, 0, 0, 10113}, + {7916, 7917, 7916, 0, 0, 9993}, + {7918, 7919, 7918, 0, 0, 10113}, + {7918, 7919, 7918, 0, 0, 9993}, + {7920, 7921, 7920, 0, 0, 10113}, + {7920, 7921, 7920, 0, 0, 9993}, + {7922, 7923, 7922, 0, 0, 10113}, + {7922, 7923, 7922, 0, 0, 9993}, + {7924, 7925, 7924, 0, 0, 10113}, + {7924, 7925, 7924, 0, 0, 9993}, + {7926, 7927, 7926, 0, 0, 10113}, + {7926, 7927, 7926, 0, 0, 9993}, + {7928, 7929, 7928, 0, 0, 10113}, + {7928, 7929, 7928, 0, 0, 9993}, + {7930, 7931, 7930, 0, 0, 10113}, + {7930, 7931, 7930, 0, 0, 9993}, + {7932, 7933, 7932, 0, 0, 10113}, + {7932, 7933, 7932, 0, 0, 9993}, + {7934, 7935, 7934, 0, 0, 10113}, + {7934, 7935, 7934, 0, 0, 9993}, + {7944, 7936, 7944, 0, 0, 9993}, + {7945, 7937, 7945, 0, 0, 9993}, + {7946, 7938, 7946, 0, 0, 9993}, + {7947, 7939, 7947, 0, 0, 9993}, + {7948, 7940, 7948, 0, 0, 9993}, + {7949, 7941, 7949, 0, 0, 9993}, + {7950, 7942, 7950, 0, 0, 9993}, + {7951, 7943, 7951, 0, 0, 9993}, + {7944, 7936, 7944, 0, 0, 10113}, + {7945, 7937, 7945, 0, 0, 10113}, + {7946, 7938, 7946, 0, 0, 10113}, + {7947, 7939, 7947, 0, 0, 10113}, + {7948, 7940, 7948, 0, 0, 10113}, + {7949, 7941, 7949, 0, 0, 10113}, + {7950, 7942, 7950, 0, 0, 10113}, + {7951, 7943, 7951, 0, 0, 10113}, + {7960, 7952, 7960, 0, 0, 9993}, + {7961, 7953, 7961, 0, 0, 9993}, + {7962, 7954, 7962, 0, 0, 9993}, + {7963, 7955, 7963, 0, 0, 9993}, + {7964, 7956, 7964, 0, 0, 9993}, + {7965, 7957, 7965, 0, 0, 9993}, + {7960, 7952, 7960, 0, 0, 10113}, + {7961, 7953, 7961, 0, 0, 10113}, + {7962, 7954, 7962, 0, 0, 10113}, + {7963, 7955, 7963, 0, 0, 10113}, + {7964, 7956, 7964, 0, 0, 10113}, + {7965, 7957, 7965, 0, 0, 10113}, + {7976, 7968, 7976, 0, 0, 9993}, + {7977, 7969, 7977, 0, 0, 9993}, + {7978, 7970, 7978, 0, 0, 9993}, + {7979, 7971, 7979, 0, 0, 9993}, + {7980, 7972, 7980, 0, 0, 9993}, + {7981, 7973, 7981, 0, 0, 9993}, + {7982, 7974, 7982, 0, 0, 9993}, + {7983, 7975, 7983, 0, 0, 9993}, + {7976, 7968, 7976, 0, 0, 10113}, + {7977, 7969, 7977, 0, 0, 10113}, + {7978, 7970, 7978, 0, 0, 10113}, + {7979, 7971, 7979, 0, 0, 10113}, + {7980, 7972, 7980, 0, 0, 10113}, + {7981, 7973, 7981, 0, 0, 10113}, + {7982, 7974, 7982, 0, 0, 10113}, + {7983, 7975, 7983, 0, 0, 10113}, + {7992, 7984, 7992, 0, 0, 9993}, + {7993, 7985, 7993, 0, 0, 9993}, + {7994, 7986, 7994, 0, 0, 9993}, + {7995, 7987, 7995, 0, 0, 9993}, + {7996, 7988, 7996, 0, 0, 9993}, + {7997, 7989, 7997, 0, 0, 9993}, + {7998, 7990, 7998, 0, 0, 9993}, + {7999, 7991, 7999, 0, 0, 9993}, + {7992, 7984, 7992, 0, 0, 10113}, + {7993, 7985, 7993, 0, 0, 10113}, + {7994, 7986, 7994, 0, 0, 10113}, + {7995, 7987, 7995, 0, 0, 10113}, + {7996, 7988, 7996, 0, 0, 10113}, + {7997, 7989, 7997, 0, 0, 10113}, + {7998, 7990, 7998, 0, 0, 10113}, + {7999, 7991, 7999, 0, 0, 10113}, + {8008, 8000, 8008, 0, 0, 9993}, + {8009, 8001, 8009, 0, 0, 9993}, + {8010, 8002, 8010, 0, 0, 9993}, + {8011, 8003, 8011, 0, 0, 9993}, + {8012, 8004, 8012, 0, 0, 9993}, + {8013, 8005, 8013, 0, 0, 9993}, + {8008, 8000, 8008, 0, 0, 10113}, + {8009, 8001, 8009, 0, 0, 10113}, + {8010, 8002, 8010, 0, 0, 10113}, + {8011, 8003, 8011, 0, 0, 10113}, + {8012, 8004, 8012, 0, 0, 10113}, + {8013, 8005, 8013, 0, 0, 10113}, + {33554475, 16777258, 33554475, 0, 0, 26377}, + {8025, 8017, 8025, 0, 0, 9993}, + {50331694, 16777261, 50331694, 0, 0, 26377}, + {8027, 8019, 8027, 0, 0, 9993}, + {50331698, 16777265, 50331698, 0, 0, 26377}, + {8029, 8021, 8029, 0, 0, 9993}, + {50331702, 16777269, 50331702, 0, 0, 26377}, + {8031, 8023, 8031, 0, 0, 9993}, + {8025, 8017, 8025, 0, 0, 10113}, + {8027, 8019, 8027, 0, 0, 10113}, + {8029, 8021, 8029, 0, 0, 10113}, + {8031, 8023, 8031, 0, 0, 10113}, + {8040, 8032, 8040, 0, 0, 9993}, + {8041, 8033, 8041, 0, 0, 9993}, + {8042, 8034, 8042, 0, 0, 9993}, + {8043, 8035, 8043, 0, 0, 9993}, + {8044, 8036, 8044, 0, 0, 9993}, + {8045, 8037, 8045, 0, 0, 9993}, + {8046, 8038, 8046, 0, 0, 9993}, + {8047, 8039, 8047, 0, 0, 9993}, + {8040, 8032, 8040, 0, 0, 10113}, + {8041, 8033, 8041, 0, 0, 10113}, + {8042, 8034, 8042, 0, 0, 10113}, + {8043, 8035, 8043, 0, 0, 10113}, + {8044, 8036, 8044, 0, 0, 10113}, + {8045, 8037, 8045, 0, 0, 10113}, + {8046, 8038, 8046, 0, 0, 10113}, + {8047, 8039, 8047, 0, 0, 10113}, + {8122, 8048, 8122, 0, 0, 9993}, + {8123, 8049, 8123, 0, 0, 9993}, + {8136, 8050, 8136, 0, 0, 9993}, + {8137, 8051, 8137, 0, 0, 9993}, + {8138, 8052, 8138, 0, 0, 9993}, + {8139, 8053, 8139, 0, 0, 9993}, + {8154, 8054, 8154, 0, 0, 9993}, + {8155, 8055, 8155, 0, 0, 9993}, + {8184, 8056, 8184, 0, 0, 9993}, + {8185, 8057, 8185, 0, 0, 9993}, + {8170, 8058, 8170, 0, 0, 9993}, + {8171, 8059, 8171, 0, 0, 9993}, + {8186, 8060, 8186, 0, 0, 9993}, + {8187, 8061, 8187, 0, 0, 9993}, + {33554490, 16777273, 16777276, 0, 0, 26377}, + {33554494, 16777277, 16777280, 0, 0, 26377}, + {33554498, 16777281, 16777284, 0, 0, 26377}, + {33554502, 16777285, 16777288, 0, 0, 26377}, + {33554506, 16777289, 16777292, 0, 0, 26377}, + {33554510, 16777293, 16777296, 0, 0, 26377}, + {33554514, 16777297, 16777300, 0, 0, 26377}, + {33554518, 16777301, 16777304, 0, 0, 26377}, + {33554522, 16777305, 16777308, 0, 0, 26433}, + {33554526, 16777309, 16777312, 0, 0, 26433}, + {33554530, 16777313, 16777316, 0, 0, 26433}, + {33554534, 16777317, 16777320, 0, 0, 26433}, + {33554538, 16777321, 16777324, 0, 0, 26433}, + {33554542, 16777325, 16777328, 0, 0, 26433}, + {33554546, 16777329, 16777332, 0, 0, 26433}, + {33554550, 16777333, 16777336, 0, 0, 26433}, + {33554554, 16777337, 16777340, 0, 0, 26377}, + {33554558, 16777341, 16777344, 0, 0, 26377}, + {33554562, 16777345, 16777348, 0, 0, 26377}, + {33554566, 16777349, 16777352, 0, 0, 26377}, + {33554570, 16777353, 16777356, 0, 0, 26377}, + {33554574, 16777357, 16777360, 0, 0, 26377}, + {33554578, 16777361, 16777364, 0, 0, 26377}, + {33554582, 16777365, 16777368, 0, 0, 26377}, + {33554586, 16777369, 16777372, 0, 0, 26433}, + {33554590, 16777373, 16777376, 0, 0, 26433}, + {33554594, 16777377, 16777380, 0, 0, 26433}, + {33554598, 16777381, 16777384, 0, 0, 26433}, + {33554602, 16777385, 16777388, 0, 0, 26433}, + {33554606, 16777389, 16777392, 0, 0, 26433}, + {33554610, 16777393, 16777396, 0, 0, 26433}, + {33554614, 16777397, 16777400, 0, 0, 26433}, + {33554618, 16777401, 16777404, 0, 0, 26377}, + {33554622, 16777405, 16777408, 0, 0, 26377}, + {33554626, 16777409, 16777412, 0, 0, 26377}, + {33554630, 16777413, 16777416, 0, 0, 26377}, + {33554634, 16777417, 16777420, 0, 0, 26377}, + {33554638, 16777421, 16777424, 0, 0, 26377}, + {33554642, 16777425, 16777428, 0, 0, 26377}, + {33554646, 16777429, 16777432, 0, 0, 26377}, + {33554650, 16777433, 16777436, 0, 0, 26433}, + {33554654, 16777437, 16777440, 0, 0, 26433}, + {33554658, 16777441, 16777444, 0, 0, 26433}, + {33554662, 16777445, 16777448, 0, 0, 26433}, + {33554666, 16777449, 16777452, 0, 0, 26433}, + {33554670, 16777453, 16777456, 0, 0, 26433}, + {33554674, 16777457, 16777460, 0, 0, 26433}, + {33554678, 16777461, 16777464, 0, 0, 26433}, + {8120, 8112, 8120, 0, 0, 9993}, + {8121, 8113, 8121, 0, 0, 9993}, + {33554682, 16777465, 33554684, 0, 0, 26377}, + {33554687, 16777470, 16777473, 0, 0, 26377}, + {33554691, 16777474, 33554693, 0, 0, 26377}, + {33554696, 16777479, 33554696, 0, 0, 26377}, + {50331915, 16777482, 50331918, 0, 0, 26377}, + {8120, 8112, 8120, 0, 0, 10113}, + {8121, 8113, 8121, 0, 0, 10113}, + {8122, 8048, 8122, 0, 0, 10113}, + {8123, 8049, 8123, 0, 0, 10113}, + {33554706, 16777489, 16777492, 0, 0, 26433}, + {921, 8126, 921, 0, 0, 9993}, + {33554710, 16777493, 33554712, 0, 0, 26377}, + {33554715, 16777498, 16777501, 0, 0, 26377}, + {33554719, 16777502, 33554721, 0, 0, 26377}, + {33554724, 16777507, 33554724, 0, 0, 26377}, + {50331943, 16777510, 50331946, 0, 0, 26377}, + {8136, 8050, 8136, 0, 0, 10113}, + {8137, 8051, 8137, 0, 0, 10113}, + {8138, 8052, 8138, 0, 0, 10113}, + {8139, 8053, 8139, 0, 0, 10113}, + {33554734, 16777517, 16777520, 0, 0, 26433}, + {8152, 8144, 8152, 0, 0, 9993}, + {8153, 8145, 8153, 0, 0, 9993}, + {50331954, 16777521, 50331954, 0, 0, 26377}, + {50331958, 16777525, 50331958, 0, 0, 26377}, + {33554746, 16777529, 33554746, 0, 0, 26377}, + {50331965, 16777532, 50331965, 0, 0, 26377}, + {8152, 8144, 8152, 0, 0, 10113}, + {8153, 8145, 8153, 0, 0, 10113}, + {8154, 8054, 8154, 0, 0, 10113}, + {8155, 8055, 8155, 0, 0, 10113}, + {8168, 8160, 8168, 0, 0, 9993}, + {8169, 8161, 8169, 0, 0, 9993}, + {50331969, 16777536, 50331969, 0, 0, 26377}, + {50331973, 16777540, 50331973, 0, 0, 26377}, + {33554761, 16777544, 33554761, 0, 0, 26377}, + {8172, 8165, 8172, 0, 0, 9993}, + {33554764, 16777547, 33554764, 0, 0, 26377}, + {50331983, 16777550, 50331983, 0, 0, 26377}, + {8168, 8160, 8168, 0, 0, 10113}, + {8169, 8161, 8169, 0, 0, 10113}, + {8170, 8058, 8170, 0, 0, 10113}, + {8171, 8059, 8171, 0, 0, 10113}, + {8172, 8165, 8172, 0, 0, 10113}, + {33554771, 16777554, 33554773, 0, 0, 26377}, + {33554776, 16777559, 16777562, 0, 0, 26377}, + {33554780, 16777563, 33554782, 0, 0, 26377}, + {33554785, 16777568, 33554785, 0, 0, 26377}, + {50332004, 16777571, 50332007, 0, 0, 26377}, + {8184, 8056, 8184, 0, 0, 10113}, + {8185, 8057, 8185, 0, 0, 10113}, + {8186, 8060, 8186, 0, 0, 10113}, + {8187, 8061, 8187, 0, 0, 10113}, + {33554795, 16777578, 16777581, 0, 0, 26433}, + {0, 0, 0, 0, 0, 3076}, + {0, 0, 0, 0, 4, 3076}, + {0, 0, 0, 0, 5, 3076}, + {0, 0, 0, 0, 6, 3076}, + {0, 0, 0, 0, 7, 3076}, + {0, 0, 0, 0, 8, 3076}, + {0, 0, 0, 0, 9, 3076}, + {0, 0, 0, 0, 0, 1792}, + {8486, 969, 8486, 0, 0, 10113}, + {8490, 107, 8490, 0, 0, 10113}, + {8491, 229, 8491, 0, 0, 10113}, + {8498, 8526, 8498, 0, 0, 10113}, + {8498, 8526, 8498, 0, 0, 9993}, + {8544, 8560, 8544, 0, 0, 12160}, + {8545, 8561, 8545, 0, 0, 12160}, + {8546, 8562, 8546, 0, 0, 12160}, + {8547, 8563, 8547, 0, 0, 12160}, + {8548, 8564, 8548, 0, 0, 12160}, + {8549, 8565, 8549, 0, 0, 12160}, + {8550, 8566, 8550, 0, 0, 12160}, + {8551, 8567, 8551, 0, 0, 12160}, + {8552, 8568, 8552, 0, 0, 12160}, + {8553, 8569, 8553, 0, 0, 12160}, + {8554, 8570, 8554, 0, 0, 12160}, + {8555, 8571, 8555, 0, 0, 12160}, + {8556, 8572, 8556, 0, 0, 12160}, + {8557, 8573, 8557, 0, 0, 12160}, + {8558, 8574, 8558, 0, 0, 12160}, + {8559, 8575, 8559, 0, 0, 12160}, + {8544, 8560, 8544, 0, 0, 12040}, + {8545, 8561, 8545, 0, 0, 12040}, + {8546, 8562, 8546, 0, 0, 12040}, + {8547, 8563, 8547, 0, 0, 12040}, + {8548, 8564, 8548, 0, 0, 12040}, + {8549, 8565, 8549, 0, 0, 12040}, + {8550, 8566, 8550, 0, 0, 12040}, + {8551, 8567, 8551, 0, 0, 12040}, + {8552, 8568, 8552, 0, 0, 12040}, + {8553, 8569, 8553, 0, 0, 12040}, + {8554, 8570, 8554, 0, 0, 12040}, + {8555, 8571, 8555, 0, 0, 12040}, + {8556, 8572, 8556, 0, 0, 12040}, + {8557, 8573, 8557, 0, 0, 12040}, + {8558, 8574, 8558, 0, 0, 12040}, + {8559, 8575, 8559, 0, 0, 12040}, + {8579, 8580, 8579, 0, 0, 10113}, + {8579, 8580, 8579, 0, 0, 9993}, + {9398, 9424, 9398, 0, 0, 9344}, + {9399, 9425, 9399, 0, 0, 9344}, + {9400, 9426, 9400, 0, 0, 9344}, + {9401, 9427, 9401, 0, 0, 9344}, + {9402, 9428, 9402, 0, 0, 9344}, + {9403, 9429, 9403, 0, 0, 9344}, + {9404, 9430, 9404, 0, 0, 9344}, + {9405, 9431, 9405, 0, 0, 9344}, + {9406, 9432, 9406, 0, 0, 9344}, + {9407, 9433, 9407, 0, 0, 9344}, + {9408, 9434, 9408, 0, 0, 9344}, + {9409, 9435, 9409, 0, 0, 9344}, + {9410, 9436, 9410, 0, 0, 9344}, + {9411, 9437, 9411, 0, 0, 9344}, + {9412, 9438, 9412, 0, 0, 9344}, + {9413, 9439, 9413, 0, 0, 9344}, + {9414, 9440, 9414, 0, 0, 9344}, + {9415, 9441, 9415, 0, 0, 9344}, + {9416, 9442, 9416, 0, 0, 9344}, + {9417, 9443, 9417, 0, 0, 9344}, + {9418, 9444, 9418, 0, 0, 9344}, + {9419, 9445, 9419, 0, 0, 9344}, + {9420, 9446, 9420, 0, 0, 9344}, + {9421, 9447, 9421, 0, 0, 9344}, + {9422, 9448, 9422, 0, 0, 9344}, + {9423, 9449, 9423, 0, 0, 9344}, + {9398, 9424, 9398, 0, 0, 9224}, + {9399, 9425, 9399, 0, 0, 9224}, + {9400, 9426, 9400, 0, 0, 9224}, + {9401, 9427, 9401, 0, 0, 9224}, + {9402, 9428, 9402, 0, 0, 9224}, + {9403, 9429, 9403, 0, 0, 9224}, + {9404, 9430, 9404, 0, 0, 9224}, + {9405, 9431, 9405, 0, 0, 9224}, + {9406, 9432, 9406, 0, 0, 9224}, + {9407, 9433, 9407, 0, 0, 9224}, + {9408, 9434, 9408, 0, 0, 9224}, + {9409, 9435, 9409, 0, 0, 9224}, + {9410, 9436, 9410, 0, 0, 9224}, + {9411, 9437, 9411, 0, 0, 9224}, + {9412, 9438, 9412, 0, 0, 9224}, + {9413, 9439, 9413, 0, 0, 9224}, + {9414, 9440, 9414, 0, 0, 9224}, + {9415, 9441, 9415, 0, 0, 9224}, + {9416, 9442, 9416, 0, 0, 9224}, + {9417, 9443, 9417, 0, 0, 9224}, + {9418, 9444, 9418, 0, 0, 9224}, + {9419, 9445, 9419, 0, 0, 9224}, + {9420, 9446, 9420, 0, 0, 9224}, + {9421, 9447, 9421, 0, 0, 9224}, + {9422, 9448, 9422, 0, 0, 9224}, + {9423, 9449, 9423, 0, 0, 9224}, + {11264, 11312, 11264, 0, 0, 10113}, + {11265, 11313, 11265, 0, 0, 10113}, + {11266, 11314, 11266, 0, 0, 10113}, + {11267, 11315, 11267, 0, 0, 10113}, + {11268, 11316, 11268, 0, 0, 10113}, + {11269, 11317, 11269, 0, 0, 10113}, + {11270, 11318, 11270, 0, 0, 10113}, + {11271, 11319, 11271, 0, 0, 10113}, + {11272, 11320, 11272, 0, 0, 10113}, + {11273, 11321, 11273, 0, 0, 10113}, + {11274, 11322, 11274, 0, 0, 10113}, + {11275, 11323, 11275, 0, 0, 10113}, + {11276, 11324, 11276, 0, 0, 10113}, + {11277, 11325, 11277, 0, 0, 10113}, + {11278, 11326, 11278, 0, 0, 10113}, + {11279, 11327, 11279, 0, 0, 10113}, + {11280, 11328, 11280, 0, 0, 10113}, + {11281, 11329, 11281, 0, 0, 10113}, + {11282, 11330, 11282, 0, 0, 10113}, + {11283, 11331, 11283, 0, 0, 10113}, + {11284, 11332, 11284, 0, 0, 10113}, + {11285, 11333, 11285, 0, 0, 10113}, + {11286, 11334, 11286, 0, 0, 10113}, + {11287, 11335, 11287, 0, 0, 10113}, + {11288, 11336, 11288, 0, 0, 10113}, + {11289, 11337, 11289, 0, 0, 10113}, + {11290, 11338, 11290, 0, 0, 10113}, + {11291, 11339, 11291, 0, 0, 10113}, + {11292, 11340, 11292, 0, 0, 10113}, + {11293, 11341, 11293, 0, 0, 10113}, + {11294, 11342, 11294, 0, 0, 10113}, + {11295, 11343, 11295, 0, 0, 10113}, + {11296, 11344, 11296, 0, 0, 10113}, + {11297, 11345, 11297, 0, 0, 10113}, + {11298, 11346, 11298, 0, 0, 10113}, + {11299, 11347, 11299, 0, 0, 10113}, + {11300, 11348, 11300, 0, 0, 10113}, + {11301, 11349, 11301, 0, 0, 10113}, + {11302, 11350, 11302, 0, 0, 10113}, + {11303, 11351, 11303, 0, 0, 10113}, + {11304, 11352, 11304, 0, 0, 10113}, + {11305, 11353, 11305, 0, 0, 10113}, + {11306, 11354, 11306, 0, 0, 10113}, + {11307, 11355, 11307, 0, 0, 10113}, + {11308, 11356, 11308, 0, 0, 10113}, + {11309, 11357, 11309, 0, 0, 10113}, + {11310, 11358, 11310, 0, 0, 10113}, + {11264, 11312, 11264, 0, 0, 9993}, + {11265, 11313, 11265, 0, 0, 9993}, + {11266, 11314, 11266, 0, 0, 9993}, + {11267, 11315, 11267, 0, 0, 9993}, + {11268, 11316, 11268, 0, 0, 9993}, + {11269, 11317, 11269, 0, 0, 9993}, + {11270, 11318, 11270, 0, 0, 9993}, + {11271, 11319, 11271, 0, 0, 9993}, + {11272, 11320, 11272, 0, 0, 9993}, + {11273, 11321, 11273, 0, 0, 9993}, + {11274, 11322, 11274, 0, 0, 9993}, + {11275, 11323, 11275, 0, 0, 9993}, + {11276, 11324, 11276, 0, 0, 9993}, + {11277, 11325, 11277, 0, 0, 9993}, + {11278, 11326, 11278, 0, 0, 9993}, + {11279, 11327, 11279, 0, 0, 9993}, + {11280, 11328, 11280, 0, 0, 9993}, + {11281, 11329, 11281, 0, 0, 9993}, + {11282, 11330, 11282, 0, 0, 9993}, + {11283, 11331, 11283, 0, 0, 9993}, + {11284, 11332, 11284, 0, 0, 9993}, + {11285, 11333, 11285, 0, 0, 9993}, + {11286, 11334, 11286, 0, 0, 9993}, + {11287, 11335, 11287, 0, 0, 9993}, + {11288, 11336, 11288, 0, 0, 9993}, + {11289, 11337, 11289, 0, 0, 9993}, + {11290, 11338, 11290, 0, 0, 9993}, + {11291, 11339, 11291, 0, 0, 9993}, + {11292, 11340, 11292, 0, 0, 9993}, + {11293, 11341, 11293, 0, 0, 9993}, + {11294, 11342, 11294, 0, 0, 9993}, + {11295, 11343, 11295, 0, 0, 9993}, + {11296, 11344, 11296, 0, 0, 9993}, + {11297, 11345, 11297, 0, 0, 9993}, + {11298, 11346, 11298, 0, 0, 9993}, + {11299, 11347, 11299, 0, 0, 9993}, + {11300, 11348, 11300, 0, 0, 9993}, + {11301, 11349, 11301, 0, 0, 9993}, + {11302, 11350, 11302, 0, 0, 9993}, + {11303, 11351, 11303, 0, 0, 9993}, + {11304, 11352, 11304, 0, 0, 9993}, + {11305, 11353, 11305, 0, 0, 9993}, + {11306, 11354, 11306, 0, 0, 9993}, + {11307, 11355, 11307, 0, 0, 9993}, + {11308, 11356, 11308, 0, 0, 9993}, + {11309, 11357, 11309, 0, 0, 9993}, + {11310, 11358, 11310, 0, 0, 9993}, + {11360, 11361, 11360, 0, 0, 10113}, + {11360, 11361, 11360, 0, 0, 9993}, + {11362, 619, 11362, 0, 0, 10113}, + {11363, 7549, 11363, 0, 0, 10113}, + {11364, 637, 11364, 0, 0, 10113}, + {570, 11365, 570, 0, 0, 9993}, + {574, 11366, 574, 0, 0, 9993}, + {11367, 11368, 11367, 0, 0, 10113}, + {11367, 11368, 11367, 0, 0, 9993}, + {11369, 11370, 11369, 0, 0, 10113}, + {11369, 11370, 11369, 0, 0, 9993}, + {11371, 11372, 11371, 0, 0, 10113}, + {11371, 11372, 11371, 0, 0, 9993}, + {11373, 593, 11373, 0, 0, 10113}, + {11374, 625, 11374, 0, 0, 10113}, + {11375, 592, 11375, 0, 0, 10113}, + {11376, 594, 11376, 0, 0, 10113}, + {11378, 11379, 11378, 0, 0, 10113}, + {11378, 11379, 11378, 0, 0, 9993}, + {11381, 11382, 11381, 0, 0, 10113}, + {11381, 11382, 11381, 0, 0, 9993}, + {11390, 575, 11390, 0, 0, 10113}, + {11391, 576, 11391, 0, 0, 10113}, + {11392, 11393, 11392, 0, 0, 10113}, + {11392, 11393, 11392, 0, 0, 9993}, + {11394, 11395, 11394, 0, 0, 10113}, + {11394, 11395, 11394, 0, 0, 9993}, + {11396, 11397, 11396, 0, 0, 10113}, + {11396, 11397, 11396, 0, 0, 9993}, + {11398, 11399, 11398, 0, 0, 10113}, + {11398, 11399, 11398, 0, 0, 9993}, + {11400, 11401, 11400, 0, 0, 10113}, + {11400, 11401, 11400, 0, 0, 9993}, + {11402, 11403, 11402, 0, 0, 10113}, + {11402, 11403, 11402, 0, 0, 9993}, + {11404, 11405, 11404, 0, 0, 10113}, + {11404, 11405, 11404, 0, 0, 9993}, + {11406, 11407, 11406, 0, 0, 10113}, + {11406, 11407, 11406, 0, 0, 9993}, + {11408, 11409, 11408, 0, 0, 10113}, + {11408, 11409, 11408, 0, 0, 9993}, + {11410, 11411, 11410, 0, 0, 10113}, + {11410, 11411, 11410, 0, 0, 9993}, + {11412, 11413, 11412, 0, 0, 10113}, + {11412, 11413, 11412, 0, 0, 9993}, + {11414, 11415, 11414, 0, 0, 10113}, + {11414, 11415, 11414, 0, 0, 9993}, + {11416, 11417, 11416, 0, 0, 10113}, + {11416, 11417, 11416, 0, 0, 9993}, + {11418, 11419, 11418, 0, 0, 10113}, + {11418, 11419, 11418, 0, 0, 9993}, + {11420, 11421, 11420, 0, 0, 10113}, + {11420, 11421, 11420, 0, 0, 9993}, + {11422, 11423, 11422, 0, 0, 10113}, + {11422, 11423, 11422, 0, 0, 9993}, + {11424, 11425, 11424, 0, 0, 10113}, + {11424, 11425, 11424, 0, 0, 9993}, + {11426, 11427, 11426, 0, 0, 10113}, + {11426, 11427, 11426, 0, 0, 9993}, + {11428, 11429, 11428, 0, 0, 10113}, + {11428, 11429, 11428, 0, 0, 9993}, + {11430, 11431, 11430, 0, 0, 10113}, + {11430, 11431, 11430, 0, 0, 9993}, + {11432, 11433, 11432, 0, 0, 10113}, + {11432, 11433, 11432, 0, 0, 9993}, + {11434, 11435, 11434, 0, 0, 10113}, + {11434, 11435, 11434, 0, 0, 9993}, + {11436, 11437, 11436, 0, 0, 10113}, + {11436, 11437, 11436, 0, 0, 9993}, + {11438, 11439, 11438, 0, 0, 10113}, + {11438, 11439, 11438, 0, 0, 9993}, + {11440, 11441, 11440, 0, 0, 10113}, + {11440, 11441, 11440, 0, 0, 9993}, + {11442, 11443, 11442, 0, 0, 10113}, + {11442, 11443, 11442, 0, 0, 9993}, + {11444, 11445, 11444, 0, 0, 10113}, + {11444, 11445, 11444, 0, 0, 9993}, + {11446, 11447, 11446, 0, 0, 10113}, + {11446, 11447, 11446, 0, 0, 9993}, + {11448, 11449, 11448, 0, 0, 10113}, + {11448, 11449, 11448, 0, 0, 9993}, + {11450, 11451, 11450, 0, 0, 10113}, + {11450, 11451, 11450, 0, 0, 9993}, + {11452, 11453, 11452, 0, 0, 10113}, + {11452, 11453, 11452, 0, 0, 9993}, + {11454, 11455, 11454, 0, 0, 10113}, + {11454, 11455, 11454, 0, 0, 9993}, + {11456, 11457, 11456, 0, 0, 10113}, + {11456, 11457, 11456, 0, 0, 9993}, + {11458, 11459, 11458, 0, 0, 10113}, + {11458, 11459, 11458, 0, 0, 9993}, + {11460, 11461, 11460, 0, 0, 10113}, + {11460, 11461, 11460, 0, 0, 9993}, + {11462, 11463, 11462, 0, 0, 10113}, + {11462, 11463, 11462, 0, 0, 9993}, + {11464, 11465, 11464, 0, 0, 10113}, + {11464, 11465, 11464, 0, 0, 9993}, + {11466, 11467, 11466, 0, 0, 10113}, + {11466, 11467, 11466, 0, 0, 9993}, + {11468, 11469, 11468, 0, 0, 10113}, + {11468, 11469, 11468, 0, 0, 9993}, + {11470, 11471, 11470, 0, 0, 10113}, + {11470, 11471, 11470, 0, 0, 9993}, + {11472, 11473, 11472, 0, 0, 10113}, + {11472, 11473, 11472, 0, 0, 9993}, + {11474, 11475, 11474, 0, 0, 10113}, + {11474, 11475, 11474, 0, 0, 9993}, + {11476, 11477, 11476, 0, 0, 10113}, + {11476, 11477, 11476, 0, 0, 9993}, + {11478, 11479, 11478, 0, 0, 10113}, + {11478, 11479, 11478, 0, 0, 9993}, + {11480, 11481, 11480, 0, 0, 10113}, + {11480, 11481, 11480, 0, 0, 9993}, + {11482, 11483, 11482, 0, 0, 10113}, + {11482, 11483, 11482, 0, 0, 9993}, + {11484, 11485, 11484, 0, 0, 10113}, + {11484, 11485, 11484, 0, 0, 9993}, + {11486, 11487, 11486, 0, 0, 10113}, + {11486, 11487, 11486, 0, 0, 9993}, + {11488, 11489, 11488, 0, 0, 10113}, + {11488, 11489, 11488, 0, 0, 9993}, + {11490, 11491, 11490, 0, 0, 10113}, + {11490, 11491, 11490, 0, 0, 9993}, + {11499, 11500, 11499, 0, 0, 10113}, + {11499, 11500, 11499, 0, 0, 9993}, + {11501, 11502, 11501, 0, 0, 10113}, + {11501, 11502, 11501, 0, 0, 9993}, + {4256, 11520, 4256, 0, 0, 9993}, + {4257, 11521, 4257, 0, 0, 9993}, + {4258, 11522, 4258, 0, 0, 9993}, + {4259, 11523, 4259, 0, 0, 9993}, + {4260, 11524, 4260, 0, 0, 9993}, + {4261, 11525, 4261, 0, 0, 9993}, + {4262, 11526, 4262, 0, 0, 9993}, + {4263, 11527, 4263, 0, 0, 9993}, + {4264, 11528, 4264, 0, 0, 9993}, + {4265, 11529, 4265, 0, 0, 9993}, + {4266, 11530, 4266, 0, 0, 9993}, + {4267, 11531, 4267, 0, 0, 9993}, + {4268, 11532, 4268, 0, 0, 9993}, + {4269, 11533, 4269, 0, 0, 9993}, + {4270, 11534, 4270, 0, 0, 9993}, + {4271, 11535, 4271, 0, 0, 9993}, + {4272, 11536, 4272, 0, 0, 9993}, + {4273, 11537, 4273, 0, 0, 9993}, + {4274, 11538, 4274, 0, 0, 9993}, + {4275, 11539, 4275, 0, 0, 9993}, + {4276, 11540, 4276, 0, 0, 9993}, + {4277, 11541, 4277, 0, 0, 9993}, + {4278, 11542, 4278, 0, 0, 9993}, + {4279, 11543, 4279, 0, 0, 9993}, + {4280, 11544, 4280, 0, 0, 9993}, + {4281, 11545, 4281, 0, 0, 9993}, + {4282, 11546, 4282, 0, 0, 9993}, + {4283, 11547, 4283, 0, 0, 9993}, + {4284, 11548, 4284, 0, 0, 9993}, + {4285, 11549, 4285, 0, 0, 9993}, + {4286, 11550, 4286, 0, 0, 9993}, + {4287, 11551, 4287, 0, 0, 9993}, + {4288, 11552, 4288, 0, 0, 9993}, + {4289, 11553, 4289, 0, 0, 9993}, + {4290, 11554, 4290, 0, 0, 9993}, + {4291, 11555, 4291, 0, 0, 9993}, + {4292, 11556, 4292, 0, 0, 9993}, + {4293, 11557, 4293, 0, 0, 9993}, + {0, 0, 0, 0, 0, 5121}, + {0, 0, 0, 0, 0, 3841}, + {42560, 42561, 42560, 0, 0, 10113}, + {42560, 42561, 42560, 0, 0, 9993}, + {42562, 42563, 42562, 0, 0, 10113}, + {42562, 42563, 42562, 0, 0, 9993}, + {42564, 42565, 42564, 0, 0, 10113}, + {42564, 42565, 42564, 0, 0, 9993}, + {42566, 42567, 42566, 0, 0, 10113}, + {42566, 42567, 42566, 0, 0, 9993}, + {42568, 42569, 42568, 0, 0, 10113}, + {42568, 42569, 42568, 0, 0, 9993}, + {42570, 42571, 42570, 0, 0, 10113}, + {42570, 42571, 42570, 0, 0, 9993}, + {42572, 42573, 42572, 0, 0, 10113}, + {42572, 42573, 42572, 0, 0, 9993}, + {42574, 42575, 42574, 0, 0, 10113}, + {42574, 42575, 42574, 0, 0, 9993}, + {42576, 42577, 42576, 0, 0, 10113}, + {42576, 42577, 42576, 0, 0, 9993}, + {42578, 42579, 42578, 0, 0, 10113}, + {42578, 42579, 42578, 0, 0, 9993}, + {42580, 42581, 42580, 0, 0, 10113}, + {42580, 42581, 42580, 0, 0, 9993}, + {42582, 42583, 42582, 0, 0, 10113}, + {42582, 42583, 42582, 0, 0, 9993}, + {42584, 42585, 42584, 0, 0, 10113}, + {42584, 42585, 42584, 0, 0, 9993}, + {42586, 42587, 42586, 0, 0, 10113}, + {42586, 42587, 42586, 0, 0, 9993}, + {42588, 42589, 42588, 0, 0, 10113}, + {42588, 42589, 42588, 0, 0, 9993}, + {42590, 42591, 42590, 0, 0, 10113}, + {42590, 42591, 42590, 0, 0, 9993}, + {42592, 42593, 42592, 0, 0, 10113}, + {42592, 42593, 42592, 0, 0, 9993}, + {42594, 42595, 42594, 0, 0, 10113}, + {42594, 42595, 42594, 0, 0, 9993}, + {42596, 42597, 42596, 0, 0, 10113}, + {42596, 42597, 42596, 0, 0, 9993}, + {42598, 42599, 42598, 0, 0, 10113}, + {42598, 42599, 42598, 0, 0, 9993}, + {42600, 42601, 42600, 0, 0, 10113}, + {42600, 42601, 42600, 0, 0, 9993}, + {42602, 42603, 42602, 0, 0, 10113}, + {42602, 42603, 42602, 0, 0, 9993}, + {42604, 42605, 42604, 0, 0, 10113}, + {42604, 42605, 42604, 0, 0, 9993}, + {42624, 42625, 42624, 0, 0, 10113}, + {42624, 42625, 42624, 0, 0, 9993}, + {42626, 42627, 42626, 0, 0, 10113}, + {42626, 42627, 42626, 0, 0, 9993}, + {42628, 42629, 42628, 0, 0, 10113}, + {42628, 42629, 42628, 0, 0, 9993}, + {42630, 42631, 42630, 0, 0, 10113}, + {42630, 42631, 42630, 0, 0, 9993}, + {42632, 42633, 42632, 0, 0, 10113}, + {42632, 42633, 42632, 0, 0, 9993}, + {42634, 42635, 42634, 0, 0, 10113}, + {42634, 42635, 42634, 0, 0, 9993}, + {42636, 42637, 42636, 0, 0, 10113}, + {42636, 42637, 42636, 0, 0, 9993}, + {42638, 42639, 42638, 0, 0, 10113}, + {42638, 42639, 42638, 0, 0, 9993}, + {42640, 42641, 42640, 0, 0, 10113}, + {42640, 42641, 42640, 0, 0, 9993}, + {42642, 42643, 42642, 0, 0, 10113}, + {42642, 42643, 42642, 0, 0, 9993}, + {42644, 42645, 42644, 0, 0, 10113}, + {42644, 42645, 42644, 0, 0, 9993}, + {42646, 42647, 42646, 0, 0, 10113}, + {42646, 42647, 42646, 0, 0, 9993}, + {42786, 42787, 42786, 0, 0, 10113}, + {42786, 42787, 42786, 0, 0, 9993}, + {42788, 42789, 42788, 0, 0, 10113}, + {42788, 42789, 42788, 0, 0, 9993}, + {42790, 42791, 42790, 0, 0, 10113}, + {42790, 42791, 42790, 0, 0, 9993}, + {42792, 42793, 42792, 0, 0, 10113}, + {42792, 42793, 42792, 0, 0, 9993}, + {42794, 42795, 42794, 0, 0, 10113}, + {42794, 42795, 42794, 0, 0, 9993}, + {42796, 42797, 42796, 0, 0, 10113}, + {42796, 42797, 42796, 0, 0, 9993}, + {42798, 42799, 42798, 0, 0, 10113}, + {42798, 42799, 42798, 0, 0, 9993}, + {42802, 42803, 42802, 0, 0, 10113}, + {42802, 42803, 42802, 0, 0, 9993}, + {42804, 42805, 42804, 0, 0, 10113}, + {42804, 42805, 42804, 0, 0, 9993}, + {42806, 42807, 42806, 0, 0, 10113}, + {42806, 42807, 42806, 0, 0, 9993}, + {42808, 42809, 42808, 0, 0, 10113}, + {42808, 42809, 42808, 0, 0, 9993}, + {42810, 42811, 42810, 0, 0, 10113}, + {42810, 42811, 42810, 0, 0, 9993}, + {42812, 42813, 42812, 0, 0, 10113}, + {42812, 42813, 42812, 0, 0, 9993}, + {42814, 42815, 42814, 0, 0, 10113}, + {42814, 42815, 42814, 0, 0, 9993}, + {42816, 42817, 42816, 0, 0, 10113}, + {42816, 42817, 42816, 0, 0, 9993}, + {42818, 42819, 42818, 0, 0, 10113}, + {42818, 42819, 42818, 0, 0, 9993}, + {42820, 42821, 42820, 0, 0, 10113}, + {42820, 42821, 42820, 0, 0, 9993}, + {42822, 42823, 42822, 0, 0, 10113}, + {42822, 42823, 42822, 0, 0, 9993}, + {42824, 42825, 42824, 0, 0, 10113}, + {42824, 42825, 42824, 0, 0, 9993}, + {42826, 42827, 42826, 0, 0, 10113}, + {42826, 42827, 42826, 0, 0, 9993}, + {42828, 42829, 42828, 0, 0, 10113}, + {42828, 42829, 42828, 0, 0, 9993}, + {42830, 42831, 42830, 0, 0, 10113}, + {42830, 42831, 42830, 0, 0, 9993}, + {42832, 42833, 42832, 0, 0, 10113}, + {42832, 42833, 42832, 0, 0, 9993}, + {42834, 42835, 42834, 0, 0, 10113}, + {42834, 42835, 42834, 0, 0, 9993}, + {42836, 42837, 42836, 0, 0, 10113}, + {42836, 42837, 42836, 0, 0, 9993}, + {42838, 42839, 42838, 0, 0, 10113}, + {42838, 42839, 42838, 0, 0, 9993}, + {42840, 42841, 42840, 0, 0, 10113}, + {42840, 42841, 42840, 0, 0, 9993}, + {42842, 42843, 42842, 0, 0, 10113}, + {42842, 42843, 42842, 0, 0, 9993}, + {42844, 42845, 42844, 0, 0, 10113}, + {42844, 42845, 42844, 0, 0, 9993}, + {42846, 42847, 42846, 0, 0, 10113}, + {42846, 42847, 42846, 0, 0, 9993}, + {42848, 42849, 42848, 0, 0, 10113}, + {42848, 42849, 42848, 0, 0, 9993}, + {42850, 42851, 42850, 0, 0, 10113}, + {42850, 42851, 42850, 0, 0, 9993}, + {42852, 42853, 42852, 0, 0, 10113}, + {42852, 42853, 42852, 0, 0, 9993}, + {42854, 42855, 42854, 0, 0, 10113}, + {42854, 42855, 42854, 0, 0, 9993}, + {42856, 42857, 42856, 0, 0, 10113}, + {42856, 42857, 42856, 0, 0, 9993}, + {42858, 42859, 42858, 0, 0, 10113}, + {42858, 42859, 42858, 0, 0, 9993}, + {42860, 42861, 42860, 0, 0, 10113}, + {42860, 42861, 42860, 0, 0, 9993}, + {42862, 42863, 42862, 0, 0, 10113}, + {42862, 42863, 42862, 0, 0, 9993}, + {42873, 42874, 42873, 0, 0, 10113}, + {42873, 42874, 42873, 0, 0, 9993}, + {42875, 42876, 42875, 0, 0, 10113}, + {42875, 42876, 42875, 0, 0, 9993}, + {42877, 7545, 42877, 0, 0, 10113}, + {42878, 42879, 42878, 0, 0, 10113}, + {42878, 42879, 42878, 0, 0, 9993}, + {42880, 42881, 42880, 0, 0, 10113}, + {42880, 42881, 42880, 0, 0, 9993}, + {42882, 42883, 42882, 0, 0, 10113}, + {42882, 42883, 42882, 0, 0, 9993}, + {42884, 42885, 42884, 0, 0, 10113}, + {42884, 42885, 42884, 0, 0, 9993}, + {42886, 42887, 42886, 0, 0, 10113}, + {42886, 42887, 42886, 0, 0, 9993}, + {42891, 42892, 42891, 0, 0, 10113}, + {42891, 42892, 42891, 0, 0, 9993}, + {42893, 613, 42893, 0, 0, 10113}, + {42896, 42897, 42896, 0, 0, 10113}, + {42896, 42897, 42896, 0, 0, 9993}, + {42912, 42913, 42912, 0, 0, 10113}, + {42912, 42913, 42912, 0, 0, 9993}, + {42914, 42915, 42914, 0, 0, 10113}, + {42914, 42915, 42914, 0, 0, 9993}, + {42916, 42917, 42916, 0, 0, 10113}, + {42916, 42917, 42916, 0, 0, 9993}, + {42918, 42919, 42918, 0, 0, 10113}, + {42918, 42919, 42918, 0, 0, 9993}, + {42920, 42921, 42920, 0, 0, 10113}, + {42920, 42921, 42920, 0, 0, 9993}, + {33554799, 16777582, 33554801, 0, 0, 26377}, + {33554804, 16777587, 33554806, 0, 0, 26377}, + {33554809, 16777592, 33554811, 0, 0, 26377}, + {50332030, 16777597, 50332033, 0, 0, 26377}, + {50332037, 16777604, 50332040, 0, 0, 26377}, + {33554828, 16777611, 33554830, 0, 0, 26377}, + {33554833, 16777616, 33554835, 0, 0, 26377}, + {33554838, 16777621, 33554840, 0, 0, 26377}, + {33554843, 16777626, 33554845, 0, 0, 26377}, + {33554848, 16777631, 33554850, 0, 0, 26377}, + {33554853, 16777636, 33554855, 0, 0, 26377}, + {33554858, 16777641, 33554860, 0, 0, 26377}, {0, 0, 0, 0, 0, 1025}, - {0, 38, 0, 0, 0, 1921}, - {0, 37, 0, 0, 0, 1921}, - {0, 64, 0, 0, 0, 1921}, - {0, 63, 0, 0, 0, 1921}, - {65498, 0, 65498, 0, 0, 1801}, - {65499, 0, 65499, 0, 0, 1801}, - {65505, 0, 65505, 0, 0, 1801}, - {65472, 0, 65472, 0, 0, 1801}, - {65473, 0, 65473, 0, 0, 1801}, - {0, 8, 0, 0, 0, 1921}, - {65474, 0, 65474, 0, 0, 1801}, - {65479, 0, 65479, 0, 0, 1801}, - {0, 0, 0, 0, 0, 1921}, - {65489, 0, 65489, 0, 0, 1801}, - {65482, 0, 65482, 0, 0, 1801}, - {65528, 0, 65528, 0, 0, 1801}, - {65450, 0, 65450, 0, 0, 1801}, - {65456, 0, 65456, 0, 0, 1801}, - {7, 0, 7, 0, 0, 1801}, - {0, 65476, 0, 0, 0, 1921}, - {65440, 0, 65440, 0, 0, 1801}, - {0, 65529, 0, 0, 0, 1921}, - {0, 80, 0, 0, 0, 1921}, - {0, 15, 0, 0, 0, 1921}, - {65521, 0, 65521, 0, 0, 1801}, - {0, 48, 0, 0, 0, 1921}, - {65488, 0, 65488, 0, 0, 1801}, - {0, 0, 0, 0, 0, 1537}, - {0, 7264, 0, 0, 0, 1921}, - {0, 0, 0, 0, 1, 5636}, - {0, 0, 0, 0, 2, 5636}, - {0, 0, 0, 0, 3, 5636}, - {0, 0, 0, 0, 4, 5636}, - {0, 0, 0, 0, 5, 5636}, - {0, 0, 0, 0, 6, 5636}, - {0, 0, 0, 0, 7, 5636}, - {0, 0, 0, 0, 8, 5636}, - {0, 0, 0, 0, 9, 5636}, - {0, 0, 0, 0, 0, 5888}, - {42877, 7545, 42877, 0, 0, 3849}, - {3814, 0, 3814, 0, 0, 1801}, - {65477, 0, 65477, 0, 0, 1801}, - {0, 57921, 0, 0, 0, 1921}, - {8, 0, 8, 0, 0, 1801}, - {0, 65528, 0, 0, 0, 1921}, - {74, 0, 74, 0, 0, 1801}, - {86, 0, 86, 0, 0, 1801}, - {100, 0, 100, 0, 0, 1801}, - {128, 0, 128, 0, 0, 1801}, - {112, 0, 112, 0, 0, 1801}, - {126, 0, 126, 0, 0, 1801}, - {0, 65528, 0, 0, 0, 1857}, - {9, 0, 9, 0, 0, 1801}, - {0, 65462, 0, 0, 0, 1921}, - {0, 65527, 0, 0, 0, 1857}, - {58331, 0, 58331, 0, 0, 1801}, - {0, 65450, 0, 0, 0, 1921}, - {0, 65436, 0, 0, 0, 1921}, - {0, 65424, 0, 0, 0, 1921}, - {0, 65408, 0, 0, 0, 1921}, - {0, 65410, 0, 0, 0, 1921}, - {0, 0, 0, 0, 0, 5124}, - {0, 0, 0, 0, 4, 5124}, - {0, 0, 0, 0, 5, 5124}, - {0, 0, 0, 0, 6, 5124}, - {0, 0, 0, 0, 7, 5124}, - {0, 0, 0, 0, 8, 5124}, - {0, 0, 0, 0, 9, 5124}, - {0, 0, 0, 0, 0, 1792}, - {0, 58019, 0, 0, 0, 1921}, - {0, 57153, 0, 0, 0, 1921}, - {0, 57274, 0, 0, 0, 1921}, - {0, 28, 0, 0, 0, 1921}, - {65508, 0, 65508, 0, 0, 1801}, - {0, 16, 0, 0, 0, 5888}, - {65520, 0, 65520, 0, 0, 5888}, - {0, 26, 0, 0, 0, 1024}, - {65510, 0, 65510, 0, 0, 1024}, - {0, 54793, 0, 0, 0, 1921}, - {0, 61722, 0, 0, 0, 1921}, - {0, 54809, 0, 0, 0, 1921}, - {54741, 0, 54741, 0, 0, 1801}, - {54744, 0, 54744, 0, 0, 1801}, - {0, 54756, 0, 0, 0, 1921}, - {0, 54787, 0, 0, 0, 1921}, - {0, 54753, 0, 0, 0, 1921}, - {0, 54754, 0, 0, 0, 1921}, - {0, 54721, 0, 0, 0, 1921}, - {58272, 0, 58272, 0, 0, 1801}, - {0, 0, 0, 0, 0, 5889}, - {42877, 7545, 42877, 0, 0, 3969}, - {42893, 613, 42893, 0, 0, 3969}, - {0, 40, 0, 0, 0, 1921}, - {65496, 0, 65496, 0, 0, 1801}, + {65313, 65345, 65313, 0, 0, 10113}, + {65314, 65346, 65314, 0, 0, 10113}, + {65315, 65347, 65315, 0, 0, 10113}, + {65316, 65348, 65316, 0, 0, 10113}, + {65317, 65349, 65317, 0, 0, 10113}, + {65318, 65350, 65318, 0, 0, 10113}, + {65319, 65351, 65319, 0, 0, 10113}, + {65320, 65352, 65320, 0, 0, 10113}, + {65321, 65353, 65321, 0, 0, 10113}, + {65322, 65354, 65322, 0, 0, 10113}, + {65323, 65355, 65323, 0, 0, 10113}, + {65324, 65356, 65324, 0, 0, 10113}, + {65325, 65357, 65325, 0, 0, 10113}, + {65326, 65358, 65326, 0, 0, 10113}, + {65327, 65359, 65327, 0, 0, 10113}, + {65328, 65360, 65328, 0, 0, 10113}, + {65329, 65361, 65329, 0, 0, 10113}, + {65330, 65362, 65330, 0, 0, 10113}, + {65331, 65363, 65331, 0, 0, 10113}, + {65332, 65364, 65332, 0, 0, 10113}, + {65333, 65365, 65333, 0, 0, 10113}, + {65334, 65366, 65334, 0, 0, 10113}, + {65335, 65367, 65335, 0, 0, 10113}, + {65336, 65368, 65336, 0, 0, 10113}, + {65337, 65369, 65337, 0, 0, 10113}, + {65338, 65370, 65338, 0, 0, 10113}, + {65313, 65345, 65313, 0, 0, 9993}, + {65314, 65346, 65314, 0, 0, 9993}, + {65315, 65347, 65315, 0, 0, 9993}, + {65316, 65348, 65316, 0, 0, 9993}, + {65317, 65349, 65317, 0, 0, 9993}, + {65318, 65350, 65318, 0, 0, 9993}, + {65319, 65351, 65319, 0, 0, 9993}, + {65320, 65352, 65320, 0, 0, 9993}, + {65321, 65353, 65321, 0, 0, 9993}, + {65322, 65354, 65322, 0, 0, 9993}, + {65323, 65355, 65323, 0, 0, 9993}, + {65324, 65356, 65324, 0, 0, 9993}, + {65325, 65357, 65325, 0, 0, 9993}, + {65326, 65358, 65326, 0, 0, 9993}, + {65327, 65359, 65327, 0, 0, 9993}, + {65328, 65360, 65328, 0, 0, 9993}, + {65329, 65361, 65329, 0, 0, 9993}, + {65330, 65362, 65330, 0, 0, 9993}, + {65331, 65363, 65331, 0, 0, 9993}, + {65332, 65364, 65332, 0, 0, 9993}, + {65333, 65365, 65333, 0, 0, 9993}, + {65334, 65366, 65334, 0, 0, 9993}, + {65335, 65367, 65335, 0, 0, 9993}, + {65336, 65368, 65336, 0, 0, 9993}, + {65337, 65369, 65337, 0, 0, 9993}, + {65338, 65370, 65338, 0, 0, 9993}, + {0, 0, 0, 0, 0, 5633}, + {66560, 66600, 66560, 0, 0, 10113}, + {66561, 66601, 66561, 0, 0, 10113}, + {66562, 66602, 66562, 0, 0, 10113}, + {66563, 66603, 66563, 0, 0, 10113}, + {66564, 66604, 66564, 0, 0, 10113}, + {66565, 66605, 66565, 0, 0, 10113}, + {66566, 66606, 66566, 0, 0, 10113}, + {66567, 66607, 66567, 0, 0, 10113}, + {66568, 66608, 66568, 0, 0, 10113}, + {66569, 66609, 66569, 0, 0, 10113}, + {66570, 66610, 66570, 0, 0, 10113}, + {66571, 66611, 66571, 0, 0, 10113}, + {66572, 66612, 66572, 0, 0, 10113}, + {66573, 66613, 66573, 0, 0, 10113}, + {66574, 66614, 66574, 0, 0, 10113}, + {66575, 66615, 66575, 0, 0, 10113}, + {66576, 66616, 66576, 0, 0, 10113}, + {66577, 66617, 66577, 0, 0, 10113}, + {66578, 66618, 66578, 0, 0, 10113}, + {66579, 66619, 66579, 0, 0, 10113}, + {66580, 66620, 66580, 0, 0, 10113}, + {66581, 66621, 66581, 0, 0, 10113}, + {66582, 66622, 66582, 0, 0, 10113}, + {66583, 66623, 66583, 0, 0, 10113}, + {66584, 66624, 66584, 0, 0, 10113}, + {66585, 66625, 66585, 0, 0, 10113}, + {66586, 66626, 66586, 0, 0, 10113}, + {66587, 66627, 66587, 0, 0, 10113}, + {66588, 66628, 66588, 0, 0, 10113}, + {66589, 66629, 66589, 0, 0, 10113}, + {66590, 66630, 66590, 0, 0, 10113}, + {66591, 66631, 66591, 0, 0, 10113}, + {66592, 66632, 66592, 0, 0, 10113}, + {66593, 66633, 66593, 0, 0, 10113}, + {66594, 66634, 66594, 0, 0, 10113}, + {66595, 66635, 66595, 0, 0, 10113}, + {66596, 66636, 66596, 0, 0, 10113}, + {66597, 66637, 66597, 0, 0, 10113}, + {66598, 66638, 66598, 0, 0, 10113}, + {66599, 66639, 66599, 0, 0, 10113}, + {66560, 66600, 66560, 0, 0, 9993}, + {66561, 66601, 66561, 0, 0, 9993}, + {66562, 66602, 66562, 0, 0, 9993}, + {66563, 66603, 66563, 0, 0, 9993}, + {66564, 66604, 66564, 0, 0, 9993}, + {66565, 66605, 66565, 0, 0, 9993}, + {66566, 66606, 66566, 0, 0, 9993}, + {66567, 66607, 66567, 0, 0, 9993}, + {66568, 66608, 66568, 0, 0, 9993}, + {66569, 66609, 66569, 0, 0, 9993}, + {66570, 66610, 66570, 0, 0, 9993}, + {66571, 66611, 66571, 0, 0, 9993}, + {66572, 66612, 66572, 0, 0, 9993}, + {66573, 66613, 66573, 0, 0, 9993}, + {66574, 66614, 66574, 0, 0, 9993}, + {66575, 66615, 66575, 0, 0, 9993}, + {66576, 66616, 66576, 0, 0, 9993}, + {66577, 66617, 66577, 0, 0, 9993}, + {66578, 66618, 66578, 0, 0, 9993}, + {66579, 66619, 66579, 0, 0, 9993}, + {66580, 66620, 66580, 0, 0, 9993}, + {66581, 66621, 66581, 0, 0, 9993}, + {66582, 66622, 66582, 0, 0, 9993}, + {66583, 66623, 66583, 0, 0, 9993}, + {66584, 66624, 66584, 0, 0, 9993}, + {66585, 66625, 66585, 0, 0, 9993}, + {66586, 66626, 66586, 0, 0, 9993}, + {66587, 66627, 66587, 0, 0, 9993}, + {66588, 66628, 66588, 0, 0, 9993}, + {66589, 66629, 66589, 0, 0, 9993}, + {66590, 66630, 66590, 0, 0, 9993}, + {66591, 66631, 66591, 0, 0, 9993}, + {66592, 66632, 66592, 0, 0, 9993}, + {66593, 66633, 66593, 0, 0, 9993}, + {66594, 66634, 66594, 0, 0, 9993}, + {66595, 66635, 66595, 0, 0, 9993}, + {66596, 66636, 66596, 0, 0, 9993}, + {66597, 66637, 66597, 0, 0, 9993}, + {66598, 66638, 66598, 0, 0, 9993}, + {66599, 66639, 66599, 0, 0, 9993}, +}; + +/* extended case mappings */ + +const Py_UCS4 _PyUnicode_ExtendedCase[] = { + 223, + 83, + 83, + 83, + 115, + 105, + 775, + 304, + 329, + 700, + 78, + 496, + 74, + 780, + 912, + 921, + 776, + 769, + 944, + 933, + 776, + 769, + 1415, + 1333, + 1362, + 1333, + 1410, + 7830, + 72, + 817, + 7831, + 84, + 776, + 7832, + 87, + 778, + 7833, + 89, + 778, + 7834, + 65, + 702, + 8016, + 933, + 787, + 8018, + 933, + 787, + 768, + 8020, + 933, + 787, + 769, + 8022, + 933, + 787, + 834, + 8064, + 7944, + 921, + 8072, + 8065, + 7945, + 921, + 8073, + 8066, + 7946, + 921, + 8074, + 8067, + 7947, + 921, + 8075, + 8068, + 7948, + 921, + 8076, + 8069, + 7949, + 921, + 8077, + 8070, + 7950, + 921, + 8078, + 8071, + 7951, + 921, + 8079, + 8064, + 7944, + 921, + 8072, + 8065, + 7945, + 921, + 8073, + 8066, + 7946, + 921, + 8074, + 8067, + 7947, + 921, + 8075, + 8068, + 7948, + 921, + 8076, + 8069, + 7949, + 921, + 8077, + 8070, + 7950, + 921, + 8078, + 8071, + 7951, + 921, + 8079, + 8080, + 7976, + 921, + 8088, + 8081, + 7977, + 921, + 8089, + 8082, + 7978, + 921, + 8090, + 8083, + 7979, + 921, + 8091, + 8084, + 7980, + 921, + 8092, + 8085, + 7981, + 921, + 8093, + 8086, + 7982, + 921, + 8094, + 8087, + 7983, + 921, + 8095, + 8080, + 7976, + 921, + 8088, + 8081, + 7977, + 921, + 8089, + 8082, + 7978, + 921, + 8090, + 8083, + 7979, + 921, + 8091, + 8084, + 7980, + 921, + 8092, + 8085, + 7981, + 921, + 8093, + 8086, + 7982, + 921, + 8094, + 8087, + 7983, + 921, + 8095, + 8096, + 8040, + 921, + 8104, + 8097, + 8041, + 921, + 8105, + 8098, + 8042, + 921, + 8106, + 8099, + 8043, + 921, + 8107, + 8100, + 8044, + 921, + 8108, + 8101, + 8045, + 921, + 8109, + 8102, + 8046, + 921, + 8110, + 8103, + 8047, + 921, + 8111, + 8096, + 8040, + 921, + 8104, + 8097, + 8041, + 921, + 8105, + 8098, + 8042, + 921, + 8106, + 8099, + 8043, + 921, + 8107, + 8100, + 8044, + 921, + 8108, + 8101, + 8045, + 921, + 8109, + 8102, + 8046, + 921, + 8110, + 8103, + 8047, + 921, + 8111, + 8114, + 8122, + 921, + 8122, + 837, + 8115, + 913, + 921, + 8124, + 8116, + 902, + 921, + 902, + 837, + 8118, + 913, + 834, + 8119, + 913, + 834, + 921, + 913, + 834, + 837, + 8115, + 913, + 921, + 8124, + 8130, + 8138, + 921, + 8138, + 837, + 8131, + 919, + 921, + 8140, + 8132, + 905, + 921, + 905, + 837, + 8134, + 919, + 834, + 8135, + 919, + 834, + 921, + 919, + 834, + 837, + 8131, + 919, + 921, + 8140, + 8146, + 921, + 776, + 768, + 8147, + 921, + 776, + 769, + 8150, + 921, + 834, + 8151, + 921, + 776, + 834, + 8162, + 933, + 776, + 768, + 8163, + 933, + 776, + 769, + 8164, + 929, + 787, + 8166, + 933, + 834, + 8167, + 933, + 776, + 834, + 8178, + 8186, + 921, + 8186, + 837, + 8179, + 937, + 921, + 8188, + 8180, + 911, + 921, + 911, + 837, + 8182, + 937, + 834, + 8183, + 937, + 834, + 921, + 937, + 834, + 837, + 8179, + 937, + 921, + 8188, + 64256, + 70, + 70, + 70, + 102, + 64257, + 70, + 73, + 70, + 105, + 64258, + 70, + 76, + 70, + 108, + 64259, + 70, + 70, + 73, + 70, + 102, + 105, + 64260, + 70, + 70, + 76, + 70, + 102, + 108, + 64261, + 83, + 84, + 83, + 116, + 64262, + 83, + 84, + 83, + 116, + 64275, + 1348, + 1350, + 1348, + 1398, + 64276, + 1348, + 1333, + 1348, + 1381, + 64277, + 1348, + 1339, + 1348, + 1387, + 64278, + 1358, + 1350, + 1358, + 1398, + 64279, + 1348, + 1341, + 1348, + 1389, }; /* type indexes */ @@ -208,59 +2640,59 @@ 34, 34, 34, 103, 34, 34, 34, 34, 34, 34, 105, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 106, 107, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 108, 109, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 110, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 111, 34, 34, 112, 113, 114, 115, 116, 117, 118, 119, 120, - 121, 122, 123, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 110, 111, 34, 34, 34, 34, 34, + 34, 34, 34, 112, 34, 34, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 124, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 127, 128, - 129, 130, 131, 132, 34, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 17, 143, 144, 145, 146, 147, 17, 17, 17, 17, 17, 17, 148, 17, 149, 17, - 150, 17, 151, 17, 152, 17, 17, 17, 153, 17, 17, 17, 154, 155, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 34, 34, 34, 34, 34, 34, 156, 17, 157, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 34, 34, 34, 34, 34, 34, 34, 34, 158, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 34, 34, 34, 34, 159, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 160, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 64, 161, 162, 163, 164, 17, 165, 17, 166, 167, 168, 169, 170, 171, - 172, 173, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 174, 175, 176, - 177, 178, 17, 179, 180, 181, 182, 183, 184, 185, 186, 65, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 187, 188, 189, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 86, 190, 34, 191, - 192, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 128, 129, + 130, 131, 132, 133, 34, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 17, 144, 145, 146, 147, 148, 17, 17, 17, 17, 17, 17, 149, 17, 150, 17, + 151, 17, 152, 17, 153, 17, 17, 17, 154, 17, 17, 17, 155, 156, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 34, 34, 34, 34, 34, 34, 157, 17, 158, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 34, 34, 34, 34, 34, 34, 34, 34, 159, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 34, 34, 34, 34, 160, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 161, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 64, 162, 163, 164, 165, 17, 166, 17, 167, 168, 169, 170, 171, 172, + 173, 174, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 175, 176, 177, + 178, 179, 17, 180, 181, 182, 183, 184, 185, 186, 187, 65, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 188, 189, 190, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 86, 191, 34, 192, + 193, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 193, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 194, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 194, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 195, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 195, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 196, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 196, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 197, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, @@ -268,1594 +2700,1798 @@ 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 197, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, + 34, 34, 34, 34, 34, 198, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 198, 34, 199, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 34, 193, 34, 34, 199, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 200, 17, 201, 202, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 203, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 203, + 34, 34, 199, 34, 200, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 34, 194, 34, 34, 200, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 201, 17, 202, 203, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 204, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 204, }; -static unsigned char index2[] = { +static unsigned short index2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 3, 2, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 5, 5, 5, 5, 5, 5, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 5, 5, 5, 5, 17, 5, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 5, 5, + 1, 1, 1, 1, 3, 3, 3, 2, 4, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 6, 5, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 6, 5, 5, 5, 5, 5, 5, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 5, 5, 5, 6, 43, 6, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 19, 5, 5, - 1, 5, 5, 5, 5, 20, 21, 5, 22, 5, 17, 5, 23, 19, 5, 24, 24, 24, 5, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 5, 16, 16, 16, 16, 16, 16, 16, 19, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 5, - 18, 18, 18, 18, 18, 18, 18, 25, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 28, 29, 26, 27, 26, 27, 26, 27, 19, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 19, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 30, 26, 27, 26, 27, 26, 27, 31, 32, 33, 26, 27, 26, 27, 34, 26, - 27, 35, 35, 26, 27, 19, 36, 37, 38, 26, 27, 35, 39, 40, 41, 42, 26, 27, - 43, 19, 41, 44, 45, 46, 26, 27, 26, 27, 26, 27, 47, 26, 27, 47, 19, 19, - 26, 27, 47, 26, 27, 48, 48, 26, 27, 26, 27, 49, 26, 27, 19, 50, 26, 27, - 19, 51, 50, 50, 50, 50, 52, 53, 54, 52, 53, 54, 52, 53, 54, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 55, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 19, 52, 53, 54, - 26, 27, 56, 57, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 58, 19, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 19, 19, 19, 19, 19, 19, 59, 26, - 27, 60, 61, 62, 62, 26, 27, 63, 64, 65, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 66, 67, 68, 69, 70, 19, 71, 71, 19, 72, 19, 73, 19, 19, 19, 19, - 71, 19, 19, 74, 19, 75, 19, 19, 76, 77, 19, 78, 19, 19, 19, 77, 19, 79, - 80, 19, 19, 81, 19, 19, 19, 19, 19, 19, 19, 82, 19, 19, 83, 19, 19, 83, - 19, 19, 19, 19, 83, 84, 85, 85, 86, 19, 19, 19, 19, 19, 87, 19, 50, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 50, 50, 50, - 50, 50, 5, 5, 5, 5, 5, 5, 5, 50, 5, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 88, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 26, 27, 26, 27, 50, 5, 26, 27, 0, 0, 89, - 45, 45, 45, 5, 0, 0, 0, 0, 0, 5, 5, 90, 17, 91, 91, 91, 0, 92, 0, 93, 93, - 19, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 94, 95, 95, 95, 19, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 96, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 97, 98, 98, 99, 100, 101, 102, 102, 102, 103, - 104, 105, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 106, 107, 108, 19, 109, 110, 5, 26, 27, - 111, 26, 27, 19, 58, 58, 58, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 5, 17, 17, 17, 17, 17, 5, 5, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 113, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 114, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 0, 0, 50, 5, 5, 5, 5, 5, 5, 0, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 19, 0, 5, 5, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 5, 17, 5, 17, 17, 5, 17, 17, 5, 17, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 50, 50, 50, 5, 5, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 5, 0, 0, 5, 5, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 5, 5, 5, 5, 50, 50, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 50, 17, - 17, 17, 17, 17, 17, 17, 1, 5, 17, 17, 17, 17, 17, 17, 50, 50, 17, 17, 5, - 17, 17, 17, 17, 50, 50, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 50, 50, 50, - 5, 5, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 1, 50, 17, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 50, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 50, 50, 5, 5, 5, 5, 50, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, - 17, 17, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 50, 17, 17, 17, 50, 17, - 17, 17, 17, 17, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 17, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 5, 6, 5, 70, 5, 5, + 71, 5, 6, 5, 5, 72, 73, 6, 74, 5, 75, 6, 76, 70, 5, 77, 77, 77, 5, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 5, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 5, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 70, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 70, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 70, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 70, 70, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 70, 321, 322, 323, 70, 324, 321, 321, 321, 321, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, + 413, 414, 415, 416, 417, 70, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 429, 430, 431, 432, 433, 434, 435, 70, 70, 70, 70, 70, 70, 436, + 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, + 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 70, 463, 464, + 70, 465, 70, 466, 70, 70, 70, 70, 467, 70, 70, 468, 70, 469, 70, 70, 470, + 471, 70, 472, 70, 70, 70, 473, 70, 474, 475, 70, 70, 476, 70, 70, 70, 70, + 70, 70, 70, 477, 70, 70, 478, 70, 70, 479, 70, 70, 70, 70, 480, 481, 482, + 483, 484, 70, 70, 70, 70, 70, 485, 70, 321, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 486, 486, 486, 486, 486, 486, 486, 486, 486, 487, 487, 487, 487, + 487, 487, 487, 486, 486, 6, 6, 6, 6, 487, 487, 487, 487, 487, 487, 487, + 487, 487, 487, 487, 487, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 486, + 486, 486, 486, 486, 6, 6, 6, 6, 6, 6, 6, 487, 6, 487, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 488, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 489, 490, 491, 492, 487, + 6, 493, 494, 0, 0, 495, 496, 497, 498, 5, 0, 0, 0, 0, 0, 6, 6, 499, 75, + 500, 501, 502, 0, 503, 0, 504, 505, 506, 507, 508, 509, 510, 511, 512, + 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 0, 524, 525, 526, + 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, + 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, + 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, + 569, 570, 571, 571, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, + 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, + 595, 596, 597, 598, 599, 600, 601, 70, 602, 603, 5, 604, 605, 606, 607, + 608, 70, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, + 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, + 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, + 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, + 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, + 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, + 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, + 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, + 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, + 734, 735, 736, 737, 738, 739, 740, 741, 5, 75, 75, 75, 75, 75, 6, 6, 742, + 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, + 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, + 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, + 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, + 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, + 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, + 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, + 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, + 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, + 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, + 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, + 897, 898, 899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 900, 901, 902, 903, 904, 905, + 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, + 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, + 934, 935, 936, 937, 0, 0, 487, 5, 5, 5, 5, 5, 5, 0, 938, 939, 940, 941, + 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, + 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, + 970, 971, 972, 973, 974, 975, 976, 0, 5, 5, 0, 0, 0, 0, 0, 0, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 5, 75, 5, 75, 75, 5, 75, 75, 5, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 0, 0, 0, 0, 321, 321, 321, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 71, 71, 71, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 5, 0, 0, 5, 5, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 487, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 5, 5, 5, 5, 321, 321, 75, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 321, 75, 75, 75, 75, 75, + 75, 75, 71, 5, 75, 75, 75, 75, 75, 75, 487, 487, 75, 75, 5, 75, 75, 75, + 75, 321, 321, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 321, 321, 321, 5, 5, + 321, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 71, 321, 75, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 487, 487, 5, 5, 5, 5, 487, 0, 0, 0, 0, 0, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 487, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 487, 75, 75, 75, 487, 75, 75, 75, 75, 75, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 75, 75, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 50, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 50, 17, 17, 17, - 17, 17, 17, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 5, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 50, 50, 50, 50, 50, 50, 50, 0, 50, - 50, 50, 50, 50, 50, 50, 0, 17, 17, 17, 0, 50, 50, 50, 50, 50, 50, 50, 50, - 0, 0, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, - 0, 0, 0, 50, 50, 50, 50, 0, 0, 17, 50, 17, 17, 17, 17, 17, 17, 17, 0, 0, - 17, 17, 0, 0, 17, 17, 17, 50, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 50, - 50, 0, 50, 50, 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 50, - 50, 5, 5, 24, 24, 24, 24, 24, 24, 5, 5, 0, 0, 0, 0, 0, 17, 17, 17, 0, 50, - 50, 50, 50, 50, 50, 0, 0, 0, 0, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, - 50, 50, 50, 50, 50, 0, 50, 50, 0, 50, 50, 0, 50, 50, 0, 0, 17, 0, 17, 17, - 17, 17, 17, 0, 0, 0, 0, 17, 17, 0, 0, 17, 17, 17, 0, 0, 0, 17, 0, 0, 0, - 0, 0, 0, 0, 50, 50, 50, 50, 0, 50, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 17, 17, 50, 50, 50, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 17, 17, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 0, 50, 50, 50, - 50, 50, 0, 0, 17, 50, 17, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 0, - 17, 17, 17, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, - 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 50, 50, 50, 50, 50, 50, - 50, 50, 0, 0, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, - 50, 0, 50, 50, 0, 50, 50, 50, 50, 50, 0, 0, 17, 50, 17, 17, 17, 17, 17, - 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, - 0, 0, 0, 0, 50, 50, 0, 50, 50, 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 5, 50, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 17, 50, 0, 50, 50, 50, 50, 50, 50, 0, 0, 0, 50, 50, 50, 0, 50, 50, 50, - 50, 0, 0, 0, 50, 50, 0, 50, 0, 50, 50, 0, 0, 0, 50, 50, 0, 0, 0, 50, 50, - 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, - 17, 17, 17, 17, 17, 0, 0, 0, 17, 17, 17, 0, 17, 17, 17, 17, 0, 0, 50, 0, - 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 24, 24, 24, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, - 0, 0, 17, 17, 17, 0, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, - 50, 50, 50, 0, 0, 0, 50, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 0, - 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 17, 17, 0, 50, 50, 0, 0, 0, 0, 0, 0, - 50, 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 5, 0, 0, 17, 17, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 0, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 0, 0, 17, 50, 17, 17, 17, - 17, 17, 17, 17, 0, 17, 17, 17, 0, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, - 17, 17, 0, 0, 0, 0, 0, 0, 0, 50, 0, 50, 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 0, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 17, 0, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 0, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 0, 50, 17, 17, 17, 17, 17, 17, 17, 0, 17, 17, 17, 0, 17, - 17, 17, 17, 50, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 50, - 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 24, 24, 24, 24, 24, - 24, 0, 0, 0, 5, 50, 50, 50, 50, 50, 50, 0, 0, 17, 17, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 0, 0, 0, 17, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, - 0, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 50, 117, 17, 17, 17, - 17, 17, 17, 17, 0, 0, 0, 0, 5, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, - 17, 17, 17, 17, 17, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 43, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 75, 43, 75, 321, 43, 43, 43, 75, 75, + 75, 75, 75, 75, 75, 75, 43, 43, 43, 43, 75, 43, 43, 321, 75, 75, 75, 75, + 75, 75, 75, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 5, + 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 487, 321, 321, 321, 321, 321, + 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 75, 43, 43, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 0, + 0, 321, 321, 321, 321, 0, 0, 75, 321, 43, 43, 43, 75, 75, 75, 75, 0, 0, + 43, 43, 0, 0, 43, 43, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, + 321, 321, 0, 321, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 321, 321, 5, 5, 77, 77, 77, 77, 77, 77, 5, 5, 0, 0, 0, 0, 0, 75, + 75, 43, 0, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 321, 321, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, + 0, 321, 321, 0, 321, 321, 0, 321, 321, 0, 0, 75, 0, 43, 43, 43, 75, 75, + 0, 0, 0, 0, 75, 75, 0, 0, 75, 75, 75, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, + 321, 321, 321, 321, 0, 321, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 75, 75, 321, 321, 321, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 75, 75, 43, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, + 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, + 321, 321, 0, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 75, 321, 43, 43, + 43, 75, 75, 75, 75, 75, 0, 75, 75, 43, 0, 43, 43, 75, 0, 0, 321, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 43, 43, 0, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, + 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, + 321, 321, 0, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 75, 321, 43, 75, + 43, 75, 75, 75, 75, 0, 0, 43, 43, 0, 0, 43, 43, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 43, 0, 0, 0, 0, 321, 321, 0, 321, 321, 321, 75, 75, 0, 0, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 5, 321, 77, 77, 77, 77, 77, 77, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 75, 321, 0, 321, 321, 321, 321, 321, 321, 0, 0, 0, 321, + 321, 321, 0, 321, 321, 321, 321, 0, 0, 0, 321, 321, 0, 321, 0, 321, 321, + 0, 0, 0, 321, 321, 0, 0, 0, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 43, 43, 75, 43, 43, + 0, 0, 0, 43, 43, 43, 0, 43, 43, 43, 75, 0, 0, 321, 0, 0, 0, 0, 0, 0, 43, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 43, 43, 43, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 0, 321, 75, 75, 75, 43, + 43, 43, 43, 0, 75, 75, 75, 0, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, 0, 75, + 75, 0, 321, 321, 0, 0, 0, 0, 0, 0, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, + 77, 5, 0, 0, 43, 43, 0, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, + 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 75, + 321, 43, 75, 43, 43, 43, 43, 43, 0, 75, 43, 43, 0, 43, 43, 75, 75, 0, 0, + 0, 0, 0, 0, 0, 43, 43, 0, 0, 0, 0, 0, 0, 0, 321, 0, 321, 321, 75, 75, 0, + 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 321, 321, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 0, 0, 321, 43, 43, 43, 75, 75, 75, 75, 0, 43, 43, 43, + 0, 43, 43, 43, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, + 0, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 77, 77, + 77, 77, 77, 77, 0, 0, 0, 5, 321, 321, 321, 321, 321, 321, 0, 0, 43, 43, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 0, 0, 0, 75, 0, 0, 0, 0, 43, 43, 43, 75, + 75, 75, 0, 75, 0, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 321, 977, 75, 75, 75, 75, 75, 75, 75, + 0, 0, 0, 0, 5, 321, 321, 321, 321, 321, 321, 487, 75, 75, 75, 75, 75, 75, + 75, 75, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, 50, 0, 0, 50, 50, 0, 50, 0, 0, - 50, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, - 50, 50, 50, 0, 50, 0, 50, 0, 0, 50, 50, 0, 50, 50, 50, 50, 17, 50, 117, - 17, 17, 17, 17, 17, 17, 0, 17, 17, 50, 0, 0, 50, 50, 50, 50, 50, 0, 50, - 0, 17, 17, 17, 17, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, - 0, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, 5, 5, 5, 5, 5, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 5, 17, - 5, 17, 5, 17, 5, 5, 5, 5, 17, 17, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, - 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 5, 17, 17, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 0, 5, 5, 5, 5, 5, 5, 5, 5, 17, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 321, 321, 0, 321, 0, 0, 321, 321, 0, 321, 0, 0, 321, + 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, + 321, 0, 321, 321, 321, 0, 321, 0, 321, 0, 0, 321, 321, 0, 321, 321, 321, + 321, 75, 321, 977, 75, 75, 75, 75, 75, 75, 0, 75, 75, 321, 0, 0, 321, + 321, 321, 321, 321, 0, 487, 0, 75, 75, 75, 75, 75, 75, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 0, 0, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, + 75, 5, 5, 5, 5, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 5, 75, 5, 75, 5, 75, 5, 5, 5, 5, 43, 43, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 0, 0, 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 43, 75, 75, 75, 75, 75, 5, 75, 75, 321, 321, 321, 321, 321, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 5, 5, 5, 5, 5, 5, 5, 5, 75, 5, 5, + 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 43, 43, 75, 75, 75, 75, 43, 75, 75, 75, 75, 75, + 75, 43, 75, 75, 43, 43, 75, 75, 321, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 5, 5, 5, 5, 5, 5, 321, 321, 321, 321, 321, 321, 43, 43, 75, 75, 321, 321, + 321, 321, 75, 75, 75, 321, 43, 43, 43, 321, 321, 43, 43, 43, 43, 43, 43, + 43, 321, 321, 321, 75, 75, 75, 75, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 43, 43, 75, 75, 43, 43, 43, 43, 43, 43, + 75, 321, 43, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 43, 43, 43, 75, 5, 5, + 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, + 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, + 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 5, 487, 0, 0, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, + 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 321, + 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 0, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, + 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 321, + 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 0, 0, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 75, 75, 75, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 0, 0, 0, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 2, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, + 5, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 5, 5, 5, 1025, 1025, 1025, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 75, 75, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 5, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, + 321, 321, 0, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 71, 71, 43, 75, 75, 75, 75, 75, 75, + 75, 43, 43, 43, 43, 43, 43, 43, 43, 75, 43, 43, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 5, 5, 5, 487, 5, 5, 5, 5, 321, 75, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, 75, 75, 2, + 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 487, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 75, 321, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 0, 0, 75, 75, 75, 43, 43, 43, 43, 75, 75, 43, 43, 43, 0, 0, 0, 0, + 43, 43, 75, 43, 43, 43, 43, 43, 43, 75, 75, 75, 0, 0, 0, 0, 5, 0, 0, 0, + 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, + 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 321, 321, 321, + 321, 321, 321, 321, 43, 43, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 1016, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 75, 43, 43, 43, 0, 0, 5, 5, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 43, 75, 43, 75, 75, 75, 75, + 75, 75, 75, 0, 75, 43, 75, 43, 43, 75, 75, 75, 75, 75, 75, 75, 75, 43, + 43, 43, 43, 43, 43, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 75, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 487, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 43, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 75, 43, 75, 75, 75, 75, 75, 43, 75, 43, 43, 43, 43, 43, 75, 43, + 43, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 75, + 75, 43, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 43, 75, 75, 75, 75, 43, 43, 75, 75, 43, 0, 0, 0, 321, 321, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 75, 43, 75, 75, 43, 43, 43, 75, 43, + 75, 75, 75, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 43, 43, 43, 43, 43, 43, 43, 43, 75, 75, 75, 75, + 75, 75, 75, 75, 43, 43, 75, 75, 0, 0, 0, 5, 5, 5, 5, 5, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 0, 0, 0, 321, 321, 321, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 487, 487, 487, 487, 487, 487, 5, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 75, 75, 75, 5, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 43, + 75, 75, 75, 75, 75, 75, 75, 321, 321, 321, 321, 75, 321, 321, 321, 321, + 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, + 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, + 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, + 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 486, 1026, 70, 70, 70, 1027, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, + 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, + 486, 486, 486, 486, 486, 486, 486, 486, 486, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 1028, 1029, + 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, + 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, + 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, + 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, + 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, + 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, + 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, + 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, + 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, + 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, + 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, + 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, + 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 70, 70, 1184, + 70, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, + 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, + 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, + 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, + 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, + 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, + 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, + 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, + 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, + 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 0, 0, + 1303, 1304, 1305, 1306, 1307, 1308, 0, 0, 1309, 1310, 1311, 1312, 1313, + 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, + 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, + 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 1347, 1348, + 1349, 1350, 1351, 1352, 0, 0, 1353, 1354, 1355, 1356, 1357, 1358, 1359, + 1360, 0, 1361, 0, 1362, 0, 1363, 0, 1364, 1365, 1366, 1367, 1368, 1369, + 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, + 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, + 1394, 0, 0, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, + 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, + 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, + 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, + 1441, 1442, 1443, 1444, 1445, 1446, 1447, 0, 1448, 1449, 1450, 1451, + 1452, 1453, 1454, 6, 1455, 6, 6, 6, 1456, 1457, 1458, 0, 1459, 1460, + 1461, 1462, 1463, 1464, 1465, 6, 6, 6, 1466, 1467, 1468, 1469, 0, 0, + 1470, 1471, 1472, 1473, 1474, 1475, 0, 6, 6, 6, 1476, 1477, 1478, 1479, + 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 6, 6, 6, 0, 0, + 1489, 1490, 1491, 0, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 6, 6, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71, 71, 71, 71, 71, 5, 5, 5, 5, 5, 5, 5, + 5, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 3, 3, 71, 71, 71, 71, + 71, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 43, 43, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 43, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 2, 71, 71, 71, 71, 71, 0, 0, 0, 0, 0, 71, 71, 71, 71, 71, 71, 1499, + 487, 0, 0, 1500, 1501, 1502, 1503, 1504, 1505, 5, 5, 5, 5, 5, 487, 1499, + 76, 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 5, 5, 5, 5, 5, 0, 486, + 486, 486, 486, 486, 487, 487, 487, 487, 487, 487, 487, 487, 0, 0, 0, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 6, 6, 6, 6, 75, 6, 6, 6, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 5, 571, 5, 5, 5, 5, 571, 5, 5, 70, 571, 571, 571, + 70, 70, 571, 571, 571, 70, 5, 571, 5, 5, 1506, 571, 571, 571, 571, 571, + 5, 5, 5, 5, 5, 5, 571, 5, 1507, 5, 571, 5, 1508, 1509, 571, 571, 1506, + 70, 571, 571, 1510, 571, 70, 321, 321, 321, 321, 70, 5, 5, 70, 70, 571, + 571, 5, 5, 5, 5, 5, 571, 70, 70, 70, 70, 5, 5, 5, 5, 1511, 5, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 1512, 1513, 1514, + 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, + 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, + 1539, 1540, 1541, 1542, 1543, 1025, 1025, 1025, 1544, 1545, 1025, 1025, + 1025, 1025, 77, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 72, 73, + 1500, 1501, 1502, 1503, 1504, 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 76, 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 76, 72, 73, 1500, 1501, 1502, 1503, 1504, + 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1546, 1547, 1548, + 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, + 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, + 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, + 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, + 1597, 1499, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 76, 72, 73, 1500, + 1501, 1502, 1503, 1504, 1505, 77, 1499, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 76, 72, 73, 1500, 1501, 1502, 1503, + 1504, 1505, 77, 76, 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 77, 76, + 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 77, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, + 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1598, 1599, 1600, 1601, 1602, 1603, + 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, + 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, + 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, + 1640, 1641, 1642, 1643, 1644, 0, 1645, 1646, 1647, 1648, 1649, 1650, + 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, + 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, + 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, + 1687, 1688, 1689, 1690, 1691, 0, 1692, 1693, 1694, 1695, 1696, 1697, + 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 70, + 1709, 1710, 70, 1711, 1712, 70, 70, 70, 70, 70, 70, 486, 1713, 1714, + 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, + 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, + 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, + 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, + 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, + 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, + 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, + 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, + 1811, 1812, 1813, 1814, 70, 5, 5, 5, 5, 5, 5, 1815, 1816, 1817, 1818, 75, + 75, 75, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 77, 5, 5, 1819, 1820, 1821, + 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, + 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, + 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 487, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 75, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, + 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, + 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, + 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, + 321, 321, 321, 321, 321, 321, 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 1857, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 0, 2, 5, 5, 5, 5, 487, 321, 1025, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 75, 75, 75, 75, 75, 75, 5, 487, 487, + 487, 487, 487, 5, 5, 1025, 1025, 1025, 487, 321, 5, 5, 5, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, + 0, 75, 75, 6, 6, 487, 487, 321, 5, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 487, + 487, 487, 321, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 0, 5, 5, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 0, 321, 321, 321, 321, 321, 1858, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1858, 321, + 321, 1858, 321, 321, 321, 1858, 321, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, + 321, 321, 321, 321, 321, 321, 1858, 321, 1858, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 1858, 1858, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, + 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 1858, + 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 1858, 321, 1858, 1858, 1858, 321, 321, 321, 321, 321, 321, 1858, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 1858, 1858, 1858, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 1858, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 1858, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 1858, 1858, 1858, 321, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 50, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 5, 5, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 50, 50, - 50, 50, 17, 17, 17, 50, 17, 17, 17, 50, 50, 17, 17, 17, 17, 17, 17, 17, - 50, 50, 50, 17, 17, 17, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 50, 17, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 17, 17, 17, 17, 5, 5, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 5, 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 0, 0, 50, 50, - 50, 50, 50, 50, 50, 0, 50, 0, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 0, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, - 0, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 17, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 119, 120, 121, 122, 123, 124, 125, 126, 127, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 2, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 0, 0, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 5, 5, 5, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, - 50, 50, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 5, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 0, 17, 17, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 1, 1, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 5, 5, 5, 50, 5, 5, 5, 5, 50, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, - 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, 17, 2, 0, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 17, 50, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 0, 0, 0, 0, 5, 0, 0, 0, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 119, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 17, 17, 17, 17, 17, 0, 0, 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 17, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, - 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 50, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 487, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 487, 487, 487, 487, 487, 487, 5, 5, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 487, 5, 5, 5, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, + 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, + 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, + 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, + 1904, 321, 75, 6, 6, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 5, 487, 1905, + 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, + 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 0, 0, + 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 75, 75, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 487, 487, 487, 487, + 487, 487, 487, 487, 487, 6, 6, 1929, 1930, 1931, 1932, 1933, 1934, 1935, + 1936, 1937, 1938, 1939, 1940, 1941, 1942, 70, 70, 1943, 1944, 1945, 1946, + 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, + 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, + 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, + 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, + 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 486, 70, 70, + 70, 70, 70, 70, 70, 70, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, + 2013, 2014, 2015, 2016, 2017, 2018, 2019, 487, 6, 6, 2020, 2021, 2022, + 70, 0, 2023, 2024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2025, 2026, + 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 17, 17, 17, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 0, 0, 0, 50, 50, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, - 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 5, 5, 5, 5, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 50, 50, 50, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 70, 321, 321, 321, 321, 321, 321, 321, 75, 321, 321, 321, 75, 321, 321, + 321, 321, 75, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 43, 43, 75, 75, + 43, 5, 5, 5, 5, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 0, 0, 0, + 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 43, 43, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, + 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 321, 321, 321, 321, 321, 321, 5, 5, 5, 321, 0, 0, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, 5, 5, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 75, 75, 75, 43, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 75, 43, 43, 75, 75, 75, 75, 43, 43, 75, 43, 43, + 43, 43, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 487, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, + 75, 75, 43, 43, 75, 75, 43, 43, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 321, 321, 75, 321, 321, 321, 321, 321, 321, 321, 321, 75, 43, 0, 0, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 5, 5, 5, 5, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 487, 321, 321, + 321, 321, 321, 321, 5, 5, 5, 321, 43, 0, 0, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 75, 321, 75, 75, 75, 321, 321, 75, 75, 321, 321, 321, 321, 321, + 75, 75, 321, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 321, 321, 487, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 0, 0, 321, + 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 5, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 50, 50, 50, 50, 17, 50, 50, 50, 50, 17, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 50, 129, - 19, 19, 19, 130, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, - 17, 17, 17, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 19, 19, 19, 19, 19, 131, 19, 19, 132, - 19, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 133, 133, 133, 133, 133, 133, 133, 133, 134, - 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 0, 0, - 134, 134, 134, 134, 134, 134, 0, 0, 133, 133, 133, 133, 133, 133, 133, - 133, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, - 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, - 133, 133, 133, 0, 0, 134, 134, 134, 134, 134, 134, 0, 0, 19, 133, 19, - 133, 19, 133, 19, 133, 0, 134, 0, 134, 0, 134, 0, 134, 133, 133, 133, - 133, 133, 133, 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, 135, - 135, 136, 136, 136, 136, 137, 137, 138, 138, 139, 139, 140, 140, 0, 0, - 133, 133, 133, 133, 133, 133, 133, 133, 141, 141, 141, 141, 141, 141, - 141, 141, 133, 133, 133, 133, 133, 133, 133, 133, 141, 141, 141, 141, - 141, 141, 141, 141, 133, 133, 133, 133, 133, 133, 133, 133, 141, 141, - 141, 141, 141, 141, 141, 141, 133, 133, 19, 142, 19, 0, 19, 19, 134, 134, - 143, 143, 144, 5, 145, 5, 5, 5, 19, 142, 19, 0, 19, 19, 146, 146, 146, - 146, 144, 5, 5, 5, 133, 133, 19, 19, 0, 0, 19, 19, 134, 134, 147, 147, 0, - 5, 5, 5, 133, 133, 19, 19, 19, 108, 19, 19, 134, 134, 148, 148, 111, 5, - 5, 5, 0, 0, 19, 142, 19, 0, 19, 19, 149, 149, 150, 150, 144, 5, 5, 0, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 1, 1, 1, 1, 1, 2, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 151, 50, 0, 0, 152, 153, - 154, 155, 156, 157, 5, 5, 5, 5, 5, 50, 151, 23, 20, 21, 152, 153, 154, - 155, 156, 157, 5, 5, 5, 5, 5, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 5, 5, 5, 5, 17, 5, 5, 5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 102, 5, 5, 5, 5, 102, - 5, 5, 19, 102, 102, 102, 19, 19, 102, 102, 102, 19, 5, 102, 5, 5, 158, - 102, 102, 102, 102, 102, 5, 5, 5, 5, 5, 5, 102, 5, 159, 5, 102, 5, 160, - 161, 102, 102, 158, 19, 102, 102, 162, 102, 19, 50, 50, 50, 50, 19, 5, 5, - 19, 19, 102, 102, 5, 5, 5, 5, 5, 102, 19, 19, 19, 19, 5, 5, 5, 5, 163, 5, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 128, 128, 128, 26, 27, 128, 128, 128, 128, 24, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 43, 43, 75, 43, 43, 75, 43, 43, 5, 43, 75, 0, 0, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, + 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 1858, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 1858, 321, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2035, 2036, 2037, 2038, + 2039, 2040, 2041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2042, 2043, 2044, + 2045, 2046, 0, 0, 0, 0, 0, 321, 75, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 0, 321, 321, 321, 321, 321, 0, 321, 0, 321, 321, 0, 321, 321, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 2047, + 2047, 2047, 2047, 2047, 2047, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 2047, 2047, 5, 5, 0, 0, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 43, 43, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 43, 43, 43, 5, 5, 6, 0, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 0, 0, 0, 0, 2047, 321, 2047, 321, + 2047, 0, 2047, 321, 2047, 321, 2047, 321, 2047, 321, 2047, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 71, 0, 5, 5, + 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 6, 5, 5, 5, 5, 5, 5, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, + 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, + 2068, 2069, 2070, 2071, 2072, 2073, 5, 5, 5, 6, 43, 6, 2074, 2075, 2076, + 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, + 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 487, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 2100, 2100, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, + 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, + 321, 321, 321, 0, 0, 321, 321, 321, 0, 0, 0, 5, 5, 5, 6, 5, 5, 5, 0, 5, + 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 71, 71, 5, 5, 0, 0, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 0, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 5, 5, 5, 0, + 0, 0, 0, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 75, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 0, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 1025, 321, 321, 321, 321, 321, 321, 321, 321, 1025, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 0, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 321, 5, 1025, 1025, 1025, 1025, 1025, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2101, 2102, 2103, 2104, + 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, + 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, + 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, + 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, + 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, + 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, + 2177, 2178, 2179, 2180, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 321, 321, 321, 321, 321, 321, 0, 0, 321, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 0, 0, 0, + 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 5, 77, 77, 77, + 77, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 77, 77, 77, 77, 77, 77, 0, 0, 0, 5, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 75, 75, 75, 0, 75, 75, 0, 0, 0, 0, 0, 75, + 75, 75, 75, 321, 321, 321, 321, 0, 321, 321, 321, 0, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 75, 75, 75, 0, + 0, 0, 0, 75, 76, 72, 73, 1500, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 77, 77, 5, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 5, 5, 5, 5, 5, + 5, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 77, 77, 77, 77, 77, + 77, 77, 77, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, + 77, 77, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 72, 73, 1500, 1501, 1502, + 1503, 1504, 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 0, 43, 75, 43, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 76, 72, 73, 1500, 1501, + 1502, 1503, 1504, 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 75, 75, 43, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 43, 43, 43, 75, 75, 75, 75, 43, 43, 75, 75, + 5, 5, 71, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1506, 1506, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1506, 1506, 1025, 1025, + 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 20, 21, 152, 153, 154, 155, 156, 157, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 20, 21, 152, 153, 154, 155, - 156, 157, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 20, 21, 152, - 153, 154, 155, 156, 157, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, - 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, 151, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 23, 20, 21, 152, 153, 154, 155, 156, 157, 24, - 151, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, - 20, 21, 152, 153, 154, 155, 156, 157, 24, 23, 20, 21, 152, 153, 154, 155, - 156, 157, 24, 23, 20, 21, 152, 153, 154, 155, 156, 157, 24, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 0, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 0, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 0, 26, 27, 168, 169, 170, 171, 172, 26, 27, 26, - 27, 26, 27, 173, 174, 175, 176, 19, 26, 27, 19, 26, 27, 19, 19, 19, 19, - 19, 19, 50, 177, 177, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 19, 5, 5, 5, - 5, 5, 5, 26, 27, 26, 27, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 24, - 5, 5, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, - 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, - 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, - 50, 50, 50, 50, 50, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 89, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, - 0, 0, 2, 5, 5, 5, 5, 50, 50, 128, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 17, 17, 17, 17, 17, 17, 5, 50, 50, 50, 50, 50, 5, 5, 128, 128, - 128, 50, 50, 5, 5, 5, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 0, 0, 17, 17, 5, 5, 50, 50, 50, 5, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 50, 50, 50, 50, 0, 0, 0, - 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 5, 5, 24, 24, 24, 24, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, - 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 179, 50, 50, 179, - 50, 50, 50, 179, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, - 179, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 179, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 179, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 179, - 179, 179, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 179, 179, 179, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 179, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 179, 179, 50, 179, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 50, 17, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 17, 17, 5, 50, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, - 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 0, 0, 0, 0, 0, 0, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 17, 17, 5, 5, 5, 5, 5, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 19, 19, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 50, 19, 19, 19, 19, 19, 19, 19, 19, 26, 27, 26, 27, 180, 26, 27, - 26, 27, 26, 27, 26, 27, 26, 27, 50, 5, 5, 26, 27, 181, 19, 0, 26, 27, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 26, 27, 26, 27, 26, 27, - 26, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 50, 50, 50, 50, 50, 50, 50, 17, 50, 50, - 50, 17, 50, 50, 50, 50, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 5, 5, - 5, 5, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 5, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 50, 50, 50, 50, 50, 50, 5, 5, 5, 50, 0, 0, 0, - 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 5, 5, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 17, 17, 17, 17, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 50, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 17, 50, 50, 50, 50, 50, - 50, 50, 50, 17, 17, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 5, 5, - 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 5, 5, 5, 50, 17, 0, 0, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 17, 50, 17, 17, 17, 50, 50, 17, 17, 50, 50, - 50, 50, 50, 17, 17, 50, 17, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, - 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 0, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 5, 17, 17, 0, 0, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, - 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 179, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, 19, - 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, 19, 0, 0, 0, 0, - 0, 50, 17, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 0, 50, 0, 50, 50, - 0, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 89, 89, 89, 89, 89, 89, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 89, 89, 5, 5, 0, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 17, - 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 17, 17, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, - 17, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 0, 5, 5, 5, 5, 0, 0, 0, 0, 89, 50, 89, 50, 89, 0, 89, 50, 89, 50, 89, 50, - 89, 50, 89, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 0, 0, 1, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 5, 5, 5, 5, 5, 5, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 5, 5, 5, 5, 17, 5, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 117, 117, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, - 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, 0, 0, 0, 5, - 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 5, 5, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 5, 5, 5, 0, 0, - 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 24, 24, 24, 24, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 24, 0, 0, 0, 0, 0, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 0, 0, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 24, 24, 24, 24, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 128, 50, 50, 50, 50, 50, 50, 50, 50, 128, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 5, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, - 0, 50, 50, 50, 50, 50, 50, 50, 50, 5, 128, 128, 128, 128, 128, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 183, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, - 50, 50, 0, 0, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 50, 50, 0, 0, 0, - 50, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 5, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 24, 24, 24, 24, 24, 24, 0, 0, 0, 5, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 50, 17, 17, 17, 0, 17, 17, 0, 0, 0, 0, 0, 17, 17, - 17, 17, 50, 50, 50, 50, 0, 50, 50, 50, 0, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 0, 0, 0, 0, 17, 17, 17, 0, 0, 0, 0, 17, 23, 20, 21, 152, 24, 24, 24, - 24, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, - 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 24, 24, 5, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 5, - 5, 5, 5, 5, 5, 5, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 20, 21, 152, 153, 154, 155, 156, 157, 24, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 17, 17, 17, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 5, 5, 5, 5, 5, 5, - 5, 0, 0, 0, 0, 23, 20, 21, 152, 153, 154, 155, 156, 157, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 5, 5, 1, 5, - 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 158, 158, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 158, 158, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, 17, 17, 17, - 5, 5, 5, 17, 17, 17, 17, 17, 17, 1, 1, 1, 1, 1, 1, 1, 1, 17, 17, 17, 17, - 17, 17, 17, 17, 5, 5, 17, 17, 17, 17, 17, 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 17, 17, - 17, 17, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 43, 43, 75, 75, 75, 5, 5, 5, 43, + 43, 43, 43, 43, 43, 71, 71, 71, 71, 71, 71, 71, 71, 75, 75, 75, 75, 75, + 75, 75, 75, 5, 5, 75, 75, 75, 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, 75, + 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 17, 17, 17, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 75, 75, 75, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 19, 19, 19, 19, 19, 19, 19, 0, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 102, 0, 102, 102, 0, 0, 102, 0, 0, 102, 102, 0, 0, - 102, 102, 102, 102, 0, 102, 102, 102, 102, 102, 102, 102, 102, 19, 19, - 19, 19, 0, 19, 0, 19, 19, 19, 19, 19, 19, 19, 0, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, 102, 0, 102, 102, 102, 102, - 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 0, 102, 102, 102, 102, 102, - 102, 102, 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, 102, 0, 102, 102, 102, - 102, 0, 102, 102, 102, 102, 102, 0, 102, 0, 0, 0, 102, 102, 102, 102, - 102, 102, 102, 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 5, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 5, 19, 19, 19, 19, 19, 19, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 5, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 5, 19, 19, 19, 19, 19, 19, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 5, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 5, 19, 19, 19, 19, - 19, 19, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 5, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 5, 19, 19, 19, 19, 19, 19, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 5, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 5, 19, 19, - 19, 19, 19, 19, 102, 19, 0, 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 0, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 571, 0, 571, 571, 0, 0, 571, 0, 0, 571, 571, 0, 0, + 571, 571, 571, 571, 0, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, + 70, 70, 0, 70, 0, 70, 70, 70, 70, 70, 70, 70, 0, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 0, 571, 571, 571, 571, + 0, 0, 571, 571, 571, 571, 571, 571, 571, 571, 0, 571, 571, 571, 571, 571, + 571, 571, 0, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 0, 571, 571, 571, + 571, 0, 571, 571, 571, 571, 571, 0, 571, 0, 0, 0, 571, 571, 571, 571, + 571, 571, 571, 0, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 0, 0, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 5, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 5, 70, 70, 70, 70, 70, 70, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 5, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 5, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 5, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 5, 70, 70, 70, 70, + 70, 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 5, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 5, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, + 571, 571, 571, 571, 571, 571, 5, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 5, 70, 70, + 70, 70, 70, 70, 571, 70, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, @@ -1866,181 +4502,206 @@ 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 151, 151, 23, 20, 21, 152, 153, - 154, 155, 156, 157, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1499, 1499, 76, 72, 73, 1500, + 1501, 1502, 1503, 1504, 1505, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, - 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 5, + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 0, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, + 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 0, 5, 0, 5, + 0, 5, 0, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 0, 5, 0, 0, 5, + 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, - 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 0, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, - 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 1858, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 1858, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, + 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 0, 5, 0, 5, 0, 5, 0, 5, - 5, 5, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 0, 5, 0, 0, 5, 5, 5, 5, 0, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, - 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 179, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 179, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, }; /* Returns the numeric value as double for Unicode characters diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -22,6 +22,7 @@ # 2006-03-10 mvl update to Unicode 4.1; add UCD 3.2 delta # 2008-06-11 gb add PRINTABLE_MASK for Atsuo Ishimoto's ascii() patch # 2011-10-21 ezio add support for name aliases and named sequences +# 2012-01 benjamin add full case mappings # # written by Fredrik Lundh (fredrik at pythonware.com) # @@ -47,6 +48,7 @@ LINE_BREAK = "LineBreak%s.txt" NAME_ALIASES = "NameAliases%s.txt" NAMED_SEQUENCES = "NamedSequences%s.txt" +SPECIAL_CASING = "SpecialCasing%s.txt" # Private Use Areas -- in planes 1, 15, 16 PUA_1 = range(0xE000, 0xF900) @@ -84,8 +86,10 @@ XID_START_MASK = 0x100 XID_CONTINUE_MASK = 0x200 PRINTABLE_MASK = 0x400 -NODELTA_MASK = 0x800 -NUMERIC_MASK = 0x1000 +NUMERIC_MASK = 0x800 +CASE_IGNORABLE_MASK = 0x1000 +CASED_MASK = 0x2000 +EXTENDED_CASE_MASK = 0x4000 # these ranges need to match unicodedata.c:is_unified_ideograph cjk_ranges = [ @@ -384,6 +388,7 @@ numeric = {} spaces = [] linebreaks = [] + extra_casing = [] for char in unicode.chars: record = unicode.table[char] @@ -396,7 +401,7 @@ delta = True if category in ["Lm", "Lt", "Lu", "Ll", "Lo"]: flags |= ALPHA_MASK - if category == "Ll": + if "Lowercase" in properties: flags |= LOWER_MASK if 'Line_Break' in properties or bidirectional == "B": flags |= LINEBREAK_MASK @@ -406,7 +411,7 @@ spaces.append(char) if category == "Lt": flags |= TITLE_MASK - if category == "Lu": + if "Uppercase" in properties: flags |= UPPER_MASK if char == ord(" ") or category[0] not in ("C", "Z"): flags |= PRINTABLE_MASK @@ -414,35 +419,41 @@ flags |= XID_START_MASK if "XID_Continue" in properties: flags |= XID_CONTINUE_MASK - # use delta predictor for upper/lower/title if it fits - if record[12]: - upper = int(record[12], 16) + if "Cased" in properties: + flags |= CASED_MASK + if "Case_Ignorable" in properties: + flags |= CASE_IGNORABLE_MASK + sc = unicode.special_casing.get(char) + if sc is None: + if record[12]: + upper = int(record[12], 16) + else: + upper = char + if record[13]: + lower = int(record[13], 16) + else: + lower = char + if record[14]: + title = int(record[14], 16) + else: + title = upper + if upper == lower == title: + upper = lower = title = 0 else: - upper = char - if record[13]: - lower = int(record[13], 16) - else: - lower = char - if record[14]: - title = int(record[14], 16) - else: - # UCD.html says that a missing title char means that - # it defaults to the uppercase character, not to the - # character itself. Apparently, in the current UCD (5.x) - # this feature is never used - title = upper - upper_d = upper - char - lower_d = lower - char - title_d = title - char - if -32768 <= upper_d <= 32767 and \ - -32768 <= lower_d <= 32767 and \ - -32768 <= title_d <= 32767: - # use deltas - upper = upper_d & 0xffff - lower = lower_d & 0xffff - title = title_d & 0xffff - else: - flags |= NODELTA_MASK + # This happens when some character maps to more than one + # character in uppercase, lowercase, or titlecase. The extra + # characters are stored in a different array. + flags |= EXTENDED_CASE_MASK + lower = len(extra_casing) | (len(sc[0]) << 24) + extra_casing.extend(sc[0]) + upper = len(extra_casing) | (len(sc[2]) << 24) + extra_casing.extend(sc[2]) + # Title is probably equal to upper. + if sc[1] == sc[2]: + title = upper + else: + title = len(extra_casing) | (len(sc[1]) << 24) + extra_casing.extend(sc[1]) # decimal digit, integer digit decimal = 0 if record[6]: @@ -469,6 +480,7 @@ print(sum(map(len, numeric.values())), "numeric code points") print(len(spaces), "whitespace code points") print(len(linebreaks), "linebreak code points") + print(len(extra_casing), "extended case array") print("--- Writing", FILE, "...") @@ -482,6 +494,14 @@ print("};", file=fp) print(file=fp) + print("/* extended case mappings */", file=fp) + print(file=fp) + print("const Py_UCS4 _PyUnicode_ExtendedCase[] = {", file=fp) + for c in extra_casing: + print(" %d," % c, file=fp) + print("};", file=fp) + print(file=fp) + # split decomposition index table index1, index2, shift = splitbins(index, trace) @@ -1070,6 +1090,23 @@ # Patch the numeric field if table[i] is not None: table[i][8] = value + sc = self.special_casing = {} + with open_data(SPECIAL_CASING, version) as file: + for s in file: + s = s[:-1].split('#', 1)[0] + if not s: + continue + data = s.split("; ") + if data[4]: + # We ignore all conditionals (since they depend on + # languages) except for one, which is hardcoded. See + # handle_capital_sigma in unicodeobject.c. + continue + c = int(data[0], 16) + lower = [int(char, 16) for char in data[1].split()] + title = [int(char, 16) for char in data[2].split()] + upper = [int(char, 16) for char in data[3].split()] + sc[c] = (lower, title, upper) def uselatin1(self): # restrict character range to ISO Latin 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 00:17:46 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 00:17:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/2db3ca05fbb7 changeset: 74339:2db3ca05fbb7 parent: 74338:f7e05d205a52 parent: 74337:7568134ac6cf user: Benjamin Peterson date: Wed Jan 11 18:17:40 2012 -0500 summary: merge heads files: Doc/library/functions.rst | 4 +++- Doc/library/stdtypes.rst | 8 ++++---- Doc/tutorial/classes.rst | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -959,7 +959,9 @@ *end*. The *file* argument must be an object with a ``write(string)`` method; if it - is not present or ``None``, :data:`sys.stdout` will be used. + is not present or ``None``, :data:`sys.stdout` will be used. Output buffering + is determined by *file*. Use ``sys.stdout.flush()`` to ensure immediate + appearance on a screen. .. function:: property(fget=None, fset=None, fdel=None, doc=None) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1193,7 +1193,7 @@ Return a string which is the concatenation of the strings in the :term:`iterable` *iterable*. A :exc:`TypeError` will be raised if there are - any non-string values in *seq*, including :class:`bytes` objects. The + any non-string values in *iterable*, including :class:`bytes` objects. The separator between elements is the string providing this method. @@ -1201,7 +1201,7 @@ Return the string left justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. method:: str.lower() @@ -1270,7 +1270,7 @@ Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. method:: str.rpartition(sep) @@ -1419,7 +1419,7 @@ Return the numeric string left filled with zeros in a string of length *width*. A sign prefix is handled correctly. The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -458,8 +458,8 @@ self.add(x) Methods may reference global names in the same way as ordinary functions. The -global scope associated with a method is the module containing the class -definition. (The class itself is never used as a global scope.) While one +global scope associated with a method is the module containing its +definition. (A class is never used as a global scope.) While one rarely encounters a good reason for using global data in a method, there are many legitimate uses of the global scope: for one thing, functions and modules imported into the global scope can be used by methods, as well as functions and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 03:00:54 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 03:00:54 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_fold_into_one_i?= =?utf8?q?f_statement?= Message-ID: http://hg.python.org/cpython/rev/068e5c4d4bae changeset: 74340:068e5c4d4bae branch: 3.2 parent: 74336:32ea3675fba2 user: Benjamin Peterson date: Wed Jan 11 21:00:16 2012 -0500 summary: fold into one if statement files: Python/bltinmodule.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1502,10 +1502,8 @@ PyObject *sep = NULL, *end = NULL, *file = NULL; int i, err; - if (dummy_args == NULL) { - if (!(dummy_args = PyTuple_New(0))) + if (dummy_args == NULL && !(dummy_args = PyTuple_New(0))) return NULL; - } if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print", kwlist, &sep, &end, &file)) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 03:00:55 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 03:00:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_remove_some_usage_of_Py=5FU?= =?utf8?q?NICODE=5FTOUPPER/LOWER?= Message-ID: http://hg.python.org/cpython/rev/c2153ce1b5dd changeset: 74341:c2153ce1b5dd parent: 74339:2db3ca05fbb7 user: Benjamin Peterson date: Wed Jan 11 21:00:42 2012 -0500 summary: remove some usage of Py_UNICODE_TOUPPER/LOWER files: Objects/stringlib/asciilib.h | 2 - Objects/stringlib/stringdefs.h | 2 - Objects/stringlib/ucs1lib.h | 2 - Objects/stringlib/ucs2lib.h | 2 - Objects/stringlib/ucs4lib.h | 2 - Objects/stringlib/unicodedefs.h | 2 - Python/_warnings.c | 9 +++--- Python/formatter_unicode.c | 27 ++++++++++++-------- 8 files changed, 21 insertions(+), 27 deletions(-) diff --git a/Objects/stringlib/asciilib.h b/Objects/stringlib/asciilib.h --- a/Objects/stringlib/asciilib.h +++ b/Objects/stringlib/asciilib.h @@ -15,8 +15,6 @@ #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL -#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER -#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER #define STRINGLIB_STR PyUnicode_1BYTE_DATA #define STRINGLIB_LEN PyUnicode_GET_LENGTH #define STRINGLIB_NEW unicode_fromascii diff --git a/Objects/stringlib/stringdefs.h b/Objects/stringlib/stringdefs.h --- a/Objects/stringlib/stringdefs.h +++ b/Objects/stringlib/stringdefs.h @@ -18,8 +18,6 @@ #define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r')) #define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9')) #define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1) -#define STRINGLIB_TOUPPER Py_TOUPPER -#define STRINGLIB_TOLOWER Py_TOLOWER #define STRINGLIB_STR PyBytes_AS_STRING #define STRINGLIB_LEN PyBytes_GET_SIZE #define STRINGLIB_NEW PyBytes_FromStringAndSize diff --git a/Objects/stringlib/ucs1lib.h b/Objects/stringlib/ucs1lib.h --- a/Objects/stringlib/ucs1lib.h +++ b/Objects/stringlib/ucs1lib.h @@ -15,8 +15,6 @@ #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL -#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER -#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER #define STRINGLIB_STR PyUnicode_1BYTE_DATA #define STRINGLIB_LEN PyUnicode_GET_LENGTH #define STRINGLIB_NEW _PyUnicode_FromUCS1 diff --git a/Objects/stringlib/ucs2lib.h b/Objects/stringlib/ucs2lib.h --- a/Objects/stringlib/ucs2lib.h +++ b/Objects/stringlib/ucs2lib.h @@ -15,8 +15,6 @@ #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL -#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER -#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER #define STRINGLIB_STR PyUnicode_2BYTE_DATA #define STRINGLIB_LEN PyUnicode_GET_LENGTH #define STRINGLIB_NEW _PyUnicode_FromUCS2 diff --git a/Objects/stringlib/ucs4lib.h b/Objects/stringlib/ucs4lib.h --- a/Objects/stringlib/ucs4lib.h +++ b/Objects/stringlib/ucs4lib.h @@ -15,8 +15,6 @@ #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL -#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER -#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER #define STRINGLIB_STR PyUnicode_4BYTE_DATA #define STRINGLIB_LEN PyUnicode_GET_LENGTH #define STRINGLIB_NEW _PyUnicode_FromUCS4 diff --git a/Objects/stringlib/unicodedefs.h b/Objects/stringlib/unicodedefs.h --- a/Objects/stringlib/unicodedefs.h +++ b/Objects/stringlib/unicodedefs.h @@ -18,8 +18,6 @@ #define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK #define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL #define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL -#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER -#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER #define STRINGLIB_STR PyUnicode_AS_UNICODE #define STRINGLIB_LEN PyUnicode_GET_SIZE #define STRINGLIB_NEW PyUnicode_FromUnicode diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -510,13 +510,14 @@ kind = PyUnicode_KIND(*filename); data = PyUnicode_DATA(*filename); +#define ascii_lower(c) ((c <= 127) ? Py_TOLOWER(c) : 0) /* if filename.lower().endswith((".pyc", ".pyo")): */ if (len >= 4 && PyUnicode_READ(kind, data, len-4) == '.' && - Py_UNICODE_TOLOWER(PyUnicode_READ(kind, data, len-3)) == 'p' && - Py_UNICODE_TOLOWER(PyUnicode_READ(kind, data, len-2)) == 'y' && - (Py_UNICODE_TOLOWER(PyUnicode_READ(kind, data, len-1)) == 'c' || - Py_UNICODE_TOLOWER(PyUnicode_READ(kind, data, len-1)) == 'o')) + ascii_lower(PyUnicode_READ(kind, data, len-3)) == 'p' && + ascii_lower(PyUnicode_READ(kind, data, len-2)) == 'y' && + (ascii_lower(PyUnicode_READ(kind, data, len-1)) == 'c' || + ascii_lower(PyUnicode_READ(kind, data, len-1)) == 'o')) { *filename = PyUnicode_Substring(*filename, 0, PyUnicode_GET_LENGTH(*filename)-1); diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -561,13 +561,14 @@ return -1; if (toupper) { Py_ssize_t t; - /* XXX if the upper-case prefix is wider than the target - buffer, the caller should have allocated a wider string, - but currently doesn't. */ - for (t = 0; t < spec->n_prefix; ++t) - PyUnicode_WRITE(kind, data, pos + t, - Py_UNICODE_TOUPPER( - PyUnicode_READ(kind, data, pos + t))); + for (t = 0; t < spec->n_prefix; t++) { + Py_UCS4 c = PyUnicode_READ(kind, data, pos + t); + if (c > 127) { + PyErr_SetString(PyExc_SystemError, "prefix not ASCII"); + return -1; + } + PyUnicode_WRITE(kind, data, pos + t, Py_TOUPPER(c)); + } } pos += spec->n_prefix; } @@ -607,10 +608,14 @@ } if (toupper) { Py_ssize_t t; - for (t = 0; t < spec->n_grouped_digits; ++t) - PyUnicode_WRITE(kind, data, pos + t, - Py_UNICODE_TOUPPER( - PyUnicode_READ(kind, data, pos + t))); + for (t = 0; t < spec->n_grouped_digits; t++) { + Py_UCS4 c = PyUnicode_READ(kind, data, pos + t); + if (c > 127) { + PyErr_SetString(PyExc_SystemError, "non-ascii grouped digit"); + return -1; + } + PyUnicode_WRITE(kind, data, pos + t, Py_TOUPPER(c)); + } } pos += spec->n_grouped_digits; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 03:00:56 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 03:00:56 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/9ccb498a3c16 changeset: 74342:9ccb498a3c16 parent: 74341:c2153ce1b5dd parent: 74340:068e5c4d4bae user: Benjamin Peterson date: Wed Jan 11 21:00:48 2012 -0500 summary: merge 3.2 files: Python/bltinmodule.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1489,10 +1489,8 @@ PyObject *sep = NULL, *end = NULL, *file = NULL; int i, err; - if (dummy_args == NULL) { - if (!(dummy_args = PyTuple_New(0))) + if (dummy_args == NULL && !(dummy_args = PyTuple_New(0))) return NULL; - } if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print", kwlist, &sep, &end, &file)) return NULL; -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Jan 12 05:32:16 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 12 Jan 2012 05:32:16 +0100 Subject: [Python-checkins] Daily reference leaks (9ccb498a3c16): sum=0 Message-ID: results for 9ccb498a3c16 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog16KcrU', '-x'] From python-checkins at python.org Thu Jan 12 08:11:22 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 08:11:22 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzI0?= =?utf8?q?=3A_improve_documentation_for_socket=2Ecreate=5Fconnection=2E?= Message-ID: http://hg.python.org/cpython/rev/5594cd88bfed changeset: 74343:5594cd88bfed branch: 3.2 parent: 74340:068e5c4d4bae user: Antoine Pitrou date: Thu Jan 12 08:06:19 2012 +0100 summary: Issue #13724: improve documentation for socket.create_connection. files: Doc/library/socket.rst | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -236,10 +236,17 @@ .. function:: create_connection(address[, timeout[, source_address]]) - Convenience function. Connect to *address* (a 2-tuple ``(host, port)``), - and return the socket object. Passing the optional *timeout* parameter will - set the timeout on the socket instance before attempting to connect. If no - *timeout* is supplied, the global default timeout setting returned by + Connect to a TCP service listening on the Internet *address* (a 2-tuple + ``(host, port)``), and return the socket object. This is a higher-level + function than :meth:`socket.connect`: if *host* is a non-numeric hostname, + it will try to resolve it for both :data:`AF_INET` and :data:`AF_INET6`, + and then try to connect to all possible addresses in turn until a + connection succeeds. This makes it easy to write clients that are + compatible to both IPv4 and IPv6. + + Passing the optional *timeout* parameter will set the timeout on the + socket instance before attempting to connect. If no *timeout* is + supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 08:11:23 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 08:11:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313724=3A_improve_documentation_for_socket=2Ecreate?= =?utf8?q?=5Fconnection=2E?= Message-ID: http://hg.python.org/cpython/rev/43d08528223c changeset: 74344:43d08528223c parent: 74342:9ccb498a3c16 parent: 74343:5594cd88bfed user: Antoine Pitrou date: Thu Jan 12 08:06:49 2012 +0100 summary: Issue #13724: improve documentation for socket.create_connection. files: Doc/library/socket.rst | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -284,10 +284,17 @@ .. function:: create_connection(address[, timeout[, source_address]]) - Convenience function. Connect to *address* (a 2-tuple ``(host, port)``), - and return the socket object. Passing the optional *timeout* parameter will - set the timeout on the socket instance before attempting to connect. If no - *timeout* is supplied, the global default timeout setting returned by + Connect to a TCP service listening on the Internet *address* (a 2-tuple + ``(host, port)``), and return the socket object. This is a higher-level + function than :meth:`socket.connect`: if *host* is a non-numeric hostname, + it will try to resolve it for both :data:`AF_INET` and :data:`AF_INET6`, + and then try to connect to all possible addresses in turn until a + connection succeeds. This makes it easy to write clients that are + compatible to both IPv4 and IPv6. + + Passing the optional *timeout* parameter will set the timeout on the + socket instance before attempting to connect. If no *timeout* is + supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 08:11:23 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 08:11:23 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNzI0?= =?utf8?q?=3A_improve_documentation_for_socket=2Ecreate=5Fconnection=2E?= Message-ID: http://hg.python.org/cpython/rev/60e77810a47e changeset: 74345:60e77810a47e branch: 2.7 parent: 74329:d22f13bb58c6 user: Antoine Pitrou date: Thu Jan 12 08:06:19 2012 +0100 summary: Issue #13724: improve documentation for socket.create_connection. files: Doc/library/socket.rst | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -207,10 +207,17 @@ .. function:: create_connection(address[, timeout[, source_address]]) - Convenience function. Connect to *address* (a 2-tuple ``(host, port)``), - and return the socket object. Passing the optional *timeout* parameter will - set the timeout on the socket instance before attempting to connect. If no - *timeout* is supplied, the global default timeout setting returned by + Connect to a TCP service listening on the Internet *address* (a 2-tuple + ``(host, port)``), and return the socket object. This is a higher-level + function than :meth:`socket.connect`: if *host* is a non-numeric hostname, + it will try to resolve it for both :data:`AF_INET` and :data:`AF_INET6`, + and then try to connect to all possible addresses in turn until a + connection succeeds. This makes it easy to write clients that are + compatible to both IPv4 and IPv6. + + Passing the optional *timeout* parameter will set the timeout on the + socket instance before attempting to connect. If no *timeout* is + supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 08:11:25 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 08:11:25 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf8?q?_Merge?= Message-ID: http://hg.python.org/cpython/rev/66f2bcb47050 changeset: 74346:66f2bcb47050 branch: 2.7 parent: 74345:60e77810a47e parent: 74335:10a5165103f9 user: Antoine Pitrou date: Thu Jan 12 08:09:15 2012 +0100 summary: Merge files: Doc/library/stdtypes.rst | 6 +++--- Doc/tutorial/classes.rst | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1049,7 +1049,7 @@ Return the string left justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. versionchanged:: 2.4 Support for the *fillchar* argument. @@ -1113,7 +1113,7 @@ Return the string right justified in a string of length *width*. Padding is done using the specified *fillchar* (default is a space). The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. versionchanged:: 2.4 Support for the *fillchar* argument. @@ -1293,7 +1293,7 @@ Return the numeric string left filled with zeros in a string of length *width*. A sign prefix is handled correctly. The original string is - returned if *width* is less than ``len(s)``. + returned if *width* is less than or equal to ``len(s)``. .. versionadded:: 2.2.2 diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -409,8 +409,8 @@ self.add(x) Methods may reference global names in the same way as ordinary functions. The -global scope associated with a method is the module containing the class -definition. (The class itself is never used as a global scope.) While one +global scope associated with a method is the module containing its +definition. (A class is never used as a global scope.) While one rarely encounters a good reason for using global data in a method, there are many legitimate uses of the global scope: for one thing, functions and modules imported into the global scope can be used by methods, as well as functions and -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 20:52:06 2012 From: python-checkins at python.org (terry.reedy) Date: Thu, 12 Jan 2012 20:52:06 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_=2311633_At_lea?= =?utf8?q?st_2_people_prefer_earlier_revision=2E?= Message-ID: http://hg.python.org/cpython/rev/4a767054551b changeset: 74347:4a767054551b branch: 3.2 parent: 74343:5594cd88bfed user: Terry Jan Reedy date: Thu Jan 12 14:49:02 2012 -0500 summary: #11633 At least 2 people prefer earlier revision. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -955,8 +955,8 @@ The *file* argument must be an object with a ``write(string)`` method; if it is not present or ``None``, :data:`sys.stdout` will be used. Output buffering - is determined by *file*. Use ``sys.stdout.flush()`` to ensure immediate - appearance on a screen. + is determined by *file*. Use ``file.flush()`` to ensure, for instance, + immediate appearance on a screen. .. function:: property(fget=None, fset=None, fdel=None, doc=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 20:52:07 2012 From: python-checkins at python.org (terry.reedy) Date: Thu, 12 Jan 2012 20:52:07 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_=2311633_At_least_2_people_prefer_earlier_revision=2E?= Message-ID: http://hg.python.org/cpython/rev/22688f5f9d0f changeset: 74348:22688f5f9d0f parent: 74344:43d08528223c parent: 74347:4a767054551b user: Terry Jan Reedy date: Thu Jan 12 14:51:14 2012 -0500 summary: Merge #11633 At least 2 people prefer earlier revision. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -960,8 +960,8 @@ The *file* argument must be an object with a ``write(string)`` method; if it is not present or ``None``, :data:`sys.stdout` will be used. Output buffering - is determined by *file*. Use ``sys.stdout.flush()`` to ensure immediate - appearance on a screen. + is determined by *file*. Use ``file.flush()`` to ensure, for instance, + immediate appearance on a screen. .. function:: property(fget=None, fset=None, fdel=None, doc=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 21:26:26 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 21:26:26 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_kill_capwords_implementatio?= =?utf8?q?n_which_has_been_disabled_since_the_begining?= Message-ID: http://hg.python.org/cpython/rev/29612a16e346 changeset: 74349:29612a16e346 parent: 74344:43d08528223c user: Benjamin Peterson date: Thu Jan 12 15:25:41 2012 -0500 summary: kill capwords implementation which has been disabled since the begining files: Objects/unicodeobject.c | 42 ----------------------------- 1 files changed, 0 insertions(+), 42 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10499,44 +10499,6 @@ return case_operation(self, do_capitalize); } -#if 0 -PyDoc_STRVAR(capwords__doc__, - "S.capwords() -> str\n\ -\n\ -Apply .capitalize() to all words in S and return the result with\n\ -normalized whitespace (all whitespace strings are replaced by ' ')."); - -static PyObject* -unicode_capwords(PyObject *self) -{ - PyObject *list; - PyObject *item; - Py_ssize_t i; - - /* Split into words */ - list = split(self, NULL, -1); - if (!list) - return NULL; - - /* Capitalize each word */ - for (i = 0; i < PyList_GET_SIZE(list); i++) { - item = fixup(PyList_GET_ITEM(list, i), - fixcapitalize); - if (item == NULL) - goto onError; - Py_DECREF(PyList_GET_ITEM(list, i)); - PyList_SET_ITEM(list, i, item); - } - - /* Join the words to form a new string */ - item = PyUnicode_Join(NULL, list); - - onError: - Py_DECREF(list); - return item; -} -#endif - /* Argument converter. Coerces to a single unicode character */ static int @@ -13075,10 +13037,6 @@ METH_VARARGS | METH_STATIC, maketrans__doc__}, {"__sizeof__", (PyCFunction) unicode__sizeof__, METH_NOARGS, sizeof__doc__}, #if 0 - {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, -#endif - -#if 0 /* These methods are just used for debugging the implementation. */ {"_decimal2ascii", (PyCFunction) unicode__decimal2ascii, METH_NOARGS}, #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 21:26:27 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 21:26:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/54b09bce78af changeset: 74350:54b09bce78af parent: 74349:29612a16e346 parent: 74348:22688f5f9d0f user: Benjamin Peterson date: Thu Jan 12 15:26:20 2012 -0500 summary: merge heads files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -960,8 +960,8 @@ The *file* argument must be an object with a ``write(string)`` method; if it is not present or ``None``, :data:`sys.stdout` will be used. Output buffering - is determined by *file*. Use ``sys.stdout.flush()`` to ensure immediate - appearance on a screen. + is determined by *file*. Use ``file.flush()`` to ensure, for instance, + immediate appearance on a screen. .. function:: property(fget=None, fset=None, fdel=None, doc=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 21:40:23 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 12 Jan 2012 21:40:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_make_fix=5Fdecimal=5Fand=5F?= =?utf8?q?space=5Fto=5Fascii_check_if_it_modifies_the_string?= Message-ID: http://hg.python.org/cpython/rev/c9ead1b5ca85 changeset: 74351:c9ead1b5ca85 user: Benjamin Peterson date: Thu Jan 12 15:40:18 2012 -0500 summary: make fix_decimal_and_space_to_ascii check if it modifies the string files: Objects/unicodeobject.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8845,6 +8845,7 @@ const int kind = PyUnicode_KIND(self); void *data = PyUnicode_DATA(self); Py_UCS4 maxchar = 0, ch, fixed; + int modified = 0; Py_ssize_t i; for (i = 0; i < len; ++i) { @@ -8859,6 +8860,7 @@ fixed = '0' + decimal; } if (fixed != 0) { + modified = 1; if (fixed > maxchar) maxchar = fixed; PyUnicode_WRITE(kind, data, i, fixed); @@ -8870,7 +8872,7 @@ maxchar = ch; } - return maxchar; + return (modified) ? maxchar : 0; } PyObject * -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 22:39:56 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 22:39:56 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_test=5Fstrlit_w?= =?utf8?q?as_never_run?= Message-ID: http://hg.python.org/cpython/rev/e23beda83902 changeset: 74352:e23beda83902 branch: 3.2 parent: 74347:4a767054551b user: Antoine Pitrou date: Thu Jan 12 22:36:48 2012 +0100 summary: test_strlit was never run files: Lib/test/test_strlit.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_strlit.py b/Lib/test/test_strlit.py --- a/Lib/test/test_strlit.py +++ b/Lib/test/test_strlit.py @@ -32,6 +32,7 @@ import shutil import tempfile import unittest +import test.support TEMPLATE = r"""# coding: %s @@ -142,7 +143,8 @@ self.check_encoding("latin9") +def test_main(): + test.support.run_unittest(__name__) + if __name__ == "__main__": - # Hack so that error messages containing non-ASCII can be printed - sys.stdout._encoding = sys.stderr._encoding = "utf-8" - unittest.main() + test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 22:39:57 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 22:39:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_test=5Fstrlit_was_never_run?= Message-ID: http://hg.python.org/cpython/rev/96525742d188 changeset: 74353:96525742d188 parent: 74351:c9ead1b5ca85 parent: 74352:e23beda83902 user: Antoine Pitrou date: Thu Jan 12 22:38:13 2012 +0100 summary: test_strlit was never run files: Lib/test/test_strlit.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_strlit.py b/Lib/test/test_strlit.py --- a/Lib/test/test_strlit.py +++ b/Lib/test/test_strlit.py @@ -32,6 +32,7 @@ import shutil import tempfile import unittest +import test.support TEMPLATE = r"""# coding: %s @@ -142,7 +143,8 @@ self.check_encoding("latin9") +def test_main(): + test.support.run_unittest(__name__) + if __name__ == "__main__": - # Hack so that error messages containing non-ASCII can be printed - sys.stdout._encoding = sys.stderr._encoding = "utf-8" - unittest.main() + test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 12 22:47:54 2012 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 12 Jan 2012 22:47:54 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313748=3A_Raw_bytes?= =?utf8?q?_literals_can_now_be_written_with_the_=60rb=60_prefix_as?= Message-ID: http://hg.python.org/cpython/rev/bbed36370b08 changeset: 74354:bbed36370b08 user: Antoine Pitrou date: Thu Jan 12 22:46:19 2012 +0100 summary: Issue #13748: Raw bytes literals can now be written with the `rb` prefix as well as `br`. files: Doc/reference/lexical_analysis.rst | 6 ++++- Lib/test/test_strlit.py | 21 ++++++++++++++--- Lib/test/tokenize_tests.txt | 8 ++++++ Misc/NEWS | 3 ++ Parser/tokenizer.c | 16 +++++++------ Python/ast.c | 19 ++++++++++------ 6 files changed, 54 insertions(+), 19 deletions(-) diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -412,7 +412,7 @@ .. productionlist:: bytesliteral: `bytesprefix`(`shortbytes` | `longbytes`) - bytesprefix: "b" | "B" | "br" | "Br" | "bR" | "BR" + bytesprefix: "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB" shortbytes: "'" `shortbytesitem`* "'" | '"' `shortbytesitem`* '"' longbytes: "'''" `longbytesitem`* "'''" | '"""' `longbytesitem`* '"""' shortbytesitem: `shortbyteschar` | `bytesescapeseq` @@ -446,6 +446,10 @@ literal characters. As a result, in string literals, ``'\U'`` and ``'\u'`` escapes in raw strings are not treated specially. + .. versionadded:: 3.3 + The ``'rb'`` prefix of raw bytes literals has been added as a synonym + of ``'br'``. + In triple-quoted strings, unescaped newlines and quotes are allowed (and are retained), except that three unescaped quotes in a row terminate the string. (A "quote" is the character used to open the string, i.e. either ``'`` or ``"``.) diff --git a/Lib/test/test_strlit.py b/Lib/test/test_strlit.py --- a/Lib/test/test_strlit.py +++ b/Lib/test/test_strlit.py @@ -2,10 +2,10 @@ There are four types of string literals: - 'abc' -- normal str - r'abc' -- raw str - b'xyz' -- normal bytes - br'xyz' -- raw bytes + 'abc' -- normal str + r'abc' -- raw str + b'xyz' -- normal bytes + br'xyz' | rb'xyz' -- raw bytes The difference between normal and raw strings is of course that in a raw string, \ escapes (while still used to determine the end of the @@ -103,12 +103,25 @@ def test_eval_bytes_raw(self): self.assertEqual(eval(""" br'x' """), b'x') + self.assertEqual(eval(""" rb'x' """), b'x') self.assertEqual(eval(r""" br'\x01' """), b'\\' + b'x01') + self.assertEqual(eval(r""" rb'\x01' """), b'\\' + b'x01') self.assertEqual(eval(""" br'\x01' """), byte(1)) + self.assertEqual(eval(""" rb'\x01' """), byte(1)) self.assertEqual(eval(r""" br'\x81' """), b"\\" + b"x81") + self.assertEqual(eval(r""" rb'\x81' """), b"\\" + b"x81") self.assertRaises(SyntaxError, eval, """ br'\x81' """) + self.assertRaises(SyntaxError, eval, """ rb'\x81' """) self.assertEqual(eval(r""" br'\u1881' """), b"\\" + b"u1881") + self.assertEqual(eval(r""" rb'\u1881' """), b"\\" + b"u1881") self.assertRaises(SyntaxError, eval, """ br'\u1881' """) + self.assertRaises(SyntaxError, eval, """ rb'\u1881' """) + self.assertRaises(SyntaxError, eval, """ bb'' """) + self.assertRaises(SyntaxError, eval, """ rr'' """) + self.assertRaises(SyntaxError, eval, """ brr'' """) + self.assertRaises(SyntaxError, eval, """ bbr'' """) + self.assertRaises(SyntaxError, eval, """ rrb'' """) + self.assertRaises(SyntaxError, eval, """ rbb'' """) def check_encoding(self, encoding, extra=""): modname = "xx_" + encoding.replace("-", "_") diff --git a/Lib/test/tokenize_tests.txt b/Lib/test/tokenize_tests.txt --- a/Lib/test/tokenize_tests.txt +++ b/Lib/test/tokenize_tests.txt @@ -114,8 +114,12 @@ y = b"abc" + B"ABC" x = br'abc' + Br'ABC' + bR'ABC' + BR'ABC' y = br"abc" + Br"ABC" + bR"ABC" + BR"ABC" +x = rb'abc' + rB'ABC' + Rb'ABC' + RB'ABC' +y = rb"abc" + rB"ABC" + Rb"ABC" + RB"ABC" x = br'\\' + BR'\\' +x = rb'\\' + RB'\\' x = br'\'' + '' +x = rb'\'' + '' y = br''' foo bar \\ baz''' + BR''' @@ -124,6 +128,10 @@ bar \\ baz """ + bR'''spam ''' +y = rB"""foo +bar \\ baz +""" + Rb'''spam +''' # Indentation if 1: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #13748: Raw bytes literals can now be written with the ``rb`` prefix + as well as ``br``. + - Issue #12736: Use full unicode case mappings for upper, lower, and title case. - Issue #12760: Add a create mode to open(). Patch by David Townshend. diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1412,13 +1412,15 @@ /* Identifier (most frequent token!) */ nonascii = 0; if (is_potential_identifier_start(c)) { - /* Process b"", r"" and br"" */ - if (c == 'b' || c == 'B') { - c = tok_nextc(tok); - if (c == '"' || c == '\'') - goto letter_quote; - } - if (c == 'r' || c == 'R') { + /* Process b"", r"", br"" and rb"" */ + int saw_b = 0, saw_r = 0; + while (1) { + if (!saw_b && (c == 'b' || c == 'B')) + saw_b = 1; + else if (!saw_r && (c == 'r' || c == 'R')) + saw_r = 1; + else + break; c = tok_nextc(tok); if (c == '"' || c == '\'') goto letter_quote; diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -3744,13 +3744,18 @@ int rawmode = 0; int need_encoding; if (isalpha(quote)) { - if (quote == 'b' || quote == 'B') { - quote = *++s; - *bytesmode = 1; - } - if (quote == 'r' || quote == 'R') { - quote = *++s; - rawmode = 1; + while (!*bytesmode || !rawmode) { + if (quote == 'b' || quote == 'B') { + quote = *++s; + *bytesmode = 1; + } + else if (quote == 'r' || quote == 'R') { + quote = *++s; + rawmode = 1; + } + else { + break; + } } } if (quote != '\'' && quote != '\"') { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 03:13:20 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jan 2012 03:13:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_move_do=5Ftitle_to_a_better?= =?utf8?q?_place?= Message-ID: http://hg.python.org/cpython/rev/f46c1007b626 changeset: 74355:f46c1007b626 user: Benjamin Peterson date: Thu Jan 12 21:10:29 2012 -0500 summary: move do_title to a better place files: Objects/unicodeobject.c | 56 ++++++++++++++-------------- 1 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9576,6 +9576,34 @@ return do_upper_or_lower(kind, data, length, res, maxchar, 1); } +static Py_ssize_t +do_title(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) +{ + Py_ssize_t i, k = 0; + int previous_is_cased; + + previous_is_cased = 0; + for (i = 0; i < length; i++) { + const Py_UCS4 c = PyUnicode_READ(kind, data, i); + Py_UCS4 mapped[3]; + int n_res, j; + + if (previous_is_cased) + n_res = lower_ucs4(kind, data, length, i, c, mapped); + else + n_res = _PyUnicode_ToTitleFull(c, mapped); + + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + + previous_is_cased = _PyUnicode_IsCased(c); + } + return k; +} + static PyObject * case_operation(PyObject *self, Py_ssize_t (*perform)(int, void *, Py_ssize_t, Py_UCS4 *, Py_UCS4 *)) @@ -9621,34 +9649,6 @@ return res; } -static Py_ssize_t -do_title(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) -{ - Py_ssize_t i, k = 0; - int previous_is_cased; - - previous_is_cased = 0; - for (i = 0; i < length; i++) { - const Py_UCS4 c = PyUnicode_READ(kind, data, i); - Py_UCS4 mapped[3]; - int n_res, j; - - if (previous_is_cased) - n_res = lower_ucs4(kind, data, length, i, c, mapped); - else - n_res = _PyUnicode_ToTitleFull(c, mapped); - - for (j = 0; j < n_res; j++) { - if (mapped[j] > *maxchar) - *maxchar = mapped[j]; - res[k++] = mapped[j]; - } - - previous_is_cased = _PyUnicode_IsCased(c); - } - return k; -} - PyObject * PyUnicode_Join(PyObject *separator, PyObject *seq) { -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Jan 13 05:31:23 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 13 Jan 2012 05:31:23 +0100 Subject: [Python-checkins] Daily reference leaks (f46c1007b626): sum=0 Message-ID: results for f46c1007b626 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogSpM0fm', '-x'] From python-checkins at python.org Fri Jan 13 12:43:53 2012 From: python-checkins at python.org (nick.coghlan) Date: Fri, 13 Jan 2012 12:43:53 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Implement_PEP_380_-_=27yiel?= =?utf8?q?d_from=27_=28closes_=2311682=29?= Message-ID: http://hg.python.org/cpython/rev/d64ac9ab4cd0 changeset: 74356:d64ac9ab4cd0 user: Nick Coghlan date: Fri Jan 13 21:43:40 2012 +1000 summary: Implement PEP 380 - 'yield from' (closes #11682) files: Doc/library/dis.rst | 7 + Doc/library/exceptions.rst | 11 +- Doc/reference/expressions.rst | 30 ++- Doc/reference/simple_stmts.rst | 24 +- Doc/whatsnew/3.3.rst | 17 +- Grammar/Grammar | 5 +- Include/Python-ast.h | 6 +- Include/frameobject.h | 43 ++-- Include/genobject.h | 21 +- Include/graminit.h | 1 + Include/opcode.h | 169 ++++++++-------- Include/pyerrors.h | 7 + Lib/opcode.py | 1 + Lib/test/test_ast.py | 3 +- Lib/test/test_generators.py | 42 ---- Lib/test/test_grammar.py | 32 +++ Lib/test/test_parser.py | 5 +- Lib/test/test_sys.py | 2 +- Misc/ACKS | 2 + Misc/NEWS | 4 + Modules/parsermodule.c | 82 +++++-- Objects/abstract.c | 2 - Objects/exceptions.c | 66 ++++++- Objects/frameobject.c | 15 +- Objects/genobject.c | 219 +++++++++++++++++++- Parser/Python.asdl | 2 +- Python/Python-ast.c | 27 ++- Python/ast.c | 21 +- Python/ceval.c | 46 ++++ Python/compile.c | 8 +- Python/graminit.c | 190 +++++++++-------- Python/opcode_targets.h | 2 +- Python/symtable.c | 19 - 33 files changed, 791 insertions(+), 340 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -431,6 +431,13 @@ Pops ``TOS`` and yields it from a :term:`generator`. +.. opcode:: YIELD_FROM + + Pops ``TOS`` and delegates to it as a subiterator from a :term:`generator`. + + .. versionadded:: 3.3 + + .. opcode:: IMPORT_STAR Loads all symbols not starting with ``'_'`` directly from the module TOS to the diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -250,7 +250,16 @@ .. exception:: StopIteration Raised by built-in function :func:`next` and an :term:`iterator`\'s - :meth:`__next__` method to signal that there are no further values. + :meth:`__next__` method to signal that there are no further items to be + produced by the iterator. + + The exception object has a single attribute :attr:`value`, which is + given as an argument when constructing the exception, and defaults + to :const:`None`. + + When a generator function returns, a new :exc:`StopIteration` instance is + raised, and the value returned by the function is used as the + :attr:`value` parameter to the constructor of the exception. .. exception:: SyntaxError diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -318,7 +318,7 @@ .. productionlist:: yield_atom: "(" `yield_expression` ")" - yield_expression: "yield" [`expression_list`] + yield_expression: "yield" [`expression_list` | "from" `expression`] The :keyword:`yield` expression is only used when defining a generator function, and can only be used in the body of a function definition. Using a @@ -336,7 +336,10 @@ the generator's methods, the function can proceed exactly as if the :keyword:`yield` expression was just another external call. The value of the :keyword:`yield` expression after resuming depends on the method which resumed -the execution. +the execution. If :meth:`__next__` is used (typically via either a +:keyword:`for` or the :func:`next` builtin) then the result is :const:`None`, +otherwise, if :meth:`send` is used, then the result will be the value passed +in to that method. .. index:: single: coroutine @@ -346,12 +349,29 @@ where should the execution continue after it yields; the control is always transferred to the generator's caller. -The :keyword:`yield` statement is allowed in the :keyword:`try` clause of a +:keyword:`yield` expressions are allowed in the :keyword:`try` clause of a :keyword:`try` ... :keyword:`finally` construct. If the generator is not resumed before it is finalized (by reaching a zero reference count or by being garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. +When ``yield from expression`` is used, it treats the supplied expression as +a subiterator. All values produced by that subiterator are passed directly +to the caller of the current generator's methods. Any values passed in with +:meth:`send` and any exceptions passed in with :meth:`throw` are passed to +the underlying iterator if it has the appropriate methods. If this is not the +case, then :meth:`send` will raise :exc:`AttributeError` or :exc:`TypeError`, +while :meth:`throw` will just raise the passed in exception immediately. + +When the underlying iterator is complete, the :attr:`~StopIteration.value` +attribute of the raised :exc:`StopIteration` instance becomes the value of +the yield expression. It can be either set explicitly when raising +:exc:`StopIteration`, or automatically when the sub-iterator is a generator +(by returning a value from the sub-generator). + +The parentheses can be omitted when the :keyword:`yield` expression is the +sole expression on the right hand side of an assignment statement. + .. index:: object: generator The following generator's methods can be used to control the execution of a @@ -444,6 +464,10 @@ The proposal to enhance the API and syntax of generators, making them usable as simple coroutines. + :pep:`0380` - Syntax for Delegating to a Subgenerator + The proposal to introduce the :token:`yield_from` syntax, making delegation + to sub-generators easy. + .. _primaries: diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -425,10 +425,10 @@ :keyword:`finally` clause, that :keyword:`finally` clause is executed before really leaving the function. -In a generator function, the :keyword:`return` statement is not allowed to -include an :token:`expression_list`. In that context, a bare :keyword:`return` -indicates that the generator is done and will cause :exc:`StopIteration` to be -raised. +In a generator function, the :keyword:`return` statement indicates that the +generator is done and will cause :exc:`StopIteration` to be raised. The returned +value (if any) is used as an argument to construct :exc:`StopIteration` and +becomes the :attr:`StopIteration.value` attribute. .. _yield: @@ -450,6 +450,7 @@ and is only used in the body of the generator function. Using a :keyword:`yield` statement in a function definition is sufficient to cause that definition to create a generator function instead of a normal function. + When a generator function is called, it returns an iterator known as a generator iterator, or more commonly, a generator. The body of the generator function is executed by calling the :func:`next` function on the generator repeatedly until @@ -469,14 +470,25 @@ garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. +When ``yield from expression`` is used, it treats the supplied expression as +a subiterator, producing values from it until the underlying iterator is +exhausted. + +For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr` +section. + .. seealso:: :pep:`0255` - Simple Generators The proposal for adding generators and the :keyword:`yield` statement to Python. :pep:`0342` - Coroutines via Enhanced Generators - The proposal that, among other generator enhancements, proposed allowing - :keyword:`yield` to appear inside a :keyword:`try` ... :keyword:`finally` block. + The proposal to enhance the API and syntax of generators, making them + usable as simple coroutines. + + :pep:`0380` - Syntax for Delegating to a Subgenerator + The proposal to introduce the :token:`yield_from` syntax, making delegation + to sub-generators easy. .. _raise: diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -195,6 +195,22 @@ print("You are not allowed to read document.txt") +PEP 380: Syntax for Delegating to a Subgenerator +================================================ + +PEP 380 adds the ``yield from`` expression, allowing a generator to delegate +part of its operations to another generator. This allows a section of code +containing 'yield' to be factored out and placed in another generator. +Additionally, the subgenerator is allowed to return with a value, and the +value is made available to the delegating generator. +While designed primarily for use in delegating to a subgenerator, the ``yield +from`` expression actually allows delegation to arbitrary subiterators. + +(Implementation by Greg Ewing, integrated into 3.3 by Renaud Blanch, Ryan +Kelly and Nick Coghlan, documentation by Zbigniew J?drzejewski-Szmek and +Nick Coghlan) + + PEP 3155: Qualified name for classes and functions ================================================== @@ -208,7 +224,6 @@ how they might be accessible from the global scope. Example with (non-bound) methods:: - >>> class C: ... def meth(self): ... pass diff --git a/Grammar/Grammar b/Grammar/Grammar --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -121,7 +121,7 @@ |'**' test) # The reason that keywords are test nodes instead of NAME is that using NAME # results in an ambiguity. ast.c makes sure it's a NAME. -argument: test [comp_for] | test '=' test # Really [keyword '='] test +argument: (test) [comp_for] | test '=' test # Really [keyword '='] test comp_iter: comp_for | comp_if comp_for: 'for' exprlist 'in' or_test [comp_iter] comp_if: 'if' test_nocond [comp_iter] @@ -129,4 +129,5 @@ # not used in grammar, but may appear in "node" passed from Parser to Compiler encoding_decl: NAME -yield_expr: 'yield' [testlist] +yield_expr: 'yield' [yield_arg] +yield_arg: 'from' test | testlist diff --git a/Include/Python-ast.h b/Include/Python-ast.h --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -245,6 +245,7 @@ } GeneratorExp; struct { + int is_from; expr_ty value; } Yield; @@ -487,8 +488,9 @@ #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); -#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) -expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena); +#define Yield(a0, a1, a2, a3, a4) _Py_Yield(a0, a1, a2, a3, a4) +expr_ty _Py_Yield(int is_from, expr_ty value, int lineno, int col_offset, + PyArena *arena); #define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int col_offset, PyArena *arena); diff --git a/Include/frameobject.h b/Include/frameobject.h --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -9,45 +9,46 @@ #endif typedef struct { - int b_type; /* what kind of block this is */ - int b_handler; /* where to jump to find handler */ - int b_level; /* value stack level to pop to */ + int b_type; /* what kind of block this is */ + int b_handler; /* where to jump to find handler */ + int b_level; /* value stack level to pop to */ } PyTryBlock; typedef struct _frame { PyObject_VAR_HEAD - struct _frame *f_back; /* previous frame, or NULL */ - PyCodeObject *f_code; /* code segment */ - PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ - PyObject *f_globals; /* global symbol table (PyDictObject) */ - PyObject *f_locals; /* local symbol table (any mapping) */ - PyObject **f_valuestack; /* points after the last local */ + struct _frame *f_back; /* previous frame, or NULL */ + PyCodeObject *f_code; /* code segment */ + PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ + PyObject *f_globals; /* global symbol table (PyDictObject) */ + PyObject *f_locals; /* local symbol table (any mapping) */ + PyObject **f_valuestack; /* points after the last local */ /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. Frame evaluation usually NULLs it, but a frame that yields sets it to the current stack top. */ PyObject **f_stacktop; - PyObject *f_trace; /* Trace function */ + PyObject *f_trace; /* Trace function */ + PyObject *f_yieldfrom; /* Iterator being delegated to by yield from */ - /* In a generator, we need to be able to swap between the exception - state inside the generator and the exception state of the calling - frame (which shouldn't be impacted when the generator "yields" - from an except handler). - These three fields exist exactly for that, and are unused for - non-generator frames. See the SAVE_EXC_STATE and SWAP_EXC_STATE - macros in ceval.c for details of their use. */ + /* In a generator, we need to be able to swap between the exception + state inside the generator and the exception state of the calling + frame (which shouldn't be impacted when the generator "yields" + from an except handler). + These three fields exist exactly for that, and are unused for + non-generator frames. See the SAVE_EXC_STATE and SWAP_EXC_STATE + macros in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; PyThreadState *f_tstate; - int f_lasti; /* Last instruction if called */ + int f_lasti; /* Last instruction if called */ /* Call PyFrame_GetLineNumber() instead of reading this field directly. As of 2.3 f_lineno is only valid when tracing is active (i.e. when f_trace is set). At other times we use PyCode_Addr2Line to calculate the line from the current bytecode index. */ - int f_lineno; /* Current line number */ - int f_iblock; /* index in f_blockstack */ + int f_lineno; /* Current line number */ + int f_iblock; /* index in f_blockstack */ PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ - PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ + PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ } PyFrameObject; diff --git a/Include/genobject.h b/Include/genobject.h --- a/Include/genobject.h +++ b/Include/genobject.h @@ -11,20 +11,20 @@ struct _frame; /* Avoid including frameobject.h */ typedef struct { - PyObject_HEAD - /* The gi_ prefix is intended to remind of generator-iterator. */ + PyObject_HEAD + /* The gi_ prefix is intended to remind of generator-iterator. */ - /* Note: gi_frame can be NULL if the generator is "finished" */ - struct _frame *gi_frame; + /* Note: gi_frame can be NULL if the generator is "finished" */ + struct _frame *gi_frame; - /* True if generator is being executed. */ - int gi_running; + /* True if generator is being executed. */ + int gi_running; - /* The code object backing the generator */ - PyObject *gi_code; + /* The code object backing the generator */ + PyObject *gi_code; - /* List of weak reference. */ - PyObject *gi_weakreflist; + /* List of weak reference. */ + PyObject *gi_weakreflist; } PyGenObject; PyAPI_DATA(PyTypeObject) PyGen_Type; @@ -34,6 +34,7 @@ PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); +PyAPI_FUNC(int) PyGen_FetchStopIterationValue(PyObject **); #ifdef __cplusplus } diff --git a/Include/graminit.h b/Include/graminit.h --- a/Include/graminit.h +++ b/Include/graminit.h @@ -81,3 +81,4 @@ #define comp_if 334 #define encoding_decl 335 #define yield_expr 336 +#define yield_arg 337 diff --git a/Include/opcode.h b/Include/opcode.h --- a/Include/opcode.h +++ b/Include/opcode.h @@ -7,116 +7,117 @@ /* Instruction opcodes for compiled code */ -#define POP_TOP 1 -#define ROT_TWO 2 -#define ROT_THREE 3 -#define DUP_TOP 4 +#define POP_TOP 1 +#define ROT_TWO 2 +#define ROT_THREE 3 +#define DUP_TOP 4 #define DUP_TOP_TWO 5 -#define NOP 9 +#define NOP 9 -#define UNARY_POSITIVE 10 -#define UNARY_NEGATIVE 11 -#define UNARY_NOT 12 +#define UNARY_POSITIVE 10 +#define UNARY_NEGATIVE 11 +#define UNARY_NOT 12 -#define UNARY_INVERT 15 +#define UNARY_INVERT 15 -#define BINARY_POWER 19 +#define BINARY_POWER 19 -#define BINARY_MULTIPLY 20 +#define BINARY_MULTIPLY 20 -#define BINARY_MODULO 22 -#define BINARY_ADD 23 -#define BINARY_SUBTRACT 24 -#define BINARY_SUBSCR 25 +#define BINARY_MODULO 22 +#define BINARY_ADD 23 +#define BINARY_SUBTRACT 24 +#define BINARY_SUBSCR 25 #define BINARY_FLOOR_DIVIDE 26 #define BINARY_TRUE_DIVIDE 27 #define INPLACE_FLOOR_DIVIDE 28 #define INPLACE_TRUE_DIVIDE 29 -#define STORE_MAP 54 -#define INPLACE_ADD 55 -#define INPLACE_SUBTRACT 56 -#define INPLACE_MULTIPLY 57 +#define STORE_MAP 54 +#define INPLACE_ADD 55 +#define INPLACE_SUBTRACT 56 +#define INPLACE_MULTIPLY 57 -#define INPLACE_MODULO 59 -#define STORE_SUBSCR 60 -#define DELETE_SUBSCR 61 +#define INPLACE_MODULO 59 +#define STORE_SUBSCR 60 +#define DELETE_SUBSCR 61 -#define BINARY_LSHIFT 62 -#define BINARY_RSHIFT 63 -#define BINARY_AND 64 -#define BINARY_XOR 65 -#define BINARY_OR 66 -#define INPLACE_POWER 67 -#define GET_ITER 68 -#define STORE_LOCALS 69 -#define PRINT_EXPR 70 +#define BINARY_LSHIFT 62 +#define BINARY_RSHIFT 63 +#define BINARY_AND 64 +#define BINARY_XOR 65 +#define BINARY_OR 66 +#define INPLACE_POWER 67 +#define GET_ITER 68 +#define STORE_LOCALS 69 +#define PRINT_EXPR 70 #define LOAD_BUILD_CLASS 71 +#define YIELD_FROM 72 -#define INPLACE_LSHIFT 75 -#define INPLACE_RSHIFT 76 -#define INPLACE_AND 77 -#define INPLACE_XOR 78 -#define INPLACE_OR 79 -#define BREAK_LOOP 80 +#define INPLACE_LSHIFT 75 +#define INPLACE_RSHIFT 76 +#define INPLACE_AND 77 +#define INPLACE_XOR 78 +#define INPLACE_OR 79 +#define BREAK_LOOP 80 #define WITH_CLEANUP 81 -#define RETURN_VALUE 83 -#define IMPORT_STAR 84 +#define RETURN_VALUE 83 +#define IMPORT_STAR 84 -#define YIELD_VALUE 86 -#define POP_BLOCK 87 -#define END_FINALLY 88 -#define POP_EXCEPT 89 +#define YIELD_VALUE 86 +#define POP_BLOCK 87 +#define END_FINALLY 88 +#define POP_EXCEPT 89 -#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ +#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ -#define STORE_NAME 90 /* Index in name list */ -#define DELETE_NAME 91 /* "" */ -#define UNPACK_SEQUENCE 92 /* Number of sequence items */ -#define FOR_ITER 93 +#define STORE_NAME 90 /* Index in name list */ +#define DELETE_NAME 91 /* "" */ +#define UNPACK_SEQUENCE 92 /* Number of sequence items */ +#define FOR_ITER 93 #define UNPACK_EX 94 /* Num items before variable part + (Num items after variable part << 8) */ -#define STORE_ATTR 95 /* Index in name list */ -#define DELETE_ATTR 96 /* "" */ -#define STORE_GLOBAL 97 /* "" */ -#define DELETE_GLOBAL 98 /* "" */ +#define STORE_ATTR 95 /* Index in name list */ +#define DELETE_ATTR 96 /* "" */ +#define STORE_GLOBAL 97 /* "" */ +#define DELETE_GLOBAL 98 /* "" */ -#define LOAD_CONST 100 /* Index in const list */ -#define LOAD_NAME 101 /* Index in name list */ -#define BUILD_TUPLE 102 /* Number of tuple items */ -#define BUILD_LIST 103 /* Number of list items */ -#define BUILD_SET 104 /* Number of set items */ -#define BUILD_MAP 105 /* Always zero for now */ -#define LOAD_ATTR 106 /* Index in name list */ -#define COMPARE_OP 107 /* Comparison operator */ -#define IMPORT_NAME 108 /* Index in name list */ -#define IMPORT_FROM 109 /* Index in name list */ +#define LOAD_CONST 100 /* Index in const list */ +#define LOAD_NAME 101 /* Index in name list */ +#define BUILD_TUPLE 102 /* Number of tuple items */ +#define BUILD_LIST 103 /* Number of list items */ +#define BUILD_SET 104 /* Number of set items */ +#define BUILD_MAP 105 /* Always zero for now */ +#define LOAD_ATTR 106 /* Index in name list */ +#define COMPARE_OP 107 /* Comparison operator */ +#define IMPORT_NAME 108 /* Index in name list */ +#define IMPORT_FROM 109 /* Index in name list */ -#define JUMP_FORWARD 110 /* Number of bytes to skip */ -#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning of code */ -#define JUMP_IF_TRUE_OR_POP 112 /* "" */ -#define JUMP_ABSOLUTE 113 /* "" */ -#define POP_JUMP_IF_FALSE 114 /* "" */ -#define POP_JUMP_IF_TRUE 115 /* "" */ +#define JUMP_FORWARD 110 /* Number of bytes to skip */ +#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning of code */ +#define JUMP_IF_TRUE_OR_POP 112 /* "" */ +#define JUMP_ABSOLUTE 113 /* "" */ +#define POP_JUMP_IF_FALSE 114 /* "" */ +#define POP_JUMP_IF_TRUE 115 /* "" */ -#define LOAD_GLOBAL 116 /* Index in name list */ +#define LOAD_GLOBAL 116 /* Index in name list */ -#define CONTINUE_LOOP 119 /* Start of loop (absolute) */ -#define SETUP_LOOP 120 /* Target address (relative) */ -#define SETUP_EXCEPT 121 /* "" */ -#define SETUP_FINALLY 122 /* "" */ +#define CONTINUE_LOOP 119 /* Start of loop (absolute) */ +#define SETUP_LOOP 120 /* Target address (relative) */ +#define SETUP_EXCEPT 121 /* "" */ +#define SETUP_FINALLY 122 /* "" */ -#define LOAD_FAST 124 /* Local variable number */ -#define STORE_FAST 125 /* Local variable number */ -#define DELETE_FAST 126 /* Local variable number */ +#define LOAD_FAST 124 /* Local variable number */ +#define STORE_FAST 125 /* Local variable number */ +#define DELETE_FAST 126 /* Local variable number */ -#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ +#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ -#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ -#define MAKE_FUNCTION 132 /* #defaults + #kwdefaults<<8 + #annotations<<16 */ -#define BUILD_SLICE 133 /* Number of items */ +#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ +#define MAKE_FUNCTION 132 /* #defaults + #kwdefaults<<8 + #annotations<<16 */ +#define BUILD_SLICE 133 /* Number of items */ #define MAKE_CLOSURE 134 /* same as MAKE_FUNCTION */ #define LOAD_CLOSURE 135 /* Load free variable from closure */ @@ -126,9 +127,9 @@ /* The next 3 opcodes must be contiguous and satisfy (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ -#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ -#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ -#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ #define SETUP_WITH 143 @@ -148,7 +149,7 @@ enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, - PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; + PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) diff --git a/Include/pyerrors.h b/Include/pyerrors.h --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -51,6 +51,11 @@ Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */ } PyOSErrorObject; +typedef struct { + PyException_HEAD + PyObject *value; +} PyStopIterationObject; + /* Compatibility typedefs */ typedef PyOSErrorObject PyEnvironmentErrorObject; #ifdef MS_WINDOWS @@ -380,6 +385,8 @@ const char *reason /* UTF-8 encoded string */ ); +/* create a StopIteration exception with the given value */ +PyAPI_FUNC(PyObject *) PyStopIteration_Create(PyObject *); /* These APIs aren't really part of the error implementation, but often needed to format error messages; the native C lib APIs are diff --git a/Lib/opcode.py b/Lib/opcode.py --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -87,6 +87,7 @@ def_op('PRINT_EXPR', 70) def_op('LOAD_BUILD_CLASS', 71) +def_op('YIELD_FROM', 72) def_op('INPLACE_LSHIFT', 75) def_op('INPLACE_RSHIFT', 76) diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -813,7 +813,8 @@ self._check_comprehension(factory) def test_yield(self): - self.expr(ast.Yield(ast.Name("x", ast.Store())), "must have Load") + self.expr(ast.Yield(0, ast.Name("x", ast.Store())), "must have Load") + self.expr(ast.Yield(1, ast.Name("x", ast.Store())), "must have Load") def test_compare(self): left = ast.Name("x", ast.Load()) diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -728,29 +728,6 @@ syntax_tests = """ ->>> def f(): -... return 22 -... yield 1 -Traceback (most recent call last): - .. -SyntaxError: 'return' with argument inside generator - ->>> def f(): -... yield 1 -... return 22 -Traceback (most recent call last): - .. -SyntaxError: 'return' with argument inside generator - -"return None" is not the same as "return" in a generator: - ->>> def f(): -... yield 1 -... return None -Traceback (most recent call last): - .. -SyntaxError: 'return' with argument inside generator - These are fine: >>> def f(): @@ -866,20 +843,6 @@ >>> type(f()) - ->>> def f(): -... if 0: -... lambda x: x # shouldn't trigger here -... return # or here -... def f(i): -... return 2*i # or here -... if 0: -... return 3 # but *this* sucks (line 8) -... if 0: -... yield 2 # because it's a generator (line 10) -Traceback (most recent call last): -SyntaxError: 'return' with argument inside generator - This one caused a crash (see SF bug 567538): >>> def f(): @@ -1566,11 +1529,6 @@ ... SyntaxError: 'yield' outside function ->>> def f(): return lambda x=(yield): 1 -Traceback (most recent call last): - ... -SyntaxError: 'return' with argument inside generator - >>> def f(): x = yield = y Traceback (most recent call last): ... diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -458,7 +458,39 @@ check_syntax_error(self, "class foo:return 1") def test_yield(self): + # Allowed as standalone statement + def g(): yield 1 + def g(): yield from () + # Allowed as RHS of assignment + def g(): x = yield 1 + def g(): x = yield from () + # Ordinary yield accepts implicit tuples + def g(): yield 1, 1 + def g(): x = yield 1, 1 + # 'yield from' does not + check_syntax_error(self, "def g(): yield from (), 1") + check_syntax_error(self, "def g(): x = yield from (), 1") + # Requires parentheses as subexpression + def g(): 1, (yield 1) + def g(): 1, (yield from ()) + check_syntax_error(self, "def g(): 1, yield 1") + check_syntax_error(self, "def g(): 1, yield from ()") + # Requires parentheses as call argument + def g(): f((yield 1)) + def g(): f((yield 1), 1) + def g(): f((yield from ())) + def g(): f((yield from ()), 1) + check_syntax_error(self, "def g(): f(yield 1)") + check_syntax_error(self, "def g(): f(yield 1, 1)") + check_syntax_error(self, "def g(): f(yield from ())") + check_syntax_error(self, "def g(): f(yield from (), 1)") + # Not allowed at top level + check_syntax_error(self, "yield") + check_syntax_error(self, "yield from") + # Not allowed at class scope check_syntax_error(self, "class foo:yield 1") + check_syntax_error(self, "class foo:yield from ()") + def test_raise(self): # 'raise' test [',' test] diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py --- a/Lib/test/test_parser.py +++ b/Lib/test/test_parser.py @@ -50,6 +50,10 @@ self.check_suite("def f(): (yield 1)*2") self.check_suite("def f(): return; yield 1") self.check_suite("def f(): yield 1; return") + self.check_suite("def f(): yield from 1") + self.check_suite("def f(): x = yield from 1") + self.check_suite("def f(): f((yield from 1))") + self.check_suite("def f(): yield 1; return 1") self.check_suite("def f():\n" " for x in range(30):\n" " yield x\n") @@ -621,7 +625,6 @@ with self.assertRaises(TypeError): parser.expr("a", "b") - def test_main(): support.run_unittest( RoundtripLegalSyntaxTestCase, diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -727,7 +727,7 @@ nfrees = len(x.f_code.co_freevars) extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ ncells + nfrees - 1 - check(x, size(vh + '12P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) + check(x, size(vh + '13P3i' + CO_MAXBLOCKS*'3i' + 'P' + extras*'P')) # function def func(): pass check(func, size(h + '12P')) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -96,6 +96,7 @@ Philippe Biondi Stuart Bishop Roy Bixler +Renaud Blanch Mike Bland Martin Bless Pablo Bleyer @@ -482,6 +483,7 @@ Jack Jansen Bill Janssen Thomas Jarosch +Zbigniew J?drzejewski-Szmek Julien Jehannet Drew Jenkins Flemming Kj?r Jensen diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- PEP 380, Issue #11682: Add "yield from " to support easy delegation to + subgenerators (initial patch by Greg Ewing, integration into 3.3 by + Renaud Blanch, Ryan Kelly, Zbigniew J?drzejewski-Szmek and Nick Coghlan) + - Issue #13748: Raw bytes literals can now be written with the ``rb`` prefix as well as ``br``. diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -298,25 +298,25 @@ /* Convert return value to a Boolean */ switch (op) { - case Py_EQ: + case Py_EQ: v = TEST_COND(result == 0); break; - case Py_NE: + case Py_NE: v = TEST_COND(result != 0); break; - case Py_LE: + case Py_LE: v = TEST_COND(result <= 0); break; - case Py_GE: + case Py_GE: v = TEST_COND(result >= 0); break; - case Py_LT: + case Py_LT: v = TEST_COND(result < 0); break; - case Py_GT: + case Py_GT: v = TEST_COND(result > 0); break; - default: + default: PyErr_BadArgument(); return NULL; } @@ -976,6 +976,7 @@ VALIDATER(testlist_comp); VALIDATER(yield_expr); VALIDATER(or_test); VALIDATER(test_nocond); VALIDATER(lambdef_nocond); +VALIDATER(yield_arg); #undef VALIDATER @@ -1636,22 +1637,49 @@ } -/* yield_expr: 'yield' [testlist] +/* yield_expr: 'yield' [yield_arg] */ static int validate_yield_expr(node *tree) { int nch = NCH(tree); - int res = (validate_ntype(tree, yield_expr) - && ((nch == 1) || (nch == 2)) - && validate_name(CHILD(tree, 0), "yield")); - - if (res && (nch == 2)) - res = validate_testlist(CHILD(tree, 1)); - - return (res); + if (nch < 1 || nch > 2) + return 0; + if (!validate_ntype(tree, yield_expr)) + return 0; + if (!validate_name(CHILD(tree, 0), "yield")) + return 0; + if (nch == 2) { + if (!validate_yield_arg(CHILD(tree, 1))) + return 0; + } + return 1; } +/* yield_arg: 'from' test | testlist + */ +static int +validate_yield_arg(node *tree) +{ + int nch = NCH(tree); + if (!validate_ntype(tree, yield_arg)) + return 0; + switch (nch) { + case 1: + if (!validate_testlist(CHILD(tree, nch - 1))) + return 0; + break; + case 2: + if (!validate_name(CHILD(tree, 0), "from")) + return 0; + if (!validate_test(CHILD(tree, 1))) + return 0; + break; + default: + return 0; + } + return 1; +} /* yield_stmt: yield_expr */ @@ -2120,16 +2148,16 @@ */ tree = CHILD(tree, 0); switch (TYPE(tree)) { - case LESS: - case GREATER: - case EQEQUAL: - case EQUAL: - case LESSEQUAL: - case GREATEREQUAL: - case NOTEQUAL: + case LESS: + case GREATER: + case EQEQUAL: + case EQUAL: + case LESSEQUAL: + case GREATEREQUAL: + case NOTEQUAL: res = 1; break; - case NAME: + case NAME: res = ((strcmp(STR(tree), "in") == 0) || (strcmp(STR(tree), "is") == 0)); if (!res) { @@ -2665,9 +2693,9 @@ { int nch = NCH(tree); int res = (validate_ntype(tree, argument) - && ((nch == 1) || (nch == 2) || (nch == 3)) - && validate_test(CHILD(tree, 0))); - + && ((nch == 1) || (nch == 2) || (nch == 3))); + if (res) + res = validate_test(CHILD(tree, 0)); if (res && (nch == 2)) res = validate_comp_for(CHILD(tree, 1)); else if (res && (nch == 3)) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2267,7 +2267,6 @@ func = PyObject_GetAttrString(o, name); if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); return 0; } @@ -2311,7 +2310,6 @@ func = PyObject_GetAttrString(o, name); if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); return 0; } va_start(va, format); diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -487,8 +487,70 @@ /* * StopIteration extends Exception */ -SimpleExtendsException(PyExc_Exception, StopIteration, - "Signal the end from iterator.__next__()."); + +static PyMemberDef StopIteration_members[] = { + {"value", T_OBJECT, offsetof(PyStopIterationObject, value), 0, + PyDoc_STR("generator return value")}, + {NULL} /* Sentinel */ +}; + +static int +StopIteration_init(PyStopIterationObject *self, PyObject *args, PyObject *kwds) +{ + Py_ssize_t size = PyTuple_GET_SIZE(args); + PyObject *value; + + if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) + return -1; + Py_CLEAR(self->value); + if (size > 0) + value = PyTuple_GET_ITEM(args, 0); + else + value = Py_None; + Py_INCREF(value); + self->value = value; + return 0; +} + +static int +StopIteration_clear(PyStopIterationObject *self) +{ + Py_CLEAR(self->value); + return BaseException_clear((PyBaseExceptionObject *)self); +} + +static void +StopIteration_dealloc(PyStopIterationObject *self) +{ + _PyObject_GC_UNTRACK(self); + StopIteration_clear(self); + Py_TYPE(self)->tp_free((PyObject *)self); +} + +static int +StopIteration_traverse(PyStopIterationObject *self, visitproc visit, void *arg) +{ + Py_VISIT(self->value); + return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); +} + +PyObject * +PyStopIteration_Create(PyObject *value) +{ + return PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL); +} + +ComplexExtendsException( + PyExc_Exception, /* base */ + StopIteration, /* name */ + StopIteration, /* prefix for *_init, etc */ + 0, /* new */ + 0, /* methods */ + StopIteration_members, /* members */ + 0, /* getset */ + 0, /* str */ + "Signal the end from iterator.__next__()." +); /* diff --git a/Objects/frameobject.c b/Objects/frameobject.c --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -15,11 +15,12 @@ #define OFF(x) offsetof(PyFrameObject, x) static PyMemberDef frame_memberlist[] = { - {"f_back", T_OBJECT, OFF(f_back), READONLY}, - {"f_code", T_OBJECT, OFF(f_code), READONLY}, - {"f_builtins", T_OBJECT, OFF(f_builtins),READONLY}, - {"f_globals", T_OBJECT, OFF(f_globals), READONLY}, - {"f_lasti", T_INT, OFF(f_lasti), READONLY}, + {"f_back", T_OBJECT, OFF(f_back), READONLY}, + {"f_code", T_OBJECT, OFF(f_code), READONLY}, + {"f_builtins", T_OBJECT, OFF(f_builtins), READONLY}, + {"f_globals", T_OBJECT, OFF(f_globals), READONLY}, + {"f_lasti", T_INT, OFF(f_lasti), READONLY}, + {"f_yieldfrom", T_OBJECT, OFF(f_yieldfrom), READONLY}, {NULL} /* Sentinel */ }; @@ -444,6 +445,7 @@ Py_CLEAR(f->f_exc_type); Py_CLEAR(f->f_exc_value); Py_CLEAR(f->f_exc_traceback); + Py_CLEAR(f->f_yieldfrom); co = f->f_code; if (co->co_zombieframe == NULL) @@ -475,6 +477,7 @@ Py_VISIT(f->f_exc_type); Py_VISIT(f->f_exc_value); Py_VISIT(f->f_exc_traceback); + Py_VISIT(f->f_yieldfrom); /* locals */ slots = f->f_code->co_nlocals + PyTuple_GET_SIZE(f->f_code->co_cellvars) + PyTuple_GET_SIZE(f->f_code->co_freevars); @@ -508,6 +511,7 @@ Py_CLEAR(f->f_exc_value); Py_CLEAR(f->f_exc_traceback); Py_CLEAR(f->f_trace); + Py_CLEAR(f->f_yieldfrom); /* locals */ slots = f->f_code->co_nlocals + PyTuple_GET_SIZE(f->f_code->co_cellvars) + PyTuple_GET_SIZE(f->f_code->co_freevars); @@ -711,6 +715,7 @@ f->f_lasti = -1; f->f_lineno = code->co_firstlineno; f->f_iblock = 0; + f->f_yieldfrom = NULL; _PyObject_GC_TRACK(f); return f; diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -5,6 +5,9 @@ #include "structmember.h" #include "opcode.h" +static PyObject *gen_close(PyGenObject *gen, PyObject *args); +static void gen_undelegate(PyGenObject *gen); + static int gen_traverse(PyGenObject *gen, visitproc visit, void *arg) { @@ -90,12 +93,18 @@ /* If the generator just returned (as opposed to yielding), signal * that the generator is exhausted. */ - if (result == Py_None && f->f_stacktop == NULL) { - Py_DECREF(result); - result = NULL; - /* Set exception if not called by gen_iternext() */ - if (arg) + if (result && f->f_stacktop == NULL) { + if (result == Py_None) { + /* Delay exception instantiation if we can */ PyErr_SetNone(PyExc_StopIteration); + } else { + PyObject *e = PyStopIteration_Create(result); + if (e != NULL) { + PyErr_SetObject(PyExc_StopIteration, e); + Py_DECREF(e); + } + } + Py_CLEAR(result); } if (!result || f->f_stacktop == NULL) { @@ -111,8 +120,8 @@ Py_XDECREF(t); Py_XDECREF(v); Py_XDECREF(tb); + gen->gi_frame = NULL; Py_DECREF(f); - gen->gi_frame = NULL; } return result; @@ -125,17 +134,91 @@ static PyObject * gen_send(PyGenObject *gen, PyObject *arg) { - return gen_send_ex(gen, arg, 0); + int exc = 0; + PyObject *ret; + PyObject *yf = gen->gi_frame ? gen->gi_frame->f_yieldfrom : NULL; + /* XXX (ncoghlan): Are the incref/decref on arg and yf strictly needed? + * Or would it be valid to rely on borrowed references? + */ + Py_INCREF(arg); + if (yf) { + Py_INCREF(yf); + if (PyGen_CheckExact(yf)) { + ret = gen_send((PyGenObject *)yf, arg); + } else { + if (arg == Py_None) + ret = PyIter_Next(yf); + else + ret = PyObject_CallMethod(yf, "send", "O", arg); + } + if (ret) { + Py_DECREF(yf); + goto done; + } + gen_undelegate(gen); + Py_CLEAR(arg); + if (PyGen_FetchStopIterationValue(&arg) < 0) { + exc = 1; + } + Py_DECREF(yf); + } + ret = gen_send_ex(gen, arg, exc); +done: + Py_XDECREF(arg); + return ret; } PyDoc_STRVAR(close_doc, "close(arg) -> raise GeneratorExit inside generator."); +/* + * This helper function is used by gen_close and gen_throw to + * close a subiterator being delegated to by yield-from. + */ + +static int +gen_close_iter(PyObject *yf) +{ + PyObject *retval = NULL; + + if (PyGen_CheckExact(yf)) { + retval = gen_close((PyGenObject *)yf, NULL); + if (retval == NULL) { + return -1; + } + } else { + PyObject *meth = PyObject_GetAttrString(yf, "close"); + if (meth == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, ""); + Py_DECREF(meth); + if (!retval) + return -1; + } + } + Py_XDECREF(retval); + return 0; +} + static PyObject * gen_close(PyGenObject *gen, PyObject *args) { PyObject *retval; - PyErr_SetNone(PyExc_GeneratorExit); + PyObject *yf = gen->gi_frame ? gen->gi_frame->f_yieldfrom : NULL; + int err = 0; + + if (yf) { + Py_INCREF(yf); + err = gen_close_iter(yf); + gen_undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) + PyErr_SetNone(PyExc_GeneratorExit); retval = gen_send_ex(gen, Py_None, 1); if (retval) { Py_DECREF(retval); @@ -196,7 +279,7 @@ _Py_NewReference(self); self->ob_refcnt = refcnt; } - assert(PyType_IS_GC(self->ob_type) && + assert(PyType_IS_GC(Py_TYPE(self)) && _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so @@ -209,8 +292,8 @@ * undone. */ #ifdef COUNT_ALLOCS - --self->ob_type->tp_frees; - --self->ob_type->tp_allocs; + --(Py_TYPE(self)->tp_frees); + --(Py_TYPE(self)->tp_allocs); #endif } @@ -226,10 +309,55 @@ PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; + PyObject *yf = gen->gi_frame ? gen->gi_frame->f_yieldfrom : NULL; if (!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)) return NULL; + if (yf) { + PyObject *ret; + int err; + Py_INCREF(yf); + if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { + err = gen_close_iter(yf); + Py_DECREF(yf); + gen_undelegate(gen); + if (err < 0) + return gen_send_ex(gen, Py_None, 1); + goto throw_here; + } + if (PyGen_CheckExact(yf)) { + ret = gen_throw((PyGenObject *)yf, args); + } else { + PyObject *meth = PyObject_GetAttrString(yf, "throw"); + if (meth == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + Py_DECREF(yf); + return NULL; + } + PyErr_Clear(); + Py_DECREF(yf); + gen_undelegate(gen); + goto throw_here; + } + ret = PyObject_CallObject(meth, args); + Py_DECREF(meth); + } + Py_DECREF(yf); + if (!ret) { + PyObject *val; + gen_undelegate(gen); + if (PyGen_FetchStopIterationValue(&val) == 0) { + ret = gen_send_ex(gen, val, 0); + Py_DECREF(val); + } else { + ret = gen_send_ex(gen, Py_None, 1); + } + } + return ret; + } + +throw_here: /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { @@ -272,7 +400,7 @@ PyErr_Format(PyExc_TypeError, "exceptions must be classes or instances " "deriving from BaseException, not %s", - typ->ob_type->tp_name); + Py_TYPE(typ)->tp_name); goto failed_throw; } @@ -291,9 +419,74 @@ static PyObject * gen_iternext(PyGenObject *gen) { - return gen_send_ex(gen, NULL, 0); + PyObject *val = NULL; + PyObject *ret; + int exc = 0; + PyObject *yf = gen->gi_frame ? gen->gi_frame->f_yieldfrom : NULL; + if (yf) { + Py_INCREF(yf); + /* ceval.c ensures that yf is an iterator */ + ret = Py_TYPE(yf)->tp_iternext(yf); + if (ret) { + Py_DECREF(yf); + return ret; + } + gen_undelegate(gen); + if (PyGen_FetchStopIterationValue(&val) < 0) + exc = 1; + Py_DECREF(yf); + } + ret = gen_send_ex(gen, val, exc); + Py_XDECREF(val); + return ret; } +/* + * In certain recursive situations, a generator may lose its frame + * before we get a chance to clear f_yieldfrom, so we use this + * helper function. + */ + +static void +gen_undelegate(PyGenObject *gen) { + if (gen->gi_frame) { + Py_XDECREF(gen->gi_frame->f_yieldfrom); + gen->gi_frame->f_yieldfrom = NULL; + } +} + +/* + * If StopIteration exception is set, fetches its 'value' + * attribute if any, otherwise sets pvalue to None. + * + * Returns 0 if no exception or StopIteration is set. + * If any other exception is set, returns -1 and leaves + * pvalue unchanged. + */ + +int +PyGen_FetchStopIterationValue(PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + + if (PyErr_ExceptionMatches(PyExc_StopIteration)) { + PyErr_Fetch(&et, &ev, &tb); + Py_XDECREF(et); + Py_XDECREF(tb); + if (ev) { + value = ((PyStopIterationObject *)ev)->value; + Py_DECREF(ev); + } + } else if (PyErr_Occurred()) { + return -1; + } + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + *pvalue = value; + return 0; +} static PyObject * gen_repr(PyGenObject *gen) diff --git a/Parser/Python.asdl b/Parser/Python.asdl --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -59,7 +59,7 @@ | DictComp(expr key, expr value, comprehension* generators) | GeneratorExp(expr elt, comprehension* generators) -- the grammar constrains where yield expressions can occur - | Yield(expr? value) + | Yield(int is_from, expr? value) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -231,7 +231,9 @@ "generators", }; static PyTypeObject *Yield_type; +_Py_IDENTIFIER(is_from); static char *Yield_fields[]={ + "is_from", "value", }; static PyTypeObject *Compare_type; @@ -810,7 +812,7 @@ GeneratorExp_type = make_type("GeneratorExp", expr_type, GeneratorExp_fields, 2); if (!GeneratorExp_type) return 0; - Yield_type = make_type("Yield", expr_type, Yield_fields, 1); + Yield_type = make_type("Yield", expr_type, Yield_fields, 2); if (!Yield_type) return 0; Compare_type = make_type("Compare", expr_type, Compare_fields, 3); if (!Compare_type) return 0; @@ -1747,13 +1749,14 @@ } expr_ty -Yield(expr_ty value, int lineno, int col_offset, PyArena *arena) +Yield(int is_from, expr_ty value, int lineno, int col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; p->kind = Yield_kind; + p->v.Yield.is_from = is_from; p->v.Yield.value = value; p->lineno = lineno; p->col_offset = col_offset; @@ -2795,6 +2798,11 @@ case Yield_kind: result = PyType_GenericNew(Yield_type, NULL, NULL); if (!result) goto failed; + value = ast2obj_int(o->v.Yield.is_from); + if (!value) goto failed; + if (PyObject_SetAttrString(result, "is_from", value) == -1) + goto failed; + Py_DECREF(value); value = ast2obj_expr(o->v.Yield.value); if (!value) goto failed; if (_PyObject_SetAttrId(result, &PyId_value, value) == -1) @@ -5337,8 +5345,21 @@ return 1; } if (isinstance) { + int is_from; expr_ty value; + if (_PyObject_HasAttrId(obj, &PyId_is_from)) { + int res; + tmp = _PyObject_GetAttrId(obj, &PyId_is_from); + if (tmp == NULL) goto failed; + res = obj2ast_int(tmp, &is_from, arena); + if (res != 0) goto failed; + Py_XDECREF(tmp); + tmp = NULL; + } else { + PyErr_SetString(PyExc_TypeError, "required field \"is_from\" missing from Yield"); + return 1; + } if (_PyObject_HasAttrId(obj, &PyId_value)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_value); @@ -5350,7 +5371,7 @@ } else { value = NULL; } - *out = Yield(value, lineno, col_offset, arena); + *out = Yield(is_from, value, lineno, col_offset, arena); if (*out == NULL) goto failed; return 0; } diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -2369,13 +2369,24 @@ } return ast_for_binop(c, n); case yield_expr: { + node *an = NULL; + node *en = NULL; + int is_from = 0; expr_ty exp = NULL; - if (NCH(n) == 2) { - exp = ast_for_testlist(c, CHILD(n, 1)); + if (NCH(n) > 1) + an = CHILD(n, 1); /* yield_arg */ + if (an) { + en = CHILD(an, NCH(an) - 1); + if (NCH(an) == 2) { + is_from = 1; + exp = ast_for_expr(c, en); + } + else + exp = ast_for_testlist(c, en); if (!exp) return NULL; } - return Yield(exp, LINENO(n), n->n_col_offset, c->c_arena); + return Yield(is_from, exp, LINENO(n), n->n_col_offset, c->c_arena); } case factor: if (NCH(n) == 1) { @@ -2399,7 +2410,7 @@ /* arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) - argument: [test '='] test [comp_for] # Really [keyword '='] test + argument: [test '='] (test) [comp_for] # Really [keyword '='] test */ int i, nargs, nkeywords, ngens; @@ -2693,7 +2704,7 @@ continue_stmt: 'continue' return_stmt: 'return' [testlist] yield_stmt: yield_expr - yield_expr: 'yield' testlist + yield_expr: 'yield' testlist | 'yield' 'from' test raise_stmt: 'raise' [test [',' test [',' test]]] */ node *ch; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1828,6 +1828,52 @@ why = WHY_RETURN; goto fast_block_end; + TARGET(YIELD_FROM) + u = POP(); + x = PyObject_GetIter(u); + Py_DECREF(u); + if (x == NULL) + break; + /* x is now the iterator, make the first next() call */ + retval = (*Py_TYPE(x)->tp_iternext)(x); + if (!retval) { + /* iter may be exhausted */ + Py_CLEAR(x); + if (!PyErr_ExceptionMatches(PyExc_StopIteration)) { + /* some other exception */ + break; + } + /* try to get return value from exception */ + PyObject *et, *ev, *tb; + PyErr_Fetch(&et, &ev, &tb); + Py_XDECREF(et); + Py_XDECREF(tb); + /* u is return value */ + u = NULL; + if (ev) { + u = PyObject_GetAttrString(ev, "value"); + Py_DECREF(ev); + if (u == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + /* some other exception */ + break; + } + PyErr_Clear(); + } + } + if (u == NULL) { + u = Py_None; + Py_INCREF(u); + } + PUSH(u); + continue; + } + /* x is iterator, retval is value to be yielded */ + f->f_yieldfrom = x; + f->f_stacktop = stack_pointer; + why = WHY_YIELD; + goto fast_yield; + TARGET(YIELD_VALUE) retval = POP(); f->f_stacktop = stack_pointer; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -840,6 +840,7 @@ case IMPORT_STAR: return -1; case YIELD_VALUE: + case YIELD_FROM: return 0; case POP_BLOCK: @@ -3318,7 +3319,12 @@ else { ADDOP_O(c, LOAD_CONST, Py_None, consts); } - ADDOP(c, YIELD_VALUE); + if (e->v.Yield.is_from) { + ADDOP(c, YIELD_FROM); + } + else { + ADDOP(c, YIELD_VALUE); + } break; case Compare_kind: return compiler_compare(c, e); diff --git a/Python/graminit.c b/Python/graminit.c --- a/Python/graminit.c +++ b/Python/graminit.c @@ -1791,7 +1791,7 @@ {167, 1}, }; static arc arcs_80_1[2] = { - {9, 2}, + {168, 2}, {0, 1}, }; static arc arcs_80_2[1] = { @@ -1802,171 +1802,188 @@ {2, arcs_80_1}, {1, arcs_80_2}, }; -static dfa dfas[81] = { +static arc arcs_81_0[2] = { + {73, 1}, + {9, 2}, +}; +static arc arcs_81_1[1] = { + {24, 2}, +}; +static arc arcs_81_2[1] = { + {0, 2}, +}; +static state states_81[3] = { + {2, arcs_81_0}, + {1, arcs_81_1}, + {1, arcs_81_2}, +}; +static dfa dfas[82] = { {256, "single_input", 0, 3, states_0, - "\004\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204"}, + "\004\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, {257, "file_input", 0, 2, states_1, - "\204\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204"}, + "\204\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, {258, "eval_input", 0, 3, states_2, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {259, "decorator", 0, 7, states_3, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {260, "decorators", 0, 2, states_4, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {261, "decorated", 0, 3, states_5, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {262, "funcdef", 0, 8, states_6, - "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {263, "parameters", 0, 4, states_7, - "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {264, "typedargslist", 0, 18, states_8, - "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {265, "tfpdef", 0, 4, states_9, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {266, "varargslist", 0, 18, states_10, - "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\200\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {267, "vfpdef", 0, 2, states_11, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {268, "stmt", 0, 2, states_12, - "\000\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204"}, + "\000\050\060\200\000\000\000\240\340\223\160\220\045\200\020\000\000\206\120\076\204\000"}, {269, "simple_stmt", 0, 4, states_13, - "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200"}, + "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, {270, "small_stmt", 0, 2, states_14, - "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200"}, + "\000\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, {271, "expr_stmt", 0, 6, states_15, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {272, "testlist_star_expr", 0, 3, states_16, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {273, "augassign", 0, 2, states_17, - "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\376\037\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {274, "del_stmt", 0, 3, states_18, - "\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {275, "pass_stmt", 0, 2, states_19, - "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {276, "flow_stmt", 0, 2, states_20, - "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\200"}, + "\000\000\000\000\000\000\000\000\340\001\000\000\000\000\000\000\000\000\000\000\200\000"}, {277, "break_stmt", 0, 2, states_21, - "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {278, "continue_stmt", 0, 2, states_22, - "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {279, "return_stmt", 0, 3, states_23, - "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {280, "yield_stmt", 0, 2, states_24, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, {281, "raise_stmt", 0, 5, states_25, - "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000"}, {282, "import_stmt", 0, 2, states_26, - "\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\022\000\000\000\000\000\000\000\000\000\000\000\000"}, {283, "import_name", 0, 3, states_27, - "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"}, {284, "import_from", 0, 8, states_28, - "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000"}, {285, "import_as_name", 0, 4, states_29, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {286, "dotted_as_name", 0, 4, states_30, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {287, "import_as_names", 0, 3, states_31, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {288, "dotted_as_names", 0, 2, states_32, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {289, "dotted_name", 0, 2, states_33, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {290, "global_stmt", 0, 3, states_34, - "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000"}, {291, "nonlocal_stmt", 0, 3, states_35, - "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000"}, {292, "assert_stmt", 0, 5, states_36, - "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, {293, "compound_stmt", 0, 2, states_37, - "\000\010\020\000\000\000\000\000\000\000\000\220\045\000\000\000\000\000\000\000\004"}, + "\000\010\020\000\000\000\000\000\000\000\000\220\045\000\000\000\000\000\000\000\004\000"}, {294, "if_stmt", 0, 8, states_38, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, {295, "while_stmt", 0, 8, states_39, - "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"}, {296, "for_stmt", 0, 10, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, {297, "try_stmt", 0, 13, states_41, - "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000"}, {298, "with_stmt", 0, 5, states_42, - "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000"}, {299, "with_item", 0, 4, states_43, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {300, "except_clause", 0, 5, states_44, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, {301, "suite", 0, 5, states_45, - "\004\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200"}, + "\004\040\040\200\000\000\000\240\340\223\160\000\000\200\020\000\000\206\120\076\200\000"}, {302, "test", 0, 6, states_46, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {303, "test_nocond", 0, 2, states_47, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {304, "lambdef", 0, 5, states_48, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, {305, "lambdef_nocond", 0, 5, states_49, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000"}, {306, "or_test", 0, 2, states_50, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, {307, "and_test", 0, 2, states_51, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, {308, "not_test", 0, 3, states_52, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\020\000\000\206\120\076\000\000"}, {309, "comparison", 0, 2, states_53, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {310, "comp_op", 0, 4, states_54, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\220\177\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\220\177\000\000\000\000\000\000"}, {311, "star_expr", 0, 3, states_55, - "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {312, "expr", 0, 2, states_56, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {313, "xor_expr", 0, 2, states_57, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {314, "and_expr", 0, 2, states_58, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {315, "shift_expr", 0, 2, states_59, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {316, "arith_expr", 0, 2, states_60, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {317, "term", 0, 2, states_61, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {318, "factor", 0, 3, states_62, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {319, "power", 0, 4, states_63, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000\000"}, {320, "atom", 0, 9, states_64, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\120\076\000\000"}, {321, "testlist_comp", 0, 5, states_65, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {322, "trailer", 0, 7, states_66, - "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000"}, + "\000\040\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\020\000\000\000"}, {323, "subscriptlist", 0, 3, states_67, - "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {324, "subscript", 0, 5, states_68, - "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\002\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {325, "sliceop", 0, 3, states_69, - "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\002\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {326, "exprlist", 0, 3, states_70, - "\000\040\040\200\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000"}, + "\000\040\040\200\000\000\000\000\000\200\000\000\000\000\000\000\000\206\120\076\000\000"}, {327, "testlist", 0, 3, states_71, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {328, "dictorsetmaker", 0, 11, states_72, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {329, "classdef", 0, 8, states_73, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\004\000"}, {330, "arglist", 0, 8, states_74, - "\000\040\040\200\001\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\200\001\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {331, "argument", 0, 4, states_75, - "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000"}, + "\000\040\040\000\000\000\000\000\000\200\000\000\000\200\020\000\000\206\120\076\000\000"}, {332, "comp_iter", 0, 2, states_76, - "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, {333, "comp_for", 0, 6, states_77, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, {334, "comp_if", 0, 4, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"}, + "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, {335, "encoding_decl", 0, 2, states_79, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, + "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, {336, "yield_expr", 0, 3, states_80, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200"}, + "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\200\000"}, + {337, "yield_arg", 0, 3, states_81, + "\000\040\040\000\000\000\000\000\000\202\000\000\000\200\020\000\000\206\120\076\000\000"}, }; -static label labels[168] = { +static label labels[169] = { {0, "EMPTY"}, {256, 0}, {4, 0}, @@ -2135,10 +2152,11 @@ {334, 0}, {335, 0}, {1, "yield"}, + {337, 0}, }; grammar _PyParser_Grammar = { - 81, + 82, dfas, - {168, labels}, + {169, labels}, 256 }; diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -71,7 +71,7 @@ &&TARGET_STORE_LOCALS, &&TARGET_PRINT_EXPR, &&TARGET_LOAD_BUILD_CLASS, - &&_unknown_opcode, + &&TARGET_YIELD_FROM, &&_unknown_opcode, &&_unknown_opcode, &&TARGET_INPLACE_LSHIFT, diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -19,10 +19,6 @@ #define IMPORT_STAR_WARNING "import * only allowed at module level" -#define RETURN_VAL_IN_GENERATOR \ - "'return' with argument inside generator" - - static PySTEntryObject * ste_new(struct symtable *st, identifier name, _Py_block_ty block, void *key, int lineno, int col_offset) @@ -1133,14 +1129,6 @@ if (s->v.Return.value) { VISIT(st, expr, s->v.Return.value); st->st_cur->ste_returns_value = 1; - if (st->st_cur->ste_generator) { - PyErr_SetString(PyExc_SyntaxError, - RETURN_VAL_IN_GENERATOR); - PyErr_SyntaxLocationEx(st->st_filename, - s->lineno, - s->col_offset); - return 0; - } } break; case Delete_kind: @@ -1345,13 +1333,6 @@ if (e->v.Yield.value) VISIT(st, expr, e->v.Yield.value); st->st_cur->ste_generator = 1; - if (st->st_cur->ste_returns_value) { - PyErr_SetString(PyExc_SyntaxError, - RETURN_VAL_IN_GENERATOR); - PyErr_SyntaxLocationEx(st->st_filename, - e->lineno, e->col_offset); - return 0; - } break; case Compare_kind: VISIT(st, expr, e->v.Compare.left); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 13:07:26 2012 From: python-checkins at python.org (nick.coghlan) Date: Fri, 13 Jan 2012 13:07:26 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_PEP_380_is_done_-_anything_fro?= =?utf8?q?m_here_on_out_will_be_handled_via_normal?= Message-ID: http://hg.python.org/peps/rev/fe8867efc2bb changeset: 4011:fe8867efc2bb user: Nick Coghlan date: Fri Jan 13 22:07:17 2012 +1000 summary: PEP 380 is done - anything from here on out will be handled via normal maintenance processes files: pep-0380.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0380.txt b/pep-0380.txt --- a/pep-0380.txt +++ b/pep-0380.txt @@ -3,7 +3,7 @@ Version: $Revision$ Last-Modified: $Date$ Author: Gregory Ewing -Status: Accepted +Status: Final Type: Standards Track Content-Type: text/x-rst Created: 13-Feb-2009 -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 13 14:46:03 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jan 2012 14:46:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_make_Python-ast=2Ec_depend_?= =?utf8?q?on_Python-ast=2Eh?= Message-ID: http://hg.python.org/cpython/rev/bb94a16ac984 changeset: 74357:bb94a16ac984 user: Benjamin Peterson date: Fri Jan 13 08:45:55 2012 -0500 summary: make Python-ast.c depend on Python-ast.h files: Makefile.pre.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -614,7 +614,7 @@ $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES) $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL) -$(AST_C): $(AST_ASDL) $(ASDLGEN_FILES) +$(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES) $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 18:53:52 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 13 Jan 2012 18:53:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313645=3A_pyc_files?= =?utf8?q?_now_contain_the_size_of_the_corresponding_source?= Message-ID: http://hg.python.org/cpython/rev/87331661042b changeset: 74358:87331661042b user: Antoine Pitrou date: Fri Jan 13 18:52:16 2012 +0100 summary: Issue #13645: pyc files now contain the size of the corresponding source code, to avoid timestamp collisions (especially on filesystems with a low timestamp resolution) when checking for freshness of the bytecode. files: Doc/library/importlib.rst | 19 +++ Lib/importlib/_bootstrap.py | 57 +++++++-- Lib/importlib/abc.py | 15 ++- Lib/importlib/test/source/test_abc_loader.py | 10 +- Lib/importlib/test/source/test_file_loader.py | 44 +++++-- Lib/pkgutil.py | 2 +- Lib/py_compile.py | 7 +- Lib/test/test_import.py | 12 +- Lib/test/test_zipimport.py | 10 +- Misc/NEWS | 4 + Modules/zipimport.c | 4 +- Python/Python-ast.c | 2 +- Python/import.c | 26 +++- Python/pythonrun.c | 2 + 14 files changed, 166 insertions(+), 48 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -239,11 +239,30 @@ optimization to speed up loading by removing the parsing step of Python's compiler, and so no bytecode-specific API is exposed. + .. method:: path_stats(self, path) + + Optional abstract method which returns a :class:`dict` containing + metadata about the specifed path. Supported dictionary keys are: + + - ``'mtime'`` (mandatory): an integer or floating-point number + representing the modification time of the source code; + - ``'size'`` (optional): the size in bytes of the source code. + + Any other keys in the dictionary are ignored, to allow for future + extensions. + + .. versionadded:: 3.3 + .. method:: path_mtime(self, path) Optional abstract method which returns the modification time for the specified path. + .. deprecated:: 3.3 + This method is deprecated in favour of :meth:`path_stats`. You don't + have to implement it, but it is still available for compatibility + purposes. + .. method:: set_data(self, path, data) Optional abstract method which writes the specified bytes to a file diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -331,25 +331,40 @@ filename = self.get_filename(fullname).rpartition(path_sep)[2] return filename.rsplit('.', 1)[0] == '__init__' - def _bytes_from_bytecode(self, fullname, data, source_mtime): + def _bytes_from_bytecode(self, fullname, data, source_stats): """Return the marshalled bytes from bytecode, verifying the magic - number and timestamp along the way. + number, timestamp and source size along the way. - If source_mtime is None then skip the timestamp check. + If source_stats is None then skip the timestamp check. """ magic = data[:4] raw_timestamp = data[4:8] + raw_size = data[8:12] if len(magic) != 4 or magic != imp.get_magic(): raise ImportError("bad magic number in {}".format(fullname)) elif len(raw_timestamp) != 4: raise EOFError("bad timestamp in {}".format(fullname)) - elif source_mtime is not None: - if marshal._r_long(raw_timestamp) != source_mtime: - raise ImportError("bytecode is stale for {}".format(fullname)) + elif len(raw_size) != 4: + raise EOFError("bad size in {}".format(fullname)) + if source_stats is not None: + try: + source_mtime = int(source_stats['mtime']) + except KeyError: + pass + else: + if marshal._r_long(raw_timestamp) != source_mtime: + raise ImportError("bytecode is stale for {}".format(fullname)) + try: + source_size = source_stats['size'] & 0xFFFFFFFF + except KeyError: + pass + else: + if marshal._r_long(raw_size) != source_size: + raise ImportError("bytecode is stale for {}".format(fullname)) # Can't return the code object as errors from marshal loading need to # propagate even when source is available. - return data[8:] + return data[12:] @module_for_loader def _load_module(self, module, *, sourceless=False): @@ -377,11 +392,20 @@ def path_mtime(self, path): """Optional method that returns the modification time (an int) for the specified path, where path is a str. + """ + raise NotImplementedError + + def path_stats(self, path): + """Optional method returning a metadata dict for the specified path + to by the path (str). + Possible keys: + - 'mtime' (mandatory) is the numeric timestamp of last source + code modification; + - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. - """ - raise NotImplementedError + return {'mtime': self.path_mtime(path)} def set_data(self, path, data): """Optional method which writes data (bytes) to a file path (a str). @@ -407,7 +431,7 @@ def get_code(self, fullname): """Concrete implementation of InspectLoader.get_code. - Reading of bytecode requires path_mtime to be implemented. To write + Reading of bytecode requires path_stats to be implemented. To write bytecode, set_data must also be implemented. """ @@ -416,10 +440,11 @@ source_mtime = None if bytecode_path is not None: try: - source_mtime = self.path_mtime(source_path) + st = self.path_stats(source_path) except NotImplementedError: pass else: + source_mtime = int(st['mtime']) try: data = self.get_data(bytecode_path) except IOError: @@ -427,7 +452,7 @@ else: try: bytes_data = self._bytes_from_bytecode(fullname, data, - source_mtime) + st) except (ImportError, EOFError): pass else: @@ -448,6 +473,7 @@ # throw an exception. data = bytearray(imp.get_magic()) data.extend(marshal._w_long(source_mtime)) + data.extend(marshal._w_long(len(source_bytes))) data.extend(marshal.dumps(code_object)) try: self.set_data(bytecode_path, data) @@ -492,9 +518,10 @@ """Concrete implementation of SourceLoader using the file system.""" - def path_mtime(self, path): - """Return the modification time for the path.""" - return int(_os.stat(path).st_mtime) + def path_stats(self, path): + """Return the metadat for the path.""" + st = _os.stat(path) + return {'mtime': st.st_mtime, 'size': st.st_size} def set_data(self, path, data): """Write bytes data to a file.""" diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -123,7 +123,20 @@ def path_mtime(self, path): """Return the (int) modification time for the path (str).""" - raise NotImplementedError + if self.path_stats.__func__ is SourceLoader.path_stats: + raise NotImplementedError + return int(self.path_stats(path)['mtime']) + + def path_stats(self, path): + """Return a metadata dict for the source pointed to by the path (str). + Possible keys: + - 'mtime' (mandatory) is the numeric timestamp of last source + code modification; + - 'size' (optional) is the size in bytes of the source code. + """ + if self.path_mtime.__func__ is SourceLoader.path_mtime: + raise NotImplementedError + return {'mtime': self.path_mtime(path)} def set_data(self, path, data): """Write the bytes to the path (if possible). diff --git a/Lib/importlib/test/source/test_abc_loader.py b/Lib/importlib/test/source/test_abc_loader.py --- a/Lib/importlib/test/source/test_abc_loader.py +++ b/Lib/importlib/test/source/test_abc_loader.py @@ -5,6 +5,7 @@ from .. import util from . import util as source_util +import collections import imp import inspect import io @@ -40,8 +41,10 @@ def __init__(self, path, magic=imp.get_magic()): super().__init__(path) self.bytecode_path = imp.cache_from_source(self.path) + self.source_size = len(self.source) data = bytearray(magic) data.extend(marshal._w_long(self.source_mtime)) + data.extend(marshal._w_long(self.source_size)) code_object = compile(self.source, self.path, 'exec', dont_inherit=True) data.extend(marshal.dumps(code_object)) @@ -56,9 +59,9 @@ else: raise IOError - def path_mtime(self, path): + def path_stats(self, path): assert path == self.path - return self.source_mtime + return {'mtime': self.source_mtime, 'size': self.source_size} def set_data(self, path, data): self.written[path] = bytes(data) @@ -657,6 +660,7 @@ self.assertIn(self.cached, self.loader.written) data = bytearray(imp.get_magic()) data.extend(marshal._w_long(self.loader.source_mtime)) + data.extend(marshal._w_long(self.loader.source_size)) data.extend(marshal.dumps(code_object)) self.assertEqual(self.loader.written[self.cached], bytes(data)) @@ -847,7 +851,7 @@ # Required abstractmethods. self.raises_NotImplementedError(ins, 'get_filename', 'get_data') # Optional abstractmethods. - self.raises_NotImplementedError(ins,'path_mtime', 'set_data') + self.raises_NotImplementedError(ins,'path_stats', 'set_data') def test_PyLoader(self): self.raises_NotImplementedError(self.PyLoader(), 'source_path', diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -70,11 +70,6 @@ module_dict_id = id(module.__dict__) with open(mapping['_temp'], 'w') as file: file.write("testing_var = 42\n") - # For filesystems where the mtime is only to a second granularity, - # everything that has happened above can be too fast; - # force an mtime on the source that is guaranteed to be different - # than the original mtime. - loader.path_mtime = self.fake_mtime(loader.path_mtime) module = loader.load_module('_temp') self.assertTrue('testing_var' in module.__dict__, "'testing_var' not in " @@ -190,10 +185,17 @@ del_source=del_source) test('_temp', mapping, bc_path) + def _test_partial_size(self, test, *, del_source=False): + with source_util.create_modules('_temp') as mapping: + bc_path = self.manipulate_bytecode('_temp', mapping, + lambda bc: bc[:11], + del_source=del_source) + test('_temp', mapping, bc_path) + def _test_no_marshal(self, *, del_source=False): with source_util.create_modules('_temp') as mapping: bc_path = self.manipulate_bytecode('_temp', mapping, - lambda bc: bc[:8], + lambda bc: bc[:12], del_source=del_source) file_path = mapping['_temp'] if not del_source else bc_path with self.assertRaises(EOFError): @@ -202,7 +204,7 @@ def _test_non_code_marshal(self, *, del_source=False): with source_util.create_modules('_temp') as mapping: bytecode_path = self.manipulate_bytecode('_temp', mapping, - lambda bc: bc[:8] + marshal.dumps(b'abcd'), + lambda bc: bc[:12] + marshal.dumps(b'abcd'), del_source=del_source) file_path = mapping['_temp'] if not del_source else bytecode_path with self.assertRaises(ImportError): @@ -211,7 +213,7 @@ def _test_bad_marshal(self, *, del_source=False): with source_util.create_modules('_temp') as mapping: bytecode_path = self.manipulate_bytecode('_temp', mapping, - lambda bc: bc[:8] + b'', + lambda bc: bc[:12] + b'', del_source=del_source) file_path = mapping['_temp'] if not del_source else bytecode_path with self.assertRaises(EOFError): @@ -235,7 +237,7 @@ def test(name, mapping, bytecode_path): self.import_(mapping[name], name) with open(bytecode_path, 'rb') as file: - self.assertGreater(len(file.read()), 8) + self.assertGreater(len(file.read()), 12) self._test_empty_file(test) @@ -243,7 +245,7 @@ def test(name, mapping, bytecode_path): self.import_(mapping[name], name) with open(bytecode_path, 'rb') as file: - self.assertGreater(len(file.read()), 8) + self.assertGreater(len(file.read()), 12) self._test_partial_magic(test) @@ -254,7 +256,7 @@ def test(name, mapping, bytecode_path): self.import_(mapping[name], name) with open(bytecode_path, 'rb') as file: - self.assertGreater(len(file.read()), 8) + self.assertGreater(len(file.read()), 12) self._test_magic_only(test) @@ -276,11 +278,22 @@ def test(name, mapping, bc_path): self.import_(mapping[name], name) with open(bc_path, 'rb') as file: - self.assertGreater(len(file.read()), 8) + self.assertGreater(len(file.read()), 12) self._test_partial_timestamp(test) @source_util.writes_bytecode_files + def test_partial_size(self): + # When the size is partial, regenerate the .pyc, else + # raise EOFError. + def test(name, mapping, bc_path): + self.import_(mapping[name], name) + with open(bc_path, 'rb') as file: + self.assertGreater(len(file.read()), 12) + + self._test_partial_size(test) + + @source_util.writes_bytecode_files def test_no_marshal(self): # When there is only the magic number and timestamp, raise EOFError. self._test_no_marshal() @@ -375,6 +388,13 @@ self._test_partial_timestamp(test, del_source=True) + def test_partial_size(self): + def test(name, mapping, bytecode_path): + with self.assertRaises(EOFError): + self.import_(bytecode_path, name) + + self._test_partial_size(test, del_source=True) + def test_no_marshal(self): self._test_no_marshal(del_source=True) diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -21,7 +21,7 @@ if magic != imp.get_magic(): return None - stream.read(4) # Skip timestamp + stream.read(8) # Skip timestamp and size return marshal.load(stream) diff --git a/Lib/py_compile.py b/Lib/py_compile.py --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -110,9 +110,11 @@ """ with tokenize.open(file) as f: try: - timestamp = int(os.fstat(f.fileno()).st_mtime) + st = os.fstat(f.fileno()) except AttributeError: - timestamp = int(os.stat(file).st_mtime) + st = os.stat(file) + timestamp = int(st.st_mtime) + size = st.st_size & 0xFFFFFFFF codestring = f.read() try: codeobject = builtins.compile(codestring, dfile or file, 'exec', @@ -139,6 +141,7 @@ with open(cfile, 'wb') as fc: fc.write(b'\0\0\0\0') wr_long(fc, timestamp) + wr_long(fc, size) marshal.dump(codeobject, fc) fc.flush() fc.seek(0, 0) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -380,7 +380,7 @@ def test_foreign_code(self): py_compile.compile(self.file_name) with open(self.compiled_name, "rb") as f: - header = f.read(8) + header = f.read(12) code = marshal.load(f) constants = list(code.co_consts) foreign_code = test_main.__code__ @@ -644,6 +644,16 @@ self.assertEqual(sys.modules['pep3147.foo'].__cached__, os.path.join(os.curdir, foo_pyc)) + def test_recompute_pyc_same_second(self): + # Even when the source file doesn't change timestamp, a change in + # source size is enough to trigger recomputation of the pyc file. + __import__(TESTFN) + unload(TESTFN) + with open(self.source, 'a') as fp: + print("x = 5", file=fp) + m = __import__(TESTFN) + self.assertEqual(m.x, 5) + class RelativeImportFromImportlibTests(test_relative_imports.RelativeImports): diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -19,7 +19,7 @@ from traceback import extract_tb, extract_stack, print_tb raise_src = 'def do_raise(): raise TypeError\n' -def make_pyc(co, mtime): +def make_pyc(co, mtime, size): data = marshal.dumps(co) if type(mtime) is type(0.0): # Mac mtimes need a bit of special casing @@ -27,14 +27,14 @@ mtime = int(mtime) else: mtime = int(-0x100000000 + int(mtime)) - pyc = imp.get_magic() + struct.pack("", "exec"), NOW) + pyc = make_pyc(compile(src, "", "exec"), NOW, len(src)) files = {TESTMOD + pyc_ext: (NOW, pyc), "some.data": (NOW, "some data")} self.doTest(pyc_ext, files, TESTMOD) @@ -313,7 +313,7 @@ self.doTest(".py", files, TESTMOD, call=self.assertModuleSource) def testGetCompiledSource(self): - pyc = make_pyc(compile(test_src, "", "exec"), NOW) + pyc = make_pyc(compile(test_src, "", "exec"), NOW, len(test_src)) files = {TESTMOD + ".py": (NOW, test_src), TESTMOD + pyc_ext: (NOW, pyc)} self.doTest(pyc_ext, files, TESTMOD, call=self.assertModuleSource) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #13645: pyc files now contain the size of the corresponding source + code, to avoid timestamp collisions (especially on filesystems with a low + timestamp resolution) when checking for freshness of the bytecode. + - PEP 380, Issue #11682: Add "yield from " to support easy delegation to subgenerators (initial patch by Greg Ewing, integration into 3.3 by Renaud Blanch, Ryan Kelly, Zbigniew J?drzejewski-Szmek and Nick Coghlan) diff --git a/Modules/zipimport.c b/Modules/zipimport.c --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1033,7 +1033,9 @@ return Py_None; /* signal caller to try alternative */ } - code = PyMarshal_ReadObjectFromString(buf + 8, size - 8); + /* XXX the pyc's size field is ignored; timestamp collisions are probably + unimportant with zip files. */ + code = PyMarshal_ReadObjectFromString(buf + 12, size - 12); if (code == NULL) return NULL; if (!PyCode_Check(code)) { diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2800,7 +2800,7 @@ if (!result) goto failed; value = ast2obj_int(o->v.Yield.is_from); if (!value) goto failed; - if (PyObject_SetAttrString(result, "is_from", value) == -1) + if (_PyObject_SetAttrId(result, &PyId_is_from, value) == -1) goto failed; Py_DECREF(value); value = ast2obj_expr(o->v.Yield.value); diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -104,6 +104,7 @@ Python 3.2a2 3180 (add DELETE_DEREF) Python 3.3a0 3190 __class__ super closure changed Python 3.3a0 3200 (__qualname__ added) + 3210 (added size modulo 2**32 to the pyc header) */ /* MAGIC must change whenever the bytecode emitted by the compiler may no @@ -116,7 +117,7 @@ #define STRIFY(name) QUOTE(name) #define MAJOR STRIFY(PY_MAJOR_VERSION) #define MINOR STRIFY(PY_MINOR_VERSION) -#define MAGIC (3200 | ((long)'\r'<<16) | ((long)'\n'<<24)) +#define MAGIC (3210 | ((long)'\r'<<16) | ((long)'\n'<<24)) #define TAG "cpython-" MAJOR MINOR; #define CACHEDIR "__pycache__" /* Current magic word and string tag as globals. */ @@ -1071,11 +1072,12 @@ Doesn't set an exception. */ static FILE * -check_compiled_module(PyObject *pathname, time_t mtime, PyObject *cpathname) +check_compiled_module(PyObject *pathname, struct stat *srcstat, PyObject *cpathname) { FILE *fp; long magic; long pyc_mtime; + long pyc_size; fp = _Py_fopen(cpathname, "rb"); if (fp == NULL) @@ -1088,12 +1090,19 @@ return NULL; } pyc_mtime = PyMarshal_ReadLongFromFile(fp); - if (pyc_mtime != mtime) { + if (pyc_mtime != srcstat->st_mtime) { if (Py_VerboseFlag) PySys_FormatStderr("# %R has bad mtime\n", cpathname); fclose(fp); return NULL; } + pyc_size = PyMarshal_ReadLongFromFile(fp); + if (pyc_size != (srcstat->st_size & 0xFFFFFFFF)) { + if (Py_VerboseFlag) + PySys_FormatStderr("# %R has bad size\n", cpathname); + fclose(fp); + return NULL; + } if (Py_VerboseFlag) PySys_FormatStderr("# %R matches %R\n", cpathname, pathname); return fp; @@ -1136,6 +1145,8 @@ "Bad magic number in %R", cpathname); return NULL; } + /* Skip mtime and size */ + (void) PyMarshal_ReadLongFromFile(fp); (void) PyMarshal_ReadLongFromFile(fp); co = read_compiled_module(cpathname, fp); if (co == NULL) @@ -1196,6 +1207,7 @@ Py_UCS4 *cpathname_ucs4; FILE *fp; time_t mtime = srcstat->st_mtime; + long size = srcstat->st_size & 0xFFFFFFFF; PyObject *cpathname_tmp; #ifdef MS_WINDOWS /* since Windows uses different permissions */ mode_t mode = srcstat->st_mode & ~S_IEXEC; @@ -1326,14 +1338,16 @@ return; } PyMarshal_WriteLongToFile(pyc_magic, fp, Py_MARSHAL_VERSION); - /* First write a 0 for mtime */ + /* First write a 0 for mtime and size */ + PyMarshal_WriteLongToFile(0L, fp, Py_MARSHAL_VERSION); PyMarshal_WriteLongToFile(0L, fp, Py_MARSHAL_VERSION); PyMarshal_WriteObjectToFile((PyObject *)co, fp, Py_MARSHAL_VERSION); fflush(fp); - /* Now write the true mtime */ + /* Now write the true mtime and size */ fseek(fp, 4L, 0); assert(mtime < LONG_MAX); PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); + PyMarshal_WriteLongToFile(size, fp, Py_MARSHAL_VERSION); if (fflush(fp) != 0 || ferror(fp)) { if (Py_VerboseFlag) PySys_FormatStderr("# can't write %R\n", cpathname); @@ -1478,7 +1492,7 @@ cpathname = make_compiled_pathname(pathname, !Py_OptimizeFlag); if (cpathname != NULL) - fpc = check_compiled_module(pathname, st.st_mtime, cpathname); + fpc = check_compiled_module(pathname, &st, cpathname); else fpc = NULL; diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1844,6 +1844,8 @@ "Bad magic number in .pyc file"); return NULL; } + /* Skip mtime and size */ + (void) PyMarshal_ReadLongFromFile(fp); (void) PyMarshal_ReadLongFromFile(fp); v = PyMarshal_ReadLastObjectFromFile(fp); fclose(fp); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 19:42:17 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 19:42:17 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Closes_=2313761=3A_add_a_?= =?utf8?q?=22flush=22_keyword_argument_to_print=28=29=2E?= Message-ID: http://hg.python.org/cpython/rev/3120a988a1a3 changeset: 74359:3120a988a1a3 user: Georg Brandl date: Fri Jan 13 19:41:25 2012 +0100 summary: Closes #13761: add a "flush" keyword argument to print(). files: Doc/library/functions.rst | 11 +++++++---- Lib/test/test_print.py | 26 ++++++++++++++++++++++++++ Misc/NEWS | 3 +++ Python/bltinmodule.c | 24 +++++++++++++++++++----- 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -946,7 +946,7 @@ must be of integer types, and *y* must be non-negative. -.. function:: print([object, ...], *, sep=' ', end='\\n', file=sys.stdout) +.. function:: print([object, ...], *, sep=' ', end='\\n', file=sys.stdout, flush=False) Print *object*\(s) to the stream *file*, separated by *sep* and followed by *end*. *sep*, *end* and *file*, if present, must be given as keyword @@ -959,9 +959,12 @@ *end*. The *file* argument must be an object with a ``write(string)`` method; if it - is not present or ``None``, :data:`sys.stdout` will be used. Output buffering - is determined by *file*. Use ``file.flush()`` to ensure, for instance, - immediate appearance on a screen. + is not present or ``None``, :data:`sys.stdout` will be used. Whether output + is buffered is usually determined by *file*, but if the *flush* keyword + argument is true, the stream is forcibly flushed. + + .. versionchanged:: 3.3 + Added the *flush* keyword argument. .. function:: property(fget=None, fset=None, fdel=None, doc=None) diff --git a/Lib/test/test_print.py b/Lib/test/test_print.py --- a/Lib/test/test_print.py +++ b/Lib/test/test_print.py @@ -111,6 +111,32 @@ self.assertRaises(TypeError, print, '', end=3) self.assertRaises(AttributeError, print, '', file='') + def test_print_flush(self): + # operation of the flush flag + class filelike(): + def __init__(self): + self.written = '' + self.flushed = 0 + def write(self, str): + self.written += str + def flush(self): + self.flushed += 1 + + f = filelike() + print(1, file=f, end='', flush=True) + print(2, file=f, end='', flush=True) + print(3, file=f, flush=False) + self.assertEqual(f.written, '123\n') + self.assertEqual(f.flushed, 2) + + # ensure exceptions from flush are passed through + class noflush(): + def write(self, str): + pass + def flush(self): + raise RuntimeError + self.assertRaises(RuntimeError, print, 1, file=noflush(), flush=True) + def test_main(): support.run_unittest(TestPrint) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #13761: Add a "flush" keyword argument to the print() function, + used to ensure flushing the output stream. + - Issue #13645: pyc files now contain the size of the corresponding source code, to avoid timestamp collisions (especially on filesystems with a low timestamp resolution) when checking for freshness of the bytecode. diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1484,15 +1484,15 @@ static PyObject * builtin_print(PyObject *self, PyObject *args, PyObject *kwds) { - static char *kwlist[] = {"sep", "end", "file", 0}; + static char *kwlist[] = {"sep", "end", "file", "flush", 0}; static PyObject *dummy_args; - PyObject *sep = NULL, *end = NULL, *file = NULL; + PyObject *sep = NULL, *end = NULL, *file = NULL, *flush = NULL; int i, err; if (dummy_args == NULL && !(dummy_args = PyTuple_New(0))) - return NULL; - if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print", - kwlist, &sep, &end, &file)) + return NULL; + if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOOO:print", + kwlist, &sep, &end, &file, &flush)) return NULL; if (file == NULL || file == Py_None) { file = PySys_GetObject("stdout"); @@ -1543,6 +1543,20 @@ if (err) return NULL; + if (flush != NULL) { + PyObject *tmp; + int do_flush = PyObject_IsTrue(flush); + if (do_flush == -1) + return NULL; + else if (do_flush) { + tmp = PyObject_CallMethod(file, "flush", ""); + if (tmp == NULL) + return NULL; + else + Py_DECREF(tmp); + } + } + Py_RETURN_NONE; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 19:45:32 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 13 Jan 2012 19:45:32 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzY0?= =?utf8?q?=3A_remove_outdated_script_Misc/build=2Esh?= Message-ID: http://hg.python.org/cpython/rev/f36c6f5f9d61 changeset: 74360:f36c6f5f9d61 branch: 3.2 parent: 74352:e23beda83902 user: Antoine Pitrou date: Fri Jan 13 19:41:42 2012 +0100 summary: Issue #13764: remove outdated script Misc/build.sh files: Misc/build.sh | 281 -------------------------------------- 1 files changed, 0 insertions(+), 281 deletions(-) diff --git a/Misc/build.sh b/Misc/build.sh deleted file mode 100755 --- a/Misc/build.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/bin/sh - -## Script to build and test the latest python from svn. It basically -## does this: -## svn up ; ./configure ; make ; make test ; make install ; cd Doc ; make -## -## Logs are kept and rsync'ed to the webhost. If there are test failure(s), -## information about the failure(s) is mailed. -## -## The user must be a member of the webmaster group locally and on webhost. -## -## This script is run on the PSF's machine as user neal via crontab. -## -## Yes, this script would probably be easier in python, but then -## there's a bootstrap problem. What if Python doesn't build? -## -## This script should be fairly clean Bourne shell, ie not too many -## bash-isms. We should try to keep it portable to other Unixes. -## Even though it will probably only run on Linux. I'm sure there are -## several GNU-isms currently (date +%s and readlink). -## -## Perhaps this script should be broken up into 2 (or more) components. -## Building doc is orthogonal to the rest of the python build/test. -## - -## FIXME: we should detect test hangs (eg, if they take more than 45 minutes) - -## FIXME: we should run valgrind -## FIXME: we should run code coverage - -## Utilities invoked in this script include: -## basename, date, dirname, expr, grep, readlink, uname -## cksum, make, mutt, rsync, svn - -## remember where did we started from -DIR=`dirname $0` -if [ "$DIR" = "" ]; then - DIR="." -fi - -## make directory absolute -DIR=`readlink -f $DIR` -FULLPATHNAME="$DIR/`basename $0`" -## we want Misc/.. -DIR=`dirname $DIR` - -## Configurable options - -FAILURE_SUBJECT="Python Regression Test Failures" -#FAILURE_MAILTO="YOUR_ACCOUNT at gmail.com" -FAILURE_MAILTO="python-checkins at python.org" -#FAILURE_CC="optional--uncomment and set to desired address" - -REMOTE_SYSTEM="neal at dinsdale.python.org" -REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/py3k" -RESULT_FILE="$DIR/build/index.html" -INSTALL_DIR="/tmp/python-test-3.2/local" -RSYNC_OPTS="-C -e ssh -rlogD" - -# Always run the installed version of Python. -PYTHON=$INSTALL_DIR/bin/python - -# Python options and regression test program that should always be run. -REGRTEST_ARGS="-E $INSTALL_DIR/lib/python3.0/test/regrtest.py" - -REFLOG="build/reflog.txt.out" -# These tests are not stable and falsely report leaks sometimes. -# The entire leak report will be mailed if any test not in this list leaks. -# Note: test_XXX (none currently) really leak, but are disabled -# so we don't send spam. Any test which really leaks should only -# be listed here if there are also test cases under Lib/test/leakers. -LEAKY_TESTS="test_(asynchat|cmd_line|docxmlrpc|dumbdbm|file|ftplib|httpservers|imaplib|popen2|socket|smtplib|sys|telnetlib|threadedtempfile|threading|threadsignals|xmlrpc)" - -# These tests always fail, so skip them so we don't get false positives. -_ALWAYS_SKIP="" -ALWAYS_SKIP="-x $_ALWAYS_SKIP" - -# Skip these tests altogether when looking for leaks. These tests -# do not need to be stored above in LEAKY_TESTS too. -# test_logging causes hangs, skip it. -# KBK 21Apr09: test_httpservers causes hangs, skip for now. -LEAKY_SKIPS="-x test_compiler test_logging test_httpservers" - -# Change this flag to "yes" for old releases to only update/build the docs. -BUILD_DISABLED="no" - -## utility functions -current_time() { - date +%s -} - -update_status() { - now=`current_time` - time=`expr $now - $3` - echo "
  • $1 ($time seconds)
  • " >> $RESULT_FILE -} - -place_summary_first() { - testf=$1 - sed -n '/^[0-9][0-9]* tests OK\./,$p' < $testf \ - | egrep -v '\[[0-9]+ refs\]' > $testf.tmp - echo "" >> $testf.tmp - cat $testf >> $testf.tmp - mv $testf.tmp $testf -} - -count_failures () { - testf=$1 - n=`grep -ic " failed:" $testf` - if [ $n -eq 1 ] ; then - n=`grep " failed:" $testf | sed -e 's/ .*//'` - fi - echo $n -} - -mail_on_failure() { - if [ "$NUM_FAILURES" != "0" ]; then - dest=$FAILURE_MAILTO - # FAILURE_CC is optional. - if [ "$FAILURE_CC" != "" ]; then - dest="$dest -c $FAILURE_CC" - fi - if [ "x$3" != "x" ] ; then - (echo "More important issues:" - echo "----------------------" - egrep -v "$3" < $2 - echo "" - echo "Less important issues:" - echo "----------------------" - egrep "$3" < $2) - else - cat $2 - fi | mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest - fi -} - -## setup -cd $DIR -make clobber > /dev/null 2>&1 -cp -p Modules/Setup.dist Modules/Setup -# But maybe there was no Makefile - we are only building docs. Clear build: -rm -rf build/ -mkdir -p build -rm -rf $INSTALL_DIR -## get the path we are building -repo_path=$(grep "url=" .svn/entries | sed -e s/\\W*url=// -e s/\"//g) - -## create results file -TITLE="Automated Python Build Results" -echo "" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " $TITLE" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo "

    Automated Python Build Results

    " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo "
    Built on:`date`
    Hostname:`uname -n`
    Platform:`uname -srmpo`
    URL:$repo_path
    " >> $RESULT_FILE -echo "
      " >> $RESULT_FILE - -## update, build, and test -ORIG_CHECKSUM=`cksum $FULLPATHNAME` -F=svn-update.out -start=`current_time` -svn update >& build/$F -err=$? -update_status "Updating" "$F" $start -if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then - ## FIXME: we should check if this file has changed. - ## If it has changed, we should re-run the script to pick up changes. - if [ "$ORIG_CHECKSUM" != "$ORIG_CHECKSUM" ]; then - exec $FULLPATHNAME $@ - fi - - F=svn-stat.out - start=`current_time` - svn stat >& build/$F - ## ignore some of the diffs - NUM_DIFFS=`egrep -vc '^. (@test|db_home|Lib/test/(regrtest\.py|db_home))$' build/$F` - update_status "svn stat ($NUM_DIFFS possibly important diffs)" "$F" $start - - F=configure.out - start=`current_time` - ./configure --prefix=$INSTALL_DIR --with-pydebug >& build/$F - err=$? - update_status "Configuring" "$F" $start - if [ $err = 0 ]; then - F=make.out - start=`current_time` - make >& build/$F - err=$? - warnings=`grep warning build/$F | egrep -vc "te?mpnam(_r|)' is dangerous,"` - update_status "Building ($warnings warnings)" "$F" $start - if [ $err = 0 ]; then - ## make install - F=make-install.out - start=`current_time` - make install >& build/$F - update_status "Installing" "$F" $start - - if [ ! -x $PYTHON ]; then - ln -s ${PYTHON}3.* $PYTHON - fi - - ## make and run basic tests - F=make-test.out - start=`current_time` - $PYTHON $REGRTEST_ARGS -W -u urlfetch >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing basics ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "basics" build/$F - - F=make-test-opt.out - start=`current_time` - $PYTHON -O $REGRTEST_ARGS -W -u urlfetch >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing opt ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "opt" build/$F - - ## run the tests looking for leaks - F=make-test-refleak.out - start=`current_time` - ## ensure that the reflog exists so the grep doesn't fail - touch $REFLOG - $PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F - LEAK_PAT="($LEAKY_TESTS|sum=0)" - NUM_FAILURES=`egrep -vc "$LEAK_PAT" $REFLOG` - place_summary_first build/$F - update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "refleak" $REFLOG "$LEAK_PAT" - - ## now try to run all the tests - F=make-testall.out - start=`current_time` - ## skip curses when running from cron since there's no terminal - ## skip sound since it's not setup on the PSF box (/dev/dsp) - $PYTHON $REGRTEST_ARGS -W -uall -x test_curses test_linuxaudiodev test_ossaudiodev &_ALWAYS_SKIP >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing all except curses and sound ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "all" build/$F - fi - fi -fi - - -## make doc -cd $DIR/Doc -F="make-doc.out" -start=`current_time` -make clean > ../build/$F 2>&1 -make checkout html >> ../build/$F 2>&1 -err=$? -update_status "Making doc" "$F" $start -if [ $err != 0 ]; then - NUM_FAILURES=1 - mail_on_failure "doc" ../build/$F -fi - -echo "
    " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo "" >> $RESULT_FILE - -## copy results -## (not used anymore, the daily build is now done directly on the server) -#chgrp -R webmaster build/html -#chmod -R g+w build/html -#rsync $RSYNC_OPTS build/html/* $REMOTE_SYSTEM:$REMOTE_DIR -#cd ../build -#rsync $RSYNC_OPTS index.html *.out $REMOTE_SYSTEM:$REMOTE_DIR/results/ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 19:45:33 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 13 Jan 2012 19:45:33 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313764=3A_remove_outdated_script_Misc/build=2Esh?= Message-ID: http://hg.python.org/cpython/rev/609482c6710e changeset: 74361:609482c6710e parent: 74359:3120a988a1a3 parent: 74360:f36c6f5f9d61 user: Antoine Pitrou date: Fri Jan 13 19:42:13 2012 +0100 summary: Issue #13764: remove outdated script Misc/build.sh files: Misc/build.sh | 281 -------------------------------------- 1 files changed, 0 insertions(+), 281 deletions(-) diff --git a/Misc/build.sh b/Misc/build.sh deleted file mode 100755 --- a/Misc/build.sh +++ /dev/null @@ -1,281 +0,0 @@ -#!/bin/sh - -## Script to build and test the latest python from svn. It basically -## does this: -## svn up ; ./configure ; make ; make test ; make install ; cd Doc ; make -## -## Logs are kept and rsync'ed to the webhost. If there are test failure(s), -## information about the failure(s) is mailed. -## -## The user must be a member of the webmaster group locally and on webhost. -## -## This script is run on the PSF's machine as user neal via crontab. -## -## Yes, this script would probably be easier in python, but then -## there's a bootstrap problem. What if Python doesn't build? -## -## This script should be fairly clean Bourne shell, ie not too many -## bash-isms. We should try to keep it portable to other Unixes. -## Even though it will probably only run on Linux. I'm sure there are -## several GNU-isms currently (date +%s and readlink). -## -## Perhaps this script should be broken up into 2 (or more) components. -## Building doc is orthogonal to the rest of the python build/test. -## - -## FIXME: we should detect test hangs (eg, if they take more than 45 minutes) - -## FIXME: we should run valgrind -## FIXME: we should run code coverage - -## Utilities invoked in this script include: -## basename, date, dirname, expr, grep, readlink, uname -## cksum, make, mutt, rsync, svn - -## remember where did we started from -DIR=`dirname $0` -if [ "$DIR" = "" ]; then - DIR="." -fi - -## make directory absolute -DIR=`readlink -f $DIR` -FULLPATHNAME="$DIR/`basename $0`" -## we want Misc/.. -DIR=`dirname $DIR` - -## Configurable options - -FAILURE_SUBJECT="Python Regression Test Failures" -#FAILURE_MAILTO="YOUR_ACCOUNT at gmail.com" -FAILURE_MAILTO="python-checkins at python.org" -#FAILURE_CC="optional--uncomment and set to desired address" - -REMOTE_SYSTEM="neal at dinsdale.python.org" -REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/py3k" -RESULT_FILE="$DIR/build/index.html" -INSTALL_DIR="/tmp/python-test-3.2/local" -RSYNC_OPTS="-C -e ssh -rlogD" - -# Always run the installed version of Python. -PYTHON=$INSTALL_DIR/bin/python - -# Python options and regression test program that should always be run. -REGRTEST_ARGS="-E $INSTALL_DIR/lib/python3.0/test/regrtest.py" - -REFLOG="build/reflog.txt.out" -# These tests are not stable and falsely report leaks sometimes. -# The entire leak report will be mailed if any test not in this list leaks. -# Note: test_XXX (none currently) really leak, but are disabled -# so we don't send spam. Any test which really leaks should only -# be listed here if there are also test cases under Lib/test/leakers. -LEAKY_TESTS="test_(asynchat|cmd_line|docxmlrpc|dumbdbm|file|ftplib|httpservers|imaplib|popen2|socket|smtplib|sys|telnetlib|threadedtempfile|threading|threadsignals|xmlrpc)" - -# These tests always fail, so skip them so we don't get false positives. -_ALWAYS_SKIP="" -ALWAYS_SKIP="-x $_ALWAYS_SKIP" - -# Skip these tests altogether when looking for leaks. These tests -# do not need to be stored above in LEAKY_TESTS too. -# test_logging causes hangs, skip it. -# KBK 21Apr09: test_httpservers causes hangs, skip for now. -LEAKY_SKIPS="-x test_compiler test_logging test_httpservers" - -# Change this flag to "yes" for old releases to only update/build the docs. -BUILD_DISABLED="no" - -## utility functions -current_time() { - date +%s -} - -update_status() { - now=`current_time` - time=`expr $now - $3` - echo "
  • $1 ($time seconds)
  • " >> $RESULT_FILE -} - -place_summary_first() { - testf=$1 - sed -n '/^[0-9][0-9]* tests OK\./,$p' < $testf \ - | egrep -v '\[[0-9]+ refs\]' > $testf.tmp - echo "" >> $testf.tmp - cat $testf >> $testf.tmp - mv $testf.tmp $testf -} - -count_failures () { - testf=$1 - n=`grep -ic " failed:" $testf` - if [ $n -eq 1 ] ; then - n=`grep " failed:" $testf | sed -e 's/ .*//'` - fi - echo $n -} - -mail_on_failure() { - if [ "$NUM_FAILURES" != "0" ]; then - dest=$FAILURE_MAILTO - # FAILURE_CC is optional. - if [ "$FAILURE_CC" != "" ]; then - dest="$dest -c $FAILURE_CC" - fi - if [ "x$3" != "x" ] ; then - (echo "More important issues:" - echo "----------------------" - egrep -v "$3" < $2 - echo "" - echo "Less important issues:" - echo "----------------------" - egrep "$3" < $2) - else - cat $2 - fi | mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest - fi -} - -## setup -cd $DIR -make clobber > /dev/null 2>&1 -cp -p Modules/Setup.dist Modules/Setup -# But maybe there was no Makefile - we are only building docs. Clear build: -rm -rf build/ -mkdir -p build -rm -rf $INSTALL_DIR -## get the path we are building -repo_path=$(grep "url=" .svn/entries | sed -e s/\\W*url=// -e s/\"//g) - -## create results file -TITLE="Automated Python Build Results" -echo "" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " $TITLE" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo "

    Automated Python Build Results

    " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo "
    Built on:`date`
    Hostname:`uname -n`
    Platform:`uname -srmpo`
    URL:$repo_path
    " >> $RESULT_FILE -echo "
      " >> $RESULT_FILE - -## update, build, and test -ORIG_CHECKSUM=`cksum $FULLPATHNAME` -F=svn-update.out -start=`current_time` -svn update >& build/$F -err=$? -update_status "Updating" "$F" $start -if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then - ## FIXME: we should check if this file has changed. - ## If it has changed, we should re-run the script to pick up changes. - if [ "$ORIG_CHECKSUM" != "$ORIG_CHECKSUM" ]; then - exec $FULLPATHNAME $@ - fi - - F=svn-stat.out - start=`current_time` - svn stat >& build/$F - ## ignore some of the diffs - NUM_DIFFS=`egrep -vc '^. (@test|db_home|Lib/test/(regrtest\.py|db_home))$' build/$F` - update_status "svn stat ($NUM_DIFFS possibly important diffs)" "$F" $start - - F=configure.out - start=`current_time` - ./configure --prefix=$INSTALL_DIR --with-pydebug >& build/$F - err=$? - update_status "Configuring" "$F" $start - if [ $err = 0 ]; then - F=make.out - start=`current_time` - make >& build/$F - err=$? - warnings=`grep warning build/$F | egrep -vc "te?mpnam(_r|)' is dangerous,"` - update_status "Building ($warnings warnings)" "$F" $start - if [ $err = 0 ]; then - ## make install - F=make-install.out - start=`current_time` - make install >& build/$F - update_status "Installing" "$F" $start - - if [ ! -x $PYTHON ]; then - ln -s ${PYTHON}3.* $PYTHON - fi - - ## make and run basic tests - F=make-test.out - start=`current_time` - $PYTHON $REGRTEST_ARGS -W -u urlfetch >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing basics ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "basics" build/$F - - F=make-test-opt.out - start=`current_time` - $PYTHON -O $REGRTEST_ARGS -W -u urlfetch >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing opt ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "opt" build/$F - - ## run the tests looking for leaks - F=make-test-refleak.out - start=`current_time` - ## ensure that the reflog exists so the grep doesn't fail - touch $REFLOG - $PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F - LEAK_PAT="($LEAKY_TESTS|sum=0)" - NUM_FAILURES=`egrep -vc "$LEAK_PAT" $REFLOG` - place_summary_first build/$F - update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "refleak" $REFLOG "$LEAK_PAT" - - ## now try to run all the tests - F=make-testall.out - start=`current_time` - ## skip curses when running from cron since there's no terminal - ## skip sound since it's not setup on the PSF box (/dev/dsp) - $PYTHON $REGRTEST_ARGS -W -uall -x test_curses test_linuxaudiodev test_ossaudiodev &_ALWAYS_SKIP >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing all except curses and sound ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "all" build/$F - fi - fi -fi - - -## make doc -cd $DIR/Doc -F="make-doc.out" -start=`current_time` -make clean > ../build/$F 2>&1 -make checkout html >> ../build/$F 2>&1 -err=$? -update_status "Making doc" "$F" $start -if [ $err != 0 ]; then - NUM_FAILURES=1 - mail_on_failure "doc" ../build/$F -fi - -echo "
    " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo "" >> $RESULT_FILE - -## copy results -## (not used anymore, the daily build is now done directly on the server) -#chgrp -R webmaster build/html -#chmod -R g+w build/html -#rsync $RSYNC_OPTS build/html/* $REMOTE_SYSTEM:$REMOTE_DIR -#cd ../build -#rsync $RSYNC_OPTS index.html *.out $REMOTE_SYSTEM:$REMOTE_DIR/results/ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 19:45:34 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 13 Jan 2012 19:45:34 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNzY0?= =?utf8?q?=3A_remove_outdated_script_Misc/build=2Esh?= Message-ID: http://hg.python.org/cpython/rev/7fcfbaad75ee changeset: 74362:7fcfbaad75ee branch: 2.7 parent: 74346:66f2bcb47050 user: Antoine Pitrou date: Fri Jan 13 19:41:42 2012 +0100 summary: Issue #13764: remove outdated script Misc/build.sh files: Misc/build.sh | 279 -------------------------------------- 1 files changed, 0 insertions(+), 279 deletions(-) diff --git a/Misc/build.sh b/Misc/build.sh deleted file mode 100755 --- a/Misc/build.sh +++ /dev/null @@ -1,279 +0,0 @@ -#!/bin/sh - -## Script to build and test the latest python from svn. It basically -## does this: -## svn up ; ./configure ; make ; make test ; make install ; cd Doc ; make -## -## Logs are kept and rsync'ed to the webhost. If there are test failure(s), -## information about the failure(s) is mailed. -## -## The user must be a member of the webmaster group locally and on webhost. -## -## This script is run on the PSF's machine as user neal via crontab. -## -## Yes, this script would probably be easier in python, but then -## there's a bootstrap problem. What if Python doesn't build? -## -## This script should be fairly clean Bourne shell, ie not too many -## bash-isms. We should try to keep it portable to other Unixes. -## Even though it will probably only run on Linux. I'm sure there are -## several GNU-isms currently (date +%s and readlink). -## -## Perhaps this script should be broken up into 2 (or more) components. -## Building doc is orthogonal to the rest of the python build/test. -## - -## FIXME: we should detect test hangs (eg, if they take more than 45 minutes) - -## FIXME: we should run valgrind -## FIXME: we should run code coverage - -## Utilities invoked in this script include: -## basename, date, dirname, expr, grep, readlink, uname -## cksum, make, mutt, rsync, svn - -## remember where did we started from -DIR=`dirname $0` -if [ "$DIR" = "" ]; then - DIR="." -fi - -## make directory absolute -DIR=`readlink -f $DIR` -FULLPATHNAME="$DIR/`basename $0`" -## we want Misc/.. -DIR=`dirname $DIR` - -## Configurable options - -FAILURE_SUBJECT="Python Regression Test Failures" -#FAILURE_MAILTO="YOUR_ACCOUNT at gmail.com" -FAILURE_MAILTO="python-checkins at python.org" -#FAILURE_CC="optional--uncomment and set to desired address" - -REMOTE_SYSTEM="neal at dinsdale.python.org" -REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/" -RESULT_FILE="$DIR/build/index.html" -INSTALL_DIR="/tmp/python-test/local" -RSYNC_OPTS="-C -e ssh -rlogD" - -# Always run the installed version of Python. -PYTHON=$INSTALL_DIR/bin/python - -# Python options and regression test program that should always be run. -REGRTEST_ARGS="-E -tt $INSTALL_DIR/lib/python2.7/test/regrtest.py" - -REFLOG="build/reflog.txt.out" -# These tests are not stable and falsely report leaks sometimes. -# The entire leak report will be mailed if any test not in this list leaks. -# Note: test_XXX (none currently) really leak, but are disabled -# so we don't send spam. Any test which really leaks should only -# be listed here if there are also test cases under Lib/test/leakers. -LEAKY_TESTS="test_(asynchat|cmd_line|docxmlrpc|dumbdbm|file|ftplib|httpservers|imaplib|popen2|socket|smtplib|sys|telnetlib|threadedtempfile|threading|threadsignals|xmlrpc)" - -# Skip these tests altogether when looking for leaks. These tests -# do not need to be stored above in LEAKY_TESTS too. -# test_compiler almost never finishes with the same number of refs -# since it depends on other modules, skip it. -# test_logging causes hangs, skip it. -# KBK 21Apr09: test_httpservers causes hangs, skip for now. -LEAKY_SKIPS="-x test_compiler test_logging test_httpservers" - -# Change this flag to "yes" for old releases to only update/build the docs. -BUILD_DISABLED="no" - -## utility functions -current_time() { - date +%s -} - -update_status() { - now=`current_time` - time=`expr $now - $3` - echo "
  • $1 ($time seconds)
  • " >> $RESULT_FILE -} - -place_summary_first() { - testf=$1 - sed -n '/^[0-9][0-9]* tests OK\./,$p' < $testf \ - | egrep -v '\[[0-9]+ refs\]' > $testf.tmp - echo "" >> $testf.tmp - cat $testf >> $testf.tmp - mv $testf.tmp $testf -} - -count_failures () { - testf=$1 - n=`grep -ic " failed:" $testf` - if [ $n -eq 1 ] ; then - n=`grep " failed:" $testf | sed -e 's/ .*//'` - fi - echo $n -} - -mail_on_failure() { - if [ "$NUM_FAILURES" != "0" ]; then - dest=$FAILURE_MAILTO - # FAILURE_CC is optional. - if [ "$FAILURE_CC" != "" ]; then - dest="$dest -c $FAILURE_CC" - fi - if [ "x$3" != "x" ] ; then - (echo "More important issues:" - echo "----------------------" - egrep -v "$3" < $2 - echo "" - echo "Less important issues:" - echo "----------------------" - egrep "$3" < $2) - else - cat $2 - fi | mutt -s "$FAILURE_SUBJECT $1 ($NUM_FAILURES)" $dest - fi -} - -## setup -cd $DIR -make clobber > /dev/null 2>&1 -cp -p Modules/Setup.dist Modules/Setup -# But maybe there was no Makefile - we are only building docs. Clear build: -rm -rf build/ -mkdir -p build -rm -rf $INSTALL_DIR -## get the path we are building -repo_path=$(grep "url=" .svn/entries | sed -e s/\\W*url=// -e s/\"//g) - -## create results file -TITLE="Automated Python Build Results" -echo "" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " $TITLE" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo "

    Automated Python Build Results

    " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo " " >> $RESULT_FILE -echo "
    Built on:`date`
    Hostname:`uname -n`
    Platform:`uname -srmpo`
    URL:$repo_path
    " >> $RESULT_FILE -echo "
      " >> $RESULT_FILE - -## update, build, and test -ORIG_CHECKSUM=`cksum $FULLPATHNAME` -F=svn-update.out -start=`current_time` -svn update >& build/$F -err=$? -update_status "Updating" "$F" $start -if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then - ## FIXME: we should check if this file has changed. - ## If it has changed, we should re-run the script to pick up changes. - if [ "$ORIG_CHECKSUM" != "$ORIG_CHECKSUM" ]; then - exec $FULLPATHNAME $@ - fi - - F=svn-stat.out - start=`current_time` - svn stat >& build/$F - ## ignore some of the diffs - NUM_DIFFS=`egrep -vc '^. (@test|db_home|Lib/test/(regrtest\.py|db_home))$' build/$F` - update_status "svn stat ($NUM_DIFFS possibly important diffs)" "$F" $start - - F=configure.out - start=`current_time` - ./configure --prefix=$INSTALL_DIR --with-pydebug >& build/$F - err=$? - update_status "Configuring" "$F" $start - if [ $err = 0 ]; then - F=make.out - start=`current_time` - make >& build/$F - err=$? - warnings=`grep warning build/$F | egrep -vc "te?mpnam(_r|)' is dangerous,"` - update_status "Building ($warnings warnings)" "$F" $start - if [ $err = 0 ]; then - ## make install - F=make-install.out - start=`current_time` - make install >& build/$F - update_status "Installing" "$F" $start - - if [ ! -x $PYTHON ]; then - ln -s ${PYTHON}2.* $PYTHON - fi - - ## make and run basic tests - F=make-test.out - start=`current_time` - $PYTHON $REGRTEST_ARGS -W -u urlfetch >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing basics ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "basics" build/$F - - F=make-test-opt.out - start=`current_time` - $PYTHON -O $REGRTEST_ARGS -W -u urlfetch >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing opt ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "opt" build/$F - - ## run the tests looking for leaks - F=make-test-refleak.out - start=`current_time` - ## ensure that the reflog exists so the grep doesn't fail - touch $REFLOG - $PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F - LEAK_PAT="($LEAKY_TESTS|sum=0)" - NUM_FAILURES=`egrep -vc "$LEAK_PAT" $REFLOG` - place_summary_first build/$F - update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "refleak" $REFLOG "$LEAK_PAT" - - ## now try to run all the tests - F=make-testall.out - start=`current_time` - ## skip curses when running from cron since there's no terminal - ## skip sound since it's not setup on the PSF box (/dev/dsp) - $PYTHON $REGRTEST_ARGS -W -uall -x test_curses test_linuxaudiodev test_ossaudiodev >& build/$F - NUM_FAILURES=`count_failures build/$F` - place_summary_first build/$F - update_status "Testing all except curses and sound ($NUM_FAILURES failures)" "$F" $start - mail_on_failure "all" build/$F - fi - fi -fi - - -## make doc -cd $DIR/Doc -F="make-doc.out" -start=`current_time` -make clean > ../build/$F 2>&1 -make checkout html >> ../build/$F 2>&1 -err=$? -update_status "Making doc" "$F" $start -if [ $err != 0 ]; then - NUM_FAILURES=1 - mail_on_failure "doc" ../build/$F -fi - -echo "
    " >> $RESULT_FILE -echo "" >> $RESULT_FILE -echo "" >> $RESULT_FILE - -## copy results -## (not used anymore, the daily build is now done directly on the server) -#chgrp -R webmaster build/html -#chmod -R g+w build/html -#rsync $RSYNC_OPTS build/html/* $REMOTE_SYSTEM:$REMOTE_DIR -#cd ../build -#rsync $RSYNC_OPTS index.html *.out $REMOTE_SYSTEM:$REMOTE_DIR/results/ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 20:39:45 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jan 2012 20:39:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_add_test=2C_which_was_missi?= =?utf8?q?ng_from_d64ac9ab4cd0?= Message-ID: http://hg.python.org/cpython/rev/be85914b611c changeset: 74363:be85914b611c parent: 74361:609482c6710e user: Benjamin Peterson date: Fri Jan 13 14:39:38 2012 -0500 summary: add test, which was missing from d64ac9ab4cd0 files: Lib/test/test_pep380.py | 842 ++++++++++++++++++++++++++++ 1 files changed, 842 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_pep380.py @@ -0,0 +1,842 @@ +# -*- coding: utf-8 -*- + +""" +Test suite for PEP 380 implementation + +adapted from original tests written by Greg Ewing +see +""" + +import unittest +import io +import sys +import traceback +import parser + +from test.support import captured_stderr + +class TestPEP380Operation(unittest.TestCase): + """ + Test semantics. + """ + + def test_delegation_of_initial_next_to_subgenerator(self): + """ + Test delegation of initial next() call to subgenerator + """ + trace = [] + def g1(): + trace.append("Starting g1") + yield from g2() + trace.append("Finishing g1") + def g2(): + trace.append("Starting g2") + yield 42 + trace.append("Finishing g2") + for x in g1(): + trace.append("Yielded %s" % (x,)) + self.assertEqual(trace,[ + "Starting g1", + "Starting g2", + "Yielded 42", + "Finishing g2", + "Finishing g1", + ]) + + def test_raising_exception_in_initial_next_call(self): + """ + Test raising exception in initial next() call + """ + trace = [] + def g1(): + try: + trace.append("Starting g1") + yield from g2() + finally: + trace.append("Finishing g1") + def g2(): + try: + trace.append("Starting g2") + raise ValueError("spanish inquisition occurred") + finally: + trace.append("Finishing g2") + try: + for x in g1(): + trace.append("Yielded %s" % (x,)) + except ValueError as e: + self.assertEqual(e.args[0], "spanish inquisition occurred") + else: + self.fail("subgenerator failed to raise ValueError") + self.assertEqual(trace,[ + "Starting g1", + "Starting g2", + "Finishing g2", + "Finishing g1", + ]) + + def test_delegation_of_next_call_to_subgenerator(self): + """ + Test delegation of next() call to subgenerator + """ + trace = [] + def g1(): + trace.append("Starting g1") + yield "g1 ham" + yield from g2() + yield "g1 eggs" + trace.append("Finishing g1") + def g2(): + trace.append("Starting g2") + yield "g2 spam" + yield "g2 more spam" + trace.append("Finishing g2") + for x in g1(): + trace.append("Yielded %s" % (x,)) + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Yielded g2 more spam", + "Finishing g2", + "Yielded g1 eggs", + "Finishing g1", + ]) + + def test_raising_exception_in_delegated_next_call(self): + """ + Test raising exception in delegated next() call + """ + trace = [] + def g1(): + try: + trace.append("Starting g1") + yield "g1 ham" + yield from g2() + yield "g1 eggs" + finally: + trace.append("Finishing g1") + def g2(): + try: + trace.append("Starting g2") + yield "g2 spam" + raise ValueError("hovercraft is full of eels") + yield "g2 more spam" + finally: + trace.append("Finishing g2") + try: + for x in g1(): + trace.append("Yielded %s" % (x,)) + except ValueError as e: + self.assertEqual(e.args[0], "hovercraft is full of eels") + else: + self.fail("subgenerator failed to raise ValueError") + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Finishing g2", + "Finishing g1", + ]) + + def test_delegation_of_send(self): + """ + Test delegation of send() + """ + trace = [] + def g1(): + trace.append("Starting g1") + x = yield "g1 ham" + trace.append("g1 received %s" % (x,)) + yield from g2() + x = yield "g1 eggs" + trace.append("g1 received %s" % (x,)) + trace.append("Finishing g1") + def g2(): + trace.append("Starting g2") + x = yield "g2 spam" + trace.append("g2 received %s" % (x,)) + x = yield "g2 more spam" + trace.append("g2 received %s" % (x,)) + trace.append("Finishing g2") + g = g1() + y = next(g) + x = 1 + try: + while 1: + y = g.send(x) + trace.append("Yielded %s" % (y,)) + x += 1 + except StopIteration: + pass + self.assertEqual(trace,[ + "Starting g1", + "g1 received 1", + "Starting g2", + "Yielded g2 spam", + "g2 received 2", + "Yielded g2 more spam", + "g2 received 3", + "Finishing g2", + "Yielded g1 eggs", + "g1 received 4", + "Finishing g1", + ]) + + def test_handling_exception_while_delegating_send(self): + """ + Test handling exception while delegating 'send' + """ + trace = [] + def g1(): + trace.append("Starting g1") + x = yield "g1 ham" + trace.append("g1 received %s" % (x,)) + yield from g2() + x = yield "g1 eggs" + trace.append("g1 received %s" % (x,)) + trace.append("Finishing g1") + def g2(): + trace.append("Starting g2") + x = yield "g2 spam" + trace.append("g2 received %s" % (x,)) + raise ValueError("hovercraft is full of eels") + x = yield "g2 more spam" + trace.append("g2 received %s" % (x,)) + trace.append("Finishing g2") + def run(): + g = g1() + y = next(g) + x = 1 + try: + while 1: + y = g.send(x) + trace.append("Yielded %s" % (y,)) + x += 1 + except StopIteration: + trace.append("StopIteration") + self.assertRaises(ValueError,run) + self.assertEqual(trace,[ + "Starting g1", + "g1 received 1", + "Starting g2", + "Yielded g2 spam", + "g2 received 2", + ]) + + def test_delegating_close(self): + """ + Test delegating 'close' + """ + trace = [] + def g1(): + try: + trace.append("Starting g1") + yield "g1 ham" + yield from g2() + yield "g1 eggs" + finally: + trace.append("Finishing g1") + def g2(): + try: + trace.append("Starting g2") + yield "g2 spam" + yield "g2 more spam" + finally: + trace.append("Finishing g2") + g = g1() + for i in range(2): + x = next(g) + trace.append("Yielded %s" % (x,)) + g.close() + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Finishing g2", + "Finishing g1" + ]) + + def test_handing_exception_while_delegating_close(self): + """ + Test handling exception while delegating 'close' + """ + trace = [] + def g1(): + try: + trace.append("Starting g1") + yield "g1 ham" + yield from g2() + yield "g1 eggs" + finally: + trace.append("Finishing g1") + def g2(): + try: + trace.append("Starting g2") + yield "g2 spam" + yield "g2 more spam" + finally: + trace.append("Finishing g2") + raise ValueError("nybbles have exploded with delight") + try: + g = g1() + for i in range(2): + x = next(g) + trace.append("Yielded %s" % (x,)) + g.close() + except ValueError as e: + self.assertEqual(e.args[0], "nybbles have exploded with delight") + self.assertIsInstance(e.__context__, GeneratorExit) + else: + self.fail("subgenerator failed to raise ValueError") + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Finishing g2", + "Finishing g1", + ]) + + def test_delegating_throw(self): + """ + Test delegating 'throw' + """ + trace = [] + def g1(): + try: + trace.append("Starting g1") + yield "g1 ham" + yield from g2() + yield "g1 eggs" + finally: + trace.append("Finishing g1") + def g2(): + try: + trace.append("Starting g2") + yield "g2 spam" + yield "g2 more spam" + finally: + trace.append("Finishing g2") + try: + g = g1() + for i in range(2): + x = next(g) + trace.append("Yielded %s" % (x,)) + e = ValueError("tomato ejected") + g.throw(e) + except ValueError as e: + self.assertEqual(e.args[0], "tomato ejected") + else: + self.fail("subgenerator failed to raise ValueError") + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Finishing g2", + "Finishing g1", + ]) + + def test_value_attribute_of_StopIteration_exception(self): + """ + Test 'value' attribute of StopIteration exception + """ + trace = [] + def pex(e): + trace.append("%s: %s" % (e.__class__.__name__, e)) + trace.append("value = %s" % (e.value,)) + e = StopIteration() + pex(e) + e = StopIteration("spam") + pex(e) + e.value = "eggs" + pex(e) + self.assertEqual(trace,[ + "StopIteration: ", + "value = None", + "StopIteration: spam", + "value = spam", + "StopIteration: spam", + "value = eggs", + ]) + + + def test_generator_return_value(self): + """ + Test generator return value + """ + trace = [] + def g1(): + trace.append("Starting g1") + yield "g1 ham" + ret = yield from g2() + trace.append("g2 returned %s" % (ret,)) + ret = yield from g2(42) + trace.append("g2 returned %s" % (ret,)) + yield "g1 eggs" + trace.append("Finishing g1") + def g2(v = None): + trace.append("Starting g2") + yield "g2 spam" + yield "g2 more spam" + trace.append("Finishing g2") + if v: + return v + for x in g1(): + trace.append("Yielded %s" % (x,)) + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Yielded g2 more spam", + "Finishing g2", + "g2 returned None", + "Starting g2", + "Yielded g2 spam", + "Yielded g2 more spam", + "Finishing g2", + "g2 returned 42", + "Yielded g1 eggs", + "Finishing g1", + ]) + + def test_delegation_of_next_to_non_generator(self): + """ + Test delegation of next() to non-generator + """ + trace = [] + def g(): + yield from range(3) + for x in g(): + trace.append("Yielded %s" % (x,)) + self.assertEqual(trace,[ + "Yielded 0", + "Yielded 1", + "Yielded 2", + ]) + + + def test_conversion_of_sendNone_to_next(self): + """ + Test conversion of send(None) to next() + """ + trace = [] + def g(): + yield from range(3) + gi = g() + for x in range(3): + y = gi.send(None) + trace.append("Yielded: %s" % (y,)) + self.assertEqual(trace,[ + "Yielded: 0", + "Yielded: 1", + "Yielded: 2", + ]) + + def test_delegation_of_close_to_non_generator(self): + """ + Test delegation of close() to non-generator + """ + trace = [] + def g(): + try: + trace.append("starting g") + yield from range(3) + trace.append("g should not be here") + finally: + trace.append("finishing g") + gi = g() + next(gi) + with captured_stderr() as output: + gi.close() + self.assertEqual(output.getvalue(), '') + self.assertEqual(trace,[ + "starting g", + "finishing g", + ]) + + def test_delegating_throw_to_non_generator(self): + """ + Test delegating 'throw' to non-generator + """ + trace = [] + def g(): + try: + trace.append("Starting g") + yield from range(10) + finally: + trace.append("Finishing g") + try: + gi = g() + for i in range(5): + x = next(gi) + trace.append("Yielded %s" % (x,)) + e = ValueError("tomato ejected") + gi.throw(e) + except ValueError as e: + self.assertEqual(e.args[0],"tomato ejected") + else: + self.fail("subgenerator failed to raise ValueError") + self.assertEqual(trace,[ + "Starting g", + "Yielded 0", + "Yielded 1", + "Yielded 2", + "Yielded 3", + "Yielded 4", + "Finishing g", + ]) + + def test_attempting_to_send_to_non_generator(self): + """ + Test attempting to send to non-generator + """ + trace = [] + def g(): + try: + trace.append("starting g") + yield from range(3) + trace.append("g should not be here") + finally: + trace.append("finishing g") + try: + gi = g() + next(gi) + for x in range(3): + y = gi.send(42) + trace.append("Should not have yielded:", y) + except AttributeError as e: + self.assertIn("send", e.args[0]) + else: + self.fail("was able to send into non-generator") + self.assertEqual(trace,[ + "starting g", + "finishing g", + ]) + + def test_broken_getattr_handling(self): + """ + Test subiterator with a broken getattr implementation + """ + class Broken: + def __iter__(self): + return self + def __next__(self): + return 1 + def __getattr__(self, attr): + 1/0 + + def g(): + yield from Broken() + + with self.assertRaises(ZeroDivisionError): + gi = g() + self.assertEqual(next(gi), 1) + gi.send(1) + + with self.assertRaises(ZeroDivisionError): + gi = g() + self.assertEqual(next(gi), 1) + gi.throw(AttributeError) + + with captured_stderr() as output: + gi = g() + self.assertEqual(next(gi), 1) + gi.close() + self.assertIn('ZeroDivisionError', output.getvalue()) + + def test_exception_in_initial_next_call(self): + """ + Test exception in initial next() call + """ + trace = [] + def g1(): + trace.append("g1 about to yield from g2") + yield from g2() + trace.append("g1 should not be here") + def g2(): + yield 1/0 + def run(): + gi = g1() + next(gi) + self.assertRaises(ZeroDivisionError,run) + self.assertEqual(trace,[ + "g1 about to yield from g2" + ]) + + def test_attempted_yield_from_loop(self): + """ + Test attempted yield-from loop + """ + trace = [] + def g1(): + trace.append("g1: starting") + yield "y1" + trace.append("g1: about to yield from g2") + yield from g2() + trace.append("g1 should not be here") + + def g2(): + trace.append("g2: starting") + yield "y2" + trace.append("g2: about to yield from g1") + yield from gi + trace.append("g2 should not be here") + try: + gi = g1() + for y in gi: + trace.append("Yielded: %s" % (y,)) + except ValueError as e: + self.assertEqual(e.args[0],"generator already executing") + else: + self.fail("subgenerator didn't raise ValueError") + self.assertEqual(trace,[ + "g1: starting", + "Yielded: y1", + "g1: about to yield from g2", + "g2: starting", + "Yielded: y2", + "g2: about to yield from g1", + ]) + + def test_returning_value_from_delegated_throw(self): + """ + Test returning value from delegated 'throw' + """ + trace = [] + def g1(): + try: + trace.append("Starting g1") + yield "g1 ham" + yield from g2() + yield "g1 eggs" + finally: + trace.append("Finishing g1") + def g2(): + try: + trace.append("Starting g2") + yield "g2 spam" + yield "g2 more spam" + except LunchError: + trace.append("Caught LunchError in g2") + yield "g2 lunch saved" + yield "g2 yet more spam" + class LunchError(Exception): + pass + g = g1() + for i in range(2): + x = next(g) + trace.append("Yielded %s" % (x,)) + e = LunchError("tomato ejected") + g.throw(e) + for x in g: + trace.append("Yielded %s" % (x,)) + self.assertEqual(trace,[ + "Starting g1", + "Yielded g1 ham", + "Starting g2", + "Yielded g2 spam", + "Caught LunchError in g2", + "Yielded g2 yet more spam", + "Yielded g1 eggs", + "Finishing g1", + ]) + + def test_next_and_return_with_value(self): + """ + Test next and return with value + """ + trace = [] + def f(r): + gi = g(r) + next(gi) + try: + trace.append("f resuming g") + next(gi) + trace.append("f SHOULD NOT BE HERE") + except StopIteration as e: + trace.append("f caught %s" % (repr(e),)) + def g(r): + trace.append("g starting") + yield + trace.append("g returning %s" % (r,)) + return r + f(None) + f(42) + self.assertEqual(trace,[ + "g starting", + "f resuming g", + "g returning None", + "f caught StopIteration()", + "g starting", + "f resuming g", + "g returning 42", + "f caught StopIteration(42,)", + ]) + + def test_send_and_return_with_value(self): + """ + Test send and return with value + """ + trace = [] + def f(r): + gi = g(r) + next(gi) + try: + trace.append("f sending spam to g") + gi.send("spam") + trace.append("f SHOULD NOT BE HERE") + except StopIteration as e: + trace.append("f caught %r" % (e,)) + def g(r): + trace.append("g starting") + x = yield + trace.append("g received %s" % (x,)) + trace.append("g returning %s" % (r,)) + return r + f(None) + f(42) + self.assertEqual(trace,[ + "g starting", + "f sending spam to g", + "g received spam", + "g returning None", + "f caught StopIteration()", + "g starting", + "f sending spam to g", + "g received spam", + "g returning 42", + "f caught StopIteration(42,)", + ]) + + def test_catching_exception_from_subgen_and_returning(self): + """ + Test catching an exception thrown into a + subgenerator and returning a value + """ + trace = [] + def inner(): + try: + yield 1 + except ValueError: + trace.append("inner caught ValueError") + return 2 + + def outer(): + v = yield from inner() + trace.append("inner returned %r to outer" % v) + yield v + g = outer() + trace.append(next(g)) + trace.append(g.throw(ValueError)) + self.assertEqual(trace,[ + 1, + "inner caught ValueError", + "inner returned 2 to outer", + 2, + ]) + + def test_throwing_GeneratorExit_into_subgen_that_returns(self): + """ + Test throwing GeneratorExit into a subgenerator that + catches it and returns normally. + """ + trace = [] + def f(): + try: + trace.append("Enter f") + yield + trace.append("Exit f") + except GeneratorExit: + return + def g(): + trace.append("Enter g") + yield from f() + trace.append("Exit g") + try: + gi = g() + next(gi) + gi.throw(GeneratorExit) + except GeneratorExit: + pass + else: + self.fail("subgenerator failed to raise GeneratorExit") + self.assertEqual(trace,[ + "Enter g", + "Enter f", + ]) + + def test_throwing_GeneratorExit_into_subgenerator_that_yields(self): + """ + Test throwing GeneratorExit into a subgenerator that + catches it and yields. + """ + trace = [] + def f(): + try: + trace.append("Enter f") + yield + trace.append("Exit f") + except GeneratorExit: + yield + def g(): + trace.append("Enter g") + yield from f() + trace.append("Exit g") + try: + gi = g() + next(gi) + gi.throw(GeneratorExit) + except RuntimeError as e: + self.assertEqual(e.args[0], "generator ignored GeneratorExit") + else: + self.fail("subgenerator failed to raise GeneratorExit") + self.assertEqual(trace,[ + "Enter g", + "Enter f", + ]) + + def test_throwing_GeneratorExit_into_subgen_that_raises(self): + """ + Test throwing GeneratorExit into a subgenerator that + catches it and raises a different exception. + """ + trace = [] + def f(): + try: + trace.append("Enter f") + yield + trace.append("Exit f") + except GeneratorExit: + raise ValueError("Vorpal bunny encountered") + def g(): + trace.append("Enter g") + yield from f() + trace.append("Exit g") + try: + gi = g() + next(gi) + gi.throw(GeneratorExit) + except ValueError as e: + self.assertEqual(e.args[0], "Vorpal bunny encountered") + self.assertIsInstance(e.__context__, GeneratorExit) + else: + self.fail("subgenerator failed to raise ValueError") + self.assertEqual(trace,[ + "Enter g", + "Enter f", + ]) + + +def test_main(): + from test import support + test_classes = [TestPEP380Operation] + support.run_unittest(*test_classes) + + +if __name__ == '__main__': + test_main() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 20:54:37 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 13 Jan 2012 20:54:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_NULL_and_no_exception_set_f?= =?utf8?q?rom_tp=5Fiternext_means_StopIteration?= Message-ID: http://hg.python.org/cpython/rev/315781cd72fa changeset: 74364:315781cd72fa user: Benjamin Peterson date: Fri Jan 13 14:54:31 2012 -0500 summary: NULL and no exception set from tp_iternext means StopIteration files: Lib/test/test_pep380.py | 5 +++++ Python/ceval.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py --- a/Lib/test/test_pep380.py +++ b/Lib/test/test_pep380.py @@ -831,6 +831,11 @@ "Enter f", ]) + def test_yield_from_empty(self): + def g(): + yield from () + self.assertRaises(StopIteration, next, g()) + def test_main(): from test import support diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1839,7 +1839,8 @@ if (!retval) { /* iter may be exhausted */ Py_CLEAR(x); - if (!PyErr_ExceptionMatches(PyExc_StopIteration)) { + if (PyErr_Occurred() && + !PyErr_ExceptionMatches(PyExc_StopIteration)) { /* some other exception */ break; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 21:10:56 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jan 2012 21:10:56 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_compilation_warning_on_?= =?utf8?q?Windows?= Message-ID: http://hg.python.org/cpython/rev/42d95944662d changeset: 74365:42d95944662d user: Amaury Forgeot d'Arc date: Sat Dec 17 10:23:14 2011 +0100 summary: Fix compilation warning on Windows files: Modules/_multiprocessing/multiprocessing.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c --- a/Modules/_multiprocessing/multiprocessing.c +++ b/Modules/_multiprocessing/multiprocessing.c @@ -99,7 +99,7 @@ PyMODINIT_FUNC PyInit__multiprocessing(void) { - PyObject *module, *temp, *value; + PyObject *module, *temp, *value = NULL; /* Initialize module */ module = PyModule_Create(&multiprocessing_module); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 21:11:09 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jan 2012 21:11:09 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_a_crash_when_the_return?= =?utf8?q?_value_of_a_subgenerator_is_a_temporary?= Message-ID: http://hg.python.org/cpython/rev/9e9c1be433d7 changeset: 74366:9e9c1be433d7 user: Amaury Forgeot d'Arc date: Fri Jan 13 21:06:12 2012 +0100 summary: Fix a crash when the return value of a subgenerator is a temporary object (with a refcount of 1) files: Lib/test/test_pep380.py | 11 +++++++++++ Objects/genobject.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py --- a/Lib/test/test_pep380.py +++ b/Lib/test/test_pep380.py @@ -364,6 +364,17 @@ ]) + def test_exception_value_crash(self): + # There used to be a refcount error when the return value + # stored in the StopIteration has a refcount of 1. + def g1(): + yield from g2() + def g2(): + yield "g2" + return [42] + self.assertEqual(list(g1()), ["g2"]) + + def test_generator_return_value(self): """ Test generator return value diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -475,6 +475,7 @@ Py_XDECREF(tb); if (ev) { value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); Py_DECREF(ev); } } else if (PyErr_Occurred()) { @@ -482,8 +483,8 @@ } if (value == NULL) { value = Py_None; + Py_INCREF(value); } - Py_INCREF(value); *pvalue = value; return 0; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 21:11:10 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jan 2012 21:11:10 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_compilation_with_C89_co?= =?utf8?b?bXBpbGVycyAoV2luZG93cy4uLik=?= Message-ID: http://hg.python.org/cpython/rev/fbb38a476713 changeset: 74367:fbb38a476713 user: Amaury Forgeot d'Arc date: Fri Jan 13 21:08:49 2012 +0100 summary: Fix compilation with C89 compilers (Windows...) files: Python/ceval.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1837,6 +1837,7 @@ /* x is now the iterator, make the first next() call */ retval = (*Py_TYPE(x)->tp_iternext)(x); if (!retval) { + PyObject *et, *ev, *tb; /* iter may be exhausted */ Py_CLEAR(x); if (PyErr_Occurred() && @@ -1845,7 +1846,6 @@ break; } /* try to get return value from exception */ - PyObject *et, *ev, *tb; PyErr_Fetch(&et, &ev, &tb); Py_XDECREF(et); Py_XDECREF(tb); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 21:18:12 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 21:18:12 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Bring_the_Python_3=2E3_feature?= =?utf8?q?_list_up_to_date=2E?= Message-ID: http://hg.python.org/peps/rev/ea3ffa3611e5 changeset: 4012:ea3ffa3611e5 user: Georg Brandl date: Fri Jan 13 21:18:11 2012 +0100 summary: Bring the Python 3.3 feature list up to date. files: pep-0398.txt | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -57,27 +57,34 @@ Features for 3.3 ================ +Implemented PEPs: + +* PEP 380: Syntax for Delegating to a Subgenerator +* PEP 393: Flexible String Representation +* PEP 3151: Reworking the OS and IO exception hierarchy +* PEP 3155: Qualified name for classes and functions + +Other final large-scale changes: + +* Addition of the "packaging" module, deprecating "distutils" +* Addition of the faulthandler module + Candidate PEPs: * PEP 362: Function Signature Object -* PEP 380: Syntax for Delegating to a Subgenerator * PEP 382: Namespace Packages -* PEP 393: Flexible String Representation * PEP 395: Module Aliasing * PEP 397: Python launcher for Windows * PEP 3143: Standard daemon process library -* PEP 3151: Reworking the OS and IO exception hierarchy (Note that these are not accepted yet and even if they are, they might not be finished in time for Python 3.3.) Other planned large-scale changes: -* Addition of the "packaging" module, replacing "distutils" * Implementing ``__import__`` using importlib * Email version 6 * A standard event-loop interface (PEP by Jim Fulton pending) -* Adding the faulthandler module. * Breaking out standard library and docs in separate repos? * A PEP on supplementing C modules with equivalent Python modules? -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 13 21:25:29 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 21:25:29 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_lzma_module=2E?= Message-ID: http://hg.python.org/peps/rev/11079269c4a7 changeset: 4013:11079269c4a7 user: Georg Brandl date: Fri Jan 13 21:25:28 2012 +0100 summary: Add lzma module. files: pep-0398.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -68,6 +68,7 @@ * Addition of the "packaging" module, deprecating "distutils" * Addition of the faulthandler module +* Addition of the lzma module, and lzma/xz support in tarfile Candidate PEPs: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 13 22:01:13 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 22:01:13 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Grammar_fix=2E?= Message-ID: http://hg.python.org/devguide/rev/1b64699ebba5 changeset: 473:1b64699ebba5 user: Georg Brandl date: Fri Jan 13 21:56:01 2012 +0100 summary: Grammar fix. files: committing.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -163,7 +163,7 @@ .. _eol extension: http://mercurial.selenic.com/wiki/EolExtension -Handling Other's Code +Handling Others' Code --------------------- As a core developer you will occasionally want to commit a patch created by -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 13 22:01:19 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 22:01:19 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Some_advice_about_what_goe?= =?utf8?q?s_into_a_single_commit=2E?= Message-ID: http://hg.python.org/devguide/rev/2afe1f8ae855 changeset: 474:2afe1f8ae855 user: Georg Brandl date: Fri Jan 13 22:01:10 2012 +0100 summary: Some advice about what goes into a single commit. files: committing.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -3,6 +3,16 @@ Committing and Pushing Changes ============================== +Once a change patch is ready and tested, it can be committed to the repository. +We usually prefer to put a whole feature or bugfix into a single commit, but no +more. In particular: + +* Do **not** fix more than one issue in the same commit (except, of course, if + one code change fixes all of them). +* Do **not** do cosmetic changes to unrelated code in the same commit as some + feature/bugfix. + + Patch Checklist --------------- -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 13 22:03:33 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 22:03:33 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Some_more_advice_about_mer?= =?utf8?q?ges=2E?= Message-ID: http://hg.python.org/devguide/rev/5d7759157a67 changeset: 475:5d7759157a67 user: Georg Brandl date: Fri Jan 13 22:03:32 2012 +0100 summary: Some more advice about merges. files: committing.rst | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -12,6 +12,9 @@ * Do **not** do cosmetic changes to unrelated code in the same commit as some feature/bugfix. +It is of course okay to pile up several commits to one branch and merge them +into another in one merge commit. + Patch Checklist --------------- -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 13 22:09:35 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 22:09:35 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Make_=22quickstart=22_sect?= =?utf8?q?ion_more_consistent=2E_Remove_=22indices_and_tables=22_section?= Message-ID: http://hg.python.org/devguide/rev/dedeac10054e changeset: 476:dedeac10054e user: Georg Brandl date: Fri Jan 13 22:09:35 2012 +0100 summary: Make "quickstart" section more consistent. Remove "indices and tables" section that had no indices or tables. files: index.rst | 81 ++++++++++++++++++------------------------ 1 files changed, 35 insertions(+), 46 deletions(-) diff --git a/index.rst b/index.rst --- a/index.rst +++ b/index.rst @@ -37,27 +37,27 @@ Quick Start ----------- -Here is a list of the basic step necessary to get set up and make a patch: +Here is a list of the basic steps necessary to get set up and make a patch: -1. get :ref:`a clone of CPython ` with - ``hg clone http://hg.python.org/cpython``; +1. Get :ref:`a clone of CPython ` with ``hg clone + http://hg.python.org/cpython``. 2. On UNIX, run ``./configure --with-pydebug && make -j2`` to :ref:`build Python `. On :ref:`Windows `, load the project file :file:`PCbuild\\pcbuild.sln` in Visual Studio, select :menuselection:`Debug`, - and :menuselection:`Build -> Build Solution`; -3. :doc:`run the tests ` with ``./python -m test -j3`` - (use :file:`./python.exe` on :ref:`most ` Mac OS X systems and - :file:`PCbuild\\python_d.exe` on Windows); -4. make the :doc:`patch `; -5. submit it to the `issue tracker`_. + and :menuselection:`Build --> Build Solution`. +3. :doc:`Run the tests ` with ``./python -m test -j3`` (use + :file:`./python.exe` on :ref:`most ` Mac OS X systems and + :file:`PCbuild\\python_d.exe` on Windows). +4. Make the :doc:`patch `. +5. Submit it to the `issue tracker`_. Quick Links ----------- -Here are some links that you may find you reference frequently while +Here are some links that you probably will reference frequently while contributing to Python. * `Issue tracker`_ @@ -69,11 +69,11 @@ Contributing ------------ -We encourage everyone to contribute to Python and that's why we have put up -this developer's guide. If you still have questions after reviewing the -material in this guide, then the `Python Mentors`_ group is available to help -guide new contributors through the process. The :doc:`Developer FAQ ` is -another useful source of information. +We encourage everyone to contribute to Python and that's why we have put up this +developer's guide. If you still have questions after reviewing the material in +this guide, then the `Python Mentors`_ group is available to help guide new +contributors through the process. The :doc:`Developer FAQ ` is another +useful source of information. Guide for contributing to Python: @@ -98,12 +98,12 @@ * :doc:`devcycle` * :doc:`buildbots` -It is **recommended** that the above documents be read in the order listed. -You can stop where you feel comfortable and begin contributing immediately -without reading and understanding these documents all at once. If you do -choose to skip around within the documentation, be aware that it is written -assuming preceding documentation has been read so you may find it necessary -to backtrack to fill in missing concepts and terminology. +It is **recommended** that the above documents be read in the order listed. You +can stop where you feel comfortable and begin contributing immediately without +reading and understanding these documents all at once. If you do choose to skip +around within the documentation, be aware that it is written assuming preceding +documentation has been read so you may find it necessary to backtrack to fill in +missing concepts and terminology. Proposing changes to Python itself @@ -111,9 +111,9 @@ Improving Python's code, documentation and tests are ongoing tasks that are never going to be "finished", as Python operates as part of an ever-evolving -system of technology. An even more challenging ongoing task than these -necessary maintenance activities is finding ways to make Python, in the form -of the standard library and the language definition, an even better tool in a +system of technology. An even more challenging ongoing task than these +necessary maintenance activities is finding ways to make Python, in the form of +the standard library and the language definition, an even better tool in a developer's toolkit. While these kinds of change are much rarer than those described above, they do @@ -126,15 +126,14 @@ Other Interpreter Implementations --------------------------------- -This guide is specifically for contributing to the Python reference -interpreter, also known as CPython (while most of the standard library is -written in Python, the interpreter core is written in C and integrates most -easily with the C and C++ ecosystems). +This guide is specifically for contributing to the Python reference interpreter, +also known as CPython (while most of the standard library is written in Python, +the interpreter core is written in C and integrates most easily with the C and +C++ ecosystems). -There are other Python implementations, each with a different focus. -Like CPython, they always have more things they would like to do than they -have developers to work on them. Some major example that may be of interest -are: +There are other Python implementations, each with a different focus. Like +CPython, they always have more things they would like to do than they have +developers to work on them. Some major example that may be of interest are: * PyPy_: A Python interpreter focused on high speed (JIT-compiled) operation on major platforms @@ -153,9 +152,9 @@ Resources --------- -* Anyone can checkout this guide from http://hg.python.org/devguide/. - Core developers should use ssh://hg at hg.python.org/devguide instead, so - that they can push back their edits to the server. +* Anyone can clone this guide from http://hg.python.org/devguide/. Core + developers should use ssh://hg at hg.python.org/devguide instead, so that they + can push back their edits to the server. * Coding style guides * :PEP:`7` (Style Guide for C Code) * :PEP:`8` (Style Guide for Python Code) @@ -181,6 +180,7 @@ * `python.org maintenance`_ * :doc:`developers` +* :ref:`Search this guide ` .. _Buildbot status: http://python.org/dev/buildbot/ .. _Firefox search engine plug-in: http://www.python.org/dev/searchplugin/ @@ -193,14 +193,3 @@ .. _IronPython: http://ironpython.net/ .. _Stackless: http://www.stackless.com/ .. _Issue tracker: http://bugs.python.org/ - - -Indices and tables -================== - -.. XXX commented until non-empty - * :ref:`genindex` - * :ref:`modindex` - -* :ref:`search` - -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 13 22:12:31 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 22:12:31 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Remove_duplicate_word=2E?= Message-ID: http://hg.python.org/devguide/rev/2f7ac41f250f changeset: 477:2f7ac41f250f user: Georg Brandl date: Fri Jan 13 22:11:26 2012 +0100 summary: Remove duplicate word. files: devcycle.rst | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/devcycle.rst b/devcycle.rst --- a/devcycle.rst +++ b/devcycle.rst @@ -34,14 +34,14 @@ 2.7, 3.2, 3.3). Development is handled separately for Python 2 and Python 3: no merging happens between 2.x and 3.x branches. -In each of the 2.x and 3.x realms, the branch for a feature version is -always a descendant of the previous feature version: for example, the ``3.2`` -branch is a descendant of the ``3.1`` branch. +In each of the 2.x and 3.x realms, the branch for a feature version is always a +descendant of the previous feature version: for example, the ``3.2`` branch is a +descendant of the ``3.1`` branch. -Therefore, each change change should be made **first** in the oldest branch -to which it applies and forward-ported as appropriate: if a bug must be -fixed in both Python 3.2 and 3.3, first fix it in ``3.2`` and then merge ``3.2`` -into ``default`` (which holds the future 3.3). +Therefore, each change should be made **first** in the oldest branch to which it +applies and forward-ported as appropriate: if a bug must be fixed in both Python +3.2 and 3.3, first fix it in ``3.2`` and then merge ``3.2`` into ``default`` +(which holds the future 3.3). .. _indevbranch: -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 13 22:12:57 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jan 2012 22:12:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Silence_compilation_warning?= =?utf8?q?s_on_Windows?= Message-ID: http://hg.python.org/cpython/rev/8e538ed41766 changeset: 74368:8e538ed41766 user: Amaury Forgeot d'Arc date: Fri Jan 13 22:12:37 2012 +0100 summary: Silence compilation warnings on Windows files: Include/unicodeobject.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2024,11 +2024,11 @@ ); PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable( - const Py_UCS4 ch /* Unicode character */ + Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_IsCased( - const Py_UCS4 ch /* Unicode character */ + Py_UCS4 ch /* Unicode character */ ); PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 13 22:15:05 2012 From: python-checkins at python.org (georg.brandl) Date: Fri, 13 Jan 2012 22:15:05 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Fix_typo=2E?= Message-ID: http://hg.python.org/devguide/rev/de5ddb1c61b3 changeset: 478:de5ddb1c61b3 user: Georg Brandl date: Fri Jan 13 22:15:05 2012 +0100 summary: Fix typo. files: patch.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/patch.rst b/patch.rst --- a/patch.rst +++ b/patch.rst @@ -70,7 +70,7 @@ First, make sure to follow Python's style guidelines. For Python code you should follow :PEP:`8`, and for C code you should follow :PEP:`7`. If you have -one or two discrepencies those can be fixed by the core developer who commits +one or two discrepancies those can be fixed by the core developer who commits your patch. But if you have systematic deviations from the style guides your patch will be put on hold until you fix the formatting issues. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 13 22:54:20 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 13 Jan 2012 22:54:20 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNzc0?= =?utf8?q?=3A_json=3A_Fix_a_SystemError_when_a_bogus_encoding_is_passed_to?= Message-ID: http://hg.python.org/cpython/rev/a9680746ae4a changeset: 74369:a9680746ae4a branch: 2.7 parent: 74362:7fcfbaad75ee user: Amaury Forgeot d'Arc date: Fri Jan 13 22:53:25 2012 +0100 summary: Issue #13774: json: Fix a SystemError when a bogus encoding is passed to json.loads(). files: Lib/json/tests/test_unicode.py | 4 ++++ Misc/NEWS | 3 +++ Modules/_json.c | 9 ++++++++- 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/Lib/json/tests/test_unicode.py b/Lib/json/tests/test_unicode.py --- a/Lib/json/tests/test_unicode.py +++ b/Lib/json/tests/test_unicode.py @@ -80,6 +80,10 @@ # Issue 10038. self.assertEqual(type(self.loads('"foo"')), unicode) + def test_bad_encoding(self): + self.assertRaises(UnicodeEncodeError, self.loads, '"a"', u"rat\xe9") + self.assertRaises(TypeError, self.loads, '"a"', 1) + class TestPyUnicode(TestUnicode, PyTest): pass class TestCUnicode(TestUnicode, CTest): pass diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -374,6 +374,9 @@ Extension Modules ----------------- +- Issue #13774: json: Fix a SystemError when a bogus encoding is passed to + json.loads(). + - Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. diff --git a/Modules/_json.c b/Modules/_json.c --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1725,8 +1725,15 @@ Py_DECREF(s->encoding); s->encoding = tmp; } - if (s->encoding == NULL || !PyString_Check(s->encoding)) + if (s->encoding == NULL) goto bail; + if (!PyString_Check(s->encoding)) { + PyErr_Format(PyExc_TypeError, + "encoding must be a string, not %.80s", + Py_TYPE(s->encoding)->tp_name); + goto bail; + } + /* All of these will fail "gracefully" so we don't need to verify them */ s->strict = PyObject_GetAttrString(ctx, "strict"); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 05:20:01 2012 From: python-checkins at python.org (nick.coghlan) Date: Sat, 14 Jan 2012 05:20:01 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_merge_glitch_in_What=27?= =?utf8?q?s_New?= Message-ID: http://hg.python.org/cpython/rev/1116d22f813b changeset: 74370:1116d22f813b parent: 74368:8e538ed41766 user: Nick Coghlan date: Sat Jan 14 14:19:49 2012 +1000 summary: Fix merge glitch in What's New files: Doc/whatsnew/3.3.rst | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -224,6 +224,7 @@ how they might be accessible from the global scope. Example with (non-bound) methods:: + >>> class C: ... def meth(self): ... pass -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jan 14 05:32:23 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 14 Jan 2012 05:32:23 +0100 Subject: [Python-checkins] Daily reference leaks (8e538ed41766): sum=0 Message-ID: results for 8e538ed41766 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogsOvpBu', '-x'] From python-checkins at python.org Sat Jan 14 05:43:34 2012 From: python-checkins at python.org (nick.coghlan) Date: Sat, 14 Jan 2012 05:43:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_versionchanged_notes_fo?= =?utf8?q?r_PEP_380?= Message-ID: http://hg.python.org/cpython/rev/e2f11c6305ae changeset: 74371:e2f11c6305ae user: Nick Coghlan date: Sat Jan 14 14:43:24 2012 +1000 summary: Add versionchanged notes for PEP 380 files: Doc/library/exceptions.rst | 3 +++ Doc/reference/expressions.rst | 5 ++++- Doc/reference/simple_stmts.rst | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -261,6 +261,9 @@ raised, and the value returned by the function is used as the :attr:`value` parameter to the constructor of the exception. + .. versionchanged:: 3.3 + Added ``value`` attribute and the ability for generator functions to + use it to return a value. .. exception:: SyntaxError diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -355,7 +355,7 @@ garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. -When ``yield from expression`` is used, it treats the supplied expression as +When ``yield from `` is used, it treats the supplied expression as a subiterator. All values produced by that subiterator are passed directly to the caller of the current generator's methods. Any values passed in with :meth:`send` and any exceptions passed in with :meth:`throw` are passed to @@ -369,6 +369,9 @@ :exc:`StopIteration`, or automatically when the sub-iterator is a generator (by returning a value from the sub-generator). + .. versionchanged:: 3.3 + Added ``yield from `` to delegate control flow to a subiterator + The parentheses can be omitted when the :keyword:`yield` expression is the sole expression on the right hand side of an assignment statement. diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -470,10 +470,13 @@ garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. -When ``yield from expression`` is used, it treats the supplied expression as +When ``yield from `` is used, it treats the supplied expression as a subiterator, producing values from it until the underlying iterator is exhausted. + .. versionchanged:: 3.3 + Added ``yield from `` to delegate control flow to a subiterator + For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr` section. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 05:48:26 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 14 Jan 2012 05:48:26 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_closes_=2313730?= Message-ID: http://hg.python.org/cpython/rev/1e65183337ff changeset: 74372:1e65183337ff branch: 2.7 parent: 74369:a9680746ae4a user: Terry Jan Reedy date: Fri Jan 13 23:41:31 2012 -0500 summary: closes #13730 files: Doc/library/decimal.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -35,7 +35,7 @@ people learn at school." -- excerpt from the decimal arithmetic specification. * Decimal numbers can be represented exactly. In contrast, numbers like - :const:`1.1` and :const:`2.2` do not have an exact representations in binary + :const:`1.1` and :const:`2.2` do not have exact representations in binary floating point. End users typically would not expect ``1.1 + 2.2`` to display as :const:`3.3000000000000003` as it does with binary floating point. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 05:48:27 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 14 Jan 2012 05:48:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_=2313730_gramma?= =?utf8?q?r_fix?= Message-ID: http://hg.python.org/cpython/rev/bac18092c1dc changeset: 74373:bac18092c1dc branch: 3.2 parent: 74360:f36c6f5f9d61 user: Terry Jan Reedy date: Fri Jan 13 23:43:13 2012 -0500 summary: #13730 grammar fix files: Doc/library/decimal.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -29,7 +29,7 @@ people learn at school." -- excerpt from the decimal arithmetic specification. * Decimal numbers can be represented exactly. In contrast, numbers like - :const:`1.1` and :const:`2.2` do not have an exact representations in binary + :const:`1.1` and :const:`2.2` do not have exact representations in binary floating point. End users typically would not expect ``1.1 + 2.2`` to display as :const:`3.3000000000000003` as it does with binary floating point. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 05:48:28 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 14 Jan 2012 05:48:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2_=2313730_grammar_fix?= Message-ID: http://hg.python.org/cpython/rev/e6b0d9d209f2 changeset: 74374:e6b0d9d209f2 parent: 74368:8e538ed41766 parent: 74373:bac18092c1dc user: Terry Jan Reedy date: Fri Jan 13 23:44:49 2012 -0500 summary: Merge with 3.2 #13730 grammar fix files: Doc/library/decimal.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -29,7 +29,7 @@ people learn at school." -- excerpt from the decimal arithmetic specification. * Decimal numbers can be represented exactly. In contrast, numbers like - :const:`1.1` and :const:`2.2` do not have an exact representations in binary + :const:`1.1` and :const:`2.2` do not have exact representations in binary floating point. End users typically would not expect ``1.1 + 2.2`` to display as :const:`3.3000000000000003` as it does with binary floating point. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 05:48:28 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 14 Jan 2012 05:48:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/ec95169055ab changeset: 74375:ec95169055ab parent: 74374:e6b0d9d209f2 parent: 74371:e2f11c6305ae user: Terry Jan Reedy date: Fri Jan 13 23:47:41 2012 -0500 summary: Merge files: Doc/library/exceptions.rst | 3 +++ Doc/reference/expressions.rst | 5 ++++- Doc/reference/simple_stmts.rst | 5 ++++- Doc/whatsnew/3.3.rst | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -261,6 +261,9 @@ raised, and the value returned by the function is used as the :attr:`value` parameter to the constructor of the exception. + .. versionchanged:: 3.3 + Added ``value`` attribute and the ability for generator functions to + use it to return a value. .. exception:: SyntaxError diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -355,7 +355,7 @@ garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. -When ``yield from expression`` is used, it treats the supplied expression as +When ``yield from `` is used, it treats the supplied expression as a subiterator. All values produced by that subiterator are passed directly to the caller of the current generator's methods. Any values passed in with :meth:`send` and any exceptions passed in with :meth:`throw` are passed to @@ -369,6 +369,9 @@ :exc:`StopIteration`, or automatically when the sub-iterator is a generator (by returning a value from the sub-generator). + .. versionchanged:: 3.3 + Added ``yield from `` to delegate control flow to a subiterator + The parentheses can be omitted when the :keyword:`yield` expression is the sole expression on the right hand side of an assignment statement. diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -470,10 +470,13 @@ garbage collected), the generator-iterator's :meth:`close` method will be called, allowing any pending :keyword:`finally` clauses to execute. -When ``yield from expression`` is used, it treats the supplied expression as +When ``yield from `` is used, it treats the supplied expression as a subiterator, producing values from it until the underlying iterator is exhausted. + .. versionchanged:: 3.3 + Added ``yield from `` to delegate control flow to a subiterator + For full details of :keyword:`yield` semantics, refer to the :ref:`yieldexpr` section. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -224,6 +224,7 @@ how they might be accessible from the global scope. Example with (non-bound) methods:: + >>> class C: ... def meth(self): ... pass -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 06:07:40 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 14 Jan 2012 06:07:40 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_=2311633_about_?= =?utf8?q?buffering_of_print?= Message-ID: http://hg.python.org/cpython/rev/8935a33773b9 changeset: 74376:8935a33773b9 branch: 2.7 parent: 74372:1e65183337ff user: Terry Jan Reedy date: Sat Jan 14 00:06:37 2012 -0500 summary: #11633 about buffering of print files: Doc/library/functions.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -910,7 +910,9 @@ *end*. The *file* argument must be an object with a ``write(string)`` method; if it - is not present or ``None``, :data:`sys.stdout` will be used. + is not present or ``None``, :data:`sys.stdout` will be used. Output buffering + is determined by *file*. Use ``file.flush()`` to ensure, for instance, + immediate appearance on a screen. .. note:: -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Sat Jan 14 06:16:32 2012 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sat, 14 Jan 2012 15:16:32 +1000 Subject: [Python-checkins] cpython: add test, which was missing from d64ac9ab4cd0 In-Reply-To: References: Message-ID: On Sat, Jan 14, 2012 at 5:39 AM, benjamin.peterson wrote: > http://hg.python.org/cpython/rev/be85914b611c > changeset: ? 74363:be85914b611c > parent: ? ? ?74361:609482c6710e > user: ? ? ? ?Benjamin Peterson > date: ? ? ? ?Fri Jan 13 14:39:38 2012 -0500 > summary: > ?add test, which was missing from d64ac9ab4cd0 Ah, that's where that came from, thanks. I still haven't fully trained myself to use hg import instead of patch, which would avoid precisely this kind of error :P Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Sat Jan 14 07:03:18 2012 From: python-checkins at python.org (nick.coghlan) Date: Sat, 14 Jan 2012 07:03:18 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_lingering_artifact_o?= =?utf8?q?f_an_initial_PEP_380_Grammar_change_that_was_later?= Message-ID: http://hg.python.org/cpython/rev/fd7b7506f317 changeset: 74377:fd7b7506f317 parent: 74375:ec95169055ab user: Nick Coghlan date: Sat Jan 14 16:03:07 2012 +1000 summary: Remove lingering artifact of an initial PEP 380 Grammar change that was later reverted files: Grammar/Grammar | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Grammar/Grammar b/Grammar/Grammar --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -121,7 +121,7 @@ |'**' test) # The reason that keywords are test nodes instead of NAME is that using NAME # results in an ambiguity. ast.c makes sure it's a NAME. -argument: (test) [comp_for] | test '=' test # Really [keyword '='] test +argument: test [comp_for] | test '=' test # Really [keyword '='] test comp_iter: comp_for | comp_if comp_for: 'for' exprlist 'in' or_test [comp_iter] comp_if: 'if' test_nocond [comp_iter] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 07:08:17 2012 From: python-checkins at python.org (nick.coghlan) Date: Sat, 14 Jan 2012 07:08:17 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_indenting?= Message-ID: http://hg.python.org/cpython/rev/2d768a2e8909 changeset: 74378:2d768a2e8909 user: Nick Coghlan date: Sat Jan 14 16:08:08 2012 +1000 summary: Fix indenting files: Include/genobject.h | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Include/genobject.h b/Include/genobject.h --- a/Include/genobject.h +++ b/Include/genobject.h @@ -11,20 +11,20 @@ struct _frame; /* Avoid including frameobject.h */ typedef struct { - PyObject_HEAD - /* The gi_ prefix is intended to remind of generator-iterator. */ + PyObject_HEAD + /* The gi_ prefix is intended to remind of generator-iterator. */ - /* Note: gi_frame can be NULL if the generator is "finished" */ - struct _frame *gi_frame; + /* Note: gi_frame can be NULL if the generator is "finished" */ + struct _frame *gi_frame; - /* True if generator is being executed. */ - int gi_running; + /* True if generator is being executed. */ + int gi_running; - /* The code object backing the generator */ - PyObject *gi_code; + /* The code object backing the generator */ + PyObject *gi_code; - /* List of weak reference. */ - PyObject *gi_weakreflist; + /* List of weak reference. */ + PyObject *gi_weakreflist; } PyGenObject; PyAPI_DATA(PyTypeObject) PyGen_Type; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 07:45:58 2012 From: python-checkins at python.org (nick.coghlan) Date: Sat, 14 Jan 2012 07:45:58 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_a_separate_NEWS_entry_f?= =?utf8?q?or_a_change_to_PyObject=5FCallMethod_in_the_PEP_380?= Message-ID: http://hg.python.org/cpython/rev/cfab2b2009e4 changeset: 74379:cfab2b2009e4 user: Nick Coghlan date: Sat Jan 14 16:45:48 2012 +1000 summary: Add a separate NEWS entry for a change to PyObject_CallMethod in the PEP 380 patch, and make the private CallMethod variants consistent with the public one files: Misc/NEWS | 3 +++ Objects/abstract.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2449,6 +2449,9 @@ C-API ----- +- PyObject_CallMethod now passes along any underlying AttributeError from + PyObject_GetAttr, instead of replacing it with something less informative + - Issue #10913: Deprecate misleading functions PyEval_AcquireLock() and PyEval_ReleaseLock(). The thread-state aware APIs should be used instead. diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2288,7 +2288,6 @@ func = _PyObject_GetAttrId(o, name); if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name->string); return 0; } @@ -2330,7 +2329,6 @@ func = _PyObject_GetAttrId(o, name); if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name->string); return NULL; } va_start(va, format); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 11:39:37 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 11:39:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Issue13726_-_Fi?= =?utf8?q?x_the__ambiguous_-S_flag_in_regrtest=2E_It_is_-o/--slow_for?= Message-ID: http://hg.python.org/cpython/rev/4fc5dfad766a changeset: 74380:4fc5dfad766a branch: 3.2 parent: 74373:bac18092c1dc user: Senthil Kumaran date: Sat Jan 14 18:26:27 2012 +0800 summary: Issue13726 - Fix the ambiguous -S flag in regrtest. It is -o/--slow for printing the 10 slowest test. files: Lib/test/regrtest.py | 4 ++-- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -28,7 +28,7 @@ -W/--verbose3 -- display test output on failure -d/--debug -- print traceback for failed tests -q/--quiet -- no output unless one or more tests fail --S/--slow -- print the slowest 10 tests +-o/--slow -- print the slowest 10 tests --header -- print header with interpreter info Selecting tests @@ -312,7 +312,7 @@ start = a elif o in ('-s', '--single'): single = True - elif o in ('-S', '--slow'): + elif o in ('-o', '--slow'): print_slow = True elif o in ('-r', '--randomize'): randomize = True diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,9 @@ Library ------- +- Issue #13726: Fix the ambiguous -S flag in regrtest. It is -o/--slow for slow + tests. + - Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor. The hang would occur when retrieving the result of a scheduled future after the executor had been shut down. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 11:39:37 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 11:39:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Adding_the_-o_o?= =?utf8?q?ption_for_Issue13726?= Message-ID: http://hg.python.org/cpython/rev/9a0efac5bbcb changeset: 74381:9a0efac5bbcb branch: 3.2 user: Senthil Kumaran date: Sat Jan 14 18:38:28 2012 +0800 summary: Adding the -o option for Issue13726 files: Lib/test/regrtest.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -272,7 +272,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoSrf:lu:t:TD:NLR:FwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 11:39:41 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 11:39:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/b84f61fdcb4c changeset: 74382:b84f61fdcb4c parent: 74379:cfab2b2009e4 parent: 74380:4fc5dfad766a user: Senthil Kumaran date: Sat Jan 14 18:39:06 2012 +0800 summary: merge from 3.2 files: Lib/test/regrtest.py | 4 ++-- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -33,7 +33,7 @@ -W/--verbose3 -- display test output on failure -d/--debug -- print traceback for failed tests -q/--quiet -- no output unless one or more tests fail --S/--slow -- print the slowest 10 tests +-o/--slow -- print the slowest 10 tests --header -- print header with interpreter info Selecting tests @@ -340,7 +340,7 @@ start = a elif o in ('-s', '--single'): single = True - elif o in ('-S', '--slow'): + elif o in ('-o', '--slow'): print_slow = True elif o in ('-r', '--randomize'): randomize = True diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -442,6 +442,9 @@ Library ------- +- Issue #13726: Fix the ambiguous -S flag in regrtest. It is -o/--slow for slow + tests. + - Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor. The hang would occur when retrieving the result of a scheduled future after the executor had been shut down. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 11:39:42 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 11:39:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/6797e7458ad0 changeset: 74383:6797e7458ad0 parent: 74382:b84f61fdcb4c parent: 74381:9a0efac5bbcb user: Senthil Kumaran date: Sat Jan 14 18:39:23 2012 +0800 summary: merge from 3.2 files: Lib/test/regrtest.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -298,7 +298,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoSrf:lu:t:TD:NLR:FwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 11:53:44 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 14 Jan 2012 11:53:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312760=3A_Refer_to_?= =?utf8?q?the_new_=27x=27_open_mode_as_=22exclusive_creation=22_mode=2E?= Message-ID: http://hg.python.org/cpython/rev/8bcbe2dc3835 changeset: 74384:8bcbe2dc3835 parent: 74379:cfab2b2009e4 user: Charles-Fran?ois Natali date: Sat Jan 14 11:51:00 2012 +0100 summary: Issue #12760: Refer to the new 'x' open mode as "exclusive creation" mode. files: Doc/library/io.rst | 12 ++++++------ Doc/whatsnew/3.3.rst | 5 +++-- Lib/_pyio.py | 2 +- Modules/_io/fileio.c | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -472,12 +472,12 @@ to which the resulting :class:`FileIO` object will give access. The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading - (default), writing, creating or appending. The file will be created if it - doesn't exist when opened for writing or appending; it will be truncated - when opened for writing. :exc:`FileExistsError` will be raised if it already - exists when opened for creating. Opening a file for creating implies - writing, so this mode behaves in a similar way to ``'w'``. Add a ``'+'`` to - the mode to allow simultaneous reading and writing. + (default), writing, exclusive creation or appending. The file will be + created if it doesn't exist when opened for writing or appending; it will be + truncated when opened for writing. :exc:`FileExistsError` will be raised if + it already exists when opened for creating. Opening a file for creating + implies writing, so this mode behaves in a similar way to ``'w'``. Add a + ``'+'`` to the mode to allow simultaneous reading and writing. The :meth:`read` (when called with a positive argument), :meth:`readinto` and :meth:`write` methods on this class will only make one system call. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -427,8 +427,9 @@ io -- -The :func:`~io.open` function has a new ``'x'`` mode that can be used to create -a new file, and raise a :exc:`FileExistsError` if the file already exists. +The :func:`~io.open` function has a new ``'x'`` mode that can be used to +exclusively create a new file, and raise a :exc:`FileExistsError` if the file +already exists. It is based on the C11 'x' mode to fopen(). (Contributed by David Townshend in :issue:`12760`) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -41,7 +41,7 @@ mode is an optional string that specifies the mode in which the file is opened. It defaults to 'r' which means open for reading in text mode. Other common values are 'w' for writing (truncating the file if it already - exists), 'x' for creating and writing to a new file, and 'a' for appending + exists), 'x' for exclusive creation of a new file, and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). In text mode, if encoding is not specified the encoding used is platform dependent. (For reading and diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -1066,9 +1066,9 @@ "file(name: str[, mode: str][, opener: None]) -> file IO object\n" "\n" "Open a file. The mode can be 'r', 'w', 'x' or 'a' for reading (default),\n" -"writing, creating or appending. The file will be created if it doesn't\n" -"exist when opened for writing or appending; it will be truncated when\n" -"opened for writing. A `FileExistsError` will be raised if it already\n" +"writing, exclusive creation or appending. The file will be created if it\n" +"doesn't exist when opened for writing or appending; it will be truncated\n" +"when opened for writing. A `FileExistsError` will be raised if it already\n" "exists when opened for creating. Opening a file for creating implies\n" "writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode\n" "to allow simultaneous reading and writing. A custom opener can be used by\n" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 11:53:45 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 14 Jan 2012 11:53:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?b?KTogTWVyZ2Uu?= Message-ID: http://hg.python.org/cpython/rev/db661cee5baa changeset: 74385:db661cee5baa parent: 74384:8bcbe2dc3835 parent: 74383:6797e7458ad0 user: Charles-Fran?ois Natali date: Sat Jan 14 11:53:37 2012 +0100 summary: Merge. files: Lib/test/regrtest.py | 6 +++--- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -33,7 +33,7 @@ -W/--verbose3 -- display test output on failure -d/--debug -- print traceback for failed tests -q/--quiet -- no output unless one or more tests fail --S/--slow -- print the slowest 10 tests +-o/--slow -- print the slowest 10 tests --header -- print header with interpreter info Selecting tests @@ -298,7 +298,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoSrf:lu:t:TD:NLR:FwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', @@ -340,7 +340,7 @@ start = a elif o in ('-s', '--single'): single = True - elif o in ('-S', '--slow'): + elif o in ('-o', '--slow'): print_slow = True elif o in ('-r', '--randomize'): randomize = True diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -442,6 +442,9 @@ Library ------- +- Issue #13726: Fix the ambiguous -S flag in regrtest. It is -o/--slow for slow + tests. + - Issue #12364: Fix a hang in concurrent.futures.ProcessPoolExecutor. The hang would occur when retrieving the result of a scheduled future after the executor had been shut down. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 12:13:19 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 12:13:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_Issue_=2313?= =?utf8?q?642=3A_Unquote_before_b64encoding_user=3Apassword_during_Basic?= Message-ID: http://hg.python.org/cpython/rev/80e3b8de4edd changeset: 74386:80e3b8de4edd branch: 3.2 parent: 74381:9a0efac5bbcb user: Senthil Kumaran date: Sat Jan 14 19:09:04 2012 +0800 summary: Fix Issue #13642: Unquote before b64encoding user:password during Basic Authentication. files: Lib/test/test_urllib.py | 33 +++++++++++++++++++++++++++- Lib/urllib/request.py | 5 +-- Misc/NEWS | 3 ++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -12,6 +12,8 @@ import sys import tempfile +from base64 import b64encode + def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() @@ -42,8 +44,8 @@ class FakeSocket(io.BytesIO): io_refs = 1 - def sendall(self, str): - pass + def sendall(self, data): + FakeHTTPConnection.buf = data def makefile(self, *args, **kwds): self.io_refs += 1 @@ -65,8 +67,13 @@ io.BytesIO.close(self) class FakeHTTPConnection(http.client.HTTPConnection): + + # buffer to store data for verification in urlopen tests. + buf = None + def connect(self): self.sock = FakeSocket(fakedata) + self._connection_class = http.client.HTTPConnection http.client.HTTPConnection = FakeHTTPConnection @@ -268,6 +275,25 @@ finally: self.unfakehttp() + def test_userpass_inurl_w_spaces(self): + self.fakehttp(b"HTTP/1.0 200 OK\r\n\r\nHello!") + try: + userpass = "a b:c d" + url = "http://{}@python.org/".format(userpass) + fakehttp_wrapper = http.client.HTTPConnection + authorization = ("Authorization: Basic %s\r\n" % + b64encode(userpass.encode("ASCII")).decode("ASCII")) + fp = urlopen(url) + # The authorization header must be in place + self.assertIn(authorization, fakehttp_wrapper.buf.decode("UTF-8")) + self.assertEqual(fp.readline(), b"Hello!") + self.assertEqual(fp.readline(), b"") + # the spaces are quoted in URL so no match + self.assertNotEqual(fp.geturl(), url) + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + class urlretrieve_FileTests(unittest.TestCase): """Test urllib.urlretrieve() on local files""" @@ -1111,6 +1137,9 @@ self.assertEqual(('user', 'a\fb'),urllib.parse.splitpasswd('user:a\fb')) self.assertEqual(('user', 'a\vb'),urllib.parse.splitpasswd('user:a\vb')) self.assertEqual(('user', 'a:b'),urllib.parse.splitpasswd('user:a:b')) + self.assertEqual(('user', 'a b'),urllib.parse.splitpasswd('user:a b')) + self.assertEqual(('user 2', 'ab'),urllib.parse.splitpasswd('user 2:ab')) + self.assertEqual(('user+1', 'a+b'),urllib.parse.splitpasswd('user+1:a+b')) def test_thishost(self): """Test the urllib.request.thishost utility function returns a tuple""" diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1661,13 +1661,13 @@ if not host: raise IOError('http error', 'no host given') if proxy_passwd: - import base64 + proxy_passwd = unquote(proxy_passwd) proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii') else: proxy_auth = None if user_passwd: - import base64 + user_passwd = unquote(user_passwd) auth = base64.b64encode(user_passwd.encode()).decode('ascii') else: auth = None @@ -1871,7 +1871,6 @@ time.gmtime(time.time()))) msg.append('Content-type: %s' % type) if encoding == 'base64': - import base64 # XXX is this encoding/decoding ok? data = base64.decodebytes(data.encode('ascii')).decode('latin1') else: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -97,6 +97,9 @@ Library ------- +- Issue #13642: Unquote before b64encoding user:password during Basic + Authentication. Patch contributed by Joonas Kuorilehto. + - Issue #13726: Fix the ambiguous -S flag in regrtest. It is -o/--slow for slow tests. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 12:13:20 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 12:13:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?b?KTogbWVyZ2UgaGVhZHMu?= Message-ID: http://hg.python.org/cpython/rev/e78f00dbd7ae changeset: 74388:e78f00dbd7ae parent: 74387:4b4029fc8cf2 parent: 74385:db661cee5baa user: Senthil Kumaran date: Sat Jan 14 19:13:06 2012 +0800 summary: merge heads. files: Doc/library/io.rst | 12 ++++++------ Doc/whatsnew/3.3.rst | 5 +++-- Lib/_pyio.py | 2 +- Modules/_io/fileio.c | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -472,12 +472,12 @@ to which the resulting :class:`FileIO` object will give access. The *mode* can be ``'r'``, ``'w'``, ``'x'`` or ``'a'`` for reading - (default), writing, creating or appending. The file will be created if it - doesn't exist when opened for writing or appending; it will be truncated - when opened for writing. :exc:`FileExistsError` will be raised if it already - exists when opened for creating. Opening a file for creating implies - writing, so this mode behaves in a similar way to ``'w'``. Add a ``'+'`` to - the mode to allow simultaneous reading and writing. + (default), writing, exclusive creation or appending. The file will be + created if it doesn't exist when opened for writing or appending; it will be + truncated when opened for writing. :exc:`FileExistsError` will be raised if + it already exists when opened for creating. Opening a file for creating + implies writing, so this mode behaves in a similar way to ``'w'``. Add a + ``'+'`` to the mode to allow simultaneous reading and writing. The :meth:`read` (when called with a positive argument), :meth:`readinto` and :meth:`write` methods on this class will only make one system call. diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -427,8 +427,9 @@ io -- -The :func:`~io.open` function has a new ``'x'`` mode that can be used to create -a new file, and raise a :exc:`FileExistsError` if the file already exists. +The :func:`~io.open` function has a new ``'x'`` mode that can be used to +exclusively create a new file, and raise a :exc:`FileExistsError` if the file +already exists. It is based on the C11 'x' mode to fopen(). (Contributed by David Townshend in :issue:`12760`) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -41,7 +41,7 @@ mode is an optional string that specifies the mode in which the file is opened. It defaults to 'r' which means open for reading in text mode. Other common values are 'w' for writing (truncating the file if it already - exists), 'x' for creating and writing to a new file, and 'a' for appending + exists), 'x' for exclusive creation of a new file, and 'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position). In text mode, if encoding is not specified the encoding used is platform dependent. (For reading and diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -1066,9 +1066,9 @@ "file(name: str[, mode: str][, opener: None]) -> file IO object\n" "\n" "Open a file. The mode can be 'r', 'w', 'x' or 'a' for reading (default),\n" -"writing, creating or appending. The file will be created if it doesn't\n" -"exist when opened for writing or appending; it will be truncated when\n" -"opened for writing. A `FileExistsError` will be raised if it already\n" +"writing, exclusive creation or appending. The file will be created if it\n" +"doesn't exist when opened for writing or appending; it will be truncated\n" +"when opened for writing. A `FileExistsError` will be raised if it already\n" "exists when opened for creating. Opening a file for creating implies\n" "writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode\n" "to allow simultaneous reading and writing. A custom opener can be used by\n" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 12:13:20 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 12:13:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_Issue_=2313642=3A_Unquote_before_b64e?= =?utf8?q?ncoding_user=3Apassword?= Message-ID: http://hg.python.org/cpython/rev/4b4029fc8cf2 changeset: 74387:4b4029fc8cf2 parent: 74383:6797e7458ad0 parent: 74386:80e3b8de4edd user: Senthil Kumaran date: Sat Jan 14 19:12:28 2012 +0800 summary: merge from 3.2 - Fix Issue #13642: Unquote before b64encoding user:password during Basic Authentication. files: Lib/test/test_urllib.py | 33 +++++++++++++++++++++++++++- Lib/urllib/request.py | 2 + Misc/NEWS | 3 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -12,6 +12,8 @@ import sys import tempfile +from base64 import b64encode + def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() @@ -42,8 +44,8 @@ class FakeSocket(io.BytesIO): io_refs = 1 - def sendall(self, str): - pass + def sendall(self, data): + FakeHTTPConnection.buf = data def makefile(self, *args, **kwds): self.io_refs += 1 @@ -65,8 +67,13 @@ io.BytesIO.close(self) class FakeHTTPConnection(http.client.HTTPConnection): + + # buffer to store data for verification in urlopen tests. + buf = None + def connect(self): self.sock = FakeSocket(fakedata) + self._connection_class = http.client.HTTPConnection http.client.HTTPConnection = FakeHTTPConnection @@ -268,6 +275,25 @@ finally: self.unfakehttp() + def test_userpass_inurl_w_spaces(self): + self.fakehttp(b"HTTP/1.0 200 OK\r\n\r\nHello!") + try: + userpass = "a b:c d" + url = "http://{}@python.org/".format(userpass) + fakehttp_wrapper = http.client.HTTPConnection + authorization = ("Authorization: Basic %s\r\n" % + b64encode(userpass.encode("ASCII")).decode("ASCII")) + fp = urlopen(url) + # The authorization header must be in place + self.assertIn(authorization, fakehttp_wrapper.buf.decode("UTF-8")) + self.assertEqual(fp.readline(), b"Hello!") + self.assertEqual(fp.readline(), b"") + # the spaces are quoted in URL so no match + self.assertNotEqual(fp.geturl(), url) + self.assertEqual(fp.getcode(), 200) + finally: + self.unfakehttp() + class urlretrieve_FileTests(unittest.TestCase): """Test urllib.urlretrieve() on local files""" @@ -1111,6 +1137,9 @@ self.assertEqual(('user', 'a\fb'),urllib.parse.splitpasswd('user:a\fb')) self.assertEqual(('user', 'a\vb'),urllib.parse.splitpasswd('user:a\vb')) self.assertEqual(('user', 'a:b'),urllib.parse.splitpasswd('user:a:b')) + self.assertEqual(('user', 'a b'),urllib.parse.splitpasswd('user:a b')) + self.assertEqual(('user 2', 'ab'),urllib.parse.splitpasswd('user 2:ab')) + self.assertEqual(('user+1', 'a+b'),urllib.parse.splitpasswd('user+1:a+b')) def test_thishost(self): """Test the urllib.request.thishost utility function returns a tuple""" diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1693,11 +1693,13 @@ if not host: raise IOError('http error', 'no host given') if proxy_passwd: + proxy_passwd = unquote(proxy_passwd) proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii') else: proxy_auth = None if user_passwd: + user_passwd = unquote(user_passwd) auth = base64.b64encode(user_passwd.encode()).decode('ascii') else: auth = None diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -442,6 +442,9 @@ Library ------- +- Issue #13642: Unquote before b64encoding user:password during Basic + Authentication. Patch contributed by Joonas Kuorilehto. + - Issue #13726: Fix the ambiguous -S flag in regrtest. It is -o/--slow for slow tests. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 14:08:27 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 14:08:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_issue13726?= =?utf8?q?=3A_-S_accepts_an_argument_just_as_--start=2E?= Message-ID: http://hg.python.org/cpython/rev/c4919642fd25 changeset: 74389:c4919642fd25 branch: 3.2 parent: 74386:80e3b8de4edd user: Senthil Kumaran date: Sat Jan 14 21:07:31 2012 +0800 summary: Fix issue13726: -S accepts an argument just as --start. files: Lib/test/regrtest.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -272,7 +272,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoSrf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 14:08:27 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 14 Jan 2012 14:08:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2_-_Fix_issue13726=3A_-S_accepts_an_argument_?= =?utf8?q?just_as_--start=2E?= Message-ID: http://hg.python.org/cpython/rev/347f6305bd26 changeset: 74390:347f6305bd26 parent: 74388:e78f00dbd7ae parent: 74389:c4919642fd25 user: Senthil Kumaran date: Sat Jan 14 21:08:15 2012 +0800 summary: merge from 3.2 - Fix issue13726: -S accepts an argument just as --start. files: Lib/test/regrtest.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -298,7 +298,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoSrf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 14:58:28 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 14 Jan 2012 14:58:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_make_YieldFrom_its_own_dist?= =?utf8?q?inct_from_Yield_=28closes_=2313780=29?= Message-ID: http://hg.python.org/cpython/rev/e1177b9167ce changeset: 74391:e1177b9167ce user: Benjamin Peterson date: Sat Jan 14 08:58:23 2012 -0500 summary: make YieldFrom its own distinct from Yield (closes #13780) files: Include/Python-ast.h | 21 +++++--- Lib/test/test_ast.py | 4 +- Parser/Python.asdl | 3 +- Python/Python-ast.c | 76 ++++++++++++++++++++++--------- Python/ast.c | 8 ++- Python/compile.c | 10 ++- Python/symtable.c | 8 ++- 7 files changed, 91 insertions(+), 39 deletions(-) diff --git a/Include/Python-ast.h b/Include/Python-ast.h --- a/Include/Python-ast.h +++ b/Include/Python-ast.h @@ -180,10 +180,10 @@ enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, - Yield_kind=12, Compare_kind=13, Call_kind=14, Num_kind=15, - Str_kind=16, Bytes_kind=17, Ellipsis_kind=18, - Attribute_kind=19, Subscript_kind=20, Starred_kind=21, - Name_kind=22, List_kind=23, Tuple_kind=24}; + Yield_kind=12, YieldFrom_kind=13, Compare_kind=14, + Call_kind=15, Num_kind=16, Str_kind=17, Bytes_kind=18, + Ellipsis_kind=19, Attribute_kind=20, Subscript_kind=21, + Starred_kind=22, Name_kind=23, List_kind=24, Tuple_kind=25}; struct _expr { enum _expr_kind kind; union { @@ -245,11 +245,14 @@ } GeneratorExp; struct { - int is_from; expr_ty value; } Yield; struct { + expr_ty value; + } YieldFrom; + + struct { expr_ty left; asdl_int_seq *ops; asdl_seq *comparators; @@ -488,9 +491,11 @@ #define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena *arena); -#define Yield(a0, a1, a2, a3, a4) _Py_Yield(a0, a1, a2, a3, a4) -expr_ty _Py_Yield(int is_from, expr_ty value, int lineno, int col_offset, - PyArena *arena); +#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) +expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena); +#define YieldFrom(a0, a1, a2, a3) _Py_YieldFrom(a0, a1, a2, a3) +expr_ty _Py_YieldFrom(expr_ty value, int lineno, int col_offset, PyArena + *arena); #define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int col_offset, PyArena *arena); diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -813,8 +813,8 @@ self._check_comprehension(factory) def test_yield(self): - self.expr(ast.Yield(0, ast.Name("x", ast.Store())), "must have Load") - self.expr(ast.Yield(1, ast.Name("x", ast.Store())), "must have Load") + self.expr(ast.Yield(ast.Name("x", ast.Store())), "must have Load") + self.expr(ast.YieldFrom(ast.Name("x", ast.Store())), "must have Load") def test_compare(self): left = ast.Name("x", ast.Load()) diff --git a/Parser/Python.asdl b/Parser/Python.asdl --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -59,7 +59,8 @@ | DictComp(expr key, expr value, comprehension* generators) | GeneratorExp(expr elt, comprehension* generators) -- the grammar constrains where yield expressions can occur - | Yield(int is_from, expr? value) + | Yield(expr? value) + | YieldFrom(expr? value) -- need sequences for compare to distinguish between -- x < 4 < 3 and (x < 4) < 3 | Compare(expr left, cmpop* ops, expr* comparators) diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -231,9 +231,11 @@ "generators", }; static PyTypeObject *Yield_type; -_Py_IDENTIFIER(is_from); static char *Yield_fields[]={ - "is_from", + "value", +}; +static PyTypeObject *YieldFrom_type; +static char *YieldFrom_fields[]={ "value", }; static PyTypeObject *Compare_type; @@ -812,8 +814,10 @@ GeneratorExp_type = make_type("GeneratorExp", expr_type, GeneratorExp_fields, 2); if (!GeneratorExp_type) return 0; - Yield_type = make_type("Yield", expr_type, Yield_fields, 2); + Yield_type = make_type("Yield", expr_type, Yield_fields, 1); if (!Yield_type) return 0; + YieldFrom_type = make_type("YieldFrom", expr_type, YieldFrom_fields, 1); + if (!YieldFrom_type) return 0; Compare_type = make_type("Compare", expr_type, Compare_fields, 3); if (!Compare_type) return 0; Call_type = make_type("Call", expr_type, Call_fields, 5); @@ -1749,14 +1753,13 @@ } expr_ty -Yield(int is_from, expr_ty value, int lineno, int col_offset, PyArena *arena) +Yield(expr_ty value, int lineno, int col_offset, PyArena *arena) { expr_ty p; p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; p->kind = Yield_kind; - p->v.Yield.is_from = is_from; p->v.Yield.value = value; p->lineno = lineno; p->col_offset = col_offset; @@ -1764,6 +1767,20 @@ } expr_ty +YieldFrom(expr_ty value, int lineno, int col_offset, PyArena *arena) +{ + expr_ty p; + p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); + if (!p) + return NULL; + p->kind = YieldFrom_kind; + p->v.YieldFrom.value = value; + p->lineno = lineno; + p->col_offset = col_offset; + return p; +} + +expr_ty Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, int col_offset, PyArena *arena) { @@ -2798,12 +2815,16 @@ case Yield_kind: result = PyType_GenericNew(Yield_type, NULL, NULL); if (!result) goto failed; - value = ast2obj_int(o->v.Yield.is_from); + value = ast2obj_expr(o->v.Yield.value); if (!value) goto failed; - if (_PyObject_SetAttrId(result, &PyId_is_from, value) == -1) + if (_PyObject_SetAttrId(result, &PyId_value, value) == -1) goto failed; Py_DECREF(value); - value = ast2obj_expr(o->v.Yield.value); + break; + case YieldFrom_kind: + result = PyType_GenericNew(YieldFrom_type, NULL, NULL); + if (!result) goto failed; + value = ast2obj_expr(o->v.YieldFrom.value); if (!value) goto failed; if (_PyObject_SetAttrId(result, &PyId_value, value) == -1) goto failed; @@ -5345,21 +5366,8 @@ return 1; } if (isinstance) { - int is_from; expr_ty value; - if (_PyObject_HasAttrId(obj, &PyId_is_from)) { - int res; - tmp = _PyObject_GetAttrId(obj, &PyId_is_from); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &is_from, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"is_from\" missing from Yield"); - return 1; - } if (_PyObject_HasAttrId(obj, &PyId_value)) { int res; tmp = _PyObject_GetAttrId(obj, &PyId_value); @@ -5371,7 +5379,29 @@ } else { value = NULL; } - *out = Yield(is_from, value, lineno, col_offset, arena); + *out = Yield(value, lineno, col_offset, arena); + if (*out == NULL) goto failed; + return 0; + } + isinstance = PyObject_IsInstance(obj, (PyObject*)YieldFrom_type); + if (isinstance == -1) { + return 1; + } + if (isinstance) { + expr_ty value; + + if (_PyObject_HasAttrId(obj, &PyId_value)) { + int res; + tmp = _PyObject_GetAttrId(obj, &PyId_value); + if (tmp == NULL) goto failed; + res = obj2ast_expr(tmp, &value, arena); + if (res != 0) goto failed; + Py_XDECREF(tmp); + tmp = NULL; + } else { + value = NULL; + } + *out = YieldFrom(value, lineno, col_offset, arena); if (*out == NULL) goto failed; return 0; } @@ -6928,6 +6958,8 @@ (PyObject*)GeneratorExp_type) < 0) return NULL; if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return NULL; + if (PyDict_SetItemString(d, "YieldFrom", (PyObject*)YieldFrom_type) < + 0) return NULL; if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) return NULL; if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -223,6 +223,9 @@ validate_expr(exp->v.DictComp.value, Load); case Yield_kind: return !exp->v.Yield.value || validate_expr(exp->v.Yield.value, Load); + case YieldFrom_kind: + return !exp->v.YieldFrom.value || + validate_expr(exp->v.YieldFrom.value, Load); case Compare_kind: if (!asdl_seq_LEN(exp->v.Compare.comparators)) { PyErr_SetString(PyExc_ValueError, "Compare with no comparators"); @@ -942,6 +945,7 @@ expr_name = "generator expression"; break; case Yield_kind: + case YieldFrom_kind: expr_name = "yield expression"; break; case ListComp_kind: @@ -2386,7 +2390,9 @@ if (!exp) return NULL; } - return Yield(is_from, exp, LINENO(n), n->n_col_offset, c->c_arena); + if (is_from) + return YieldFrom(exp, LINENO(n), n->n_col_offset, c->c_arena); + return Yield(exp, LINENO(n), n->n_col_offset, c->c_arena); } case factor: if (NCH(n) == 1) { diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -3311,21 +3311,25 @@ case DictComp_kind: return compiler_dictcomp(c, e); case Yield_kind: + case YieldFrom_kind: { + expr_ty value; if (c->u->u_ste->ste_type != FunctionBlock) return compiler_error(c, "'yield' outside function"); - if (e->v.Yield.value) { - VISIT(c, expr, e->v.Yield.value); + value = (e->kind == YieldFrom_kind) ? e->v.YieldFrom.value : e->v.Yield.value; + if (value) { + VISIT(c, expr, value); } else { ADDOP_O(c, LOAD_CONST, Py_None, consts); } - if (e->v.Yield.is_from) { + if (e->kind == YieldFrom_kind) { ADDOP(c, YIELD_FROM); } else { ADDOP(c, YIELD_VALUE); } break; + } case Compare_kind: return compiler_compare(c, e); case Call_kind: diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -1330,10 +1330,14 @@ return 0; break; case Yield_kind: - if (e->v.Yield.value) - VISIT(st, expr, e->v.Yield.value); + case YieldFrom_kind: { + expr_ty value; + value = (e->kind == YieldFrom_kind) ? e->v.YieldFrom.value : e->v.Yield.value; + if (value) + VISIT(st, expr, value); st->st_cur->ste_generator = 1; break; + } case Compare_kind: VISIT(st, expr, e->v.Compare.left); VISIT_SEQ(st, expr, e->v.Compare.comparators); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:19:47 2012 From: python-checkins at python.org (meador.inge) Date: Sat, 14 Jan 2012 16:19:47 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzI1?= =?utf8?q?=3A_regrtest_does_not_recognize_-d_flag=2E?= Message-ID: http://hg.python.org/cpython/rev/f80f9eb5df02 changeset: 74392:f80f9eb5df02 branch: 3.2 parent: 74389:c4919642fd25 user: Meador Inge date: Sat Jan 14 09:12:55 2012 -0600 summary: Issue #13725: regrtest does not recognize -d flag. Patch by Erno Tukia. files: Lib/test/regrtest.py | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -272,7 +272,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FdwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -920,6 +920,7 @@ John Tromp Jason Trowbridge Anthony Tuininga +Erno Tukia Stephen Turner Theodore Turocy Bill Tutt -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:19:48 2012 From: python-checkins at python.org (meador.inge) Date: Sat, 14 Jan 2012 16:19:48 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313725=3A_regrtest_does_not_recognize_-d_flag=2E?= Message-ID: http://hg.python.org/cpython/rev/f2b764dd0851 changeset: 74393:f2b764dd0851 parent: 74391:e1177b9167ce parent: 74392:f80f9eb5df02 user: Meador Inge date: Sat Jan 14 09:17:10 2012 -0600 summary: Issue #13725: regrtest does not recognize -d flag. Patch by Erno Tukia. files: Lib/test/regrtest.py | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -298,7 +298,7 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FwWM:nj:Gm:', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FdwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1004,6 +1004,7 @@ John Tromp Jason Trowbridge Anthony Tuininga +Erno Tukia Stephen Turner Theodore Turocy Bill Tutt -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:54:09 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 16:54:09 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_update_Sphinx_r?= =?utf8?q?eference_from_0=2E6=2E7_to_1=2E0=2E7?= Message-ID: http://hg.python.org/cpython/rev/905f9d976e7e changeset: 74394:905f9d976e7e branch: 2.7 parent: 74376:8935a33773b9 user: Sandro Tosi date: Sat Jan 14 16:41:26 2012 +0100 summary: update Sphinx reference from 0.6.7 to 1.0.7 files: Doc/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -40,7 +40,7 @@ checkout: @if [ ! -d tools/sphinx ]; then \ echo "Checking out Sphinx..."; \ - svn checkout $(SVNROOT)/external/Sphinx-0.6.7/sphinx tools/sphinx; \ + svn checkout $(SVNROOT)/external/Sphinx-1.0.7/sphinx tools/sphinx; \ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:54:11 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 16:54:11 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_update_to_new_C?= =?utf8?q?_roles_and_directives?= Message-ID: http://hg.python.org/cpython/rev/74ff71b2f53d changeset: 74395:74ff71b2f53d branch: 2.7 user: Sandro Tosi date: Sat Jan 14 16:42:02 2012 +0100 summary: update to new C roles and directives files: Doc/c-api/abstract.rst | 2 +- Doc/c-api/allocation.rst | 38 +- Doc/c-api/arg.rst | 168 +++--- Doc/c-api/bool.rst | 14 +- Doc/c-api/buffer.rst | 292 ++++++------ Doc/c-api/bytearray.rst | 32 +- Doc/c-api/capsule.rst | 68 +- Doc/c-api/cell.rst | 16 +- Doc/c-api/class.rst | 16 +- Doc/c-api/cobject.rst | 30 +- Doc/c-api/code.rst | 18 +- Doc/c-api/codec.rst | 34 +- Doc/c-api/complex.rst | 70 +- Doc/c-api/concrete.rst | 2 +- Doc/c-api/conversion.rst | 52 +- Doc/c-api/datetime.rst | 96 ++-- Doc/c-api/descriptor.rst | 16 +- Doc/c-api/dict.rst | 74 +- Doc/c-api/exceptions.rst | 304 ++++++------ Doc/c-api/file.rst | 74 +- Doc/c-api/float.rst | 54 +- Doc/c-api/function.rst | 26 +- Doc/c-api/gcsupport.rst | 60 +- Doc/c-api/gen.rst | 12 +- Doc/c-api/import.rst | 76 +- Doc/c-api/init.rst | 298 ++++++------ Doc/c-api/int.rst | 64 +- Doc/c-api/intro.rst | 104 ++-- Doc/c-api/iter.rst | 4 +- Doc/c-api/iterator.rst | 20 +- Doc/c-api/list.rst | 72 +- Doc/c-api/long.rst | 126 ++-- Doc/c-api/mapping.rst | 24 +- Doc/c-api/marshal.rst | 36 +- Doc/c-api/memory.rst | 48 +- Doc/c-api/method.rst | 30 +- Doc/c-api/module.rst | 30 +- Doc/c-api/none.rst | 10 +- Doc/c-api/number.rst | 94 ++-- Doc/c-api/objbuffer.rst | 14 +- Doc/c-api/object.rst | 114 ++-- Doc/c-api/refcounting.rst | 32 +- Doc/c-api/reflection.rst | 18 +- Doc/c-api/sequence.rst | 86 +- Doc/c-api/set.rst | 64 +- Doc/c-api/slice.rst | 22 +- Doc/c-api/string.rst | 82 +- Doc/c-api/structures.rst | 92 ++-- Doc/c-api/sys.rst | 56 +- Doc/c-api/tuple.rst | 58 +- Doc/c-api/type.rst | 26 +- Doc/c-api/typeobj.rst | 338 +++++++------- Doc/c-api/unicode.rst | 338 +++++++------- Doc/c-api/veryhigh.rst | 138 +++--- Doc/c-api/weakref.rst | 18 +- Doc/distutils/builtdist.rst | 2 +- Doc/documenting/markup.rst | 10 +- Doc/extending/embedding.rst | 22 +- Doc/extending/extending.rst | 280 ++++++------ Doc/extending/newtypes.rst | 114 ++-- Doc/extending/windows.rst | 6 +- Doc/faq/extending.rst | 54 +- Doc/faq/gui.rst | 4 +- Doc/faq/programming.rst | 2 +- Doc/faq/windows.rst | 2 +- Doc/howto/cporting.rst | 42 +- Doc/howto/descriptor.rst | 6 +- Doc/library/al.rst | 2 +- Doc/library/array.rst | 2 +- Doc/library/asynchat.rst | 2 +- Doc/library/asyncore.rst | 12 +- Doc/library/bsddb.rst | 2 +- Doc/library/codecs.rst | 4 +- Doc/library/commands.rst | 2 +- Doc/library/ctypes.rst | 174 +++--- Doc/library/datetime.rst | 14 +- Doc/library/dl.rst | 6 +- Doc/library/exceptions.rst | 14 +- Doc/library/fcntl.rst | 10 +- Doc/library/fl.rst | 12 +- Doc/library/fm.rst | 4 +- Doc/library/functions.rst | 8 +- Doc/library/getopt.rst | 10 +- Doc/library/inspect.rst | 4 +- Doc/library/locale.rst | 4 +- Doc/library/macos.rst | 2 +- Doc/library/mailbox.rst | 8 +- Doc/library/msilib.rst | 38 +- Doc/library/msvcrt.rst | 2 +- Doc/library/multiprocessing.rst | 2 +- Doc/library/new.rst | 2 +- Doc/library/os.rst | 46 +- Doc/library/ossaudiodev.rst | 2 +- Doc/library/platform.rst | 4 +- Doc/library/popen2.rst | 2 +- Doc/library/posix.rst | 8 +- Doc/library/re.rst | 10 +- Doc/library/restricted.rst | 2 +- Doc/library/rfc822.rst | 4 +- Doc/library/select.rst | 24 +- Doc/library/signal.rst | 4 +- Doc/library/socket.rst | 26 +- Doc/library/stat.rst | 6 +- Doc/library/statvfs.rst | 2 +- Doc/library/stdtypes.rst | 20 +- Doc/library/struct.rst | 88 +- Doc/library/subprocess.rst | 2 +- Doc/library/sunaudio.rst | 8 +- Doc/library/sys.rst | 8 +- Doc/library/time.rst | 6 +- Doc/library/warnings.rst | 2 +- Doc/library/winsound.rst | 4 +- Doc/library/zlib.rst | 2 +- Doc/reference/expressions.rst | 2 +- Doc/tools/sphinxext/susp-ignored.csv | 6 +- Doc/tutorial/inputoutput.rst | 2 +- Doc/whatsnew/2.2.rst | 48 +- Doc/whatsnew/2.3.rst | 36 +- Doc/whatsnew/2.4.rst | 40 +- Doc/whatsnew/2.5.rst | 108 ++-- Doc/whatsnew/2.6.rst | 68 +- Doc/whatsnew/2.7.rst | 102 ++-- 122 files changed, 2838 insertions(+), 2838 deletions(-) diff --git a/Doc/c-api/abstract.rst b/Doc/c-api/abstract.rst --- a/Doc/c-api/abstract.rst +++ b/Doc/c-api/abstract.rst @@ -13,7 +13,7 @@ will raise a Python exception. It is not possible to use these functions on objects that are not properly -initialized, such as a list object that has been created by :cfunc:`PyList_New`, +initialized, such as a list object that has been created by :c:func:`PyList_New`, but whose items have not been set to some non-\ ``NULL`` value yet. .. toctree:: diff --git a/Doc/c-api/allocation.rst b/Doc/c-api/allocation.rst --- a/Doc/c-api/allocation.rst +++ b/Doc/c-api/allocation.rst @@ -6,20 +6,20 @@ ============================== -.. cfunction:: PyObject* _PyObject_New(PyTypeObject *type) +.. c:function:: PyObject* _PyObject_New(PyTypeObject *type) -.. cfunction:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size) +.. c:function:: PyVarObject* _PyObject_NewVar(PyTypeObject *type, Py_ssize_t size) .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: void _PyObject_Del(PyObject *op) +.. c:function:: void _PyObject_Del(PyObject *op) -.. cfunction:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type) +.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type) Initialize a newly-allocated object *op* with its type and initial reference. Returns the initialized object. If *type* indicates that the @@ -28,17 +28,17 @@ affected. -.. cfunction:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size) +.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size) - This does everything :cfunc:`PyObject_Init` does, and also initializes the + This does everything :c:func:`PyObject_Init` does, and also initializes the length information for a variable-size object. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: TYPE* PyObject_New(TYPE, PyTypeObject *type) +.. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type) Allocate a new Python object using the C structure type *TYPE* and the Python type object *type*. Fields not defined by the Python object header @@ -47,7 +47,7 @@ the type object. -.. cfunction:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size) +.. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size) Allocate a new Python object using the C structure type *TYPE* and the Python type object *type*. Fields not defined by the Python object header @@ -59,20 +59,20 @@ improving the memory management efficiency. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: void PyObject_Del(PyObject *op) +.. c:function:: void PyObject_Del(PyObject *op) - Releases memory allocated to an object using :cfunc:`PyObject_New` or - :cfunc:`PyObject_NewVar`. This is normally called from the + Releases memory allocated to an object using :c:func:`PyObject_New` or + :c:func:`PyObject_NewVar`. This is normally called from the :attr:`tp_dealloc` handler specified in the object's type. The fields of the object should not be accessed after this call as the memory is no longer a valid Python object. -.. cfunction:: PyObject* Py_InitModule(char *name, PyMethodDef *methods) +.. c:function:: PyObject* Py_InitModule(char *name, PyMethodDef *methods) Create a new module object based on a name and table of functions, returning the new module object. @@ -82,7 +82,7 @@ *methods* argument. -.. cfunction:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc) +.. c:function:: PyObject* Py_InitModule3(char *name, PyMethodDef *methods, char *doc) Create a new module object based on a name and table of functions, returning the new module object. If *doc* is non-*NULL*, it will be used @@ -93,7 +93,7 @@ *methods* argument. -.. cfunction:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver) +.. c:function:: PyObject* Py_InitModule4(char *name, PyMethodDef *methods, char *doc, PyObject *self, int apiver) Create a new module object based on a name and table of functions, returning the new module object. If *doc* is non-*NULL*, it will be used @@ -107,7 +107,7 @@ .. note:: Most uses of this function should probably be using the - :cfunc:`Py_InitModule3` instead; only use this if you are sure you need + :c:func:`Py_InitModule3` instead; only use this if you are sure you need it. .. versionchanged:: 2.3 @@ -115,7 +115,7 @@ *methods* argument. -.. cvar:: PyObject _Py_NoneStruct +.. c:var:: PyObject _Py_NoneStruct Object which is visible in Python as ``None``. This should only be accessed using the ``Py_None`` macro, which evaluates to a pointer to this diff --git a/Doc/c-api/arg.rst b/Doc/c-api/arg.rst --- a/Doc/c-api/arg.rst +++ b/Doc/c-api/arg.rst @@ -9,8 +9,8 @@ methods. Additional information and examples are available in :ref:`extending-index`. -The first three of these functions described, :cfunc:`PyArg_ParseTuple`, -:cfunc:`PyArg_ParseTupleAndKeywords`, and :cfunc:`PyArg_Parse`, all use +The first three of these functions described, :c:func:`PyArg_ParseTuple`, +:c:func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell the function about the expected arguments. The format strings use the same syntax for each of these functions. @@ -38,7 +38,7 @@ raised. Unicode objects are converted to C strings using the default encoding. If this conversion fails, a :exc:`UnicodeError` is raised. -``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :ctype:`Py_ssize_t`, see below)] +``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :c:type:`Py_ssize_t`, see below)] This variant on ``s`` stores into two C variables, the first one a pointer to a character string, the second one its length. In this case the Python string may contain embedded null bytes. Unicode objects pass back a @@ -47,8 +47,8 @@ a reference to the raw internal data representation. Starting with Python 2.5 the type of the length argument can be controlled - by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before including - :file:`Python.h`. If the macro is defined, length is a :ctype:`Py_ssize_t` + by defining the macro :c:macro:`PY_SSIZE_T_CLEAN` before including + :file:`Python.h`. If the macro is defined, length is a :c:type:`Py_ssize_t` rather than an int. ``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer] @@ -76,14 +76,14 @@ Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of 16-bit Unicode (UTF-16) data. As with ``s``, there is no need to provide storage for the Unicode data buffer; a pointer to the existing - Unicode data is stored into the :ctype:`Py_UNICODE` pointer variable whose + Unicode data is stored into the :c:type:`Py_UNICODE` pointer variable whose address you pass. ``u#`` (Unicode) [Py_UNICODE \*, int] This variant on ``u`` stores into two C variables, the first one a pointer to a Unicode data buffer, the second one its length. Non-Unicode objects are handled by interpreting their read-buffer pointer as pointer to a - :ctype:`Py_UNICODE` array. + :c:type:`Py_UNICODE` array. ``es`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer] This variant on ``s`` is used for encoding Unicode and objects convertible @@ -91,18 +91,18 @@ embedded NUL bytes. This format requires two arguments. The first is only used as input, and - must be a :ctype:`const char\*` which points to the name of an encoding as + must be a :c:type:`const char\*` which points to the name of an encoding as a NUL-terminated string, or *NULL*, in which case the default encoding is used. An exception is raised if the named encoding is not known to Python. - The second argument must be a :ctype:`char\*\*`; the value of the pointer + The second argument must be a :c:type:`char\*\*`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument. - :cfunc:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy + :c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy the encoded data into this buffer and adjust *\*buffer* to reference the newly allocated storage. The caller is responsible for calling - :cfunc:`PyMem_Free` to free the allocated buffer after use. + :c:func:`PyMem_Free` to free the allocated buffer after use. ``et`` (string, Unicode or character buffer compatible object) [const char \*encoding, char \*\*buffer] Same as ``es`` except that 8-bit string objects are passed through without @@ -115,10 +115,10 @@ allows input data which contains NUL characters. It requires three arguments. The first is only used as input, and must be - a :ctype:`const char\*` which points to the name of an encoding as a + a :c:type:`const char\*` which points to the name of an encoding as a NUL-terminated string, or *NULL*, in which case the default encoding is used. An exception is raised if the named encoding is not known to Python. - The second argument must be a :ctype:`char\*\*`; the value of the pointer + The second argument must be a :c:type:`char\*\*`; the value of the pointer it references will be set to a buffer with the contents of the argument text. The text will be encoded in the encoding specified by the first argument. The third argument must be a pointer to an integer; the @@ -129,11 +129,11 @@ If *\*buffer* points a *NULL* pointer, the function will allocate a buffer of the needed size, copy the encoded data into this buffer and set *\*buffer* to reference the newly allocated storage. The caller is - responsible for calling :cfunc:`PyMem_Free` to free the allocated buffer + responsible for calling :c:func:`PyMem_Free` to free the allocated buffer after usage. If *\*buffer* points to a non-*NULL* pointer (an already allocated buffer), - :cfunc:`PyArg_ParseTuple` will use this location as the buffer and + :c:func:`PyArg_ParseTuple` will use this location as the buffer and interpret the initial value of *\*buffer_length* as the buffer size. It will then copy the encoded data into the buffer and NUL-terminate it. If the buffer is not large enough, a :exc:`ValueError` will be set. @@ -148,71 +148,71 @@ ``b`` (integer) [unsigned char] Convert a nonnegative Python integer to an unsigned tiny int, stored in a C - :ctype:`unsigned char`. + :c:type:`unsigned char`. ``B`` (integer) [unsigned char] Convert a Python integer to a tiny int without overflow checking, stored in - a C :ctype:`unsigned char`. + a C :c:type:`unsigned char`. .. versionadded:: 2.3 ``h`` (integer) [short int] - Convert a Python integer to a C :ctype:`short int`. + Convert a Python integer to a C :c:type:`short int`. ``H`` (integer) [unsigned short int] - Convert a Python integer to a C :ctype:`unsigned short int`, without + Convert a Python integer to a C :c:type:`unsigned short int`, without overflow checking. .. versionadded:: 2.3 ``i`` (integer) [int] - Convert a Python integer to a plain C :ctype:`int`. + Convert a Python integer to a plain C :c:type:`int`. ``I`` (integer) [unsigned int] - Convert a Python integer to a C :ctype:`unsigned int`, without overflow + Convert a Python integer to a C :c:type:`unsigned int`, without overflow checking. .. versionadded:: 2.3 ``l`` (integer) [long int] - Convert a Python integer to a C :ctype:`long int`. + Convert a Python integer to a C :c:type:`long int`. ``k`` (integer) [unsigned long] - Convert a Python integer or long integer to a C :ctype:`unsigned long` + Convert a Python integer or long integer to a C :c:type:`unsigned long` without overflow checking. .. versionadded:: 2.3 ``L`` (integer) [PY_LONG_LONG] - Convert a Python integer to a C :ctype:`long long`. This format is only - available on platforms that support :ctype:`long long` (or :ctype:`_int64` + Convert a Python integer to a C :c:type:`long long`. This format is only + available on platforms that support :c:type:`long long` (or :c:type:`_int64` on Windows). ``K`` (integer) [unsigned PY_LONG_LONG] - Convert a Python integer or long integer to a C :ctype:`unsigned long long` + Convert a Python integer or long integer to a C :c:type:`unsigned long long` without overflow checking. This format is only available on platforms that - support :ctype:`unsigned long long` (or :ctype:`unsigned _int64` on + support :c:type:`unsigned long long` (or :c:type:`unsigned _int64` on Windows). .. versionadded:: 2.3 ``n`` (integer) [Py_ssize_t] - Convert a Python integer or long integer to a C :ctype:`Py_ssize_t`. + Convert a Python integer or long integer to a C :c:type:`Py_ssize_t`. .. versionadded:: 2.5 ``c`` (string of length 1) [char] Convert a Python character, represented as a string of length 1, to a C - :ctype:`char`. + :c:type:`char`. ``f`` (float) [float] - Convert a Python floating point number to a C :ctype:`float`. + Convert a Python floating point number to a C :c:type:`float`. ``d`` (float) [double] - Convert a Python floating point number to a C :ctype:`double`. + Convert a Python floating point number to a C :c:type:`double`. ``D`` (complex) [Py_complex] - Convert a Python complex number to a C :ctype:`Py_complex` structure. + Convert a Python complex number to a C :c:type:`Py_complex` structure. ``O`` (object) [PyObject \*] Store a Python object (without any conversion) in a C object pointer. The @@ -222,20 +222,20 @@ ``O!`` (object) [*typeobject*, PyObject \*] Store a Python object in a C object pointer. This is similar to ``O``, but takes two C arguments: the first is the address of a Python type object, - the second is the address of the C variable (of type :ctype:`PyObject\*`) + the second is the address of the C variable (of type :c:type:`PyObject\*`) into which the object pointer is stored. If the Python object does not have the required type, :exc:`TypeError` is raised. ``O&`` (object) [*converter*, *anything*] Convert a Python object to a C variable through a *converter* function. This takes two arguments: the first is a function, the second is the - address of a C variable (of arbitrary type), converted to :ctype:`void \*`. + address of a C variable (of arbitrary type), converted to :c:type:`void \*`. The *converter* function in turn is called as follows:: status = converter(object, address); where *object* is the Python object to be converted and *address* is the - :ctype:`void\*` argument that was passed to the :cfunc:`PyArg_Parse\*` + :c:type:`void\*` argument that was passed to the :c:func:`PyArg_Parse\*` function. The returned *status* should be ``1`` for a successful conversion and ``0`` if the conversion has failed. When the conversion fails, the *converter* function should raise an exception and leave the @@ -244,17 +244,17 @@ ``S`` (string) [PyStringObject \*] Like ``O`` but requires that the Python object is a string object. Raises :exc:`TypeError` if the object is not a string object. The C variable may - also be declared as :ctype:`PyObject\*`. + also be declared as :c:type:`PyObject\*`. ``U`` (Unicode string) [PyUnicodeObject \*] Like ``O`` but requires that the Python object is a Unicode object. Raises :exc:`TypeError` if the object is not a Unicode object. The C variable may - also be declared as :ctype:`PyObject\*`. + also be declared as :c:type:`PyObject\*`. ``t#`` (read-only character buffer) [char \*, int] Like ``s#``, but accepts any object which implements the read-only buffer - interface. The :ctype:`char\*` variable is set to point to the first byte - of the buffer, and the :ctype:`int` is set to the length of the buffer. + interface. The :c:type:`char\*` variable is set to point to the first byte + of the buffer, and the :c:type:`int` is set to the length of the buffer. Only single-segment buffer objects are accepted; :exc:`TypeError` is raised for all others. @@ -266,8 +266,8 @@ ``w#`` (read-write character buffer) [char \*, Py_ssize_t] Like ``s#``, but accepts any object which implements the read-write buffer - interface. The :ctype:`char \*` variable is set to point to the first byte - of the buffer, and the :ctype:`Py_ssize_t` is set to the length of the + interface. The :c:type:`char \*` variable is set to point to the first byte + of the buffer, and the :c:type:`Py_ssize_t` is set to the length of the buffer. Only single-segment buffer objects are accepted; :exc:`TypeError` is raised for all others. @@ -302,13 +302,13 @@ Indicates that the remaining arguments in the Python argument list are optional. The C variables corresponding to optional arguments should be initialized to their default value --- when an optional argument is not - specified, :cfunc:`PyArg_ParseTuple` does not touch the contents of the + specified, :c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding C variable(s). ``:`` The list of format units ends here; the string after the colon is used as the function name in error messages (the "associated value" of the - exception that :cfunc:`PyArg_ParseTuple` raises). + exception that :c:func:`PyArg_ParseTuple` raises). ``;`` The list of format units ends here; the string after the semicolon is used @@ -325,40 +325,40 @@ should match what is specified for the corresponding format unit in that case. For the conversion to succeed, the *arg* object must match the format and the -format must be exhausted. On success, the :cfunc:`PyArg_Parse\*` functions +format must be exhausted. On success, the :c:func:`PyArg_Parse\*` functions return true, otherwise they return false and raise an appropriate exception. -When the :cfunc:`PyArg_Parse\*` functions fail due to conversion failure in +When the :c:func:`PyArg_Parse\*` functions fail due to conversion failure in one of the format units, the variables at the addresses corresponding to that and the following format units are left untouched. -.. cfunction:: int PyArg_ParseTuple(PyObject *args, const char *format, ...) +.. c:function:: int PyArg_ParseTuple(PyObject *args, const char *format, ...) Parse the parameters of a function that takes only positional parameters into local variables. Returns true on success; on failure, it returns false and raises the appropriate exception. -.. cfunction:: int PyArg_VaParse(PyObject *args, const char *format, va_list vargs) +.. c:function:: int PyArg_VaParse(PyObject *args, const char *format, va_list vargs) - Identical to :cfunc:`PyArg_ParseTuple`, except that it accepts a va_list + Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list rather than a variable number of arguments. -.. cfunction:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...) +.. c:function:: int PyArg_ParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], ...) Parse the parameters of a function that takes both positional and keyword parameters into local variables. Returns true on success; on failure, it returns false and raises the appropriate exception. -.. cfunction:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs) +.. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs) - Identical to :cfunc:`PyArg_ParseTupleAndKeywords`, except that it accepts a + Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a va_list rather than a variable number of arguments. -.. cfunction:: int PyArg_Parse(PyObject *args, const char *format, ...) +.. c:function:: int PyArg_Parse(PyObject *args, const char *format, ...) Function used to deconstruct the argument lists of "old-style" functions --- these are functions which use the :const:`METH_OLDARGS` parameter @@ -369,7 +369,7 @@ purpose. -.. cfunction:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...) +.. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...) A simpler form of parameter retrieval which does not use a format string to specify the types of the arguments. Functions which use this method to @@ -378,7 +378,7 @@ should be passed as *args*; it must actually be a tuple. The length of the tuple must be at least *min* and no more than *max*; *min* and *max* may be equal. Additional arguments must be passed to the function, each of which - should be a pointer to a :ctype:`PyObject\*` variable; these will be filled + should be a pointer to a :c:type:`PyObject\*` variable; these will be filled in with the values from *args*; they will contain borrowed references. The variables which correspond to optional parameters not given by *args* will not be filled in; these should be initialized by the caller. This function @@ -401,26 +401,26 @@ return result; } - The call to :cfunc:`PyArg_UnpackTuple` in this example is entirely - equivalent to this call to :cfunc:`PyArg_ParseTuple`:: + The call to :c:func:`PyArg_UnpackTuple` in this example is entirely + equivalent to this call to :c:func:`PyArg_ParseTuple`:: PyArg_ParseTuple(args, "O|O:ref", &object, &callback) .. versionadded:: 2.2 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *min* and *max*. This might + This function used an :c:type:`int` type for *min* and *max*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* Py_BuildValue(const char *format, ...) +.. c:function:: PyObject* Py_BuildValue(const char *format, ...) Create a new value based on a format string similar to those accepted by - the :cfunc:`PyArg_Parse\*` family of functions and a sequence of values. + the :c:func:`PyArg_Parse\*` family of functions and a sequence of values. Returns the value or *NULL* in the case of an error; an exception will be raised if *NULL* is returned. - :cfunc:`Py_BuildValue` does not always build a tuple. It builds a tuple + :c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple only if its format string contains two or more format units. If the format string is empty, it returns ``None``; if it contains exactly one format unit, it returns whatever object is described by that format unit. To @@ -430,10 +430,10 @@ When memory buffers are passed as parameters to supply data to build objects, as for the ``s`` and ``s#`` formats, the required data is copied. Buffers provided by the caller are never referenced by the objects created - by :cfunc:`Py_BuildValue`. In other words, if your code invokes - :cfunc:`malloc` and passes the allocated memory to :cfunc:`Py_BuildValue`, - your code is responsible for calling :cfunc:`free` for that memory once - :cfunc:`Py_BuildValue` returns. + by :c:func:`Py_BuildValue`. In other words, if your code invokes + :c:func:`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, + your code is responsible for calling :c:func:`free` for that memory once + :c:func:`Py_BuildValue` returns. In the following description, the quoted form is the format unit; the entry in (round) parentheses is the Python object type that the format unit will @@ -469,62 +469,62 @@ length is ignored and ``None`` is returned. ``i`` (integer) [int] - Convert a plain C :ctype:`int` to a Python integer object. + Convert a plain C :c:type:`int` to a Python integer object. ``b`` (integer) [char] - Convert a plain C :ctype:`char` to a Python integer object. + Convert a plain C :c:type:`char` to a Python integer object. ``h`` (integer) [short int] - Convert a plain C :ctype:`short int` to a Python integer object. + Convert a plain C :c:type:`short int` to a Python integer object. ``l`` (integer) [long int] - Convert a C :ctype:`long int` to a Python integer object. + Convert a C :c:type:`long int` to a Python integer object. ``B`` (integer) [unsigned char] - Convert a C :ctype:`unsigned char` to a Python integer object. + Convert a C :c:type:`unsigned char` to a Python integer object. ``H`` (integer) [unsigned short int] - Convert a C :ctype:`unsigned short int` to a Python integer object. + Convert a C :c:type:`unsigned short int` to a Python integer object. ``I`` (integer/long) [unsigned int] - Convert a C :ctype:`unsigned int` to a Python integer object or a Python + Convert a C :c:type:`unsigned int` to a Python integer object or a Python long integer object, if it is larger than ``sys.maxint``. ``k`` (integer/long) [unsigned long] - Convert a C :ctype:`unsigned long` to a Python integer object or a + Convert a C :c:type:`unsigned long` to a Python integer object or a Python long integer object, if it is larger than ``sys.maxint``. ``L`` (long) [PY_LONG_LONG] - Convert a C :ctype:`long long` to a Python long integer object. Only - available on platforms that support :ctype:`long long`. + Convert a C :c:type:`long long` to a Python long integer object. Only + available on platforms that support :c:type:`long long`. ``K`` (long) [unsigned PY_LONG_LONG] - Convert a C :ctype:`unsigned long long` to a Python long integer object. - Only available on platforms that support :ctype:`unsigned long long`. + Convert a C :c:type:`unsigned long long` to a Python long integer object. + Only available on platforms that support :c:type:`unsigned long long`. ``n`` (int) [Py_ssize_t] - Convert a C :ctype:`Py_ssize_t` to a Python integer or long integer. + Convert a C :c:type:`Py_ssize_t` to a Python integer or long integer. .. versionadded:: 2.5 ``c`` (string of length 1) [char] - Convert a C :ctype:`int` representing a character to a Python string of + Convert a C :c:type:`int` representing a character to a Python string of length 1. ``d`` (float) [double] - Convert a C :ctype:`double` to a Python floating point number. + Convert a C :c:type:`double` to a Python floating point number. ``f`` (float) [float] Same as ``d``. ``D`` (complex) [Py_complex \*] - Convert a C :ctype:`Py_complex` structure to a Python complex number. + Convert a C :c:type:`Py_complex` structure to a Python complex number. ``O`` (object) [PyObject \*] Pass a Python object untouched (except for its reference count, which is incremented by one). If the object passed in is a *NULL* pointer, it is assumed that this was caused because the call producing the argument - found an error and set an exception. Therefore, :cfunc:`Py_BuildValue` + found an error and set an exception. Therefore, :c:func:`Py_BuildValue` will return *NULL* but won't raise an exception. If no exception has been raised yet, :exc:`SystemError` is set. @@ -539,7 +539,7 @@ ``O&`` (object) [*converter*, *anything*] Convert *anything* to a Python object through a *converter* function. The function is called with *anything* (which should be compatible with - :ctype:`void \*`) as its argument and should return a "new" Python + :c:type:`void \*`) as its argument and should return a "new" Python object, or *NULL* if an error occurred. ``(items)`` (tuple) [*matching-items*] @@ -558,7 +558,7 @@ If there is an error in the format string, the :exc:`SystemError` exception is set and *NULL* returned. -.. cfunction:: PyObject* Py_VaBuildValue(const char *format, va_list vargs) +.. c:function:: PyObject* Py_VaBuildValue(const char *format, va_list vargs) - Identical to :cfunc:`Py_BuildValue`, except that it accepts a va_list + Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list rather than a variable number of arguments. diff --git a/Doc/c-api/bool.rst b/Doc/c-api/bool.rst --- a/Doc/c-api/bool.rst +++ b/Doc/c-api/bool.rst @@ -11,26 +11,26 @@ are available, however. -.. cfunction:: int PyBool_Check(PyObject *o) +.. c:function:: int PyBool_Check(PyObject *o) - Return true if *o* is of type :cdata:`PyBool_Type`. + Return true if *o* is of type :c:data:`PyBool_Type`. .. versionadded:: 2.3 -.. cvar:: PyObject* Py_False +.. c:var:: PyObject* Py_False The Python ``False`` object. This object has no methods. It needs to be treated just like any other object with respect to reference counts. -.. cvar:: PyObject* Py_True +.. c:var:: PyObject* Py_True The Python ``True`` object. This object has no methods. It needs to be treated just like any other object with respect to reference counts. -.. cmacro:: Py_RETURN_FALSE +.. c:macro:: Py_RETURN_FALSE Return :const:`Py_False` from a function, properly incrementing its reference count. @@ -38,7 +38,7 @@ .. versionadded:: 2.4 -.. cmacro:: Py_RETURN_TRUE +.. c:macro:: Py_RETURN_TRUE Return :const:`Py_True` from a function, properly incrementing its reference count. @@ -46,7 +46,7 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PyBool_FromLong(long v) +.. c:function:: PyObject* PyBool_FromLong(long v) Return a new reference to :const:`Py_True` or :const:`Py_False` depending on the truth value of *v*. diff --git a/Doc/c-api/buffer.rst b/Doc/c-api/buffer.rst --- a/Doc/c-api/buffer.rst +++ b/Doc/c-api/buffer.rst @@ -27,7 +27,7 @@ An example user of the buffer interface is the file object's :meth:`write` method. Any object that can export a series of bytes through the buffer interface can be written to a file. There are a number of format codes to -:cfunc:`PyArg_ParseTuple` that operate against an object's buffer interface, +:c:func:`PyArg_ParseTuple` that operate against an object's buffer interface, returning data from the target object. Starting from version 1.6, Python has been providing Python-level buffer @@ -47,49 +47,49 @@ ============================== -.. ctype:: Py_buffer +.. c:type:: Py_buffer - .. cmember:: void *buf + .. c:member:: void *buf A pointer to the start of the memory for the object. - .. cmember:: Py_ssize_t len + .. c:member:: Py_ssize_t len :noindex: The total length of the memory in bytes. - .. cmember:: int readonly + .. c:member:: int readonly An indicator of whether the buffer is read only. - .. cmember:: const char *format + .. c:member:: const char *format :noindex: A *NULL* terminated string in :mod:`struct` module style syntax giving the contents of the elements available through the buffer. If this is *NULL*, ``"B"`` (unsigned bytes) is assumed. - .. cmember:: int ndim + .. c:member:: int ndim The number of dimensions the memory represents as a multi-dimensional - array. If it is 0, :cdata:`strides` and :cdata:`suboffsets` must be + array. If it is 0, :c:data:`strides` and :c:data:`suboffsets` must be *NULL*. - .. cmember:: Py_ssize_t *shape + .. c:member:: Py_ssize_t *shape - An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim` giving the + An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim` giving the shape of the memory as a multi-dimensional array. Note that ``((*shape)[0] * ... * (*shape)[ndims-1])*itemsize`` should be equal to - :cdata:`len`. + :c:data:`len`. - .. cmember:: Py_ssize_t *strides + .. c:member:: Py_ssize_t *strides - An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim` giving the + An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim` giving the number of bytes to skip to get to a new element in each dimension. - .. cmember:: Py_ssize_t *suboffsets + .. c:member:: Py_ssize_t *suboffsets - An array of :ctype:`Py_ssize_t`\s the length of :cdata:`ndim`. If these + An array of :c:type:`Py_ssize_t`\s the length of :c:data:`ndim`. If these suboffset numbers are greater than or equal to 0, then the value stored along the indicated dimension is a pointer and the suboffset value dictates how many bytes to add to the pointer after de-referencing. A @@ -114,16 +114,16 @@ } - .. cmember:: Py_ssize_t itemsize + .. c:member:: Py_ssize_t itemsize This is a storage for the itemsize (in bytes) of each element of the shared memory. It is technically un-necessary as it can be obtained - using :cfunc:`PyBuffer_SizeFromFormat`, however an exporter may know + using :c:func:`PyBuffer_SizeFromFormat`, however an exporter may know this information without parsing the format string and it is necessary to know the itemsize for proper interpretation of striding. Therefore, storing it is more convenient and faster. - .. cmember:: void *internal + .. c:member:: void *internal This is for use internally by the exporting object. For example, this might be re-cast as an integer by the exporter and used to store flags @@ -136,14 +136,14 @@ ======================== -.. cfunction:: int PyObject_CheckBuffer(PyObject *obj) +.. c:function:: int PyObject_CheckBuffer(PyObject *obj) Return 1 if *obj* supports the buffer interface otherwise 0. -.. cfunction:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) +.. c:function:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) - Export *obj* into a :ctype:`Py_buffer`, *view*. These arguments must + Export *obj* into a :c:type:`Py_buffer`, *view*. These arguments must never be *NULL*. The *flags* argument is a bit field indicating what kind of buffer the caller is prepared to deal with and therefore what kind of buffer the exporter is allowed to return. The buffer interface @@ -156,131 +156,131 @@ just not possible. These errors should be a :exc:`BufferError` unless there is another error that is actually causing the problem. The exporter can use flags information to simplify how much of the - :cdata:`Py_buffer` structure is filled in with non-default values and/or + :c:data:`Py_buffer` structure is filled in with non-default values and/or raise an error if the object can't support a simpler view of its memory. 0 is returned on success and -1 on error. The following table gives possible values to the *flags* arguments. - +------------------------------+---------------------------------------------------+ - | Flag | Description | - +==============================+===================================================+ - | :cmacro:`PyBUF_SIMPLE` | This is the default flag state. The returned | - | | buffer may or may not have writable memory. The | - | | format of the data will be assumed to be unsigned | - | | bytes. This is a "stand-alone" flag constant. It | - | | never needs to be '|'d to the others. The exporter| - | | will raise an error if it cannot provide such a | - | | contiguous buffer of bytes. | - | | | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_WRITABLE` | The returned buffer must be writable. If it is | - | | not writable, then raise an error. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_STRIDES` | This implies :cmacro:`PyBUF_ND`. The returned | - | | buffer must provide strides information (i.e. the | - | | strides cannot be NULL). This would be used when | - | | the consumer can handle strided, discontiguous | - | | arrays. Handling strides automatically assumes | - | | you can handle shape. The exporter can raise an | - | | error if a strided representation of the data is | - | | not possible (i.e. without the suboffsets). | - | | | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_ND` | The returned buffer must provide shape | - | | information. The memory will be assumed C-style | - | | contiguous (last dimension varies the | - | | fastest). The exporter may raise an error if it | - | | cannot provide this kind of contiguous buffer. If | - | | this is not given then shape will be *NULL*. | - | | | - | | | - | | | - +------------------------------+---------------------------------------------------+ - |:cmacro:`PyBUF_C_CONTIGUOUS` | These flags indicate that the contiguity returned | - |:cmacro:`PyBUF_F_CONTIGUOUS` | buffer must be respectively, C-contiguous (last | - |:cmacro:`PyBUF_ANY_CONTIGUOUS`| dimension varies the fastest), Fortran contiguous | - | | (first dimension varies the fastest) or either | - | | one. All of these flags imply | - | | :cmacro:`PyBUF_STRIDES` and guarantee that the | - | | strides buffer info structure will be filled in | - | | correctly. | - | | | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_INDIRECT` | This flag indicates the returned buffer must have | - | | suboffsets information (which can be NULL if no | - | | suboffsets are needed). This can be used when | - | | the consumer can handle indirect array | - | | referencing implied by these suboffsets. This | - | | implies :cmacro:`PyBUF_STRIDES`. | - | | | - | | | - | | | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_FORMAT` | The returned buffer must have true format | - | | information if this flag is provided. This would | - | | be used when the consumer is going to be checking | - | | for what 'kind' of data is actually stored. An | - | | exporter should always be able to provide this | - | | information if requested. If format is not | - | | explicitly requested then the format must be | - | | returned as *NULL* (which means ``'B'``, or | - | | unsigned bytes) | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_STRIDED` | This is equivalent to ``(PyBUF_STRIDES | | - | | PyBUF_WRITABLE)``. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_STRIDED_RO` | This is equivalent to ``(PyBUF_STRIDES)``. | - | | | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_RECORDS` | This is equivalent to ``(PyBUF_STRIDES | | - | | PyBUF_FORMAT | PyBUF_WRITABLE)``. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_RECORDS_RO` | This is equivalent to ``(PyBUF_STRIDES | | - | | PyBUF_FORMAT)``. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_FULL` | This is equivalent to ``(PyBUF_INDIRECT | | - | | PyBUF_FORMAT | PyBUF_WRITABLE)``. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_FULL_RO` | This is equivalent to ``(PyBUF_INDIRECT | | - | | PyBUF_FORMAT)``. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_CONTIG` | This is equivalent to ``(PyBUF_ND | | - | | PyBUF_WRITABLE)``. | - +------------------------------+---------------------------------------------------+ - | :cmacro:`PyBUF_CONTIG_RO` | This is equivalent to ``(PyBUF_ND)``. | - | | | - +------------------------------+---------------------------------------------------+ + +-------------------------------+---------------------------------------------------+ + | Flag | Description | + +===============================+===================================================+ + | :c:macro:`PyBUF_SIMPLE` | This is the default flag state. The returned | + | | buffer may or may not have writable memory. The | + | | format of the data will be assumed to be unsigned | + | | bytes. This is a "stand-alone" flag constant. It | + | | never needs to be '|'d to the others. The exporter| + | | will raise an error if it cannot provide such a | + | | contiguous buffer of bytes. | + | | | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_WRITABLE` | The returned buffer must be writable. If it is | + | | not writable, then raise an error. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_STRIDES` | This implies :c:macro:`PyBUF_ND`. The returned | + | | buffer must provide strides information (i.e. the | + | | strides cannot be NULL). This would be used when | + | | the consumer can handle strided, discontiguous | + | | arrays. Handling strides automatically assumes | + | | you can handle shape. The exporter can raise an | + | | error if a strided representation of the data is | + | | not possible (i.e. without the suboffsets). | + | | | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_ND` | The returned buffer must provide shape | + | | information. The memory will be assumed C-style | + | | contiguous (last dimension varies the | + | | fastest). The exporter may raise an error if it | + | | cannot provide this kind of contiguous buffer. If | + | | this is not given then shape will be *NULL*. | + | | | + | | | + | | | + +-------------------------------+---------------------------------------------------+ + |:c:macro:`PyBUF_C_CONTIGUOUS` | These flags indicate that the contiguity returned | + |:c:macro:`PyBUF_F_CONTIGUOUS` | buffer must be respectively, C-contiguous (last | + |:c:macro:`PyBUF_ANY_CONTIGUOUS`| dimension varies the fastest), Fortran contiguous | + | | (first dimension varies the fastest) or either | + | | one. All of these flags imply | + | | :c:macro:`PyBUF_STRIDES` and guarantee that the | + | | strides buffer info structure will be filled in | + | | correctly. | + | | | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_INDIRECT` | This flag indicates the returned buffer must have | + | | suboffsets information (which can be NULL if no | + | | suboffsets are needed). This can be used when | + | | the consumer can handle indirect array | + | | referencing implied by these suboffsets. This | + | | implies :c:macro:`PyBUF_STRIDES`. | + | | | + | | | + | | | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_FORMAT` | The returned buffer must have true format | + | | information if this flag is provided. This would | + | | be used when the consumer is going to be checking | + | | for what 'kind' of data is actually stored. An | + | | exporter should always be able to provide this | + | | information if requested. If format is not | + | | explicitly requested then the format must be | + | | returned as *NULL* (which means ``'B'``, or | + | | unsigned bytes) | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_STRIDED` | This is equivalent to ``(PyBUF_STRIDES | | + | | PyBUF_WRITABLE)``. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_STRIDED_RO` | This is equivalent to ``(PyBUF_STRIDES)``. | + | | | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_RECORDS` | This is equivalent to ``(PyBUF_STRIDES | | + | | PyBUF_FORMAT | PyBUF_WRITABLE)``. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_RECORDS_RO` | This is equivalent to ``(PyBUF_STRIDES | | + | | PyBUF_FORMAT)``. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_FULL` | This is equivalent to ``(PyBUF_INDIRECT | | + | | PyBUF_FORMAT | PyBUF_WRITABLE)``. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_FULL_RO` | This is equivalent to ``(PyBUF_INDIRECT | | + | | PyBUF_FORMAT)``. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_CONTIG` | This is equivalent to ``(PyBUF_ND | | + | | PyBUF_WRITABLE)``. | + +-------------------------------+---------------------------------------------------+ + | :c:macro:`PyBUF_CONTIG_RO` | This is equivalent to ``(PyBUF_ND)``. | + | | | + +-------------------------------+---------------------------------------------------+ -.. cfunction:: void PyBuffer_Release(Py_buffer *view) +.. c:function:: void PyBuffer_Release(Py_buffer *view) Release the buffer *view*. This should be called when the buffer is no longer being used as it may free memory from it. -.. cfunction:: Py_ssize_t PyBuffer_SizeFromFormat(const char *) +.. c:function:: Py_ssize_t PyBuffer_SizeFromFormat(const char *) - Return the implied :cdata:`~Py_buffer.itemsize` from the struct-stype - :cdata:`~Py_buffer.format`. + Return the implied :c:data:`~Py_buffer.itemsize` from the struct-stype + :c:data:`~Py_buffer.format`. -.. cfunction:: int PyBuffer_IsContiguous(Py_buffer *view, char fortran) +.. c:function:: int PyBuffer_IsContiguous(Py_buffer *view, char fortran) Return 1 if the memory defined by the *view* is C-style (*fortran* is ``'C'``) or Fortran-style (*fortran* is ``'F'``) contiguous or either one (*fortran* is ``'A'``). Return 0 otherwise. -.. cfunction:: void PyBuffer_FillContiguousStrides(int ndim, Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t itemsize, char fortran) +.. c:function:: 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 given shape with the given number of bytes per element. -.. cfunction:: int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int infoflags) +.. c:function:: int PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, int readonly, int infoflags) Fill in a buffer-info structure, *view*, correctly for an exporter that can only share a contiguous chunk of memory of "unsigned bytes" of the given @@ -295,13 +295,13 @@ A :class:`memoryview` object exposes the new C level buffer interface as a Python object which can then be passed around like any other object. -.. cfunction:: PyObject *PyMemoryView_FromObject(PyObject *obj) +.. c:function:: PyObject *PyMemoryView_FromObject(PyObject *obj) Create a memoryview object from an object that defines the new buffer interface. -.. cfunction:: PyObject *PyMemoryView_FromBuffer(Py_buffer *view) +.. c:function:: PyObject *PyMemoryView_FromBuffer(Py_buffer *view) Create a memoryview object wrapping the given buffer-info structure *view*. The memoryview object then owns the buffer, which means you shouldn't @@ -309,7 +309,7 @@ memoryview object. -.. cfunction:: PyObject *PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order) +.. c:function:: PyObject *PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char order) Create a memoryview object to a contiguous chunk of memory (in either 'C' or 'F'ortran *order*) from an object that defines the buffer @@ -318,13 +318,13 @@ new bytes object. -.. cfunction:: int PyMemoryView_Check(PyObject *obj) +.. c:function:: int PyMemoryView_Check(PyObject *obj) Return true if the object *obj* is a memoryview object. It is not currently allowed to create subclasses of :class:`memoryview`. -.. cfunction:: Py_buffer *PyMemoryView_GET_BUFFER(PyObject *obj) +.. c:function:: Py_buffer *PyMemoryView_GET_BUFFER(PyObject *obj) Return a pointer to the buffer-info structure wrapped by the given object. The object **must** be a memoryview instance; this macro doesn't @@ -337,7 +337,7 @@ .. index:: single: PyBufferProcs More information on the old buffer interface is provided in the section -:ref:`buffer-structs`, under the description for :ctype:`PyBufferProcs`. +:ref:`buffer-structs`, under the description for :c:type:`PyBufferProcs`. A "buffer object" is defined in the :file:`bufferobject.h` header (included by :file:`Python.h`). These objects look very similar to string objects at the @@ -356,36 +356,36 @@ native, in-memory format. -.. ctype:: PyBufferObject +.. c:type:: PyBufferObject - This subtype of :ctype:`PyObject` represents a buffer object. + This subtype of :c:type:`PyObject` represents a buffer object. -.. cvar:: PyTypeObject PyBuffer_Type +.. c:var:: PyTypeObject PyBuffer_Type .. index:: single: BufferType (in module types) - The instance of :ctype:`PyTypeObject` which represents the Python buffer type; + The instance of :c:type:`PyTypeObject` which represents the Python buffer type; it is the same object as ``buffer`` and ``types.BufferType`` in the Python layer. . -.. cvar:: int Py_END_OF_BUFFER +.. c:var:: int Py_END_OF_BUFFER This constant may be passed as the *size* parameter to - :cfunc:`PyBuffer_FromObject` or :cfunc:`PyBuffer_FromReadWriteObject`. It - indicates that the new :ctype:`PyBufferObject` should refer to *base* + :c:func:`PyBuffer_FromObject` or :c:func:`PyBuffer_FromReadWriteObject`. It + indicates that the new :c:type:`PyBufferObject` should refer to *base* object from the specified *offset* to the end of its exported buffer. Using this enables the caller to avoid querying the *base* object for its length. -.. cfunction:: int PyBuffer_Check(PyObject *p) +.. c:function:: int PyBuffer_Check(PyObject *p) - Return true if the argument has type :cdata:`PyBuffer_Type`. + Return true if the argument has type :c:data:`PyBuffer_Type`. -.. cfunction:: PyObject* PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size) +.. c:function:: PyObject* PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size) Return a new read-only buffer object. This raises :exc:`TypeError` if *base* doesn't support the read-only buffer protocol or doesn't provide @@ -397,24 +397,24 @@ length of the *base* object's exported buffer data. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *offset* and *size*. This + This function used an :c:type:`int` type for *offset* and *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size) +.. c:function:: PyObject* PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size) Return a new writable buffer object. Parameters and exceptions are similar - to those for :cfunc:`PyBuffer_FromObject`. If the *base* object does not + to those for :c:func:`PyBuffer_FromObject`. If the *base* object does not export the writeable buffer protocol, then :exc:`TypeError` is raised. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *offset* and *size*. This + This function used an :c:type:`int` type for *offset* and *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyBuffer_FromMemory(void *ptr, Py_ssize_t size) +.. c:function:: PyObject* PyBuffer_FromMemory(void *ptr, Py_ssize_t size) Return a new read-only buffer object that reads from a specified location in memory, with a specified size. The caller is responsible for ensuring @@ -424,27 +424,27 @@ *size* parameter; :exc:`ValueError` will be raised in that case. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size) +.. c:function:: PyObject* PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size) - Similar to :cfunc:`PyBuffer_FromMemory`, but the returned buffer is + Similar to :c:func:`PyBuffer_FromMemory`, but the returned buffer is writable. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyBuffer_New(Py_ssize_t size) +.. c:function:: PyObject* PyBuffer_New(Py_ssize_t size) Return a new writable buffer object that maintains its own memory buffer of *size* bytes. :exc:`ValueError` is returned if *size* is not zero or positive. Note that the memory buffer (as returned by - :cfunc:`PyObject_AsWriteBuffer`) is not specifically aligned. + :c:func:`PyObject_AsWriteBuffer`) is not specifically aligned. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. diff --git a/Doc/c-api/bytearray.rst b/Doc/c-api/bytearray.rst --- a/Doc/c-api/bytearray.rst +++ b/Doc/c-api/bytearray.rst @@ -10,26 +10,26 @@ .. versionadded:: 2.6 -.. ctype:: PyByteArrayObject +.. c:type:: PyByteArrayObject - This subtype of :ctype:`PyObject` represents a Python bytearray object. + This subtype of :c:type:`PyObject` represents a Python bytearray object. -.. cvar:: PyTypeObject PyByteArray_Type +.. c:var:: PyTypeObject PyByteArray_Type - This instance of :ctype:`PyTypeObject` represents the Python bytearray type; + This instance of :c:type:`PyTypeObject` represents the Python bytearray type; it is the same object as ``bytearray`` in the Python layer. Type check macros ^^^^^^^^^^^^^^^^^ -.. cfunction:: int PyByteArray_Check(PyObject *o) +.. c:function:: int PyByteArray_Check(PyObject *o) Return true if the object *o* is a bytearray object or an instance of a subtype of the bytearray type. -.. cfunction:: int PyByteArray_CheckExact(PyObject *o) +.. c:function:: int PyByteArray_CheckExact(PyObject *o) Return true if the object *o* is a bytearray object, but not an instance of a subtype of the bytearray type. @@ -38,7 +38,7 @@ Direct API functions ^^^^^^^^^^^^^^^^^^^^ -.. cfunction:: PyObject* PyByteArray_FromObject(PyObject *o) +.. c:function:: PyObject* PyByteArray_FromObject(PyObject *o) Return a new bytearray object from any object, *o*, that implements the buffer protocol. @@ -46,29 +46,29 @@ .. XXX expand about the buffer protocol, at least somewhere -.. cfunction:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len) +.. c:function:: PyObject* PyByteArray_FromStringAndSize(const char *string, Py_ssize_t len) Create a new bytearray object from *string* and its length, *len*. On failure, *NULL* is returned. -.. cfunction:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b) +.. c:function:: PyObject* PyByteArray_Concat(PyObject *a, PyObject *b) Concat bytearrays *a* and *b* and return a new bytearray with the result. -.. cfunction:: Py_ssize_t PyByteArray_Size(PyObject *bytearray) +.. c:function:: Py_ssize_t PyByteArray_Size(PyObject *bytearray) Return the size of *bytearray* after checking for a *NULL* pointer. -.. cfunction:: char* PyByteArray_AsString(PyObject *bytearray) +.. c:function:: char* PyByteArray_AsString(PyObject *bytearray) Return the contents of *bytearray* as a char array after checking for a *NULL* pointer. -.. cfunction:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len) +.. c:function:: int PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len) Resize the internal buffer of *bytearray* to *len*. @@ -77,11 +77,11 @@ These macros trade safety for speed and they don't check pointers. -.. cfunction:: char* PyByteArray_AS_STRING(PyObject *bytearray) +.. c:function:: char* PyByteArray_AS_STRING(PyObject *bytearray) - Macro version of :cfunc:`PyByteArray_AsString`. + Macro version of :c:func:`PyByteArray_AsString`. -.. cfunction:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray) +.. c:function:: Py_ssize_t PyByteArray_GET_SIZE(PyObject *bytearray) - Macro version of :cfunc:`PyByteArray_Size`. + Macro version of :c:func:`PyByteArray_Size`. diff --git a/Doc/c-api/capsule.rst b/Doc/c-api/capsule.rst --- a/Doc/c-api/capsule.rst +++ b/Doc/c-api/capsule.rst @@ -10,33 +10,33 @@ Refer to :ref:`using-capsules` for more information on using these objects. -.. ctype:: PyCapsule +.. c:type:: PyCapsule - This subtype of :ctype:`PyObject` represents an opaque value, useful for C - extension modules who need to pass an opaque value (as a :ctype:`void\*` + This subtype of :c:type:`PyObject` represents an opaque value, useful for C + extension modules who need to pass an opaque value (as a :c:type:`void\*` pointer) through Python code to other C code. It is often used to make a C function pointer defined in one module available to other modules, so the regular import mechanism can be used to access C APIs defined in dynamically loaded modules. -.. ctype:: PyCapsule_Destructor +.. c:type:: PyCapsule_Destructor The type of a destructor callback for a capsule. Defined as:: typedef void (*PyCapsule_Destructor)(PyObject *); - See :cfunc:`PyCapsule_New` for the semantics of PyCapsule_Destructor + See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor callbacks. -.. cfunction:: int PyCapsule_CheckExact(PyObject *p) +.. c:function:: int PyCapsule_CheckExact(PyObject *p) - Return true if its argument is a :ctype:`PyCapsule`. + Return true if its argument is a :c:type:`PyCapsule`. -.. cfunction:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor) +.. c:function:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor) - Create a :ctype:`PyCapsule` encapsulating the *pointer*. The *pointer* + Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer* argument may not be *NULL*. On failure, set an exception and return *NULL*. @@ -50,91 +50,91 @@ If this capsule will be stored as an attribute of a module, the *name* should be specified as ``modulename.attributename``. This will enable other modules - to import the capsule using :cfunc:`PyCapsule_Import`. + to import the capsule using :c:func:`PyCapsule_Import`. -.. cfunction:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name) +.. c:function:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name) Retrieve the *pointer* stored in the capsule. On failure, set an exception and return *NULL*. The *name* parameter must compare exactly to the name stored in the capsule. If the name stored in the capsule is *NULL*, the *name* passed in must also - be *NULL*. Python uses the C function :cfunc:`strcmp` to compare capsule + be *NULL*. Python uses the C function :c:func:`strcmp` to compare capsule names. -.. cfunction:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule) +.. c:function:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule) Return the current destructor stored in the capsule. On failure, set an exception and return *NULL*. It is legal for a capsule to have a *NULL* destructor. This makes a *NULL* - return code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or - :cfunc:`PyErr_Occurred` to disambiguate. + return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or + :c:func:`PyErr_Occurred` to disambiguate. -.. cfunction:: void* PyCapsule_GetContext(PyObject *capsule) +.. c:function:: void* PyCapsule_GetContext(PyObject *capsule) Return the current context stored in the capsule. On failure, set an exception and return *NULL*. It is legal for a capsule to have a *NULL* context. This makes a *NULL* - return code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or - :cfunc:`PyErr_Occurred` to disambiguate. + return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or + :c:func:`PyErr_Occurred` to disambiguate. -.. cfunction:: const char* PyCapsule_GetName(PyObject *capsule) +.. c:function:: const char* PyCapsule_GetName(PyObject *capsule) Return the current name stored in the capsule. On failure, set an exception and return *NULL*. It is legal for a capsule to have a *NULL* name. This makes a *NULL* return - code somewhat ambiguous; use :cfunc:`PyCapsule_IsValid` or - :cfunc:`PyErr_Occurred` to disambiguate. + code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or + :c:func:`PyErr_Occurred` to disambiguate. -.. cfunction:: void* PyCapsule_Import(const char *name, int no_block) +.. c:function:: void* PyCapsule_Import(const char *name, int no_block) Import a pointer to a C object from a capsule attribute in a module. The *name* parameter should specify the full name to the attribute, as in ``module.attribute``. The *name* stored in the capsule must match this string exactly. If *no_block* is true, import the module without blocking - (using :cfunc:`PyImport_ImportModuleNoBlock`). If *no_block* is false, - import the module conventionally (using :cfunc:`PyImport_ImportModule`). + (using :c:func:`PyImport_ImportModuleNoBlock`). If *no_block* is false, + import the module conventionally (using :c:func:`PyImport_ImportModule`). Return the capsule's internal *pointer* on success. On failure, set an - exception and return *NULL*. However, if :cfunc:`PyCapsule_Import` failed to + exception and return *NULL*. However, if :c:func:`PyCapsule_Import` failed to import the module, and *no_block* was true, no exception is set. -.. cfunction:: int PyCapsule_IsValid(PyObject *capsule, const char *name) +.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name) Determines whether or not *capsule* is a valid capsule. A valid capsule is - non-*NULL*, passes :cfunc:`PyCapsule_CheckExact`, has a non-*NULL* pointer + non-*NULL*, passes :c:func:`PyCapsule_CheckExact`, has a non-*NULL* pointer stored in it, and its internal name matches the *name* parameter. (See - :cfunc:`PyCapsule_GetPointer` for information on how capsule names are + :c:func:`PyCapsule_GetPointer` for information on how capsule names are compared.) - In other words, if :cfunc:`PyCapsule_IsValid` returns a true value, calls to - any of the accessors (any function starting with :cfunc:`PyCapsule_Get`) are + In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls to + any of the accessors (any function starting with :c:func:`PyCapsule_Get`) are guaranteed to succeed. Return a nonzero value if the object is valid and matches the name passed in. Return 0 otherwise. This function will not fail. -.. cfunction:: int PyCapsule_SetContext(PyObject *capsule, void *context) +.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context) Set the context pointer inside *capsule* to *context*. Return 0 on success. Return nonzero and set an exception on failure. -.. cfunction:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor) +.. c:function:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor) Set the destructor inside *capsule* to *destructor*. Return 0 on success. Return nonzero and set an exception on failure. -.. cfunction:: int PyCapsule_SetName(PyObject *capsule, const char *name) +.. c:function:: int PyCapsule_SetName(PyObject *capsule, const char *name) Set the name inside *capsule* to *name*. If non-*NULL*, the name must outlive the capsule. If the previous *name* stored in the capsule was not @@ -142,7 +142,7 @@ Return 0 on success. Return nonzero and set an exception on failure. -.. cfunction:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer) +.. c:function:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer) Set the void pointer inside *capsule* to *pointer*. The pointer may not be *NULL*. diff --git a/Doc/c-api/cell.rst b/Doc/c-api/cell.rst --- a/Doc/c-api/cell.rst +++ b/Doc/c-api/cell.rst @@ -15,39 +15,39 @@ Cell objects are not likely to be useful elsewhere. -.. ctype:: PyCellObject +.. c:type:: PyCellObject The C structure used for cell objects. -.. cvar:: PyTypeObject PyCell_Type +.. c:var:: PyTypeObject PyCell_Type The type object corresponding to cell objects. -.. cfunction:: int PyCell_Check(ob) +.. c:function:: int PyCell_Check(ob) Return true if *ob* is a cell object; *ob* must not be *NULL*. -.. cfunction:: PyObject* PyCell_New(PyObject *ob) +.. c:function:: PyObject* PyCell_New(PyObject *ob) Create and return a new cell object containing the value *ob*. The parameter may be *NULL*. -.. cfunction:: PyObject* PyCell_Get(PyObject *cell) +.. c:function:: PyObject* PyCell_Get(PyObject *cell) Return the contents of the cell *cell*. -.. cfunction:: PyObject* PyCell_GET(PyObject *cell) +.. c:function:: PyObject* PyCell_GET(PyObject *cell) Return the contents of the cell *cell*, but without checking that *cell* is non-*NULL* and a cell object. -.. cfunction:: int PyCell_Set(PyObject *cell, PyObject *value) +.. c:function:: int PyCell_Set(PyObject *cell, PyObject *value) Set the contents of the cell object *cell* to *value*. This releases the reference to any current content of the cell. *value* may be *NULL*. *cell* @@ -55,7 +55,7 @@ success, ``0`` will be returned. -.. cfunction:: void PyCell_SET(PyObject *cell, PyObject *value) +.. c:function:: void PyCell_SET(PyObject *cell, PyObject *value) Sets the value of the cell object *cell* to *value*. No reference counts are adjusted, and no checks are made for safety; *cell* must be non-*NULL* and must diff --git a/Doc/c-api/class.rst b/Doc/c-api/class.rst --- a/Doc/c-api/class.rst +++ b/Doc/c-api/class.rst @@ -12,12 +12,12 @@ will want to work with type objects (section :ref:`typeobjects`). -.. ctype:: PyClassObject +.. c:type:: PyClassObject The C structure of the objects used to describe built-in classes. -.. cvar:: PyObject* PyClass_Type +.. c:var:: PyObject* PyClass_Type .. index:: single: ClassType (in module types) @@ -25,13 +25,13 @@ ``types.ClassType`` in the Python layer. -.. cfunction:: int PyClass_Check(PyObject *o) +.. c:function:: int PyClass_Check(PyObject *o) Return true if the object *o* is a class object, including instances of types derived from the standard class object. Return false in all other cases. -.. cfunction:: int PyClass_IsSubclass(PyObject *klass, PyObject *base) +.. c:function:: int PyClass_IsSubclass(PyObject *klass, PyObject *base) Return true if *klass* is a subclass of *base*. Return false in all other cases. @@ -41,23 +41,23 @@ There are very few functions specific to instance objects. -.. cvar:: PyTypeObject PyInstance_Type +.. c:var:: PyTypeObject PyInstance_Type Type object for class instances. -.. cfunction:: int PyInstance_Check(PyObject *obj) +.. c:function:: int PyInstance_Check(PyObject *obj) Return true if *obj* is an instance. -.. cfunction:: PyObject* PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw) +.. c:function:: PyObject* PyInstance_New(PyObject *class, PyObject *arg, PyObject *kw) Create a new instance of a specific class. The parameters *arg* and *kw* are used as the positional and keyword parameters to the object's constructor. -.. cfunction:: PyObject* PyInstance_NewRaw(PyObject *class, PyObject *dict) +.. c:function:: PyObject* PyInstance_NewRaw(PyObject *class, PyObject *dict) Create a new instance of a specific class without calling its constructor. *class* is the class of new object. The *dict* parameter will be used as the diff --git a/Doc/c-api/cobject.rst b/Doc/c-api/cobject.rst --- a/Doc/c-api/cobject.rst +++ b/Doc/c-api/cobject.rst @@ -13,47 +13,47 @@ The CObject API is deprecated as of Python 2.7. Please switch to the new :ref:`capsules` API. -.. ctype:: PyCObject +.. c:type:: PyCObject - This subtype of :ctype:`PyObject` represents an opaque value, useful for C - extension modules who need to pass an opaque value (as a :ctype:`void\*` + This subtype of :c:type:`PyObject` represents an opaque value, useful for C + extension modules who need to pass an opaque value (as a :c:type:`void\*` pointer) through Python code to other C code. It is often used to make a C function pointer defined in one module available to other modules, so the regular import mechanism can be used to access C APIs defined in dynamically loaded modules. -.. cfunction:: int PyCObject_Check(PyObject *p) +.. c:function:: int PyCObject_Check(PyObject *p) - Return true if its argument is a :ctype:`PyCObject`. + Return true if its argument is a :c:type:`PyCObject`. -.. cfunction:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *)) +.. c:function:: PyObject* PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *)) - Create a :ctype:`PyCObject` from the ``void *`` *cobj*. The *destr* function + Create a :c:type:`PyCObject` from the ``void *`` *cobj*. The *destr* function will be called when the object is reclaimed, unless it is *NULL*. -.. cfunction:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *)) +.. c:function:: PyObject* PyCObject_FromVoidPtrAndDesc(void* cobj, void* desc, void (*destr)(void *, void *)) - Create a :ctype:`PyCObject` from the :ctype:`void \*` *cobj*. The *destr* + Create a :c:type:`PyCObject` from the :c:type:`void \*` *cobj*. The *destr* function will be called when the object is reclaimed. The *desc* argument can be used to pass extra callback data for the destructor function. -.. cfunction:: void* PyCObject_AsVoidPtr(PyObject* self) +.. c:function:: void* PyCObject_AsVoidPtr(PyObject* self) - Return the object :ctype:`void \*` that the :ctype:`PyCObject` *self* was + Return the object :c:type:`void \*` that the :c:type:`PyCObject` *self* was created with. -.. cfunction:: void* PyCObject_GetDesc(PyObject* self) +.. c:function:: void* PyCObject_GetDesc(PyObject* self) - Return the description :ctype:`void \*` that the :ctype:`PyCObject` *self* was + Return the description :c:type:`void \*` that the :c:type:`PyCObject` *self* was created with. -.. cfunction:: int PyCObject_SetVoidPtr(PyObject* self, void* cobj) +.. c:function:: int PyCObject_SetVoidPtr(PyObject* self, void* cobj) - Set the void pointer inside *self* to *cobj*. The :ctype:`PyCObject` must not + Set the void pointer inside *self* to *cobj*. The :c:type:`PyCObject` must not have an associated destructor. Return true on success, false on failure. diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst --- a/Doc/c-api/code.rst +++ b/Doc/c-api/code.rst @@ -15,35 +15,35 @@ Each one represents a chunk of executable code that hasn't yet been bound into a function. -.. ctype:: PyCodeObject +.. c:type:: PyCodeObject The C structure of the objects used to describe code objects. The fields of this type are subject to change at any time. -.. cvar:: PyTypeObject PyCode_Type +.. c:var:: PyTypeObject PyCode_Type - This is an instance of :ctype:`PyTypeObject` representing the Python + This is an instance of :c:type:`PyTypeObject` representing the Python :class:`code` type. -.. cfunction:: int PyCode_Check(PyObject *co) +.. c:function:: int PyCode_Check(PyObject *co) Return true if *co* is a :class:`code` object -.. cfunction:: int PyCode_GetNumFree(PyObject *co) +.. c:function:: int PyCode_GetNumFree(PyObject *co) Return the number of free variables in *co*. -.. cfunction:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) +.. c:function:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) Return a new code object. If you need a dummy code object to - create a frame, use :cfunc:`PyCode_NewEmpty` instead. Calling - :cfunc:`PyCode_New` directly can bind you to a precise Python + create a frame, use :c:func:`PyCode_NewEmpty` instead. Calling + :c:func:`PyCode_New` directly can bind you to a precise Python version since the definition of the bytecode changes often. -.. cfunction:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) +.. c:function:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) Return a new empty code object with the specified filename, function name, and first line number. It is illegal to diff --git a/Doc/c-api/codec.rst b/Doc/c-api/codec.rst --- a/Doc/c-api/codec.rst +++ b/Doc/c-api/codec.rst @@ -3,19 +3,19 @@ Codec registry and support functions ==================================== -.. cfunction:: int PyCodec_Register(PyObject *search_function) +.. c:function:: int PyCodec_Register(PyObject *search_function) Register a new codec search function. As side effect, this tries to load the :mod:`encodings` package, if not yet done, to make sure that it is always first in the list of search functions. -.. cfunction:: int PyCodec_KnownEncoding(const char *encoding) +.. c:function:: int PyCodec_KnownEncoding(const char *encoding) Return ``1`` or ``0`` depending on whether there is a registered codec for the given *encoding*. -.. cfunction:: PyObject* PyCodec_Encode(PyObject *object, const char *encoding, const char *errors) +.. c:function:: PyObject* PyCodec_Encode(PyObject *object, const char *encoding, const char *errors) Generic codec based encoding API. @@ -24,7 +24,7 @@ be *NULL* to use the default method defined for the codec. Raises a :exc:`LookupError` if no encoder can be found. -.. cfunction:: PyObject* PyCodec_Decode(PyObject *object, const char *encoding, const char *errors) +.. c:function:: PyObject* PyCodec_Decode(PyObject *object, const char *encoding, const char *errors) Generic codec based decoding API. @@ -42,27 +42,27 @@ effectively case-insensitive. If no codec is found, a :exc:`KeyError` is set and *NULL* returned. -.. cfunction:: PyObject* PyCodec_Encoder(const char *encoding) +.. c:function:: PyObject* PyCodec_Encoder(const char *encoding) Get an encoder function for the given *encoding*. -.. cfunction:: PyObject* PyCodec_Decoder(const char *encoding) +.. c:function:: PyObject* PyCodec_Decoder(const char *encoding) Get a decoder function for the given *encoding*. -.. cfunction:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors) +.. c:function:: PyObject* PyCodec_IncrementalEncoder(const char *encoding, const char *errors) Get an :class:`IncrementalEncoder` object for the given *encoding*. -.. cfunction:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors) +.. c:function:: PyObject* PyCodec_IncrementalDecoder(const char *encoding, const char *errors) Get an :class:`IncrementalDecoder` object for the given *encoding*. -.. cfunction:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors) +.. c:function:: PyObject* PyCodec_StreamReader(const char *encoding, PyObject *stream, const char *errors) Get a :class:`StreamReader` factory function for the given *encoding*. -.. cfunction:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors) +.. c:function:: PyObject* PyCodec_StreamWriter(const char *encoding, PyObject *stream, const char *errors) Get a :class:`StreamWriter` factory function for the given *encoding*. @@ -70,7 +70,7 @@ Registry API for Unicode encoding error handlers ------------------------------------------------ -.. cfunction:: int PyCodec_RegisterError(const char *name, PyObject *error) +.. c:function:: int PyCodec_RegisterError(const char *name, PyObject *error) Register the error handling callback function *error* under the given *name*. This callback function will be called by a codec when it encounters @@ -89,29 +89,29 @@ Return ``0`` on success, ``-1`` on error. -.. cfunction:: PyObject* PyCodec_LookupError(const char *name) +.. c:function:: PyObject* PyCodec_LookupError(const char *name) Lookup the error handling callback function registered under *name*. As a special case *NULL* can be passed, in which case the error handling callback for "strict" will be returned. -.. cfunction:: PyObject* PyCodec_StrictErrors(PyObject *exc) +.. c:function:: PyObject* PyCodec_StrictErrors(PyObject *exc) Raise *exc* as an exception. -.. cfunction:: PyObject* PyCodec_IgnoreErrors(PyObject *exc) +.. c:function:: PyObject* PyCodec_IgnoreErrors(PyObject *exc) Ignore the unicode error, skipping the faulty input. -.. cfunction:: PyObject* PyCodec_ReplaceErrors(PyObject *exc) +.. c:function:: PyObject* PyCodec_ReplaceErrors(PyObject *exc) Replace the unicode encode error with ``?`` or ``U+FFFD``. -.. cfunction:: PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject *exc) +.. c:function:: PyObject* PyCodec_XMLCharRefReplaceErrors(PyObject *exc) Replace the unicode encode error with XML character references. -.. cfunction:: PyObject* PyCodec_BackslashReplaceErrors(PyObject *exc) +.. c:function:: PyObject* PyCodec_BackslashReplaceErrors(PyObject *exc) Replace the unicode encode error with backslash escapes (``\x``, ``\u`` and ``\U``). diff --git a/Doc/c-api/complex.rst b/Doc/c-api/complex.rst --- a/Doc/c-api/complex.rst +++ b/Doc/c-api/complex.rst @@ -21,7 +21,7 @@ pointers. This is consistent throughout the API. -.. ctype:: Py_complex +.. c:type:: Py_complex The C structure which corresponds to the value portion of a Python complex number object. Most of the functions for dealing with complex number objects @@ -34,103 +34,103 @@ } Py_complex; -.. cfunction:: Py_complex _Py_c_sum(Py_complex left, Py_complex right) +.. c:function:: Py_complex _Py_c_sum(Py_complex left, Py_complex right) - Return the sum of two complex numbers, using the C :ctype:`Py_complex` + Return the sum of two complex numbers, using the C :c:type:`Py_complex` representation. -.. cfunction:: Py_complex _Py_c_diff(Py_complex left, Py_complex right) +.. c:function:: Py_complex _Py_c_diff(Py_complex left, Py_complex right) Return the difference between two complex numbers, using the C - :ctype:`Py_complex` representation. + :c:type:`Py_complex` representation. -.. cfunction:: Py_complex _Py_c_neg(Py_complex complex) +.. c:function:: Py_complex _Py_c_neg(Py_complex complex) Return the negation of the complex number *complex*, using the C - :ctype:`Py_complex` representation. + :c:type:`Py_complex` representation. -.. cfunction:: Py_complex _Py_c_prod(Py_complex left, Py_complex right) +.. c:function:: Py_complex _Py_c_prod(Py_complex left, Py_complex right) - Return the product of two complex numbers, using the C :ctype:`Py_complex` + Return the product of two complex numbers, using the C :c:type:`Py_complex` representation. -.. cfunction:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor) +.. c:function:: Py_complex _Py_c_quot(Py_complex dividend, Py_complex divisor) - Return the quotient of two complex numbers, using the C :ctype:`Py_complex` + Return the quotient of two complex numbers, using the C :c:type:`Py_complex` representation. If *divisor* is null, this method returns zero and sets - :cdata:`errno` to :cdata:`EDOM`. + :c:data:`errno` to :c:data:`EDOM`. -.. cfunction:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp) +.. c:function:: Py_complex _Py_c_pow(Py_complex num, Py_complex exp) - Return the exponentiation of *num* by *exp*, using the C :ctype:`Py_complex` + Return the exponentiation of *num* by *exp*, using the C :c:type:`Py_complex` representation. If *num* is null and *exp* is not a positive real number, - this method returns zero and sets :cdata:`errno` to :cdata:`EDOM`. + this method returns zero and sets :c:data:`errno` to :c:data:`EDOM`. Complex Numbers as Python Objects ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. ctype:: PyComplexObject +.. c:type:: PyComplexObject - This subtype of :ctype:`PyObject` represents a Python complex number object. + This subtype of :c:type:`PyObject` represents a Python complex number object. -.. cvar:: PyTypeObject PyComplex_Type +.. c:var:: PyTypeObject PyComplex_Type - This instance of :ctype:`PyTypeObject` represents the Python complex number + This instance of :c:type:`PyTypeObject` represents the Python complex number type. It is the same object as ``complex`` and ``types.ComplexType``. -.. cfunction:: int PyComplex_Check(PyObject *p) +.. c:function:: int PyComplex_Check(PyObject *p) - Return true if its argument is a :ctype:`PyComplexObject` or a subtype of - :ctype:`PyComplexObject`. + Return true if its argument is a :c:type:`PyComplexObject` or a subtype of + :c:type:`PyComplexObject`. .. versionchanged:: 2.2 Allowed subtypes to be accepted. -.. cfunction:: int PyComplex_CheckExact(PyObject *p) +.. c:function:: int PyComplex_CheckExact(PyObject *p) - Return true if its argument is a :ctype:`PyComplexObject`, but not a subtype of - :ctype:`PyComplexObject`. + Return true if its argument is a :c:type:`PyComplexObject`, but not a subtype of + :c:type:`PyComplexObject`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyComplex_FromCComplex(Py_complex v) +.. c:function:: PyObject* PyComplex_FromCComplex(Py_complex v) - Create a new Python complex number object from a C :ctype:`Py_complex` value. + Create a new Python complex number object from a C :c:type:`Py_complex` value. -.. cfunction:: PyObject* PyComplex_FromDoubles(double real, double imag) +.. c:function:: PyObject* PyComplex_FromDoubles(double real, double imag) - Return a new :ctype:`PyComplexObject` object from *real* and *imag*. + Return a new :c:type:`PyComplexObject` object from *real* and *imag*. -.. cfunction:: double PyComplex_RealAsDouble(PyObject *op) +.. c:function:: double PyComplex_RealAsDouble(PyObject *op) - Return the real part of *op* as a C :ctype:`double`. + Return the real part of *op* as a C :c:type:`double`. -.. cfunction:: double PyComplex_ImagAsDouble(PyObject *op) +.. c:function:: double PyComplex_ImagAsDouble(PyObject *op) - Return the imaginary part of *op* as a C :ctype:`double`. + Return the imaginary part of *op* as a C :c:type:`double`. -.. cfunction:: Py_complex PyComplex_AsCComplex(PyObject *op) +.. c:function:: Py_complex PyComplex_AsCComplex(PyObject *op) - Return the :ctype:`Py_complex` value of the complex number *op*. + Return the :c:type:`Py_complex` value of the complex number *op*. Upon failure, this method returns ``-1.0`` as a real value. .. versionchanged:: 2.6 diff --git a/Doc/c-api/concrete.rst b/Doc/c-api/concrete.rst --- a/Doc/c-api/concrete.rst +++ b/Doc/c-api/concrete.rst @@ -11,7 +11,7 @@ Passing them an object of the wrong type is not a good idea; if you receive an object from a Python program and you are not sure that it has the right type, you must perform a type check first; for example, to check that an object is a -dictionary, use :cfunc:`PyDict_Check`. The chapter is structured like the +dictionary, use :c:func:`PyDict_Check`. The chapter is structured like the "family tree" of Python object types. .. warning:: diff --git a/Doc/c-api/conversion.rst b/Doc/c-api/conversion.rst --- a/Doc/c-api/conversion.rst +++ b/Doc/c-api/conversion.rst @@ -8,20 +8,20 @@ Functions for number conversion and formatted string output. -.. cfunction:: int PyOS_snprintf(char *str, size_t size, const char *format, ...) +.. c:function:: int PyOS_snprintf(char *str, size_t size, const char *format, ...) Output not more than *size* bytes to *str* according to the format string *format* and the extra arguments. See the Unix man page :manpage:`snprintf(2)`. -.. cfunction:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) +.. c:function:: int PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) Output not more than *size* bytes to *str* according to the format string *format* and the variable argument list *va*. Unix man page :manpage:`vsnprintf(2)`. -:cfunc:`PyOS_snprintf` and :cfunc:`PyOS_vsnprintf` wrap the Standard C library -functions :cfunc:`snprintf` and :cfunc:`vsnprintf`. Their purpose is to +:c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` wrap the Standard C library +functions :c:func:`snprintf` and :c:func:`vsnprintf`. Their purpose is to guarantee consistent behavior in corner cases, which the Standard C functions do not. @@ -30,7 +30,7 @@ Both functions require that ``str != NULL``, ``size > 0`` and ``format != NULL``. -If the platform doesn't have :cfunc:`vsnprintf` and the buffer size needed to +If the platform doesn't have :c:func:`vsnprintf` and the buffer size needed to avoid truncation exceeds *size* by more than 512 bytes, Python aborts with a *Py_FatalError*. @@ -51,9 +51,9 @@ The following functions provide locale-independent string to number conversions. -.. cfunction:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) +.. c:function:: double PyOS_string_to_double(const char *s, char **endptr, PyObject *overflow_exception) - Convert a string ``s`` to a :ctype:`double`, raising a Python + Convert a string ``s`` to a :c:type:`double`, raising a Python exception on failure. The set of accepted strings corresponds to the set of strings accepted by Python's :func:`float` constructor, except that ``s`` must not have leading or trailing whitespace. @@ -85,13 +85,13 @@ .. versionadded:: 2.7 -.. cfunction:: double PyOS_ascii_strtod(const char *nptr, char **endptr) +.. c:function:: double PyOS_ascii_strtod(const char *nptr, char **endptr) - Convert a string to a :ctype:`double`. This function behaves like the Standard C - function :cfunc:`strtod` does in the C locale. It does this without changing the + Convert a string to a :c:type:`double`. This function behaves like the Standard C + function :c:func:`strtod` does in the C locale. It does this without changing the current locale, since that would not be thread-safe. - :cfunc:`PyOS_ascii_strtod` should typically be used for reading configuration + :c:func:`PyOS_ascii_strtod` should typically be used for reading configuration files or other non-user input that should be locale independent. See the Unix man page :manpage:`strtod(2)` for details. @@ -99,14 +99,14 @@ .. versionadded:: 2.4 .. deprecated:: 2.7 - Use :cfunc:`PyOS_string_to_double` instead. + Use :c:func:`PyOS_string_to_double` instead. -.. cfunction:: char* PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d) +.. c:function:: char* PyOS_ascii_formatd(char *buffer, size_t buf_len, const char *format, double d) - Convert a :ctype:`double` to a string using the ``'.'`` as the decimal - separator. *format* is a :cfunc:`printf`\ -style format string specifying the + Convert a :c:type:`double` to a string using the ``'.'`` as the decimal + separator. *format* is a :c:func:`printf`\ -style format string specifying the number format. Allowed conversion characters are ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'`` and ``'G'``. @@ -119,9 +119,9 @@ instead. -.. cfunction:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype) +.. c:function:: char* PyOS_double_to_string(double val, char format_code, int precision, int flags, int *ptype) - Convert a :ctype:`double` *val* to a string using supplied + Convert a :c:type:`double` *val* to a string using supplied *format_code*, *precision*, and *flags*. *format_code* must be one of ``'e'``, ``'E'``, ``'f'``, ``'F'``, @@ -139,7 +139,7 @@ like an integer. * *Py_DTSF_ALT* means to apply "alternate" formatting rules. See the - documentation for the :cfunc:`PyOS_snprintf` ``'#'`` specifier for + documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for details. If *ptype* is non-NULL, then the value it points to will be set to one of @@ -148,34 +148,34 @@ The return value is a pointer to *buffer* with the converted string or *NULL* if the conversion failed. The caller is responsible for freeing the - returned string by calling :cfunc:`PyMem_Free`. + returned string by calling :c:func:`PyMem_Free`. .. versionadded:: 2.7 -.. cfunction:: double PyOS_ascii_atof(const char *nptr) +.. c:function:: double PyOS_ascii_atof(const char *nptr) - Convert a string to a :ctype:`double` in a locale-independent way. + Convert a string to a :c:type:`double` in a locale-independent way. See the Unix man page :manpage:`atof(2)` for details. .. versionadded:: 2.4 .. deprecated:: 3.1 - Use :cfunc:`PyOS_string_to_double` instead. + Use :c:func:`PyOS_string_to_double` instead. -.. cfunction:: char* PyOS_stricmp(char *s1, char *s2) +.. c:function:: char* PyOS_stricmp(char *s1, char *s2) Case insensitive comparison of strings. The function works almost - identically to :cfunc:`strcmp` except that it ignores the case. + identically to :c:func:`strcmp` except that it ignores the case. .. versionadded:: 2.6 -.. cfunction:: char* PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size) +.. c:function:: char* PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size) Case insensitive comparison of strings. The function works almost - identically to :cfunc:`strncmp` except that it ignores the case. + identically to :c:func:`strncmp` except that it ignores the case. .. versionadded:: 2.6 diff --git a/Doc/c-api/datetime.rst b/Doc/c-api/datetime.rst --- a/Doc/c-api/datetime.rst +++ b/Doc/c-api/datetime.rst @@ -8,89 +8,89 @@ Various date and time objects are supplied by the :mod:`datetime` module. Before using any of these functions, the header file :file:`datetime.h` must be included in your source (note that this is not included by :file:`Python.h`), -and the macro :cmacro:`PyDateTime_IMPORT` must be invoked, usually as part of +and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of the module initialisation function. The macro puts a pointer to a C structure -into a static variable, :cdata:`PyDateTimeAPI`, that is used by the following +into a static variable, :c:data:`PyDateTimeAPI`, that is used by the following macros. Type-check macros: -.. cfunction:: int PyDate_Check(PyObject *ob) +.. c:function:: int PyDate_Check(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_DateType` or a subtype of - :cdata:`PyDateTime_DateType`. *ob* must not be *NULL*. + Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype of + :c:data:`PyDateTime_DateType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyDate_CheckExact(PyObject *ob) +.. c:function:: int PyDate_CheckExact(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_DateType`. *ob* must not be + Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_Check(PyObject *ob) +.. c:function:: int PyDateTime_Check(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_DateTimeType` or a subtype of - :cdata:`PyDateTime_DateTimeType`. *ob* must not be *NULL*. + Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a subtype of + :c:data:`PyDateTime_DateTimeType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_CheckExact(PyObject *ob) +.. c:function:: int PyDateTime_CheckExact(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_DateTimeType`. *ob* must not + Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyTime_Check(PyObject *ob) +.. c:function:: int PyTime_Check(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_TimeType` or a subtype of - :cdata:`PyDateTime_TimeType`. *ob* must not be *NULL*. + Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype of + :c:data:`PyDateTime_TimeType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyTime_CheckExact(PyObject *ob) +.. c:function:: int PyTime_CheckExact(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_TimeType`. *ob* must not be + Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyDelta_Check(PyObject *ob) +.. c:function:: int PyDelta_Check(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_DeltaType` or a subtype of - :cdata:`PyDateTime_DeltaType`. *ob* must not be *NULL*. + Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype of + :c:data:`PyDateTime_DeltaType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyDelta_CheckExact(PyObject *ob) +.. c:function:: int PyDelta_CheckExact(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_DeltaType`. *ob* must not be + Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyTZInfo_Check(PyObject *ob) +.. c:function:: int PyTZInfo_Check(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_TZInfoType` or a subtype of - :cdata:`PyDateTime_TZInfoType`. *ob* must not be *NULL*. + Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype of + :c:data:`PyDateTime_TZInfoType`. *ob* must not be *NULL*. .. versionadded:: 2.4 -.. cfunction:: int PyTZInfo_CheckExact(PyObject *ob) +.. c:function:: int PyTZInfo_CheckExact(PyObject *ob) - Return true if *ob* is of type :cdata:`PyDateTime_TZInfoType`. *ob* must not be + Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must not be *NULL*. .. versionadded:: 2.4 @@ -98,14 +98,14 @@ Macros to create objects: -.. cfunction:: PyObject* PyDate_FromDate(int year, int month, int day) +.. c:function:: PyObject* PyDate_FromDate(int year, int month, int day) Return a ``datetime.date`` object with the specified year, month and day. .. versionadded:: 2.4 -.. cfunction:: PyObject* PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond) +.. c:function:: PyObject* PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond) Return a ``datetime.datetime`` object with the specified year, month, day, hour, minute, second and microsecond. @@ -113,7 +113,7 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond) +.. c:function:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond) Return a ``datetime.time`` object with the specified hour, minute, second and microsecond. @@ -121,7 +121,7 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds) +.. c:function:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds) Return a ``datetime.timedelta`` object representing the given number of days, seconds and microseconds. Normalization is performed so that the resulting @@ -131,90 +131,90 @@ .. versionadded:: 2.4 Macros to extract fields from date objects. The argument must be an instance of -:cdata:`PyDateTime_Date`, including subclasses (such as -:cdata:`PyDateTime_DateTime`). The argument must not be *NULL*, and the type is +:c:data:`PyDateTime_Date`, including subclasses (such as +:c:data:`PyDateTime_DateTime`). The argument must not be *NULL*, and the type is not checked: -.. cfunction:: int PyDateTime_GET_YEAR(PyDateTime_Date *o) +.. c:function:: int PyDateTime_GET_YEAR(PyDateTime_Date *o) Return the year, as a positive int. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_GET_MONTH(PyDateTime_Date *o) +.. c:function:: int PyDateTime_GET_MONTH(PyDateTime_Date *o) Return the month, as an int from 1 through 12. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_GET_DAY(PyDateTime_Date *o) +.. c:function:: int PyDateTime_GET_DAY(PyDateTime_Date *o) Return the day, as an int from 1 through 31. .. versionadded:: 2.4 Macros to extract fields from datetime objects. The argument must be an -instance of :cdata:`PyDateTime_DateTime`, including subclasses. The argument +instance of :c:data:`PyDateTime_DateTime`, including subclasses. The argument must not be *NULL*, and the type is not checked: -.. cfunction:: int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o) +.. c:function:: int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o) Return the hour, as an int from 0 through 23. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o) +.. c:function:: int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o) Return the minute, as an int from 0 through 59. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o) +.. c:function:: int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o) Return the second, as an int from 0 through 59. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o) +.. c:function:: int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o) Return the microsecond, as an int from 0 through 999999. .. versionadded:: 2.4 Macros to extract fields from time objects. The argument must be an instance of -:cdata:`PyDateTime_Time`, including subclasses. The argument must not be *NULL*, +:c:data:`PyDateTime_Time`, including subclasses. The argument must not be *NULL*, and the type is not checked: -.. cfunction:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o) +.. c:function:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o) Return the hour, as an int from 0 through 23. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o) +.. c:function:: int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o) Return the minute, as an int from 0 through 59. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o) +.. c:function:: int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o) Return the second, as an int from 0 through 59. .. versionadded:: 2.4 -.. cfunction:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o) +.. c:function:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o) Return the microsecond, as an int from 0 through 999999. @@ -223,7 +223,7 @@ Macros for the convenience of modules implementing the DB API: -.. cfunction:: PyObject* PyDateTime_FromTimestamp(PyObject *args) +.. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args) Create and return a new ``datetime.datetime`` object given an argument tuple suitable for passing to ``datetime.datetime.fromtimestamp()``. @@ -231,7 +231,7 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PyDate_FromTimestamp(PyObject *args) +.. c:function:: PyObject* PyDate_FromTimestamp(PyObject *args) Create and return a new ``datetime.date`` object given an argument tuple suitable for passing to ``datetime.date.fromtimestamp()``. diff --git a/Doc/c-api/descriptor.rst b/Doc/c-api/descriptor.rst --- a/Doc/c-api/descriptor.rst +++ b/Doc/c-api/descriptor.rst @@ -9,39 +9,39 @@ found in the dictionary of type objects. -.. cvar:: PyTypeObject PyProperty_Type +.. c:var:: PyTypeObject PyProperty_Type The type object for the built-in descriptor types. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset) +.. c:function:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset) .. versionadded:: 2.2 -.. cfunction:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth) +.. c:function:: PyObject* PyDescr_NewMember(PyTypeObject *type, struct PyMemberDef *meth) .. versionadded:: 2.2 -.. cfunction:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth) +.. c:function:: PyObject* PyDescr_NewMethod(PyTypeObject *type, struct PyMethodDef *meth) .. versionadded:: 2.2 -.. cfunction:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped) +.. c:function:: PyObject* PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *wrapper, void *wrapped) .. versionadded:: 2.2 -.. cfunction:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method) +.. c:function:: PyObject* PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method) .. versionadded:: 2.3 -.. cfunction:: int PyDescr_IsData(PyObject *descr) +.. c:function:: int PyDescr_IsData(PyObject *descr) Return true if the descriptor objects *descr* describes a data attribute, or false if it describes a method. *descr* must be a descriptor object; there is @@ -50,6 +50,6 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyWrapper_New(PyObject *, PyObject *) +.. c:function:: PyObject* PyWrapper_New(PyObject *, PyObject *) .. versionadded:: 2.2 diff --git a/Doc/c-api/dict.rst b/Doc/c-api/dict.rst --- a/Doc/c-api/dict.rst +++ b/Doc/c-api/dict.rst @@ -8,23 +8,23 @@ .. index:: object: dictionary -.. ctype:: PyDictObject +.. c:type:: PyDictObject - This subtype of :ctype:`PyObject` represents a Python dictionary object. + This subtype of :c:type:`PyObject` represents a Python dictionary object. -.. cvar:: PyTypeObject PyDict_Type +.. c:var:: PyTypeObject PyDict_Type .. index:: single: DictType (in module types) single: DictionaryType (in module types) - This instance of :ctype:`PyTypeObject` represents the Python dictionary + This instance of :c:type:`PyTypeObject` represents the Python dictionary type. This is exposed to Python programs as ``dict`` and ``types.DictType``. -.. cfunction:: int PyDict_Check(PyObject *p) +.. c:function:: int PyDict_Check(PyObject *p) Return true if *p* is a dict object or an instance of a subtype of the dict type. @@ -33,7 +33,7 @@ Allowed subtypes to be accepted. -.. cfunction:: int PyDict_CheckExact(PyObject *p) +.. c:function:: int PyDict_CheckExact(PyObject *p) Return true if *p* is a dict object, but not an instance of a subtype of the dict type. @@ -41,12 +41,12 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PyDict_New() +.. c:function:: PyObject* PyDict_New() Return a new empty dictionary, or *NULL* on failure. -.. cfunction:: PyObject* PyDictProxy_New(PyObject *dict) +.. c:function:: PyObject* PyDictProxy_New(PyObject *dict) Return a proxy object for a mapping which enforces read-only behavior. This is normally used to create a proxy to prevent modification of the @@ -55,12 +55,12 @@ .. versionadded:: 2.2 -.. cfunction:: void PyDict_Clear(PyObject *p) +.. c:function:: void PyDict_Clear(PyObject *p) Empty an existing dictionary of all key-value pairs. -.. cfunction:: int PyDict_Contains(PyObject *p, PyObject *key) +.. c:function:: int PyDict_Contains(PyObject *p, PyObject *key) Determine if dictionary *p* contains *key*. If an item in *p* is matches *key*, return ``1``, otherwise return ``0``. On error, return ``-1``. @@ -69,74 +69,74 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PyDict_Copy(PyObject *p) +.. c:function:: PyObject* PyDict_Copy(PyObject *p) Return a new dictionary that contains the same key-value pairs as *p*. .. versionadded:: 1.6 -.. cfunction:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val) +.. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val) Insert *value* into the dictionary *p* with a key of *key*. *key* must be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` on success or ``-1`` on failure. -.. cfunction:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val) +.. c:function:: int PyDict_SetItemString(PyObject *p, const char *key, PyObject *val) .. index:: single: PyString_FromString() Insert *value* into the dictionary *p* using *key* as a key. *key* should - be a :ctype:`char\*`. The key object is created using + be a :c:type:`char\*`. The key object is created using ``PyString_FromString(key)``. Return ``0`` on success or ``-1`` on failure. -.. cfunction:: int PyDict_DelItem(PyObject *p, PyObject *key) +.. c:function:: int PyDict_DelItem(PyObject *p, PyObject *key) Remove the entry in dictionary *p* with key *key*. *key* must be hashable; if it isn't, :exc:`TypeError` is raised. Return ``0`` on success or ``-1`` on failure. -.. cfunction:: int PyDict_DelItemString(PyObject *p, char *key) +.. c:function:: int PyDict_DelItemString(PyObject *p, char *key) Remove the entry in dictionary *p* which has a key specified by the string *key*. Return ``0`` on success or ``-1`` on failure. -.. cfunction:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key) +.. c:function:: PyObject* PyDict_GetItem(PyObject *p, PyObject *key) Return the object from dictionary *p* which has a key *key*. Return *NULL* if the key *key* is not present, but *without* setting an exception. -.. cfunction:: PyObject* PyDict_GetItemString(PyObject *p, const char *key) +.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key) - This is the same as :cfunc:`PyDict_GetItem`, but *key* is specified as a - :ctype:`char\*`, rather than a :ctype:`PyObject\*`. + This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a + :c:type:`char\*`, rather than a :c:type:`PyObject\*`. -.. cfunction:: PyObject* PyDict_Items(PyObject *p) +.. c:function:: PyObject* PyDict_Items(PyObject *p) - Return a :ctype:`PyListObject` containing all the items from the + Return a :c:type:`PyListObject` containing all the items from the dictionary, as in the dictionary method :meth:`dict.items`. -.. cfunction:: PyObject* PyDict_Keys(PyObject *p) +.. c:function:: PyObject* PyDict_Keys(PyObject *p) - Return a :ctype:`PyListObject` containing all the keys from the dictionary, + Return a :c:type:`PyListObject` containing all the keys from the dictionary, as in the dictionary method :meth:`dict.keys`. -.. cfunction:: PyObject* PyDict_Values(PyObject *p) +.. c:function:: PyObject* PyDict_Values(PyObject *p) - Return a :ctype:`PyListObject` containing all the values from the + Return a :c:type:`PyListObject` containing all the values from the dictionary *p*, as in the dictionary method :meth:`dict.values`. -.. cfunction:: Py_ssize_t PyDict_Size(PyObject *p) +.. c:function:: Py_ssize_t PyDict_Size(PyObject *p) .. index:: builtin: len @@ -144,18 +144,18 @@ ``len(p)`` on a dictionary. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) +.. c:function:: int PyDict_Next(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) Iterate over all key-value pairs in the dictionary *p*. The - :ctype:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` + :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the first call to this function to start the iteration; the function returns true for each pair in the dictionary, and false once all pairs have been reported. The parameters *pkey* and *pvalue* should either - point to :ctype:`PyObject\*` variables that will be filled in with each key + point to :c:type:`PyObject\*` variables that will be filled in with each key and value, respectively, or may be *NULL*. Any references returned through them are borrowed. *ppos* should not be altered during iteration. Its value represents offsets within the internal dictionary structure, and @@ -192,15 +192,15 @@ } .. versionchanged:: 2.5 - This function used an :ctype:`int *` type for *ppos*. This might require + This function used an :c:type:`int *` type for *ppos*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyDict_Merge(PyObject *a, PyObject *b, int override) +.. c:function:: int PyDict_Merge(PyObject *a, PyObject *b, int override) Iterate over mapping object *b* adding key-value pairs to dictionary *a*. - *b* may be a dictionary, or any object supporting :cfunc:`PyMapping_Keys` - and :cfunc:`PyObject_GetItem`. If *override* is true, existing pairs in *a* + *b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` + and :c:func:`PyObject_GetItem`. If *override* is true, existing pairs in *a* will be replaced if a matching key is found in *b*, otherwise pairs will only be added if there is not a matching key in *a*. Return ``0`` on success or ``-1`` if an exception was raised. @@ -208,7 +208,7 @@ .. versionadded:: 2.2 -.. cfunction:: int PyDict_Update(PyObject *a, PyObject *b) +.. c:function:: int PyDict_Update(PyObject *a, PyObject *b) This is the same as ``PyDict_Merge(a, b, 1)`` in C, or ``a.update(b)`` in Python. Return ``0`` on success or ``-1`` if an exception was raised. @@ -216,7 +216,7 @@ .. versionadded:: 2.2 -.. cfunction:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override) +.. c:function:: int PyDict_MergeFromSeq2(PyObject *a, PyObject *seq2, int override) Update or merge into dictionary *a*, from the key-value pairs in *seq2*. *seq2* must be an iterable object producing iterable objects of length 2, diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -9,12 +9,12 @@ The functions described in this chapter will let you handle and raise Python exceptions. It is important to understand some of the basics of Python -exception handling. It works somewhat like the Unix :cdata:`errno` variable: +exception handling. It works somewhat like the Unix :c:data:`errno` variable: there is a global indicator (per thread) of the last error that occurred. Most functions don't clear this on success, but will set it to indicate the cause of the error on failure. Most functions also return an error indicator, usually *NULL* if they are supposed to return a pointer, or ``-1`` if they return an -integer (exception: the :cfunc:`PyArg_\*` functions return ``1`` for success and +integer (exception: the :c:func:`PyArg_\*` functions return ``1`` for success and ``0`` for failure). When a function must fail because some function it called failed, it generally @@ -41,7 +41,7 @@ Either alphabetical or some kind of structure. -.. cfunction:: void PyErr_PrintEx(int set_sys_last_vars) +.. c:function:: void PyErr_PrintEx(int set_sys_last_vars) Print a standard traceback to ``sys.stderr`` and clear the error indicator. Call this function only when the error indicator is set. (Otherwise it will @@ -52,35 +52,35 @@ type, value and traceback of the printed exception, respectively. -.. cfunction:: void PyErr_Print() +.. c:function:: void PyErr_Print() Alias for ``PyErr_PrintEx(1)``. -.. cfunction:: PyObject* PyErr_Occurred() +.. c:function:: PyObject* PyErr_Occurred() Test whether the error indicator is set. If set, return the exception *type* - (the first argument to the last call to one of the :cfunc:`PyErr_Set\*` - functions or to :cfunc:`PyErr_Restore`). If not set, return *NULL*. You do not - own a reference to the return value, so you do not need to :cfunc:`Py_DECREF` + (the first argument to the last call to one of the :c:func:`PyErr_Set\*` + functions or to :c:func:`PyErr_Restore`). If not set, return *NULL*. You do not + own a reference to the return value, so you do not need to :c:func:`Py_DECREF` it. .. note:: Do not compare the return value to a specific exception; use - :cfunc:`PyErr_ExceptionMatches` instead, shown below. (The comparison could + :c:func:`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily fail since the exception may be an instance instead of a class, in the case of a class exception, or it may the a subclass of the expected exception.) -.. cfunction:: int PyErr_ExceptionMatches(PyObject *exc) +.. c:function:: int PyErr_ExceptionMatches(PyObject *exc) Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This should only be called when an exception is actually set; a memory access violation will occur if no exception has been raised. -.. cfunction:: int PyErr_GivenExceptionMatches(PyObject *given, PyObject *exc) +.. c:function:: int PyErr_GivenExceptionMatches(PyObject *given, PyObject *exc) Return true if the *given* exception matches the exception in *exc*. If *exc* is a class object, this also returns true when *given* is an instance @@ -88,22 +88,22 @@ recursively in subtuples) are searched for a match. -.. cfunction:: void PyErr_NormalizeException(PyObject**exc, PyObject**val, PyObject**tb) +.. c:function:: void PyErr_NormalizeException(PyObject**exc, PyObject**val, PyObject**tb) - Under certain circumstances, the values returned by :cfunc:`PyErr_Fetch` below + Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` below can be "unnormalized", meaning that ``*exc`` is a class object but ``*val`` is not an instance of the same class. This function can be used to instantiate the class in that case. If the values are already normalized, nothing happens. The delayed normalization is implemented to improve performance. -.. cfunction:: void PyErr_Clear() +.. c:function:: void PyErr_Clear() Clear the error indicator. If the error indicator is not set, there is no effect. -.. cfunction:: void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback) +.. c:function:: void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback) Retrieve the error indicator into three variables whose addresses are passed. If the error indicator is not set, set all three variables to *NULL*. If it is @@ -116,7 +116,7 @@ by code that needs to save and restore the error indicator temporarily. -.. cfunction:: void PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback) +.. c:function:: void PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback) Set the error indicator from the three objects. If the error indicator is already set, it is cleared first. If the objects are *NULL*, the error @@ -131,111 +131,111 @@ .. note:: This function is normally only used by code that needs to save and restore the - error indicator temporarily; use :cfunc:`PyErr_Fetch` to save the current + error indicator temporarily; use :c:func:`PyErr_Fetch` to save the current exception state. -.. cfunction:: void PyErr_SetString(PyObject *type, const char *message) +.. c:function:: void PyErr_SetString(PyObject *type, const char *message) This is the most common way to set the error indicator. The first argument specifies the exception type; it is normally one of the standard exceptions, - e.g. :cdata:`PyExc_RuntimeError`. You need not increment its reference count. + e.g. :c:data:`PyExc_RuntimeError`. You need not increment its reference count. The second argument is an error message; it is converted to a string object. -.. cfunction:: void PyErr_SetObject(PyObject *type, PyObject *value) +.. c:function:: void PyErr_SetObject(PyObject *type, PyObject *value) - This function is similar to :cfunc:`PyErr_SetString` but lets you specify an + This function is similar to :c:func:`PyErr_SetString` but lets you specify an arbitrary Python object for the "value" of the exception. -.. cfunction:: PyObject* PyErr_Format(PyObject *exception, const char *format, ...) +.. c:function:: PyObject* PyErr_Format(PyObject *exception, const char *format, ...) This function sets the error indicator and returns *NULL*. *exception* should be a Python exception class. The *format* and subsequent parameters help format the error message; they have the same meaning and - values as in :cfunc:`PyString_FromFormat`. + values as in :c:func:`PyString_FromFormat`. -.. cfunction:: void PyErr_SetNone(PyObject *type) +.. c:function:: void PyErr_SetNone(PyObject *type) This is a shorthand for ``PyErr_SetObject(type, Py_None)``. -.. cfunction:: int PyErr_BadArgument() +.. c:function:: int PyErr_BadArgument() This is a shorthand for ``PyErr_SetString(PyExc_TypeError, message)``, where *message* indicates that a built-in operation was invoked with an illegal argument. It is mostly for internal use. -.. cfunction:: PyObject* PyErr_NoMemory() +.. c:function:: PyObject* PyErr_NoMemory() This is a shorthand for ``PyErr_SetNone(PyExc_MemoryError)``; it returns *NULL* so an object allocation function can write ``return PyErr_NoMemory();`` when it runs out of memory. -.. cfunction:: PyObject* PyErr_SetFromErrno(PyObject *type) +.. c:function:: PyObject* PyErr_SetFromErrno(PyObject *type) .. index:: single: strerror() This is a convenience function to raise an exception when a C library function - has returned an error and set the C variable :cdata:`errno`. It constructs a - tuple object whose first item is the integer :cdata:`errno` value and whose - second item is the corresponding error message (gotten from :cfunc:`strerror`), + has returned an error and set the C variable :c:data:`errno`. It constructs a + tuple object whose first item is the integer :c:data:`errno` value and whose + second item is the corresponding error message (gotten from :c:func:`strerror`), and then calls ``PyErr_SetObject(type, object)``. On Unix, when the - :cdata:`errno` value is :const:`EINTR`, indicating an interrupted system call, - this calls :cfunc:`PyErr_CheckSignals`, and if that set the error indicator, + :c:data:`errno` value is :const:`EINTR`, indicating an interrupted system call, + this calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator, leaves it set to that. The function always returns *NULL*, so a wrapper function around a system call can write ``return PyErr_SetFromErrno(type);`` when the system call returns an error. -.. cfunction:: PyObject* PyErr_SetFromErrnoWithFilename(PyObject *type, const char *filename) +.. c:function:: PyObject* PyErr_SetFromErrnoWithFilename(PyObject *type, const char *filename) - Similar to :cfunc:`PyErr_SetFromErrno`, with the additional behavior that if + Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that if *filename* is not *NULL*, it is passed to the constructor of *type* as a third parameter. In the case of exceptions such as :exc:`IOError` and :exc:`OSError`, this is used to define the :attr:`filename` attribute of the exception instance. -.. cfunction:: PyObject* PyErr_SetFromWindowsErr(int ierr) +.. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr) This is a convenience function to raise :exc:`WindowsError`. If called with - *ierr* of :cdata:`0`, the error code returned by a call to :cfunc:`GetLastError` - is used instead. It calls the Win32 function :cfunc:`FormatMessage` to retrieve - the Windows description of error code given by *ierr* or :cfunc:`GetLastError`, + *ierr* of :c:data:`0`, the error code returned by a call to :c:func:`GetLastError` + is used instead. It calls the Win32 function :c:func:`FormatMessage` to retrieve + the Windows description of error code given by *ierr* or :c:func:`GetLastError`, then it constructs a tuple object whose first item is the *ierr* value and whose second item is the corresponding error message (gotten from - :cfunc:`FormatMessage`), and then calls ``PyErr_SetObject(PyExc_WindowsError, + :c:func:`FormatMessage`), and then calls ``PyErr_SetObject(PyExc_WindowsError, object)``. This function always returns *NULL*. Availability: Windows. -.. cfunction:: PyObject* PyErr_SetExcFromWindowsErr(PyObject *type, int ierr) +.. c:function:: PyObject* PyErr_SetExcFromWindowsErr(PyObject *type, int ierr) - Similar to :cfunc:`PyErr_SetFromWindowsErr`, with an additional parameter + Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter specifying the exception type to be raised. Availability: Windows. .. versionadded:: 2.3 -.. cfunction:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename) +.. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename) - Similar to :cfunc:`PyErr_SetFromWindowsErr`, with the additional behavior that + Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior that if *filename* is not *NULL*, it is passed to the constructor of :exc:`WindowsError` as a third parameter. Availability: Windows. -.. cfunction:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, char *filename) +.. c:function:: PyObject* PyErr_SetExcFromWindowsErrWithFilename(PyObject *type, int ierr, char *filename) - Similar to :cfunc:`PyErr_SetFromWindowsErrWithFilename`, with an additional + Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional parameter specifying the exception type to be raised. Availability: Windows. .. versionadded:: 2.3 -.. cfunction:: void PyErr_BadInternalCall() +.. c:function:: void PyErr_BadInternalCall() This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, where *message* indicates that an internal operation (e.g. a Python/C API @@ -243,13 +243,13 @@ use. -.. cfunction:: int PyErr_WarnEx(PyObject *category, char *message, int stacklevel) +.. c:function:: int PyErr_WarnEx(PyObject *category, char *message, int stacklevel) Issue a warning message. The *category* argument is a warning category (see below) or *NULL*; the *message* argument is a message string. *stacklevel* is a positive number giving a number of stack frames; the warning will be issued from the currently executing line of code in that stack frame. A *stacklevel* of 1 - is the function calling :cfunc:`PyErr_WarnEx`, 2 is the function above that, + is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that, and so forth. This function normally prints a warning message to *sys.stderr*; however, it is @@ -261,36 +261,36 @@ is raised. (It is not possible to determine whether a warning message is actually printed, nor what the reason is for the exception; this is intentional.) If an exception is raised, the caller should do its normal - exception handling (for example, :cfunc:`Py_DECREF` owned references and return + exception handling (for example, :c:func:`Py_DECREF` owned references and return an error value). - Warning categories must be subclasses of :cdata:`Warning`; the default warning - category is :cdata:`RuntimeWarning`. The standard Python warning categories are + Warning categories must be subclasses of :c:data:`Warning`; the default warning + category is :c:data:`RuntimeWarning`. The standard Python warning categories are available as global variables whose names are ``PyExc_`` followed by the Python - exception name. These have the type :ctype:`PyObject\*`; they are all class - objects. Their names are :cdata:`PyExc_Warning`, :cdata:`PyExc_UserWarning`, - :cdata:`PyExc_UnicodeWarning`, :cdata:`PyExc_DeprecationWarning`, - :cdata:`PyExc_SyntaxWarning`, :cdata:`PyExc_RuntimeWarning`, and - :cdata:`PyExc_FutureWarning`. :cdata:`PyExc_Warning` is a subclass of - :cdata:`PyExc_Exception`; the other warning categories are subclasses of - :cdata:`PyExc_Warning`. + exception name. These have the type :c:type:`PyObject\*`; they are all class + objects. Their names are :c:data:`PyExc_Warning`, :c:data:`PyExc_UserWarning`, + :c:data:`PyExc_UnicodeWarning`, :c:data:`PyExc_DeprecationWarning`, + :c:data:`PyExc_SyntaxWarning`, :c:data:`PyExc_RuntimeWarning`, and + :c:data:`PyExc_FutureWarning`. :c:data:`PyExc_Warning` is a subclass of + :c:data:`PyExc_Exception`; the other warning categories are subclasses of + :c:data:`PyExc_Warning`. For information about warning control, see the documentation for the :mod:`warnings` module and the :option:`-W` option in the command line documentation. There is no C API for warning control. -.. cfunction:: int PyErr_Warn(PyObject *category, char *message) +.. c:function:: int PyErr_Warn(PyObject *category, char *message) Issue a warning message. The *category* argument is a warning category (see below) or *NULL*; the *message* argument is a message string. The warning will - appear to be issued from the function calling :cfunc:`PyErr_Warn`, equivalent to - calling :cfunc:`PyErr_WarnEx` with a *stacklevel* of 1. + appear to be issued from the function calling :c:func:`PyErr_Warn`, equivalent to + calling :c:func:`PyErr_WarnEx` with a *stacklevel* of 1. - Deprecated; use :cfunc:`PyErr_WarnEx` instead. + Deprecated; use :c:func:`PyErr_WarnEx` instead. -.. cfunction:: int PyErr_WarnExplicit(PyObject *category, const char *message, const char *filename, int lineno, const char *module, PyObject *registry) +.. c:function:: int PyErr_WarnExplicit(PyObject *category, const char *message, const char *filename, int lineno, const char *module, PyObject *registry) Issue a warning message with explicit control over all warning attributes. This is a straightforward wrapper around the Python function @@ -299,15 +299,15 @@ described there. -.. cfunction:: int PyErr_WarnPy3k(char *message, int stacklevel) +.. c:function:: int PyErr_WarnPy3k(char *message, int stacklevel) Issue a :exc:`DeprecationWarning` with the given *message* and *stacklevel* - if the :cdata:`Py_Py3kWarningFlag` flag is enabled. + if the :c:data:`Py_Py3kWarningFlag` flag is enabled. .. versionadded:: 2.6 -.. cfunction:: int PyErr_CheckSignals() +.. c:function:: int PyErr_CheckSignals() .. index:: module: signal @@ -324,21 +324,21 @@ cleared if it was previously set. -.. cfunction:: void PyErr_SetInterrupt() +.. c:function:: void PyErr_SetInterrupt() .. index:: single: SIGINT single: KeyboardInterrupt (built-in exception) This function simulates the effect of a :const:`SIGINT` signal arriving --- the - next time :cfunc:`PyErr_CheckSignals` is called, :exc:`KeyboardInterrupt` will + next time :c:func:`PyErr_CheckSignals` is called, :exc:`KeyboardInterrupt` will be raised. It may be called without holding the interpreter lock. .. % XXX This was described as obsolete, but is used in .. % thread.interrupt_main() (used from IDLE), so it's still needed. -.. cfunction:: int PySignal_SetWakeupFd(int fd) +.. c:function:: int PySignal_SetWakeupFd(int fd) This utility function specifies a file descriptor to which a ``'\0'`` byte will be written whenever a signal is received. It returns the previous such file @@ -350,13 +350,13 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict) +.. c:function:: PyObject* PyErr_NewException(char *name, PyObject *base, PyObject *dict) This utility function creates and returns a new exception class. The *name* argument must be the name of the new exception, a C string of the form ``module.classname``. The *base* and *dict* arguments are normally *NULL*. This creates a class object derived from :exc:`Exception` (accessible in C as - :cdata:`PyExc_Exception`). + :c:data:`PyExc_Exception`). The :attr:`__module__` attribute of the new class is set to the first part (up to the last dot) of the *name* argument, and the class name is set to the last @@ -365,16 +365,16 @@ argument can be used to specify a dictionary of class variables and methods. -.. cfunction:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict) +.. c:function:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict) - Same as :cfunc:`PyErr_NewException`, except that the new exception class can + Same as :c:func:`PyErr_NewException`, except that the new exception class can easily be given a docstring: If *doc* is non-*NULL*, it will be used as the docstring for the exception class. .. versionadded:: 2.7 -.. cfunction:: void PyErr_WriteUnraisable(PyObject *obj) +.. c:function:: void PyErr_WriteUnraisable(PyObject *obj) This utility function prints a warning message to ``sys.stderr`` when an exception has been set but it is impossible for the interpreter to actually @@ -393,33 +393,33 @@ The following functions are used to create and modify Unicode exceptions from C. -.. cfunction:: PyObject* PyUnicodeDecodeError_Create(const char *encoding, const char *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) +.. c:function:: PyObject* PyUnicodeDecodeError_Create(const char *encoding, const char *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, *object*, *length*, *start*, *end* and *reason*. -.. cfunction:: PyObject* PyUnicodeEncodeError_Create(const char *encoding, const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) +.. c:function:: PyObject* PyUnicodeEncodeError_Create(const char *encoding, const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) Create a :class:`UnicodeEncodeError` object with the attributes *encoding*, *object*, *length*, *start*, *end* and *reason*. -.. cfunction:: PyObject* PyUnicodeTranslateError_Create(const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) +.. c:function:: PyObject* PyUnicodeTranslateError_Create(const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) Create a :class:`UnicodeTranslateError` object with the attributes *object*, *length*, *start*, *end* and *reason*. -.. cfunction:: PyObject* PyUnicodeDecodeError_GetEncoding(PyObject *exc) +.. c:function:: PyObject* PyUnicodeDecodeError_GetEncoding(PyObject *exc) PyObject* PyUnicodeEncodeError_GetEncoding(PyObject *exc) Return the *encoding* attribute of the given exception object. -.. cfunction:: PyObject* PyUnicodeDecodeError_GetObject(PyObject *exc) +.. c:function:: PyObject* PyUnicodeDecodeError_GetObject(PyObject *exc) PyObject* PyUnicodeEncodeError_GetObject(PyObject *exc) PyObject* PyUnicodeTranslateError_GetObject(PyObject *exc) Return the *object* attribute of the given exception object. -.. cfunction:: int PyUnicodeDecodeError_GetStart(PyObject *exc, Py_ssize_t *start) +.. c:function:: int PyUnicodeDecodeError_GetStart(PyObject *exc, Py_ssize_t *start) int PyUnicodeEncodeError_GetStart(PyObject *exc, Py_ssize_t *start) int PyUnicodeTranslateError_GetStart(PyObject *exc, Py_ssize_t *start) @@ -427,14 +427,14 @@ *\*start*. *start* must not be *NULL*. Return ``0`` on success, ``-1`` on failure. -.. cfunction:: int PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start) +.. c:function:: int PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start) int PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start) int PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start) Set the *start* attribute of the given exception object to *start*. Return ``0`` on success, ``-1`` on failure. -.. cfunction:: int PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end) +.. c:function:: int PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end) int PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end) int PyUnicodeTranslateError_GetEnd(PyObject *exc, Py_ssize_t *end) @@ -442,20 +442,20 @@ *\*end*. *end* must not be *NULL*. Return ``0`` on success, ``-1`` on failure. -.. cfunction:: int PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end) +.. c:function:: int PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end) int PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end) int PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end) Set the *end* attribute of the given exception object to *end*. Return ``0`` on success, ``-1`` on failure. -.. cfunction:: PyObject* PyUnicodeDecodeError_GetReason(PyObject *exc) +.. c:function:: PyObject* PyUnicodeDecodeError_GetReason(PyObject *exc) PyObject* PyUnicodeEncodeError_GetReason(PyObject *exc) PyObject* PyUnicodeTranslateError_GetReason(PyObject *exc) Return the *reason* attribute of the given exception object. -.. cfunction:: int PyUnicodeDecodeError_SetReason(PyObject *exc, const char *reason) +.. c:function:: int PyUnicodeDecodeError_SetReason(PyObject *exc, const char *reason) int PyUnicodeEncodeError_SetReason(PyObject *exc, const char *reason) int PyUnicodeTranslateError_SetReason(PyObject *exc, const char *reason) @@ -471,12 +471,12 @@ recursive code does not necessarily invoke Python code (which tracks its recursion depth automatically). -.. cfunction:: int Py_EnterRecursiveCall(char *where) +.. c:function:: int Py_EnterRecursiveCall(char *where) Marks a point where a recursive C-level call is about to be performed. If :const:`USE_STACKCHECK` is defined, this function checks if the OS - stack overflowed using :cfunc:`PyOS_CheckStack`. In this is the case, it + stack overflowed using :c:func:`PyOS_CheckStack`. In this is the case, it sets a :exc:`MemoryError` and returns a nonzero value. The function then checks if the recursion limit is reached. If this is the @@ -487,10 +487,10 @@ concatenated to the :exc:`RuntimeError` message caused by the recursion depth limit. -.. cfunction:: void Py_LeaveRecursiveCall() +.. c:function:: void Py_LeaveRecursiveCall() - Ends a :cfunc:`Py_EnterRecursiveCall`. Must be called once for each - *successful* invocation of :cfunc:`Py_EnterRecursiveCall`. + Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each + *successful* invocation of :c:func:`Py_EnterRecursiveCall`. .. _standardexceptions: @@ -500,70 +500,70 @@ All standard Python exceptions are available as global variables whose names are ``PyExc_`` followed by the Python exception name. These have the type -:ctype:`PyObject\*`; they are all class objects. For completeness, here are all +:c:type:`PyObject\*`; they are all class objects. For completeness, here are all the variables: -+------------------------------------+----------------------------+----------+ -| C Name | Python Name | Notes | -+====================================+============================+==========+ -| :cdata:`PyExc_BaseException` | :exc:`BaseException` | (1), (4) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_Exception` | :exc:`Exception` | \(1) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_StandardError` | :exc:`StandardError` | \(1) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | \(1) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_LookupError` | :exc:`LookupError` | \(1) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_AssertionError` | :exc:`AssertionError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_AttributeError` | :exc:`AttributeError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_EOFError` | :exc:`EOFError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_EnvironmentError` | :exc:`EnvironmentError` | \(1) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_IOError` | :exc:`IOError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_ImportError` | :exc:`ImportError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_IndexError` | :exc:`IndexError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_KeyError` | :exc:`KeyError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_MemoryError` | :exc:`MemoryError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_NameError` | :exc:`NameError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_NotImplementedError` | :exc:`NotImplementedError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_OSError` | :exc:`OSError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_OverflowError` | :exc:`OverflowError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_ReferenceError` | :exc:`ReferenceError` | \(2) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_RuntimeError` | :exc:`RuntimeError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_SyntaxError` | :exc:`SyntaxError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_SystemError` | :exc:`SystemError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_SystemExit` | :exc:`SystemExit` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_TypeError` | :exc:`TypeError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_ValueError` | :exc:`ValueError` | | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_WindowsError` | :exc:`WindowsError` | \(3) | -+------------------------------------+----------------------------+----------+ -| :cdata:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | | -+------------------------------------+----------------------------+----------+ ++-------------------------------------+----------------------------+----------+ +| C Name | Python Name | Notes | ++=====================================+============================+==========+ +| :c:data:`PyExc_BaseException` | :exc:`BaseException` | (1), (4) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_Exception` | :exc:`Exception` | \(1) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_StandardError` | :exc:`StandardError` | \(1) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | \(1) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_EOFError` | :exc:`EOFError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_EnvironmentError` | :exc:`EnvironmentError` | \(1) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_IOError` | :exc:`IOError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_ImportError` | :exc:`ImportError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_IndexError` | :exc:`IndexError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_KeyError` | :exc:`KeyError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_NameError` | :exc:`NameError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_NotImplementedError` | :exc:`NotImplementedError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_OSError` | :exc:`OSError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_OverflowError` | :exc:`OverflowError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_ReferenceError` | :exc:`ReferenceError` | \(2) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_SystemError` | :exc:`SystemError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_TypeError` | :exc:`TypeError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_ValueError` | :exc:`ValueError` | | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_WindowsError` | :exc:`WindowsError` | \(3) | ++-------------------------------------+----------------------------+----------+ +| :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | | ++-------------------------------------+----------------------------+----------+ .. index:: single: PyExc_BaseException diff --git a/Doc/c-api/file.rst b/Doc/c-api/file.rst --- a/Doc/c-api/file.rst +++ b/Doc/c-api/file.rst @@ -7,79 +7,79 @@ .. index:: object: file -Python's built-in file objects are implemented entirely on the :ctype:`FILE\*` +Python's built-in file objects are implemented entirely on the :c:type:`FILE\*` support from the C standard library. This is an implementation detail and may change in future releases of Python. -.. ctype:: PyFileObject +.. c:type:: PyFileObject - This subtype of :ctype:`PyObject` represents a Python file object. + This subtype of :c:type:`PyObject` represents a Python file object. -.. cvar:: PyTypeObject PyFile_Type +.. c:var:: PyTypeObject PyFile_Type .. index:: single: FileType (in module types) - This instance of :ctype:`PyTypeObject` represents the Python file type. This is + This instance of :c:type:`PyTypeObject` represents the Python file type. This is exposed to Python programs as ``file`` and ``types.FileType``. -.. cfunction:: int PyFile_Check(PyObject *p) +.. c:function:: int PyFile_Check(PyObject *p) - Return true if its argument is a :ctype:`PyFileObject` or a subtype of - :ctype:`PyFileObject`. + Return true if its argument is a :c:type:`PyFileObject` or a subtype of + :c:type:`PyFileObject`. .. versionchanged:: 2.2 Allowed subtypes to be accepted. -.. cfunction:: int PyFile_CheckExact(PyObject *p) +.. c:function:: int PyFile_CheckExact(PyObject *p) - Return true if its argument is a :ctype:`PyFileObject`, but not a subtype of - :ctype:`PyFileObject`. + Return true if its argument is a :c:type:`PyFileObject`, but not a subtype of + :c:type:`PyFileObject`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyFile_FromString(char *filename, char *mode) +.. c:function:: PyObject* PyFile_FromString(char *filename, char *mode) .. index:: single: fopen() On success, return a new file object that is opened on the file given by *filename*, with a file mode given by *mode*, where *mode* has the same - semantics as the standard C routine :cfunc:`fopen`. On failure, return *NULL*. + semantics as the standard C routine :c:func:`fopen`. On failure, return *NULL*. -.. cfunction:: PyObject* PyFile_FromFile(FILE *fp, char *name, char *mode, int (*close)(FILE*)) +.. c:function:: PyObject* PyFile_FromFile(FILE *fp, char *name, char *mode, int (*close)(FILE*)) - Create a new :ctype:`PyFileObject` from the already-open standard C file + Create a new :c:type:`PyFileObject` from the already-open standard C file pointer, *fp*. The function *close* will be called when the file should be closed. Return *NULL* and close the file using *close* on failure. *close* is optional and can be set to *NULL*. -.. cfunction:: FILE* PyFile_AsFile(PyObject \*p) +.. c:function:: FILE* PyFile_AsFile(PyObject \*p) - Return the file object associated with *p* as a :ctype:`FILE\*`. + Return the file object associated with *p* as a :c:type:`FILE\*`. - If the caller will ever use the returned :ctype:`FILE\*` object while - the :term:`GIL` is released it must also call the :cfunc:`PyFile_IncUseCount` and - :cfunc:`PyFile_DecUseCount` functions described below as appropriate. + If the caller will ever use the returned :c:type:`FILE\*` object while + the :term:`GIL` is released it must also call the :c:func:`PyFile_IncUseCount` and + :c:func:`PyFile_DecUseCount` functions described below as appropriate. -.. cfunction:: void PyFile_IncUseCount(PyFileObject \*p) +.. c:function:: void PyFile_IncUseCount(PyFileObject \*p) Increments the PyFileObject's internal use count to indicate - that the underlying :ctype:`FILE\*` is being used. + that the underlying :c:type:`FILE\*` is being used. This prevents Python from calling f_close() on it from another thread. - Callers of this must call :cfunc:`PyFile_DecUseCount` when they are - finished with the :ctype:`FILE\*`. Otherwise the file object will + Callers of this must call :c:func:`PyFile_DecUseCount` when they are + finished with the :c:type:`FILE\*`. Otherwise the file object will never be closed by Python. The :term:`GIL` must be held while calling this function. - The suggested use is to call this after :cfunc:`PyFile_AsFile` and before + The suggested use is to call this after :c:func:`PyFile_AsFile` and before you release the GIL:: FILE *fp = PyFile_AsFile(p); @@ -94,11 +94,11 @@ .. versionadded:: 2.6 -.. cfunction:: void PyFile_DecUseCount(PyFileObject \*p) +.. c:function:: void PyFile_DecUseCount(PyFileObject \*p) Decrements the PyFileObject's internal unlocked_count member to - indicate that the caller is done with its own use of the :ctype:`FILE\*`. - This may only be called to undo a prior call to :cfunc:`PyFile_IncUseCount`. + indicate that the caller is done with its own use of the :c:type:`FILE\*`. + This may only be called to undo a prior call to :c:func:`PyFile_IncUseCount`. The :term:`GIL` must be held while calling this function (see the example above). @@ -106,7 +106,7 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyFile_GetLine(PyObject *p, int n) +.. c:function:: PyObject* PyFile_GetLine(PyObject *p, int n) .. index:: single: EOFError (built-in exception) @@ -120,20 +120,20 @@ raised if the end of the file is reached immediately. -.. cfunction:: PyObject* PyFile_Name(PyObject *p) +.. c:function:: PyObject* PyFile_Name(PyObject *p) Return the name of the file specified by *p* as a string object. -.. cfunction:: void PyFile_SetBufSize(PyFileObject *p, int n) +.. c:function:: void PyFile_SetBufSize(PyFileObject *p, int n) .. index:: single: setvbuf() - Available on systems with :cfunc:`setvbuf` only. This should only be called + Available on systems with :c:func:`setvbuf` only. This should only be called immediately after file object creation. -.. cfunction:: int PyFile_SetEncoding(PyFileObject *p, const char *enc) +.. c:function:: int PyFile_SetEncoding(PyFileObject *p, const char *enc) Set the file's encoding for Unicode output to *enc*. Return 1 on success and 0 on failure. @@ -141,7 +141,7 @@ .. versionadded:: 2.3 -.. cfunction:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors) +.. c:function:: int PyFile_SetEncodingAndErrors(PyFileObject *p, const char *enc, *errors) Set the file's encoding for Unicode output to *enc*, and its error mode to *err*. Return 1 on success and 0 on failure. @@ -149,7 +149,7 @@ .. versionadded:: 2.6 -.. cfunction:: int PyFile_SoftSpace(PyObject *p, int newflag) +.. c:function:: int PyFile_SoftSpace(PyObject *p, int newflag) .. index:: single: softspace (file attribute) @@ -163,7 +163,7 @@ but doing so should not be needed. -.. cfunction:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags) +.. c:function:: int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags) .. index:: single: Py_PRINT_RAW @@ -173,7 +173,7 @@ appropriate exception will be set. -.. cfunction:: int PyFile_WriteString(const char *s, PyObject *p) +.. c:function:: int PyFile_WriteString(const char *s, PyObject *p) Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on failure; the appropriate exception will be set. diff --git a/Doc/c-api/float.rst b/Doc/c-api/float.rst --- a/Doc/c-api/float.rst +++ b/Doc/c-api/float.rst @@ -8,64 +8,64 @@ .. index:: object: floating point -.. ctype:: PyFloatObject +.. c:type:: PyFloatObject - This subtype of :ctype:`PyObject` represents a Python floating point object. + This subtype of :c:type:`PyObject` represents a Python floating point object. -.. cvar:: PyTypeObject PyFloat_Type +.. c:var:: PyTypeObject PyFloat_Type .. index:: single: FloatType (in modules types) - This instance of :ctype:`PyTypeObject` represents the Python floating point + This instance of :c:type:`PyTypeObject` represents the Python floating point type. This is the same object as ``float`` and ``types.FloatType``. -.. cfunction:: int PyFloat_Check(PyObject *p) +.. c:function:: int PyFloat_Check(PyObject *p) - Return true if its argument is a :ctype:`PyFloatObject` or a subtype of - :ctype:`PyFloatObject`. + Return true if its argument is a :c:type:`PyFloatObject` or a subtype of + :c:type:`PyFloatObject`. .. versionchanged:: 2.2 Allowed subtypes to be accepted. -.. cfunction:: int PyFloat_CheckExact(PyObject *p) +.. c:function:: int PyFloat_CheckExact(PyObject *p) - Return true if its argument is a :ctype:`PyFloatObject`, but not a subtype of - :ctype:`PyFloatObject`. + Return true if its argument is a :c:type:`PyFloatObject`, but not a subtype of + :c:type:`PyFloatObject`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyFloat_FromString(PyObject *str, char **pend) +.. c:function:: PyObject* PyFloat_FromString(PyObject *str, char **pend) - Create a :ctype:`PyFloatObject` object based on the string value in *str*, or + Create a :c:type:`PyFloatObject` object based on the string value in *str*, or *NULL* on failure. The *pend* argument is ignored. It remains only for backward compatibility. -.. cfunction:: PyObject* PyFloat_FromDouble(double v) +.. c:function:: PyObject* PyFloat_FromDouble(double v) - Create a :ctype:`PyFloatObject` object from *v*, or *NULL* on failure. + Create a :c:type:`PyFloatObject` object from *v*, or *NULL* on failure. -.. cfunction:: double PyFloat_AsDouble(PyObject *pyfloat) +.. c:function:: double PyFloat_AsDouble(PyObject *pyfloat) - Return a C :ctype:`double` representation of the contents of *pyfloat*. If + Return a C :c:type:`double` representation of the contents of *pyfloat*. If *pyfloat* is not a Python floating point object but has a :meth:`__float__` method, this method will first be called to convert *pyfloat* into a float. This method returns ``-1.0`` upon failure, so one should call - :cfunc:`PyErr_Occurred` to check for errors. + :c:func:`PyErr_Occurred` to check for errors. -.. cfunction:: double PyFloat_AS_DOUBLE(PyObject *pyfloat) +.. c:function:: double PyFloat_AS_DOUBLE(PyObject *pyfloat) - Return a C :ctype:`double` representation of the contents of *pyfloat*, but + Return a C :c:type:`double` representation of the contents of *pyfloat*, but without error checking. -.. cfunction:: PyObject* PyFloat_GetInfo(void) +.. c:function:: PyObject* PyFloat_GetInfo(void) Return a structseq instance which contains information about the precision, minimum and maximum values of a float. It's a thin wrapper @@ -74,21 +74,21 @@ .. versionadded:: 2.6 -.. cfunction:: double PyFloat_GetMax() +.. c:function:: double PyFloat_GetMax() - Return the maximum representable finite float *DBL_MAX* as C :ctype:`double`. + Return the maximum representable finite float *DBL_MAX* as C :c:type:`double`. .. versionadded:: 2.6 -.. cfunction:: double PyFloat_GetMin() +.. c:function:: double PyFloat_GetMin() - Return the minimum normalized positive float *DBL_MIN* as C :ctype:`double`. + Return the minimum normalized positive float *DBL_MIN* as C :c:type:`double`. .. versionadded:: 2.6 -.. cfunction:: int PyFloat_ClearFreeList() +.. c:function:: int PyFloat_ClearFreeList() Clear the float free list. Return the number of items that could not be freed. @@ -96,7 +96,7 @@ .. versionadded:: 2.6 -.. cfunction:: void PyFloat_AsString(char *buf, PyFloatObject *v) +.. c:function:: void PyFloat_AsString(char *buf, PyFloatObject *v) Convert the argument *v* to a string, using the same rules as :func:`str`. The length of *buf* should be at least 100. @@ -108,7 +108,7 @@ Use :func:`PyObject_Str` or :func:`PyOS_double_to_string` instead. -.. cfunction:: void PyFloat_AsReprString(char *buf, PyFloatObject *v) +.. c:function:: void PyFloat_AsReprString(char *buf, PyFloatObject *v) Same as PyFloat_AsString, except uses the same rules as :func:`repr`. The length of *buf* should be at least 100. diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst --- a/Doc/c-api/function.rst +++ b/Doc/c-api/function.rst @@ -10,26 +10,26 @@ There are a few functions specific to Python functions. -.. ctype:: PyFunctionObject +.. c:type:: PyFunctionObject The C structure used for functions. -.. cvar:: PyTypeObject PyFunction_Type +.. c:var:: PyTypeObject PyFunction_Type .. index:: single: MethodType (in module types) - This is an instance of :ctype:`PyTypeObject` and represents the Python function + This is an instance of :c:type:`PyTypeObject` and represents the Python function type. It is exposed to Python programmers as ``types.FunctionType``. -.. cfunction:: int PyFunction_Check(PyObject *o) +.. c:function:: int PyFunction_Check(PyObject *o) - Return true if *o* is a function object (has type :cdata:`PyFunction_Type`). + Return true if *o* is a function object (has type :c:data:`PyFunction_Type`). The parameter must not be *NULL*. -.. cfunction:: PyObject* PyFunction_New(PyObject *code, PyObject *globals) +.. c:function:: PyObject* PyFunction_New(PyObject *code, PyObject *globals) Return a new function object associated with the code object *code*. *globals* must be a dictionary with the global variables accessible to the function. @@ -38,30 +38,30 @@ object, the argument defaults and closure are set to *NULL*. -.. cfunction:: PyObject* PyFunction_GetCode(PyObject *op) +.. c:function:: PyObject* PyFunction_GetCode(PyObject *op) Return the code object associated with the function object *op*. -.. cfunction:: PyObject* PyFunction_GetGlobals(PyObject *op) +.. c:function:: PyObject* PyFunction_GetGlobals(PyObject *op) Return the globals dictionary associated with the function object *op*. -.. cfunction:: PyObject* PyFunction_GetModule(PyObject *op) +.. c:function:: PyObject* PyFunction_GetModule(PyObject *op) Return the *__module__* attribute of the function object *op*. This is normally a string containing the module name, but can be set to any other object by Python code. -.. cfunction:: PyObject* PyFunction_GetDefaults(PyObject *op) +.. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op) Return the argument default values of the function object *op*. This can be a tuple of arguments or *NULL*. -.. cfunction:: int PyFunction_SetDefaults(PyObject *op, PyObject *defaults) +.. c:function:: int PyFunction_SetDefaults(PyObject *op, PyObject *defaults) Set the argument default values for the function object *op*. *defaults* must be *Py_None* or a tuple. @@ -69,13 +69,13 @@ Raises :exc:`SystemError` and returns ``-1`` on failure. -.. cfunction:: PyObject* PyFunction_GetClosure(PyObject *op) +.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op) Return the closure associated with the function object *op*. This can be *NULL* or a tuple of cell objects. -.. cfunction:: int PyFunction_SetClosure(PyObject *op, PyObject *closure) +.. c:function:: int PyFunction_SetClosure(PyObject *op, PyObject *closure) Set the closure associated with the function object *op*. *closure* must be *Py_None* or a tuple of cell objects. diff --git a/Doc/c-api/gcsupport.rst b/Doc/c-api/gcsupport.rst --- a/Doc/c-api/gcsupport.rst +++ b/Doc/c-api/gcsupport.rst @@ -30,40 +30,40 @@ Constructors for container types must conform to two rules: -#. The memory for the object must be allocated using :cfunc:`PyObject_GC_New` - or :cfunc:`PyObject_GC_NewVar`. +#. The memory for the object must be allocated using :c:func:`PyObject_GC_New` + or :c:func:`PyObject_GC_NewVar`. #. Once all the fields which may contain references to other containers are - initialized, it must call :cfunc:`PyObject_GC_Track`. + initialized, it must call :c:func:`PyObject_GC_Track`. -.. cfunction:: TYPE* PyObject_GC_New(TYPE, PyTypeObject *type) +.. c:function:: TYPE* PyObject_GC_New(TYPE, PyTypeObject *type) - Analogous to :cfunc:`PyObject_New` but for container objects with the + Analogous to :c:func:`PyObject_New` but for container objects with the :const:`Py_TPFLAGS_HAVE_GC` flag set. -.. cfunction:: TYPE* PyObject_GC_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size) +.. c:function:: TYPE* PyObject_GC_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size) - Analogous to :cfunc:`PyObject_NewVar` but for container objects with the + Analogous to :c:func:`PyObject_NewVar` but for container objects with the :const:`Py_TPFLAGS_HAVE_GC` flag set. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: TYPE* PyObject_GC_Resize(TYPE, PyVarObject *op, Py_ssize_t newsize) +.. c:function:: TYPE* PyObject_GC_Resize(TYPE, PyVarObject *op, Py_ssize_t newsize) - Resize an object allocated by :cfunc:`PyObject_NewVar`. Returns the + Resize an object allocated by :c:func:`PyObject_NewVar`. Returns the resized object or *NULL* on failure. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *newsize*. This might + This function used an :c:type:`int` type for *newsize*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: void PyObject_GC_Track(PyObject *op) +.. c:function:: void PyObject_GC_Track(PyObject *op) Adds the object *op* to the set of container objects tracked by the collector. The collector can run at unexpected times so objects must be @@ -72,44 +72,44 @@ end of the constructor. -.. cfunction:: void _PyObject_GC_TRACK(PyObject *op) +.. c:function:: void _PyObject_GC_TRACK(PyObject *op) - A macro version of :cfunc:`PyObject_GC_Track`. It should not be used for + A macro version of :c:func:`PyObject_GC_Track`. It should not be used for extension modules. Similarly, the deallocator for the object must conform to a similar pair of rules: #. Before fields which refer to other containers are invalidated, - :cfunc:`PyObject_GC_UnTrack` must be called. + :c:func:`PyObject_GC_UnTrack` must be called. -#. The object's memory must be deallocated using :cfunc:`PyObject_GC_Del`. +#. The object's memory must be deallocated using :c:func:`PyObject_GC_Del`. -.. cfunction:: void PyObject_GC_Del(void *op) +.. c:function:: void PyObject_GC_Del(void *op) - Releases memory allocated to an object using :cfunc:`PyObject_GC_New` or - :cfunc:`PyObject_GC_NewVar`. + Releases memory allocated to an object using :c:func:`PyObject_GC_New` or + :c:func:`PyObject_GC_NewVar`. -.. cfunction:: void PyObject_GC_UnTrack(void *op) +.. c:function:: void PyObject_GC_UnTrack(void *op) Remove the object *op* from the set of container objects tracked by the - collector. Note that :cfunc:`PyObject_GC_Track` can be called again on + collector. Note that :c:func:`PyObject_GC_Track` can be called again on this object to add it back to the set of tracked objects. The deallocator (:attr:`tp_dealloc` handler) should call this for the object before any of the fields used by the :attr:`tp_traverse` handler become invalid. -.. cfunction:: void _PyObject_GC_UNTRACK(PyObject *op) +.. c:function:: void _PyObject_GC_UNTRACK(PyObject *op) - A macro version of :cfunc:`PyObject_GC_UnTrack`. It should not be used for + A macro version of :c:func:`PyObject_GC_UnTrack`. It should not be used for extension modules. The :attr:`tp_traverse` handler accepts a function parameter of this type: -.. ctype:: int (*visitproc)(PyObject *object, void *arg) +.. c:type:: int (*visitproc)(PyObject *object, void *arg) Type of the visitor function passed to the :attr:`tp_traverse` handler. The function should be called with an object to traverse as *object* and @@ -121,7 +121,7 @@ The :attr:`tp_traverse` handler must have the following type: -.. ctype:: int (*traverseproc)(PyObject *self, visitproc visit, void *arg) +.. c:type:: int (*traverseproc)(PyObject *self, visitproc visit, void *arg) Traversal function for a container object. Implementations must call the *visit* function for each object directly contained by *self*, with the @@ -130,12 +130,12 @@ object argument. If *visit* returns a non-zero value that value should be returned immediately. -To simplify writing :attr:`tp_traverse` handlers, a :cfunc:`Py_VISIT` macro is +To simplify writing :attr:`tp_traverse` handlers, a :c:func:`Py_VISIT` macro is provided. In order to use this macro, the :attr:`tp_traverse` implementation must name its arguments exactly *visit* and *arg*: -.. cfunction:: void Py_VISIT(PyObject *o) +.. c:function:: void Py_VISIT(PyObject *o) Call the *visit* callback, with arguments *o* and *arg*. If *visit* returns a non-zero value, then return it. Using this macro, :attr:`tp_traverse` @@ -151,15 +151,15 @@ .. versionadded:: 2.4 -The :attr:`tp_clear` handler must be of the :ctype:`inquiry` type, or *NULL* +The :attr:`tp_clear` handler must be of the :c:type:`inquiry` type, or *NULL* if the object is immutable. -.. ctype:: int (*inquiry)(PyObject *self) +.. c:type:: int (*inquiry)(PyObject *self) Drop references that may have created reference cycles. Immutable objects do not have to define this method since they can never directly create reference cycles. Note that the object must still be valid after calling - this method (don't just call :cfunc:`Py_DECREF` on a reference). The + this method (don't just call :c:func:`Py_DECREF` on a reference). The collector will call this method if it detects that this object is involved in a reference cycle. diff --git a/Doc/c-api/gen.rst b/Doc/c-api/gen.rst --- a/Doc/c-api/gen.rst +++ b/Doc/c-api/gen.rst @@ -7,31 +7,31 @@ Generator objects are what Python uses to implement generator iterators. They are normally created by iterating over a function that yields values, rather -than explicitly calling :cfunc:`PyGen_New`. +than explicitly calling :c:func:`PyGen_New`. -.. ctype:: PyGenObject +.. c:type:: PyGenObject The C structure used for generator objects. -.. cvar:: PyTypeObject PyGen_Type +.. c:var:: PyTypeObject PyGen_Type The type object corresponding to generator objects -.. cfunction:: int PyGen_Check(ob) +.. c:function:: int PyGen_Check(ob) Return true if *ob* is a generator object; *ob* must not be *NULL*. -.. cfunction:: int PyGen_CheckExact(ob) +.. c:function:: int PyGen_CheckExact(ob) Return true if *ob*'s type is *PyGen_Type* is a generator object; *ob* must not be *NULL*. -.. cfunction:: PyObject* PyGen_New(PyFrameObject *frame) +.. c:function:: PyObject* PyGen_New(PyFrameObject *frame) Create and return a new generator object based on the *frame* object. A reference to *frame* is stolen by this function. The parameter must not be diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -6,14 +6,14 @@ ================= -.. cfunction:: PyObject* PyImport_ImportModule(const char *name) +.. c:function:: PyObject* PyImport_ImportModule(const char *name) .. index:: single: package variable; __all__ single: __all__ (package variable) single: modules (in module sys) - This is a simplified interface to :cfunc:`PyImport_ImportModuleEx` below, + This is a simplified interface to :c:func:`PyImport_ImportModuleEx` below, leaving the *globals* and *locals* arguments set to *NULL* and *level* set to 0. When the *name* argument contains a dot (when it specifies a submodule of a package), the @@ -34,20 +34,20 @@ Always uses absolute imports. -.. cfunction:: PyObject* PyImport_ImportModuleNoBlock(const char *name) +.. c:function:: PyObject* PyImport_ImportModuleNoBlock(const char *name) - This version of :cfunc:`PyImport_ImportModule` does not block. It's intended + This version of :c:func:`PyImport_ImportModule` does not block. It's intended to be used in C functions that import other modules to execute a function. The import may block if another thread holds the import lock. The function - :cfunc:`PyImport_ImportModuleNoBlock` never blocks. It first tries to fetch - the module from sys.modules and falls back to :cfunc:`PyImport_ImportModule` + :c:func:`PyImport_ImportModuleNoBlock` never blocks. It first tries to fetch + the module from sys.modules and falls back to :c:func:`PyImport_ImportModule` unless the lock is held, in which case the function will raise an :exc:`ImportError`. .. versionadded:: 2.6 -.. cfunction:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist) +.. c:function:: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist) .. index:: builtin: __import__ @@ -65,11 +65,11 @@ Failing imports remove incomplete module objects. .. versionchanged:: 2.6 - The function is an alias for :cfunc:`PyImport_ImportModuleLevel` with + The function is an alias for :c:func:`PyImport_ImportModuleLevel` with -1 as level, meaning relative import. -.. cfunction:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) +.. c:function:: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level) Import a module. This is best described by referring to the built-in Python function :func:`__import__`, as the standard :func:`__import__` function calls @@ -83,7 +83,7 @@ .. versionadded:: 2.5 -.. cfunction:: PyObject* PyImport_Import(PyObject *name) +.. c:function:: PyObject* PyImport_Import(PyObject *name) .. index:: module: rexec @@ -98,7 +98,7 @@ Always uses absolute imports. -.. cfunction:: PyObject* PyImport_ReloadModule(PyObject *m) +.. c:function:: PyObject* PyImport_ReloadModule(PyObject *m) .. index:: builtin: reload @@ -108,7 +108,7 @@ with an exception set on failure (the module still exists in this case). -.. cfunction:: PyObject* PyImport_AddModule(const char *name) +.. c:function:: PyObject* PyImport_AddModule(const char *name) Return the module object corresponding to a module name. The *name* argument may be of the form ``package.module``. First check the modules dictionary if @@ -118,12 +118,12 @@ .. note:: This function does not load or import the module; if the module wasn't already - loaded, you will get an empty module object. Use :cfunc:`PyImport_ImportModule` + loaded, you will get an empty module object. Use :c:func:`PyImport_ImportModule` or one of its variants to import a module. Package structures implied by a dotted name for *name* are not created if not already present. -.. cfunction:: PyObject* PyImport_ExecCodeModule(char *name, PyObject *co) +.. c:function:: PyObject* PyImport_ExecCodeModule(char *name, PyObject *co) .. index:: builtin: compile @@ -133,7 +133,7 @@ or *NULL* with an exception set if an error occurred. Before Python 2.4, the module could still be created in error cases. Starting with Python 2.4, *name* is removed from :attr:`sys.modules` in error cases, and even if *name* was already - in :attr:`sys.modules` on entry to :cfunc:`PyImport_ExecCodeModule`. Leaving + in :attr:`sys.modules` on entry to :c:func:`PyImport_ExecCodeModule`. Leaving incompletely initialized modules in :attr:`sys.modules` is dangerous, as imports of such modules have no way to know that the module object is an unknown (and probably damaged with respect to the module author's intents) state. @@ -142,7 +142,7 @@ :cmember:`co_filename`. This function will reload the module if it was already imported. See - :cfunc:`PyImport_ReloadModule` for the intended way to reload a module. + :c:func:`PyImport_ReloadModule` for the intended way to reload a module. If *name* points to a dotted name of the form ``package.module``, any package structures not already created will still not be created. @@ -151,26 +151,26 @@ *name* is removed from :attr:`sys.modules` in error cases. -.. cfunction:: PyObject* PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname) +.. c:function:: PyObject* PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname) - Like :cfunc:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of + Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute of the module object is set to *pathname* if it is non-``NULL``. -.. cfunction:: long PyImport_GetMagicNumber() +.. c:function:: long PyImport_GetMagicNumber() Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` and :file:`.pyo` files). The magic number should be present in the first four bytes of the bytecode file, in little-endian byte order. -.. cfunction:: PyObject* PyImport_GetModuleDict() +.. c:function:: PyObject* PyImport_GetModuleDict() Return the dictionary used for the module administration (a.k.a. ``sys.modules``). Note that this is a per-interpreter variable. -.. cfunction:: PyObject* PyImport_GetImporter(PyObject *path) +.. c:function:: PyObject* PyImport_GetImporter(PyObject *path) Return an importer object for a :data:`sys.path`/:attr:`pkg.__path__` item *path*, possibly by fetching it from the :data:`sys.path_importer_cache` @@ -183,41 +183,41 @@ .. versionadded:: 2.6 -.. cfunction:: void _PyImport_Init() +.. c:function:: void _PyImport_Init() Initialize the import mechanism. For internal use only. -.. cfunction:: void PyImport_Cleanup() +.. c:function:: void PyImport_Cleanup() Empty the module table. For internal use only. -.. cfunction:: void _PyImport_Fini() +.. c:function:: void _PyImport_Fini() Finalize the import mechanism. For internal use only. -.. cfunction:: PyObject* _PyImport_FindExtension(char *, char *) +.. c:function:: PyObject* _PyImport_FindExtension(char *, char *) For internal use only. -.. cfunction:: PyObject* _PyImport_FixupExtension(char *, char *) +.. c:function:: PyObject* _PyImport_FixupExtension(char *, char *) For internal use only. -.. cfunction:: int PyImport_ImportFrozenModule(char *name) +.. c:function:: int PyImport_ImportFrozenModule(char *name) Load a frozen module named *name*. Return ``1`` for success, ``0`` if the module is not found, and ``-1`` with an exception set if the initialization failed. To access the imported module on a successful load, use - :cfunc:`PyImport_ImportModule`. (Note the misnomer --- this function would + :c:func:`PyImport_ImportModule`. (Note the misnomer --- this function would reload the module if it was already imported.) -.. ctype:: struct _frozen +.. c:type:: struct _frozen .. index:: single: freeze utility @@ -233,30 +233,30 @@ }; -.. cvar:: struct _frozen* PyImport_FrozenModules +.. c:var:: struct _frozen* PyImport_FrozenModules - This pointer is initialized to point to an array of :ctype:`struct _frozen` + This pointer is initialized to point to an array of :c:type:`struct _frozen` records, terminated by one whose members are all *NULL* or zero. When a frozen module is imported, it is searched in this table. Third-party code could play tricks with this to provide a dynamically created collection of frozen modules. -.. cfunction:: int PyImport_AppendInittab(const char *name, void (*initfunc)(void)) +.. c:function:: int PyImport_AppendInittab(const char *name, void (*initfunc)(void)) Add a single module to the existing table of built-in modules. This is a - convenience wrapper around :cfunc:`PyImport_ExtendInittab`, returning ``-1`` if + convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning ``-1`` if the table could not be extended. The new module can be imported by the name *name*, and uses the function *initfunc* as the initialization function called on the first attempted import. This should be called before - :cfunc:`Py_Initialize`. + :c:func:`Py_Initialize`. -.. ctype:: struct _inittab +.. c:type:: struct _inittab Structure describing a single entry in the list of built-in modules. Each of these structures gives the name and initialization function for a module built into the interpreter. Programs which embed Python may use an array of these - structures in conjunction with :cfunc:`PyImport_ExtendInittab` to provide + structures in conjunction with :c:func:`PyImport_ExtendInittab` to provide additional built-in modules. The structure is defined in :file:`Include/import.h` as:: @@ -266,11 +266,11 @@ }; -.. cfunction:: int PyImport_ExtendInittab(struct _inittab *newtab) +.. c:function:: int PyImport_ExtendInittab(struct _inittab *newtab) Add a collection of modules to the table of built-in modules. The *newtab* array must end with a sentinel entry which contains *NULL* for the :attr:`name` field; failure to provide the sentinel value can result in a memory fault. Returns ``0`` on success or ``-1`` if insufficient memory could be allocated to extend the internal table. In the event of failure, no modules are added to the - internal table. This should be called before :cfunc:`Py_Initialize`. + internal table. This should be called before :c:func:`Py_Initialize`. diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -12,7 +12,7 @@ =========================================== -.. cfunction:: void Py_Initialize() +.. c:function:: void Py_Initialize() .. index:: single: Py_SetProgramName() @@ -31,40 +31,40 @@ Initialize the Python interpreter. In an application embedding Python, this should be called before using any other Python/C API functions; with the - exception of :cfunc:`Py_SetProgramName`, :cfunc:`Py_SetPythonHome`, :cfunc:`PyEval_InitThreads`, - :cfunc:`PyEval_ReleaseLock`, and :cfunc:`PyEval_AcquireLock`. This initializes + exception of :c:func:`Py_SetProgramName`, :c:func:`Py_SetPythonHome`, :c:func:`PyEval_InitThreads`, + :c:func:`PyEval_ReleaseLock`, and :c:func:`PyEval_AcquireLock`. This initializes the table of loaded modules (``sys.modules``), and creates the fundamental modules :mod:`__builtin__`, :mod:`__main__` and :mod:`sys`. It also initializes the module search path (``sys.path``). It does not set ``sys.argv``; use - :cfunc:`PySys_SetArgvEx` for that. This is a no-op when called for a second time - (without calling :cfunc:`Py_Finalize` first). There is no return value; it is a + :c:func:`PySys_SetArgvEx` for that. This is a no-op when called for a second time + (without calling :c:func:`Py_Finalize` first). There is no return value; it is a fatal error if the initialization fails. -.. cfunction:: void Py_InitializeEx(int initsigs) +.. c:function:: void Py_InitializeEx(int initsigs) - This function works like :cfunc:`Py_Initialize` if *initsigs* is 1. If + This function works like :c:func:`Py_Initialize` if *initsigs* is 1. If *initsigs* is 0, it skips initialization registration of signal handlers, which might be useful when Python is embedded. .. versionadded:: 2.4 -.. cfunction:: int Py_IsInitialized() +.. c:function:: int Py_IsInitialized() Return true (nonzero) when the Python interpreter has been initialized, false - (zero) if not. After :cfunc:`Py_Finalize` is called, this returns false until - :cfunc:`Py_Initialize` is called again. + (zero) if not. After :c:func:`Py_Finalize` is called, this returns false until + :c:func:`Py_Initialize` is called again. -.. cfunction:: void Py_Finalize() +.. c:function:: void Py_Finalize() - Undo all initializations made by :cfunc:`Py_Initialize` and subsequent use of + Undo all initializations made by :c:func:`Py_Initialize` and subsequent use of Python/C API functions, and destroy all sub-interpreters (see - :cfunc:`Py_NewInterpreter` below) that were created and not yet destroyed since - the last call to :cfunc:`Py_Initialize`. Ideally, this frees all memory + :c:func:`Py_NewInterpreter` below) that were created and not yet destroyed since + the last call to :c:func:`Py_Initialize`. Ideally, this frees all memory allocated by the Python interpreter. This is a no-op when called for a second - time (without calling :cfunc:`Py_Initialize` again first). There is no return + time (without calling :c:func:`Py_Initialize` again first). There is no return value; errors during finalization are ignored. This function is provided for a number of reasons. An embedding application @@ -83,25 +83,25 @@ please report it). Memory tied up in circular references between objects is not freed. Some memory allocated by extension modules may not be freed. Some extensions may not work properly if their initialization routine is called more - than once; this can happen if an application calls :cfunc:`Py_Initialize` and - :cfunc:`Py_Finalize` more than once. + than once; this can happen if an application calls :c:func:`Py_Initialize` and + :c:func:`Py_Finalize` more than once. Process-wide parameters ======================= -.. cfunction:: void Py_SetProgramName(char *name) +.. c:function:: void Py_SetProgramName(char *name) .. index:: single: Py_Initialize() single: main() single: Py_GetPath() - This function should be called before :cfunc:`Py_Initialize` is called for + This function should be called before :c:func:`Py_Initialize` is called for the first time, if it is called at all. It tells the interpreter the value - of the ``argv[0]`` argument to the :cfunc:`main` function of the program. - This is used by :cfunc:`Py_GetPath` and some other functions below to find + of the ``argv[0]`` argument to the :c:func:`main` function of the program. + This is used by :c:func:`Py_GetPath` and some other functions below to find the Python run-time libraries relative to the interpreter executable. The default value is ``'python'``. The argument should point to a zero-terminated character string in static storage whose contents will not @@ -109,20 +109,20 @@ interpreter will change the contents of this storage. -.. cfunction:: char* Py_GetProgramName() +.. c:function:: char* Py_GetProgramName() .. index:: single: Py_SetProgramName() - Return the program name set with :cfunc:`Py_SetProgramName`, or the default. + Return the program name set with :c:func:`Py_SetProgramName`, or the default. The returned string points into static storage; the caller should not modify its value. -.. cfunction:: char* Py_GetPrefix() +.. c:function:: char* Py_GetPrefix() Return the *prefix* for installed platform-independent files. This is derived through a number of complicated rules from the program name set with - :cfunc:`Py_SetProgramName` and some environment variables; for example, if the + :c:func:`Py_SetProgramName` and some environment variables; for example, if the program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The returned string points into static storage; the caller should not modify its value. This corresponds to the :makevar:`prefix` variable in the top-level @@ -131,11 +131,11 @@ It is only useful on Unix. See also the next function. -.. cfunction:: char* Py_GetExecPrefix() +.. c:function:: char* Py_GetExecPrefix() Return the *exec-prefix* for installed platform-*dependent* files. This is derived through a number of complicated rules from the program name set with - :cfunc:`Py_SetProgramName` and some environment variables; for example, if the + :c:func:`Py_SetProgramName` and some environment variables; for example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix is ``'/usr/local'``. The returned string points into static storage; the caller should not modify its value. This corresponds to the :makevar:`exec_prefix` @@ -166,7 +166,7 @@ platform. -.. cfunction:: char* Py_GetProgramFullPath() +.. c:function:: char* Py_GetProgramFullPath() .. index:: single: Py_SetProgramName() @@ -174,19 +174,19 @@ Return the full program name of the Python executable; this is computed as a side-effect of deriving the default module search path from the program name - (set by :cfunc:`Py_SetProgramName` above). The returned string points into + (set by :c:func:`Py_SetProgramName` above). The returned string points into static storage; the caller should not modify its value. The value is available to Python code as ``sys.executable``. -.. cfunction:: char* Py_GetPath() +.. c:function:: char* Py_GetPath() .. index:: triple: module; search; path single: path (in module sys) Return the default module search path; this is computed from the program name - (set by :cfunc:`Py_SetProgramName` above) and some environment variables. + (set by :c:func:`Py_SetProgramName` above) and some environment variables. The returned string consists of a series of directory names separated by a platform dependent delimiter character. The delimiter character is ``':'`` on Unix and Mac OS X, ``';'`` on Windows. The returned string points into @@ -198,7 +198,7 @@ .. XXX should give the exact rules -.. cfunction:: const char* Py_GetVersion() +.. c:function:: const char* Py_GetVersion() Return the version of this Python interpreter. This is a string that looks something like :: @@ -213,7 +213,7 @@ modify its value. The value is available to Python code as ``sys.version``. -.. cfunction:: const char* Py_GetPlatform() +.. c:function:: const char* Py_GetPlatform() .. index:: single: platform (in module sys) @@ -226,7 +226,7 @@ to Python code as ``sys.platform``. -.. cfunction:: const char* Py_GetCopyright() +.. c:function:: const char* Py_GetCopyright() Return the official copyright string for the current Python version, for example @@ -238,7 +238,7 @@ value. The value is available to Python code as ``sys.copyright``. -.. cfunction:: const char* Py_GetCompiler() +.. c:function:: const char* Py_GetCompiler() Return an indication of the compiler used to build the current Python version, in square brackets, for example:: @@ -252,7 +252,7 @@ ``sys.version``. -.. cfunction:: const char* Py_GetBuildInfo() +.. c:function:: const char* Py_GetBuildInfo() Return information about the sequence number and build date and time of the current Python interpreter instance, for example :: @@ -266,7 +266,7 @@ ``sys.version``. -.. cfunction:: void PySys_SetArgvEx(int argc, char **argv, int updatepath) +.. c:function:: void PySys_SetArgvEx(int argc, char **argv, int updatepath) .. index:: single: main() @@ -274,12 +274,12 @@ single: argv (in module sys) Set :data:`sys.argv` based on *argc* and *argv*. These parameters are - similar to those passed to the program's :cfunc:`main` function with the + similar to those passed to the program's :c:func:`main` function with the difference that the first entry should refer to the script file to be executed rather than the executable hosting the Python interpreter. If there isn't a script that will be run, the first entry in *argv* can be an empty string. If this function fails to initialize :data:`sys.argv`, a fatal - condition is signalled using :cfunc:`Py_FatalError`. + condition is signalled using :c:func:`Py_FatalError`. If *updatepath* is zero, this is all the function does. If *updatepath* is non-zero, the function also modifies :data:`sys.path` according to the @@ -301,7 +301,7 @@ On versions before 2.6.6, you can achieve the same effect by manually popping the first :data:`sys.path` element after having called - :cfunc:`PySys_SetArgv`, for example using:: + :c:func:`PySys_SetArgv`, for example using:: PyRun_SimpleString("import sys; sys.path.pop(0)\n"); @@ -311,12 +311,12 @@ check w/ Guido. -.. cfunction:: void PySys_SetArgv(int argc, char **argv) +.. c:function:: void PySys_SetArgv(int argc, char **argv) - This function works like :cfunc:`PySys_SetArgvEx` with *updatepath* set to 1. + This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to 1. -.. cfunction:: void Py_SetPythonHome(char *home) +.. c:function:: void Py_SetPythonHome(char *home) Set the default "home" directory, that is, the location of the standard Python libraries. See :envvar:`PYTHONHOME` for the meaning of the @@ -328,10 +328,10 @@ this storage. -.. cfunction:: char* Py_GetPythonHome() +.. c:function:: char* Py_GetPythonHome() Return the default "home", that is, the value set by a previous call to - :cfunc:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` + :c:func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` environment variable if it is set. @@ -368,9 +368,9 @@ single: PyThreadState The Python interpreter keeps some thread-specific bookkeeping information -inside a data structure called :ctype:`PyThreadState`. There's also one -global variable pointing to the current :ctype:`PyThreadState`: it can -be retrieved using :cfunc:`PyThreadState_Get`. +inside a data structure called :c:type:`PyThreadState`. There's also one +global variable pointing to the current :c:type:`PyThreadState`: it can +be retrieved using :c:func:`PyThreadState_Get`. Releasing the GIL from extension code ------------------------------------- @@ -394,8 +394,8 @@ single: Py_BEGIN_ALLOW_THREADS single: Py_END_ALLOW_THREADS -The :cmacro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a -hidden local variable; the :cmacro:`Py_END_ALLOW_THREADS` macro closes the +The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a +hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the block. These two macros are still available when Python is compiled without thread support (they simply have an empty expansion). @@ -445,7 +445,7 @@ API. When you are done, you should reset the thread state pointer, release the GIL, and finally free the thread state data structure. -The :cfunc:`PyGILState_Ensure` and :cfunc:`PyGILState_Release` functions do +The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions do all of the above automatically. The typical idiom for calling into Python from a C thread is:: @@ -459,14 +459,14 @@ /* Release the thread. No Python API allowed beyond this point. */ PyGILState_Release(gstate); -Note that the :cfunc:`PyGILState_\*` functions assume there is only one global -interpreter (created automatically by :cfunc:`Py_Initialize`). Python +Note that the :c:func:`PyGILState_\*` functions assume there is only one global +interpreter (created automatically by :c:func:`Py_Initialize`). Python supports the creation of additional interpreters (using -:cfunc:`Py_NewInterpreter`), but mixing multiple interpreters and the -:cfunc:`PyGILState_\*` API is unsupported. +:c:func:`Py_NewInterpreter`), but mixing multiple interpreters and the +:c:func:`PyGILState_\*` API is unsupported. Another important thing to note about threads is their behaviour in the face -of the C :cfunc:`fork` call. On most systems with :cfunc:`fork`, after a +of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a process forks only the thread that issued the fork will exist. That also means any locks held by other threads will never be released. Python solves this for :func:`os.fork` by acquiring the locks it uses internally before @@ -474,12 +474,12 @@ :ref:`lock-objects` in the child. When extending or embedding Python, there is no way to inform Python of additional (non-Python) locks that need to be acquired before or reset after a fork. OS facilities such as -:cfunc:`pthread_atfork` would need to be used to accomplish the same thing. -Additionally, when extending or embedding Python, calling :cfunc:`fork` +:c:func:`pthread_atfork` would need to be used to accomplish the same thing. +Additionally, when extending or embedding Python, calling :c:func:`fork` directly rather than through :func:`os.fork` (and returning to or calling into Python) may result in a deadlock by one of Python's internal locks being held by a thread that is defunct after the fork. -:cfunc:`PyOS_AfterFork` tries to reset the necessary locks, but is not +:c:func:`PyOS_AfterFork` tries to reset the necessary locks, but is not always able to. @@ -489,7 +489,7 @@ These are the most commonly used types and functions when writing C extension code, or when embedding the Python interpreter: -.. ctype:: PyInterpreterState +.. c:type:: PyInterpreterState This data structure represents the state shared by a number of cooperating threads. Threads belonging to the same interpreter share their module @@ -502,14 +502,14 @@ interpreter they belong. -.. ctype:: PyThreadState +.. c:type:: PyThreadState This data structure represents the state of a single thread. The only public - data member is :ctype:`PyInterpreterState \*`:attr:`interp`, which points to + data member is :c:type:`PyInterpreterState \*`:attr:`interp`, which points to this thread's interpreter state. -.. cfunction:: void PyEval_InitThreads() +.. c:function:: void PyEval_InitThreads() .. index:: single: PyEval_ReleaseLock() @@ -519,14 +519,14 @@ Initialize and acquire the global interpreter lock. It should be called in the main thread before creating a second thread or engaging in any other thread - operations such as :cfunc:`PyEval_ReleaseLock` or + operations such as :c:func:`PyEval_ReleaseLock` or ``PyEval_ReleaseThread(tstate)``. It is not needed before calling - :cfunc:`PyEval_SaveThread` or :cfunc:`PyEval_RestoreThread`. + :c:func:`PyEval_SaveThread` or :c:func:`PyEval_RestoreThread`. .. index:: single: Py_Initialize() This is a no-op when called for a second time. It is safe to call this function - before calling :cfunc:`Py_Initialize`. + before calling :c:func:`Py_Initialize`. .. index:: module: thread @@ -539,7 +539,7 @@ when this function initializes the global interpreter lock, it also acquires it. Before the Python :mod:`_thread` module creates a new thread, knowing that either it has the lock or the lock hasn't been created yet, it calls - :cfunc:`PyEval_InitThreads`. When this call returns, it is guaranteed that + :c:func:`PyEval_InitThreads`. When this call returns, it is guaranteed that the lock has been created and that the calling thread has acquired it. It is **not** safe to call this function when it is unknown which thread (if @@ -548,9 +548,9 @@ This function is not available when thread support is disabled at compile time. -.. cfunction:: int PyEval_ThreadsInitialized() +.. c:function:: int PyEval_ThreadsInitialized() - Returns a non-zero value if :cfunc:`PyEval_InitThreads` has been called. This + Returns a non-zero value if :c:func:`PyEval_InitThreads` has been called. This function can be called without holding the GIL, and therefore can be used to avoid calls to the locking API when running single-threaded. This function is not available when thread support is disabled at compile time. @@ -558,7 +558,7 @@ .. versionadded:: 2.4 -.. cfunction:: PyThreadState* PyEval_SaveThread() +.. c:function:: PyThreadState* PyEval_SaveThread() Release the global interpreter lock (if it has been created and thread support is enabled) and reset the thread state to *NULL*, returning the @@ -567,7 +567,7 @@ when thread support is disabled at compile time.) -.. cfunction:: void PyEval_RestoreThread(PyThreadState *tstate) +.. c:function:: void PyEval_RestoreThread(PyThreadState *tstate) Acquire the global interpreter lock (if it has been created and thread support is enabled) and set the thread state to *tstate*, which must not be @@ -576,23 +576,23 @@ when thread support is disabled at compile time.) -.. cfunction:: PyThreadState* PyThreadState_Get() +.. c:function:: PyThreadState* PyThreadState_Get() Return the current thread state. The global interpreter lock must be held. When the current thread state is *NULL*, this issues a fatal error (so that the caller needn't check for *NULL*). -.. cfunction:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate) +.. c:function:: PyThreadState* PyThreadState_Swap(PyThreadState *tstate) Swap the current thread state with the thread state given by the argument *tstate*, which may be *NULL*. The global interpreter lock must be held and is not released. -.. cfunction:: void PyEval_ReInitThreads() +.. c:function:: void PyEval_ReInitThreads() - This function is called from :cfunc:`PyOS_AfterFork` to ensure that newly + This function is called from :c:func:`PyOS_AfterFork` to ensure that newly created child processes don't hold locks referring to threads which are not running in the child process. @@ -600,24 +600,24 @@ The following functions use thread-local storage, and are not compatible with sub-interpreters: -.. cfunction:: PyGILState_STATE PyGILState_Ensure() +.. c:function:: PyGILState_STATE PyGILState_Ensure() Ensure that the current thread is ready to call the Python C API regardless of the current state of Python, or of the global interpreter lock. This may be called as many times as desired by a thread as long as each call is - matched with a call to :cfunc:`PyGILState_Release`. In general, other - thread-related APIs may be used between :cfunc:`PyGILState_Ensure` and - :cfunc:`PyGILState_Release` calls as long as the thread state is restored to + matched with a call to :c:func:`PyGILState_Release`. In general, other + thread-related APIs may be used between :c:func:`PyGILState_Ensure` and + :c:func:`PyGILState_Release` calls as long as the thread state is restored to its previous state before the Release(). For example, normal usage of the - :cmacro:`Py_BEGIN_ALLOW_THREADS` and :cmacro:`Py_END_ALLOW_THREADS` macros is + :c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable. The return value is an opaque "handle" to the thread state when - :cfunc:`PyGILState_Ensure` was called, and must be passed to - :cfunc:`PyGILState_Release` to ensure Python is left in the same state. Even + :c:func:`PyGILState_Ensure` was called, and must be passed to + :c:func:`PyGILState_Release` to ensure Python is left in the same state. Even though recursive calls are allowed, these handles *cannot* be shared - each - unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call - to :cfunc:`PyGILState_Release`. + unique call to :c:func:`PyGILState_Ensure` must save the handle for its call + to :c:func:`PyGILState_Release`. When the function returns, the current thread will hold the GIL and be able to call arbitrary Python code. Failure is a fatal error. @@ -625,20 +625,20 @@ .. versionadded:: 2.3 -.. cfunction:: void PyGILState_Release(PyGILState_STATE) +.. c:function:: void PyGILState_Release(PyGILState_STATE) Release any resources previously acquired. After this call, Python's state will - be the same as it was prior to the corresponding :cfunc:`PyGILState_Ensure` call + be the same as it was prior to the corresponding :c:func:`PyGILState_Ensure` call (but generally this state will be unknown to the caller, hence the use of the GILState API). - Every call to :cfunc:`PyGILState_Ensure` must be matched by a call to - :cfunc:`PyGILState_Release` on the same thread. + Every call to :c:func:`PyGILState_Ensure` must be matched by a call to + :c:func:`PyGILState_Release` on the same thread. .. versionadded:: 2.3 -.. cfunction:: PyThreadState PyGILState_GetThisThreadState() +.. c:function:: PyThreadState PyGILState_GetThisThreadState() Get the current thread state for this thread. May return ``NULL`` if no GILState API has been used on the current thread. Note that the main thread @@ -652,33 +652,33 @@ example usage in the Python source distribution. -.. cmacro:: Py_BEGIN_ALLOW_THREADS +.. c:macro:: Py_BEGIN_ALLOW_THREADS This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();``. Note that it contains an opening brace; it must be matched with a following - :cmacro:`Py_END_ALLOW_THREADS` macro. See above for further discussion of this + :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further discussion of this macro. It is a no-op when thread support is disabled at compile time. -.. cmacro:: Py_END_ALLOW_THREADS +.. c:macro:: Py_END_ALLOW_THREADS This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it contains a closing brace; it must be matched with an earlier - :cmacro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of + :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this macro. It is a no-op when thread support is disabled at compile time. -.. cmacro:: Py_BLOCK_THREADS +.. c:macro:: Py_BLOCK_THREADS This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to - :cmacro:`Py_END_ALLOW_THREADS` without the closing brace. It is a no-op when + :c:macro:`Py_END_ALLOW_THREADS` without the closing brace. It is a no-op when thread support is disabled at compile time. -.. cmacro:: Py_UNBLOCK_THREADS +.. c:macro:: Py_UNBLOCK_THREADS This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to - :cmacro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable + :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable declaration. It is a no-op when thread support is disabled at compile time. @@ -690,47 +690,47 @@ been created. -.. cfunction:: PyInterpreterState* PyInterpreterState_New() +.. c:function:: PyInterpreterState* PyInterpreterState_New() Create a new interpreter state object. The global interpreter lock need not be held, but may be held if it is necessary to serialize calls to this function. -.. cfunction:: void PyInterpreterState_Clear(PyInterpreterState *interp) +.. c:function:: void PyInterpreterState_Clear(PyInterpreterState *interp) Reset all information in an interpreter state object. The global interpreter lock must be held. -.. cfunction:: void PyInterpreterState_Delete(PyInterpreterState *interp) +.. c:function:: void PyInterpreterState_Delete(PyInterpreterState *interp) Destroy an interpreter state object. The global interpreter lock need not be held. The interpreter state must have been reset with a previous call to - :cfunc:`PyInterpreterState_Clear`. + :c:func:`PyInterpreterState_Clear`. -.. cfunction:: PyThreadState* PyThreadState_New(PyInterpreterState *interp) +.. c:function:: PyThreadState* PyThreadState_New(PyInterpreterState *interp) Create a new thread state object belonging to the given interpreter object. The global interpreter lock need not be held, but may be held if it is necessary to serialize calls to this function. -.. cfunction:: void PyThreadState_Clear(PyThreadState *tstate) +.. c:function:: void PyThreadState_Clear(PyThreadState *tstate) Reset all information in a thread state object. The global interpreter lock must be held. -.. cfunction:: void PyThreadState_Delete(PyThreadState *tstate) +.. c:function:: void PyThreadState_Delete(PyThreadState *tstate) Destroy a thread state object. The global interpreter lock need not be held. The thread state must have been reset with a previous call to - :cfunc:`PyThreadState_Clear`. + :c:func:`PyThreadState_Clear`. -.. cfunction:: PyObject* PyThreadState_GetDict() +.. c:function:: PyObject* PyThreadState_GetDict() Return a dictionary in which extensions can store thread-specific state information. Each extension should use a unique key to use to store state in @@ -743,7 +743,7 @@ meant that an exception was raised. -.. cfunction:: int PyThreadState_SetAsyncExc(long id, PyObject *exc) +.. c:function:: int PyThreadState_SetAsyncExc(long id, PyObject *exc) Asynchronously raise an exception in a thread. The *id* argument is the thread id of the target thread; *exc* is the exception object to be raised. This @@ -756,18 +756,18 @@ .. versionadded:: 2.3 -.. cfunction:: void PyEval_AcquireThread(PyThreadState *tstate) +.. c:function:: void PyEval_AcquireThread(PyThreadState *tstate) Acquire the global interpreter lock and set the current thread state to *tstate*, which should not be *NULL*. The lock must have been created earlier. If this thread already has the lock, deadlock ensues. - :cfunc:`PyEval_RestoreThread` is a higher-level function which is always + :c:func:`PyEval_RestoreThread` is a higher-level function which is always available (even when thread support isn't enabled or when threads have not been initialized). -.. cfunction:: void PyEval_ReleaseThread(PyThreadState *tstate) +.. c:function:: void PyEval_ReleaseThread(PyThreadState *tstate) Reset the current thread state to *NULL* and release the global interpreter lock. The lock must have been created earlier and must be held by the current @@ -775,29 +775,29 @@ that it represents the current thread state --- if it isn't, a fatal error is reported. - :cfunc:`PyEval_SaveThread` is a higher-level function which is always + :c:func:`PyEval_SaveThread` is a higher-level function which is always available (even when thread support isn't enabled or when threads have not been initialized). -.. cfunction:: void PyEval_AcquireLock() +.. c:function:: void PyEval_AcquireLock() Acquire the global interpreter lock. The lock must have been created earlier. If this thread already has the lock, a deadlock ensues. .. warning:: This function does not change the current thread state. Please use - :cfunc:`PyEval_RestoreThread` or :cfunc:`PyEval_AcquireThread` + :c:func:`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead. -.. cfunction:: void PyEval_ReleaseLock() +.. c:function:: void PyEval_ReleaseLock() Release the global interpreter lock. The lock must have been created earlier. .. warning:: This function does not change the current thread state. Please use - :cfunc:`PyEval_SaveThread` or :cfunc:`PyEval_ReleaseThread` + :c:func:`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead. @@ -808,11 +808,11 @@ are cases where you need to create several independent interpreters in the same process and perhaps even in the same thread. Sub-interpreters allow you to do that. You can switch between sub-interpreters using the -:cfunc:`PyThreadState_Swap` function. You can create and destroy them +:c:func:`PyThreadState_Swap` function. You can create and destroy them using the following functions: -.. cfunction:: PyThreadState* Py_NewInterpreter() +.. c:function:: PyThreadState* Py_NewInterpreter() .. index:: module: builtins @@ -854,13 +854,13 @@ and filled with the contents of this copy; the extension's ``init`` function is not called. Note that this is different from what happens when an extension is imported after the interpreter has been completely re-initialized by calling - :cfunc:`Py_Finalize` and :cfunc:`Py_Initialize`; in that case, the extension's + :c:func:`Py_Finalize` and :c:func:`Py_Initialize`; in that case, the extension's ``initmodule`` function *is* called again. .. index:: single: close() (in module os) -.. cfunction:: void Py_EndInterpreter(PyThreadState *tstate) +.. c:function:: void Py_EndInterpreter(PyThreadState *tstate) .. index:: single: Py_Finalize() @@ -869,7 +869,7 @@ states below. When the call returns, the current thread state is *NULL*. All thread states associated with this interpreter are destroyed. (The global interpreter lock must be held before calling this function and is still held - when it returns.) :cfunc:`Py_Finalize` will destroy all sub-interpreters that + when it returns.) :c:func:`Py_Finalize` will destroy all sub-interpreters that haven't been explicitly destroyed at that point. @@ -890,11 +890,11 @@ by such objects may affect the wrong (sub-)interpreter's dictionary of loaded modules. -Also note that combining this functionality with :cfunc:`PyGILState_\*` APIs +Also note that combining this functionality with :c:func:`PyGILState_\*` APIs 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. +of matching :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:`ctypes`) using these APIs to allow calling of Python code from non-Python created threads will probably be broken when using sub-interpreters. @@ -916,7 +916,7 @@ main thread where it has possession of the global interpreter lock and can perform any Python API calls. -.. cfunction:: int Py_AddPendingCall(int (*func)(void *), void *arg) +.. c:function:: int Py_AddPendingCall(int (*func)(void *), void *arg) .. index:: single: Py_AddPendingCall() @@ -964,10 +964,10 @@ in previous versions. -.. ctype:: int (*Py_tracefunc)(PyObject *obj, PyFrameObject *frame, int what, PyObject *arg) +.. c:type:: int (*Py_tracefunc)(PyObject *obj, PyFrameObject *frame, int what, PyObject *arg) - The type of the trace function registered using :cfunc:`PyEval_SetProfile` and - :cfunc:`PyEval_SetTrace`. The first parameter is the object passed to the + The type of the trace function registered using :c:func:`PyEval_SetProfile` and + :c:func:`PyEval_SetTrace`. The first parameter is the object passed to the registration function as *obj*, *frame* is the frame object to which the event pertains, *what* is one of the constants :const:`PyTrace_CALL`, :const:`PyTrace_EXCEPTION`, :const:`PyTrace_LINE`, :const:`PyTrace_RETURN`, @@ -995,18 +995,18 @@ +------------------------------+--------------------------------------+ -.. cvar:: int PyTrace_CALL +.. c:var:: int PyTrace_CALL - The value of the *what* parameter to a :ctype:`Py_tracefunc` function when a new + The value of the *what* parameter to a :c:type:`Py_tracefunc` function when a new call to a function or method is being reported, or a new entry into a generator. Note that the creation of the iterator for a generator function is not reported as there is no control transfer to the Python bytecode in the corresponding frame. -.. cvar:: int PyTrace_EXCEPTION +.. c:var:: int PyTrace_EXCEPTION - The value of the *what* parameter to a :ctype:`Py_tracefunc` function when an + The value of the *what* parameter to a :c:type:`Py_tracefunc` function when an exception has been raised. The callback function is called with this value for *what* when after any bytecode is processed after which the exception becomes set within the frame being executed. The effect of this is that as exception @@ -1015,37 +1015,37 @@ these events; they are not needed by the profiler. -.. cvar:: int PyTrace_LINE +.. c:var:: int PyTrace_LINE The value passed as the *what* parameter to a trace function (but not a profiling function) when a line-number event is being reported. -.. cvar:: int PyTrace_RETURN +.. c:var:: int PyTrace_RETURN - The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a + The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a call is returning without propagating an exception. -.. cvar:: int PyTrace_C_CALL +.. c:var:: int PyTrace_C_CALL - The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a C + The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a C function is about to be called. -.. cvar:: int PyTrace_C_EXCEPTION +.. c:var:: int PyTrace_C_EXCEPTION - The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a C + The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a C function has raised an exception. -.. cvar:: int PyTrace_C_RETURN +.. c:var:: int PyTrace_C_RETURN - The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a C + The value for the *what* parameter to :c:type:`Py_tracefunc` functions when a C function has returned. -.. cfunction:: void PyEval_SetProfile(Py_tracefunc func, PyObject *obj) +.. c:function:: void PyEval_SetProfile(Py_tracefunc func, PyObject *obj) Set the profiler function to *func*. The *obj* parameter is passed to the function as its first parameter, and may be any Python object, or *NULL*. If @@ -1055,13 +1055,13 @@ events. -.. cfunction:: void PyEval_SetTrace(Py_tracefunc func, PyObject *obj) +.. c:function:: void PyEval_SetTrace(Py_tracefunc func, PyObject *obj) Set the tracing function to *func*. This is similar to - :cfunc:`PyEval_SetProfile`, except the tracing function does receive line-number + :c:func:`PyEval_SetProfile`, except the tracing function does receive line-number events. -.. cfunction:: PyObject* PyEval_GetCallStats(PyObject *self) +.. c:function:: PyObject* PyEval_GetCallStats(PyObject *self) Return a tuple of function call counts. There are constants defined for the positions within the tuple: @@ -1113,14 +1113,14 @@ These functions are only intended to be used by advanced debugging tools. -.. cfunction:: PyInterpreterState* PyInterpreterState_Head() +.. c:function:: PyInterpreterState* PyInterpreterState_Head() Return the interpreter state object at the head of the list of all such objects. .. versionadded:: 2.2 -.. cfunction:: PyInterpreterState* PyInterpreterState_Next(PyInterpreterState *interp) +.. c:function:: PyInterpreterState* PyInterpreterState_Next(PyInterpreterState *interp) Return the next interpreter state object after *interp* from the list of all such objects. @@ -1128,18 +1128,18 @@ .. versionadded:: 2.2 -.. cfunction:: PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *interp) +.. c:function:: PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *interp) - Return the a pointer to the first :ctype:`PyThreadState` object in the list of + Return the a pointer to the first :c:type:`PyThreadState` object in the list of threads associated with the interpreter *interp*. .. versionadded:: 2.2 -.. cfunction:: PyThreadState* PyThreadState_Next(PyThreadState *tstate) +.. c:function:: PyThreadState* PyThreadState_Next(PyThreadState *tstate) Return the next thread state object after *tstate* from the list of all such - objects belonging to the same :ctype:`PyInterpreterState` object. + objects belonging to the same :c:type:`PyInterpreterState` object. .. versionadded:: 2.2 diff --git a/Doc/c-api/int.rst b/Doc/c-api/int.rst --- a/Doc/c-api/int.rst +++ b/Doc/c-api/int.rst @@ -8,39 +8,39 @@ .. index:: object: integer -.. ctype:: PyIntObject +.. c:type:: PyIntObject - This subtype of :ctype:`PyObject` represents a Python integer object. + This subtype of :c:type:`PyObject` represents a Python integer object. -.. cvar:: PyTypeObject PyInt_Type +.. c:var:: PyTypeObject PyInt_Type .. index:: single: IntType (in modules types) - This instance of :ctype:`PyTypeObject` represents the Python plain integer type. + This instance of :c:type:`PyTypeObject` represents the Python plain integer type. This is the same object as ``int`` and ``types.IntType``. -.. cfunction:: int PyInt_Check(PyObject *o) +.. c:function:: int PyInt_Check(PyObject *o) - Return true if *o* is of type :cdata:`PyInt_Type` or a subtype of - :cdata:`PyInt_Type`. + Return true if *o* is of type :c:data:`PyInt_Type` or a subtype of + :c:data:`PyInt_Type`. .. versionchanged:: 2.2 Allowed subtypes to be accepted. -.. cfunction:: int PyInt_CheckExact(PyObject *o) +.. c:function:: int PyInt_CheckExact(PyObject *o) - Return true if *o* is of type :cdata:`PyInt_Type`, but not a subtype of - :cdata:`PyInt_Type`. + Return true if *o* is of type :c:data:`PyInt_Type`, but not a subtype of + :c:data:`PyInt_Type`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyInt_FromString(char *str, char **pend, int base) +.. c:function:: PyObject* PyInt_FromString(char *str, char **pend, int base) - Return a new :ctype:`PyIntObject` or :ctype:`PyLongObject` based on the string + Return a new :c:type:`PyIntObject` or :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*. If *pend* is non-*NULL*, ``*pend`` will point to the first character in *str* which follows the representation of the number. If *base* is ``0``, the radix will be @@ -49,13 +49,13 @@ 8 will be used; otherwise radix 10 will be used. If *base* is not ``0``, it must be between ``2`` and ``36``, inclusive. Leading spaces are ignored. If there are no digits, :exc:`ValueError` will be raised. If the string represents - a number too large to be contained within the machine's :ctype:`long int` type - and overflow warnings are being suppressed, a :ctype:`PyLongObject` will be + a number too large to be contained within the machine's :c:type:`long int` type + and overflow warnings are being suppressed, a :c:type:`PyLongObject` will be returned. If overflow warnings are not being suppressed, *NULL* will be returned in this case. -.. cfunction:: PyObject* PyInt_FromLong(long ival) +.. c:function:: PyObject* PyInt_FromLong(long ival) Create a new integer object with a value of *ival*. @@ -66,7 +66,7 @@ undefined. :-) -.. cfunction:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival) +.. c:function:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival) Create a new integer object with a value of *ival*. If the value is larger than ``LONG_MAX`` or smaller than ``LONG_MIN``, a long integer object is @@ -75,7 +75,7 @@ .. versionadded:: 2.5 -.. cfunction:: PyObject* PyInt_FromSize_t(size_t ival) +.. c:function:: PyObject* PyInt_FromSize_t(size_t ival) Create a new integer object with a value of *ival*. If the value exceeds ``LONG_MAX``, a long integer object is returned. @@ -83,47 +83,47 @@ .. versionadded:: 2.5 -.. cfunction:: long PyInt_AsLong(PyObject *io) +.. c:function:: long PyInt_AsLong(PyObject *io) - Will first attempt to cast the object to a :ctype:`PyIntObject`, if it is not + Will first attempt to cast the object to a :c:type:`PyIntObject`, if it is not already one, and then return its value. If there is an error, ``-1`` is returned, and the caller should check ``PyErr_Occurred()`` to find out whether there was an error, or whether the value just happened to be -1. -.. cfunction:: long PyInt_AS_LONG(PyObject *io) +.. c:function:: long PyInt_AS_LONG(PyObject *io) Return the value of the object *io*. No error checking is performed. -.. cfunction:: unsigned long PyInt_AsUnsignedLongMask(PyObject *io) +.. c:function:: unsigned long PyInt_AsUnsignedLongMask(PyObject *io) - Will first attempt to cast the object to a :ctype:`PyIntObject` or - :ctype:`PyLongObject`, if it is not already one, and then return its value as + Will first attempt to cast the object to a :c:type:`PyIntObject` or + :c:type:`PyLongObject`, if it is not already one, and then return its value as unsigned long. This function does not check for overflow. .. versionadded:: 2.3 -.. cfunction:: unsigned PY_LONG_LONG PyInt_AsUnsignedLongLongMask(PyObject *io) +.. c:function:: unsigned PY_LONG_LONG PyInt_AsUnsignedLongLongMask(PyObject *io) - Will first attempt to cast the object to a :ctype:`PyIntObject` or - :ctype:`PyLongObject`, if it is not already one, and then return its value as + Will first attempt to cast the object to a :c:type:`PyIntObject` or + :c:type:`PyLongObject`, if it is not already one, and then return its value as unsigned long long, without checking for overflow. .. versionadded:: 2.3 -.. cfunction:: Py_ssize_t PyInt_AsSsize_t(PyObject *io) +.. c:function:: Py_ssize_t PyInt_AsSsize_t(PyObject *io) - Will first attempt to cast the object to a :ctype:`PyIntObject` or - :ctype:`PyLongObject`, if it is not already one, and then return its value as - :ctype:`Py_ssize_t`. + Will first attempt to cast the object to a :c:type:`PyIntObject` or + :c:type:`PyLongObject`, if it is not already one, and then return its value as + :c:type:`Py_ssize_t`. .. versionadded:: 2.5 -.. cfunction:: long PyInt_GetMax() +.. c:function:: long PyInt_GetMax() .. index:: single: LONG_MAX @@ -131,7 +131,7 @@ (:const:`LONG_MAX`, as defined in the system header files). -.. cfunction:: int PyInt_ClearFreeList() +.. c:function:: int PyInt_ClearFreeList() Clear the integer free list. Return the number of items that could not be freed. diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -88,15 +88,15 @@ .. index:: object: type Most Python/C API functions have one or more arguments as well as a return value -of type :ctype:`PyObject\*`. This type is a pointer to an opaque data type +of type :c:type:`PyObject\*`. This type is a pointer to an opaque data type representing an arbitrary Python object. Since all Python object types are treated the same way by the Python language in most situations (e.g., assignments, scope rules, and argument passing), it is only fitting that they should be represented by a single C type. Almost all Python objects live on the heap: you never declare an automatic or static variable of type -:ctype:`PyObject`, only pointer variables of type :ctype:`PyObject\*` can be +:c:type:`PyObject`, only pointer variables of type :c:type:`PyObject\*` can be declared. The sole exception are the type objects; since these must never be -deallocated, they are typically static :ctype:`PyTypeObject` objects. +deallocated, they are typically static :c:type:`PyTypeObject` objects. All Python objects (even Python integers) have a :dfn:`type` and a :dfn:`reference count`. An object's type determines what kind of object it is @@ -127,8 +127,8 @@ single: Py_DECREF() Reference counts are always manipulated explicitly. The normal way is to use -the macro :cfunc:`Py_INCREF` to increment an object's reference count by one, -and :cfunc:`Py_DECREF` to decrement it by one. The :cfunc:`Py_DECREF` macro +the macro :c:func:`Py_INCREF` to increment an object's reference count by one, +and :c:func:`Py_DECREF` to decrement it by one. The :c:func:`Py_DECREF` macro is considerably more complex than the incref one, since it must check whether the reference count becomes zero and then cause the object's deallocator to be called. The deallocator is a function pointer contained in the object's type @@ -159,13 +159,13 @@ conceivably remove the object from the list, decrementing its reference count and possible deallocating it. The real danger is that innocent-looking operations may invoke arbitrary Python code which could do this; there is a code -path which allows control to flow back to the user from a :cfunc:`Py_DECREF`, so +path which allows control to flow back to the user from a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous. A safe approach is to always use the generic operations (functions whose name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or ``PyMapping_``). These operations always increment the reference count of the object they return. -This leaves the caller with the responsibility to call :cfunc:`Py_DECREF` when +This leaves the caller with the responsibility to call :c:func:`Py_DECREF` when they are done with the result; this soon becomes second nature. @@ -180,7 +180,7 @@ reference" means being responsible for calling Py_DECREF on it when the reference is no longer needed. Ownership can also be transferred, meaning that the code that receives ownership of the reference then becomes responsible for -eventually decref'ing it by calling :cfunc:`Py_DECREF` or :cfunc:`Py_XDECREF` +eventually decref'ing it by calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or passing on this responsibility (usually to its caller). When a function passes ownership of a reference on to its caller, the caller is said to receive a *new* reference. When no ownership is transferred, @@ -198,7 +198,7 @@ single: PyTuple_SetItem() Few functions steal references; the two notable exceptions are -:cfunc:`PyList_SetItem` and :cfunc:`PyTuple_SetItem`, which steal a reference +:c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to the item (but not to the tuple or list into which the item is put!). These functions were designed to steal a reference because of a common idiom for populating a tuple or list with newly created objects; for example, the code to @@ -212,21 +212,21 @@ PyTuple_SetItem(t, 1, PyInt_FromLong(2L)); PyTuple_SetItem(t, 2, PyString_FromString("three")); -Here, :cfunc:`PyInt_FromLong` returns a new reference which is immediately -stolen by :cfunc:`PyTuple_SetItem`. When you want to keep using an object -although the reference to it will be stolen, use :cfunc:`Py_INCREF` to grab +Here, :c:func:`PyInt_FromLong` returns a new reference which is immediately +stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object +although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab another reference before calling the reference-stealing function. -Incidentally, :cfunc:`PyTuple_SetItem` is the *only* way to set tuple items; -:cfunc:`PySequence_SetItem` and :cfunc:`PyObject_SetItem` refuse to do this +Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple items; +:c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to do this since tuples are an immutable data type. You should only use -:cfunc:`PyTuple_SetItem` for tuples that you are creating yourself. +:c:func:`PyTuple_SetItem` for tuples that you are creating yourself. -Equivalent code for populating a list can be written using :cfunc:`PyList_New` -and :cfunc:`PyList_SetItem`. +Equivalent code for populating a list can be written using :c:func:`PyList_New` +and :c:func:`PyList_SetItem`. However, in practice, you will rarely use these ways of creating and populating -a tuple or list. There's a generic function, :cfunc:`Py_BuildValue`, that can +a tuple or list. There's a generic function, :c:func:`Py_BuildValue`, that can create most common objects from C values, directed by a :dfn:`format string`. For example, the above two blocks of code could be replaced by the following (which also takes care of the error checking):: @@ -236,7 +236,7 @@ tuple = Py_BuildValue("(iis)", 1, 2, "three"); list = Py_BuildValue("[iis]", 1, 2, "three"); -It is much more common to use :cfunc:`PyObject_SetItem` and friends with items +It is much more common to use :c:func:`PyObject_SetItem` and friends with items whose references you are only borrowing, like arguments that were passed in to the function you are writing. In that case, their behaviour regarding reference counts is much saner, since you don't have to increment a reference count so you @@ -270,15 +270,15 @@ you ownership of the reference. The reason is simple: in many cases, the returned object is created on the fly, and the reference you get is the only reference to the object. Therefore, the generic functions that return object -references, like :cfunc:`PyObject_GetItem` and :cfunc:`PySequence_GetItem`, +references, like :c:func:`PyObject_GetItem` and :c:func:`PySequence_GetItem`, always return a new reference (the caller becomes the owner of the reference). It is important to realize that whether you own a reference returned by a function depends on which function you call only --- *the plumage* (the type of the object passed as an argument to the function) *doesn't enter into it!* -Thus, if you extract an item from a list using :cfunc:`PyList_GetItem`, you +Thus, if you extract an item from a list using :c:func:`PyList_GetItem`, you don't own the reference --- but if you obtain the same item from the same list -using :cfunc:`PySequence_GetItem` (which happens to take exactly the same +using :c:func:`PySequence_GetItem` (which happens to take exactly the same arguments), you do own a reference to the returned object. .. index:: @@ -286,8 +286,8 @@ single: PySequence_GetItem() Here is an example of how you could write a function that computes the sum of -the items in a list of integers; once using :cfunc:`PyList_GetItem`, and once -using :cfunc:`PySequence_GetItem`. :: +the items in a list of integers; once using :c:func:`PyList_GetItem`, and once +using :c:func:`PySequence_GetItem`. :: long sum_list(PyObject *list) @@ -340,8 +340,8 @@ ----- There are few other data types that play a significant role in the Python/C -API; most are simple C types such as :ctype:`int`, :ctype:`long`, -:ctype:`double` and :ctype:`char\*`. A few structure types are used to +API; most are simple C types such as :c:type:`int`, :c:type:`long`, +:c:type:`double` and :c:type:`char\*`. A few structure types are used to describe static tables used to list the functions exported by a module or the data attributes of a new object type, and another is used to describe the value of a complex number. These will be discussed together with the functions that @@ -370,7 +370,7 @@ A few functions return a Boolean true/false result, with false indicating an error. Very few functions return no explicit error indicator or have an ambiguous return value, and require explicit testing for errors with -:cfunc:`PyErr_Occurred`. These exceptions are always explicitly documented. +:c:func:`PyErr_Occurred`. These exceptions are always explicitly documented. .. index:: single: PyErr_SetString() @@ -379,11 +379,11 @@ Exception state is maintained in per-thread storage (this is equivalent to using global storage in an unthreaded application). A thread can be in one of two states: an exception has occurred, or not. The function -:cfunc:`PyErr_Occurred` can be used to check for this: it returns a borrowed +:c:func:`PyErr_Occurred` can be used to check for this: it returns a borrowed reference to the exception type object when an exception has occurred, and *NULL* otherwise. There are a number of functions to set the exception state: -:cfunc:`PyErr_SetString` is the most common (though not the most general) -function to set the exception state, and :cfunc:`PyErr_Clear` clears the +:c:func:`PyErr_SetString` is the most common (though not the most general) +function to set the exception state, and :c:func:`PyErr_Clear` clears the exception state. .. index:: @@ -424,7 +424,7 @@ .. index:: single: sum_sequence() A simple example of detecting exceptions and passing them on is shown in the -:cfunc:`sum_sequence` example above. It so happens that that example doesn't +:c:func:`sum_sequence` example above. It so happens that that example doesn't need to clean up any owned references when it detects an error. The following example function shows some error cleanup. First, to remind you why you like Python, we show the equivalent Python code:: @@ -491,10 +491,10 @@ single: Py_XDECREF() This example represents an endorsed use of the ``goto`` statement in C! -It illustrates the use of :cfunc:`PyErr_ExceptionMatches` and -:cfunc:`PyErr_Clear` to handle specific exceptions, and the use of -:cfunc:`Py_XDECREF` to dispose of owned references that may be *NULL* (note the -``'X'`` in the name; :cfunc:`Py_DECREF` would crash when confronted with a +It illustrates the use of :c:func:`PyErr_ExceptionMatches` and +:c:func:`PyErr_Clear` to handle specific exceptions, and the use of +:c:func:`Py_XDECREF` to dispose of owned references that may be *NULL* (note the +``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a *NULL* reference). It is important that the variables used to hold owned references are initialized to *NULL* for this to work; likewise, the proposed return value is initialized to ``-1`` (failure) and only set to success after @@ -520,20 +520,20 @@ triple: module; search; path single: path (in module sys) -The basic initialization function is :cfunc:`Py_Initialize`. This initializes +The basic initialization function is :c:func:`Py_Initialize`. This initializes the table of loaded modules, and creates the fundamental modules :mod:`__builtin__`, :mod:`__main__`, :mod:`sys`, and :mod:`exceptions`. It also initializes the module search path (``sys.path``). .. index:: single: PySys_SetArgvEx() -:cfunc:`Py_Initialize` does not set the "script argument list" (``sys.argv``). +:c:func:`Py_Initialize` does not set the "script argument list" (``sys.argv``). If this variable is needed by Python code that will be executed later, it must be set explicitly with a call to ``PySys_SetArgvEx(argc, argv, updatepath)`` -after the call to :cfunc:`Py_Initialize`. +after the call to :c:func:`Py_Initialize`. On most systems (in particular, on Unix and Windows, although the details are -slightly different), :cfunc:`Py_Initialize` calculates the module search path +slightly different), :c:func:`Py_Initialize` calculates the module search path based upon its best guess for the location of the standard Python interpreter executable, assuming that the Python library is found in a fixed location relative to the Python interpreter executable. In particular, it looks for a @@ -557,22 +557,22 @@ single: Py_GetProgramFullPath() The embedding application can steer the search by calling -``Py_SetProgramName(file)`` *before* calling :cfunc:`Py_Initialize`. Note that +``Py_SetProgramName(file)`` *before* calling :c:func:`Py_Initialize`. Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is still inserted in front of the standard path. An application that requires total -control has to provide its own implementation of :cfunc:`Py_GetPath`, -:cfunc:`Py_GetPrefix`, :cfunc:`Py_GetExecPrefix`, and -:cfunc:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`). +control has to provide its own implementation of :c:func:`Py_GetPath`, +:c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and +:c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`). .. index:: single: Py_IsInitialized() Sometimes, it is desirable to "uninitialize" Python. For instance, the application may want to start over (make another call to -:cfunc:`Py_Initialize`) or the application is simply done with its use of +:c:func:`Py_Initialize`) or the application is simply done with its use of Python and wants to free memory allocated by Python. This can be accomplished -by calling :cfunc:`Py_Finalize`. The function :cfunc:`Py_IsInitialized` returns +by calling :c:func:`Py_Finalize`. The function :c:func:`Py_IsInitialized` returns true if Python is currently in the initialized state. More information about -these functions is given in a later chapter. Notice that :cfunc:`Py_Finalize` +these functions is given in a later chapter. Notice that :c:func:`Py_Finalize` does *not* free all memory allocated by the Python interpreter, e.g. memory allocated by extension modules currently cannot be released. @@ -592,11 +592,11 @@ allocator, or low-level profiling of the main interpreter loop. Only the most frequently-used builds will be described in the remainder of this section. -Compiling the interpreter with the :cmacro:`Py_DEBUG` macro defined produces -what is generally meant by "a debug build" of Python. :cmacro:`Py_DEBUG` is +Compiling the interpreter with the :c:macro:`Py_DEBUG` macro defined produces +what is generally meant by "a debug build" of Python. :c:macro:`Py_DEBUG` is enabled in the Unix build by adding ``--with-pydebug`` to the :file:`./configure` command. It is also implied by the presence of the -not-Python-specific :cmacro:`_DEBUG` macro. When :cmacro:`Py_DEBUG` is enabled +not-Python-specific :c:macro:`_DEBUG` macro. When :c:macro:`Py_DEBUG` is enabled in the Unix build, compiler optimization is disabled. In addition to the reference count debugging described below, the following @@ -625,11 +625,11 @@ There may be additional checks not mentioned here. -Defining :cmacro:`Py_TRACE_REFS` enables reference tracing. When defined, a +Defining :c:macro:`Py_TRACE_REFS` enables reference tracing. When defined, a circular doubly linked list of active objects is maintained by adding two extra -fields to every :ctype:`PyObject`. Total allocations are tracked as well. Upon +fields to every :c:type:`PyObject`. Total allocations are tracked as well. Upon exit, all existing references are printed. (In interactive mode this happens -after every statement run by the interpreter.) Implied by :cmacro:`Py_DEBUG`. +after every statement run by the interpreter.) Implied by :c:macro:`Py_DEBUG`. Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source distribution for more detailed information. diff --git a/Doc/c-api/iter.rst b/Doc/c-api/iter.rst --- a/Doc/c-api/iter.rst +++ b/Doc/c-api/iter.rst @@ -10,12 +10,12 @@ There are only a couple of functions specifically for working with iterators. -.. cfunction:: int PyIter_Check(PyObject *o) +.. c:function:: int PyIter_Check(PyObject *o) Return true if the object *o* supports the iterator protocol. -.. cfunction:: PyObject* PyIter_Next(PyObject *o) +.. c:function:: PyObject* PyIter_Next(PyObject *o) Return the next value from the iteration *o*. If the object is an iterator, this retrieves the next value from the iteration, and returns *NULL* with no diff --git a/Doc/c-api/iterator.rst b/Doc/c-api/iterator.rst --- a/Doc/c-api/iterator.rst +++ b/Doc/c-api/iterator.rst @@ -12,23 +12,23 @@ sentinel value is returned. -.. cvar:: PyTypeObject PySeqIter_Type +.. c:var:: PyTypeObject PySeqIter_Type - Type object for iterator objects returned by :cfunc:`PySeqIter_New` and the + Type object for iterator objects returned by :c:func:`PySeqIter_New` and the one-argument form of the :func:`iter` built-in function for built-in sequence types. .. versionadded:: 2.2 -.. cfunction:: int PySeqIter_Check(op) +.. c:function:: int PySeqIter_Check(op) - Return true if the type of *op* is :cdata:`PySeqIter_Type`. + Return true if the type of *op* is :c:data:`PySeqIter_Type`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PySeqIter_New(PyObject *seq) +.. c:function:: PyObject* PySeqIter_New(PyObject *seq) Return an iterator that works with a general sequence object, *seq*. The iteration ends when the sequence raises :exc:`IndexError` for the subscripting @@ -37,22 +37,22 @@ .. versionadded:: 2.2 -.. cvar:: PyTypeObject PyCallIter_Type +.. c:var:: PyTypeObject PyCallIter_Type - Type object for iterator objects returned by :cfunc:`PyCallIter_New` and the + Type object for iterator objects returned by :c:func:`PyCallIter_New` and the two-argument form of the :func:`iter` built-in function. .. versionadded:: 2.2 -.. cfunction:: int PyCallIter_Check(op) +.. c:function:: int PyCallIter_Check(op) - Return true if the type of *op* is :cdata:`PyCallIter_Type`. + Return true if the type of *op* is :c:data:`PyCallIter_Type`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyCallIter_New(PyObject *callable, PyObject *sentinel) +.. c:function:: PyObject* PyCallIter_New(PyObject *callable, PyObject *sentinel) Return a new iterator. The first parameter, *callable*, can be any Python callable object that can be called with no parameters; each call to it should diff --git a/Doc/c-api/list.rst b/Doc/c-api/list.rst --- a/Doc/c-api/list.rst +++ b/Doc/c-api/list.rst @@ -8,18 +8,18 @@ .. index:: object: list -.. ctype:: PyListObject +.. c:type:: PyListObject - This subtype of :ctype:`PyObject` represents a Python list object. + This subtype of :c:type:`PyObject` represents a Python list object. -.. cvar:: PyTypeObject PyList_Type +.. c:var:: PyTypeObject PyList_Type - This instance of :ctype:`PyTypeObject` represents the Python list type. This + This instance of :c:type:`PyTypeObject` represents the Python list type. This is the same object as ``list`` in the Python layer. -.. cfunction:: int PyList_Check(PyObject *p) +.. c:function:: int PyList_Check(PyObject *p) Return true if *p* is a list object or an instance of a subtype of the list type. @@ -28,7 +28,7 @@ Allowed subtypes to be accepted. -.. cfunction:: int PyList_CheckExact(PyObject *p) +.. c:function:: int PyList_CheckExact(PyObject *p) Return true if *p* is a list object, but not an instance of a subtype of the list type. @@ -36,7 +36,7 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyList_New(Py_ssize_t len) +.. c:function:: PyObject* PyList_New(Py_ssize_t len) Return a new list of length *len* on success, or *NULL* on failure. @@ -44,15 +44,15 @@ If *len* is greater than zero, the returned list object's items are set to ``NULL``. Thus you cannot use abstract API functions such as - :cfunc:`PySequence_SetItem` or expose the object to Python code before - setting all items to a real object with :cfunc:`PyList_SetItem`. + :c:func:`PySequence_SetItem` or expose the object to Python code before + setting all items to a real object with :c:func:`PyList_SetItem`. .. versionchanged:: 2.5 - This function used an :ctype:`int` for *size*. This might require + This function used an :c:type:`int` for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyList_Size(PyObject *list) +.. c:function:: Py_ssize_t PyList_Size(PyObject *list) .. index:: builtin: len @@ -60,20 +60,20 @@ ``len(list)`` on a list object. .. versionchanged:: 2.5 - This function returned an :ctype:`int`. This might require changes in + This function returned an :c:type:`int`. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyList_GET_SIZE(PyObject *list) +.. c:function:: Py_ssize_t PyList_GET_SIZE(PyObject *list) - Macro form of :cfunc:`PyList_Size` without error checking. + Macro form of :c:func:`PyList_Size` without error checking. .. versionchanged:: 2.5 - This macro returned an :ctype:`int`. This might require changes in your + This macro returned an :c:type:`int`. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index) +.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index) Return the object at position *index* in the list pointed to by *list*. The position must be positive, indexing from the end of the list is not @@ -81,20 +81,20 @@ :exc:`IndexError` exception. .. versionchanged:: 2.5 - This function used an :ctype:`int` for *index*. This might require + This function used an :c:type:`int` for *index*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i) +.. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i) - Macro form of :cfunc:`PyList_GetItem` without error checking. + Macro form of :c:func:`PyList_GetItem` without error checking. .. versionchanged:: 2.5 - This macro used an :ctype:`int` for *i*. This might require changes in + This macro used an :c:type:`int` for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item) +.. c:function:: int PyList_SetItem(PyObject *list, Py_ssize_t index, PyObject *item) Set the item at index *index* in list to *item*. Return ``0`` on success or ``-1`` on failure. @@ -105,46 +105,46 @@ an item already in the list at the affected position. .. versionchanged:: 2.5 - This function used an :ctype:`int` for *index*. This might require + This function used an :c:type:`int` for *index*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o) +.. c:function:: void PyList_SET_ITEM(PyObject *list, Py_ssize_t i, PyObject *o) - Macro form of :cfunc:`PyList_SetItem` without error checking. This is + Macro form of :c:func:`PyList_SetItem` without error checking. This is normally only used to fill in new lists where there is no previous content. .. note:: This macro "steals" a reference to *item*, and, unlike - :cfunc:`PyList_SetItem`, does *not* discard a reference to any item that + :c:func:`PyList_SetItem`, does *not* discard a reference to any item that it being replaced; any reference in *list* at position *i* will be leaked. .. versionchanged:: 2.5 - This macro used an :ctype:`int` for *i*. This might require + This macro used an :c:type:`int` for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyList_Insert(PyObject *list, Py_ssize_t index, PyObject *item) +.. c:function:: int PyList_Insert(PyObject *list, Py_ssize_t index, PyObject *item) Insert the item *item* into list *list* in front of index *index*. Return ``0`` if successful; return ``-1`` and set an exception if unsuccessful. Analogous to ``list.insert(index, item)``. .. versionchanged:: 2.5 - This function used an :ctype:`int` for *index*. This might require + This function used an :c:type:`int` for *index*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyList_Append(PyObject *list, PyObject *item) +.. c:function:: int PyList_Append(PyObject *list, PyObject *item) Append the object *item* at the end of list *list*. Return ``0`` if successful; return ``-1`` and set an exception if unsuccessful. Analogous to ``list.append(item)``. -.. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high) +.. c:function:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high) Return a list of the objects in *list* containing the objects *between* *low* and *high*. Return *NULL* and set an exception if unsuccessful. Analogous @@ -152,11 +152,11 @@ supported. .. versionchanged:: 2.5 - This function used an :ctype:`int` for *low* and *high*. This might + This function used an :c:type:`int` for *low* and *high*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist) +.. c:function:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist) Set the slice of *list* between *low* and *high* to the contents of *itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may @@ -165,23 +165,23 @@ slicing from Python, are not supported. .. versionchanged:: 2.5 - This function used an :ctype:`int` for *low* and *high*. This might + This function used an :c:type:`int` for *low* and *high*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyList_Sort(PyObject *list) +.. c:function:: int PyList_Sort(PyObject *list) Sort the items of *list* in place. Return ``0`` on success, ``-1`` on failure. This is equivalent to ``list.sort()``. -.. cfunction:: int PyList_Reverse(PyObject *list) +.. c:function:: int PyList_Reverse(PyObject *list) Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on failure. This is the equivalent of ``list.reverse()``. -.. cfunction:: PyObject* PyList_AsTuple(PyObject *list) +.. c:function:: PyObject* PyList_AsTuple(PyObject *list) .. index:: builtin: tuple diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -8,100 +8,100 @@ .. index:: object: long integer -.. ctype:: PyLongObject +.. c:type:: PyLongObject - This subtype of :ctype:`PyObject` represents a Python long integer object. + This subtype of :c:type:`PyObject` represents a Python long integer object. -.. cvar:: PyTypeObject PyLong_Type +.. c:var:: PyTypeObject PyLong_Type .. index:: single: LongType (in modules types) - This instance of :ctype:`PyTypeObject` represents the Python long integer type. + This instance of :c:type:`PyTypeObject` represents the Python long integer type. This is the same object as ``long`` and ``types.LongType``. -.. cfunction:: int PyLong_Check(PyObject *p) +.. c:function:: int PyLong_Check(PyObject *p) - Return true if its argument is a :ctype:`PyLongObject` or a subtype of - :ctype:`PyLongObject`. + Return true if its argument is a :c:type:`PyLongObject` or a subtype of + :c:type:`PyLongObject`. .. versionchanged:: 2.2 Allowed subtypes to be accepted. -.. cfunction:: int PyLong_CheckExact(PyObject *p) +.. c:function:: int PyLong_CheckExact(PyObject *p) - Return true if its argument is a :ctype:`PyLongObject`, but not a subtype of - :ctype:`PyLongObject`. + Return true if its argument is a :c:type:`PyLongObject`, but not a subtype of + :c:type:`PyLongObject`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyLong_FromLong(long v) +.. c:function:: PyObject* PyLong_FromLong(long v) - Return a new :ctype:`PyLongObject` object from *v*, or *NULL* on failure. + Return a new :c:type:`PyLongObject` object from *v*, or *NULL* on failure. -.. cfunction:: PyObject* PyLong_FromUnsignedLong(unsigned long v) +.. c:function:: PyObject* PyLong_FromUnsignedLong(unsigned long v) - Return a new :ctype:`PyLongObject` object from a C :ctype:`unsigned long`, or + Return a new :c:type:`PyLongObject` object from a C :c:type:`unsigned long`, or *NULL* on failure. -.. cfunction:: PyObject* PyLong_FromSsize_t(Py_ssize_t v) +.. c:function:: PyObject* PyLong_FromSsize_t(Py_ssize_t v) - Return a new :ctype:`PyLongObject` object from a C :ctype:`Py_ssize_t`, or + Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or *NULL* on failure. .. versionadded:: 2.6 -.. cfunction:: PyObject* PyLong_FromSize_t(size_t v) +.. c:function:: PyObject* PyLong_FromSize_t(size_t v) - Return a new :ctype:`PyLongObject` object from a C :ctype:`size_t`, or + Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or *NULL* on failure. .. versionadded:: 2.6 -.. cfunction:: PyObject* PyLong_FromSsize_t(Py_ssize_t v) +.. c:function:: PyObject* PyLong_FromSsize_t(Py_ssize_t v) - Return a new :ctype:`PyLongObject` object with a value of *v*, or *NULL* + Return a new :c:type:`PyLongObject` object with a value of *v*, or *NULL* on failure. .. versionadded:: 2.6 -.. cfunction:: PyObject* PyLong_FromSize_t(size_t v) +.. c:function:: PyObject* PyLong_FromSize_t(size_t v) - Return a new :ctype:`PyLongObject` object with a value of *v*, or *NULL* + Return a new :c:type:`PyLongObject` object with a value of *v*, or *NULL* on failure. .. versionadded:: 2.6 -.. cfunction:: PyObject* PyLong_FromLongLong(PY_LONG_LONG v) +.. c:function:: PyObject* PyLong_FromLongLong(PY_LONG_LONG v) - Return a new :ctype:`PyLongObject` object from a C :ctype:`long long`, or *NULL* + Return a new :c:type:`PyLongObject` object from a C :c:type:`long long`, or *NULL* on failure. -.. cfunction:: PyObject* PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG v) +.. c:function:: PyObject* PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG v) - Return a new :ctype:`PyLongObject` object from a C :ctype:`unsigned long long`, + Return a new :c:type:`PyLongObject` object from a C :c:type:`unsigned long long`, or *NULL* on failure. -.. cfunction:: PyObject* PyLong_FromDouble(double v) +.. c:function:: PyObject* PyLong_FromDouble(double v) - Return a new :ctype:`PyLongObject` object from the integer part of *v*, or + Return a new :c:type:`PyLongObject` object from the integer part of *v*, or *NULL* on failure. -.. cfunction:: PyObject* PyLong_FromString(char *str, char **pend, int base) +.. c:function:: PyObject* PyLong_FromString(char *str, char **pend, int base) - Return a new :ctype:`PyLongObject` based on the string value in *str*, which is + Return a new :c:type:`PyLongObject` based on the string value in *str*, which is interpreted according to the radix in *base*. If *pend* is non-*NULL*, *\*pend* will point to the first character in *str* which follows the representation of the number. If *base* is ``0``, the radix will be determined @@ -112,7 +112,7 @@ no digits, :exc:`ValueError` will be raised. -.. cfunction:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) +.. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) Convert a sequence of Unicode digits to a Python long integer value. The first parameter, *u*, points to the first character of the Unicode string, *length* @@ -123,14 +123,14 @@ .. versionadded:: 1.6 .. versionchanged:: 2.5 - This function used an :ctype:`int` for *length*. This might require + This function used an :c:type:`int` for *length*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyLong_FromVoidPtr(void *p) +.. c:function:: PyObject* PyLong_FromVoidPtr(void *p) Create a Python integer or long integer from the pointer *p*. The pointer value - can be retrieved from the resulting value using :cfunc:`PyLong_AsVoidPtr`. + can be retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`. .. versionadded:: 1.5.2 @@ -138,20 +138,20 @@ If the integer is larger than LONG_MAX, a positive long integer is returned. -.. cfunction:: long PyLong_AsLong(PyObject *pylong) +.. c:function:: long PyLong_AsLong(PyObject *pylong) .. index:: single: LONG_MAX single: OverflowError (built-in exception) - Return a C :ctype:`long` representation of the contents of *pylong*. If + Return a C :c:type:`long` representation of the contents of *pylong*. If *pylong* is greater than :const:`LONG_MAX`, an :exc:`OverflowError` is raised and ``-1`` will be returned. -.. cfunction:: long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow) +.. c:function:: long PyLong_AsLongAndOverflow(PyObject *pylong, int *overflow) - Return a C :ctype:`long` representation of the contents of + Return a C :c:type:`long` representation of the contents of *pylong*. If *pylong* is greater than :const:`LONG_MAX` or less than :const:`LONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively, and return ``-1``; otherwise, set *\*overflow* to @@ -162,9 +162,9 @@ .. versionadded:: 2.7 -.. cfunction:: PY_LONG_LONG PyLong_AsLongLongAndOverflow(PyObject *pylong, int *overflow) +.. c:function:: PY_LONG_LONG PyLong_AsLongLongAndOverflow(PyObject *pylong, int *overflow) - Return a C :ctype:`long long` representation of the contents of + Return a C :c:type:`long long` representation of the contents of *pylong*. If *pylong* is greater than :const:`PY_LLONG_MAX` or less than :const:`PY_LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively, and return ``-1``; otherwise, set *\*overflow* to @@ -175,61 +175,61 @@ .. versionadded:: 2.7 -.. cfunction:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong) +.. c:function:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong) .. index:: single: PY_SSIZE_T_MAX single: OverflowError (built-in exception) - Return a C :ctype:`Py_ssize_t` representation of the contents of *pylong*. If + Return a C :c:type:`Py_ssize_t` representation of the contents of *pylong*. If *pylong* is greater than :const:`PY_SSIZE_T_MAX`, an :exc:`OverflowError` is raised and ``-1`` will be returned. .. versionadded:: 2.6 -.. cfunction:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong) +.. c:function:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong) .. index:: single: ULONG_MAX single: OverflowError (built-in exception) - Return a C :ctype:`unsigned long` representation of the contents of *pylong*. + Return a C :c:type:`unsigned long` representation of the contents of *pylong*. If *pylong* is greater than :const:`ULONG_MAX`, an :exc:`OverflowError` is raised. -.. cfunction:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong) +.. c:function:: Py_ssize_t PyLong_AsSsize_t(PyObject *pylong) .. index:: single: PY_SSIZE_T_MAX - Return a :ctype:`Py_ssize_t` representation of the contents of *pylong*. If + Return a :c:type:`Py_ssize_t` representation of the contents of *pylong*. If *pylong* is greater than :const:`PY_SSIZE_T_MAX`, an :exc:`OverflowError` is raised. .. versionadded:: 2.6 -.. cfunction:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong) +.. c:function:: PY_LONG_LONG PyLong_AsLongLong(PyObject *pylong) .. index:: single: OverflowError (built-in exception) - Return a C :ctype:`long long` from a Python long integer. If - *pylong* cannot be represented as a :ctype:`long long`, an + Return a C :c:type:`long long` from a Python long integer. If + *pylong* cannot be represented as a :c:type:`long long`, an :exc:`OverflowError` is raised and ``-1`` is returned. .. versionadded:: 2.2 -.. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong) +.. c:function:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(PyObject *pylong) .. index:: single: OverflowError (built-in exception) - Return a C :ctype:`unsigned long long` from a Python long integer. If - *pylong* cannot be represented as an :ctype:`unsigned long long`, an + Return a C :c:type:`unsigned long long` from a Python long integer. If + *pylong* cannot be represented as an :c:type:`unsigned long long`, an :exc:`OverflowError` is raised and ``(unsigned long long)-1`` is returned. @@ -240,35 +240,35 @@ :exc:`TypeError`. -.. cfunction:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io) +.. c:function:: unsigned long PyLong_AsUnsignedLongMask(PyObject *io) - Return a C :ctype:`unsigned long` from a Python long integer, without checking + Return a C :c:type:`unsigned long` from a Python long integer, without checking for overflow. .. versionadded:: 2.3 -.. cfunction:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject *io) +.. c:function:: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(PyObject *io) - Return a C :ctype:`unsigned long long` from a Python long integer, without + Return a C :c:type:`unsigned long long` from a Python long integer, without checking for overflow. .. versionadded:: 2.3 -.. cfunction:: double PyLong_AsDouble(PyObject *pylong) +.. c:function:: double PyLong_AsDouble(PyObject *pylong) - Return a C :ctype:`double` representation of the contents of *pylong*. If - *pylong* cannot be approximately represented as a :ctype:`double`, an + Return a C :c:type:`double` representation of the contents of *pylong*. If + *pylong* cannot be approximately represented as a :c:type:`double`, an :exc:`OverflowError` exception is raised and ``-1.0`` will be returned. -.. cfunction:: void* PyLong_AsVoidPtr(PyObject *pylong) +.. c:function:: void* PyLong_AsVoidPtr(PyObject *pylong) - Convert a Python integer or long integer *pylong* to a C :ctype:`void` pointer. + Convert a Python integer or long integer *pylong* to a C :c:type:`void` pointer. If *pylong* cannot be converted, an :exc:`OverflowError` will be raised. This - is only assured to produce a usable :ctype:`void` pointer for values created - with :cfunc:`PyLong_FromVoidPtr`. + is only assured to produce a usable :c:type:`void` pointer for values created + with :c:func:`PyLong_FromVoidPtr`. .. versionadded:: 1.5.2 diff --git a/Doc/c-api/mapping.rst b/Doc/c-api/mapping.rst --- a/Doc/c-api/mapping.rst +++ b/Doc/c-api/mapping.rst @@ -6,13 +6,13 @@ ================ -.. cfunction:: int PyMapping_Check(PyObject *o) +.. c:function:: int PyMapping_Check(PyObject *o) Return ``1`` if the object provides mapping protocol, and ``0`` otherwise. This function always succeeds. -.. cfunction:: Py_ssize_t PyMapping_Size(PyObject *o) +.. c:function:: Py_ssize_t PyMapping_Size(PyObject *o) Py_ssize_t PyMapping_Length(PyObject *o) .. index:: builtin: len @@ -22,62 +22,62 @@ expression ``len(o)``. .. versionchanged:: 2.5 - These functions returned an :ctype:`int` type. This might require + These functions returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyMapping_DelItemString(PyObject *o, char *key) +.. c:function:: int PyMapping_DelItemString(PyObject *o, char *key) Remove the mapping for object *key* from the object *o*. Return ``-1`` on failure. This is equivalent to the Python statement ``del o[key]``. -.. cfunction:: int PyMapping_DelItem(PyObject *o, PyObject *key) +.. c:function:: int PyMapping_DelItem(PyObject *o, PyObject *key) Remove the mapping for object *key* from the object *o*. Return ``-1`` on failure. This is equivalent to the Python statement ``del o[key]``. -.. cfunction:: int PyMapping_HasKeyString(PyObject *o, char *key) +.. c:function:: int PyMapping_HasKeyString(PyObject *o, char *key) On success, return ``1`` if the mapping object has the key *key* and ``0`` otherwise. This is equivalent to ``o[key]``, returning ``True`` on success and ``False`` on an exception. This function always succeeds. -.. cfunction:: int PyMapping_HasKey(PyObject *o, PyObject *key) +.. c:function:: int PyMapping_HasKey(PyObject *o, PyObject *key) Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. This is equivalent to ``o[key]``, returning ``True`` on success and ``False`` on an exception. This function always succeeds. -.. cfunction:: PyObject* PyMapping_Keys(PyObject *o) +.. c:function:: PyObject* PyMapping_Keys(PyObject *o) On success, return a list of the keys in object *o*. On failure, return *NULL*. This is equivalent to the Python expression ``o.keys()``. -.. cfunction:: PyObject* PyMapping_Values(PyObject *o) +.. c:function:: PyObject* PyMapping_Values(PyObject *o) On success, return a list of the values in object *o*. On failure, return *NULL*. This is equivalent to the Python expression ``o.values()``. -.. cfunction:: PyObject* PyMapping_Items(PyObject *o) +.. c:function:: PyObject* PyMapping_Items(PyObject *o) On success, return a list of the items in object *o*, where each item is a tuple containing a key-value pair. On failure, return *NULL*. This is equivalent to the Python expression ``o.items()``. -.. cfunction:: PyObject* PyMapping_GetItemString(PyObject *o, char *key) +.. c:function:: PyObject* PyMapping_GetItemString(PyObject *o, char *key) Return element of *o* corresponding to the object *key* or *NULL* on failure. This is the equivalent of the Python expression ``o[key]``. -.. cfunction:: int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v) +.. c:function:: int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v) Map the object *key* to the value *v* in object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o[key] = v``. diff --git a/Doc/c-api/marshal.rst b/Doc/c-api/marshal.rst --- a/Doc/c-api/marshal.rst +++ b/Doc/c-api/marshal.rst @@ -20,17 +20,17 @@ file format (currently 2). -.. cfunction:: void PyMarshal_WriteLongToFile(long value, FILE *file, int version) +.. c:function:: void PyMarshal_WriteLongToFile(long value, FILE *file, int version) - Marshal a :ctype:`long` integer, *value*, to *file*. This will only write + Marshal a :c:type:`long` integer, *value*, to *file*. This will only write the least-significant 32 bits of *value*; regardless of the size of the - native :ctype:`long` type. + native :c:type:`long` type. .. versionchanged:: 2.4 *version* indicates the file format. -.. cfunction:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version) +.. c:function:: void PyMarshal_WriteObjectToFile(PyObject *value, FILE *file, int version) Marshal a Python object, *value*, to *file*. @@ -38,7 +38,7 @@ *version* indicates the file format. -.. cfunction:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version) +.. c:function:: PyObject* PyMarshal_WriteObjectToString(PyObject *value, int version) Return a string object containing the marshalled representation of *value*. @@ -55,31 +55,31 @@ written using these routines? -.. cfunction:: long PyMarshal_ReadLongFromFile(FILE *file) +.. c:function:: long PyMarshal_ReadLongFromFile(FILE *file) - Return a C :ctype:`long` from the data stream in a :ctype:`FILE\*` opened + Return a C :c:type:`long` from the data stream in a :c:type:`FILE\*` opened for reading. Only a 32-bit value can be read in using this function, - regardless of the native size of :ctype:`long`. + regardless of the native size of :c:type:`long`. -.. cfunction:: int PyMarshal_ReadShortFromFile(FILE *file) +.. c:function:: int PyMarshal_ReadShortFromFile(FILE *file) - Return a C :ctype:`short` from the data stream in a :ctype:`FILE\*` opened + Return a C :c:type:`short` from the data stream in a :c:type:`FILE\*` opened for reading. Only a 16-bit value can be read in using this function, - regardless of the native size of :ctype:`short`. + regardless of the native size of :c:type:`short`. -.. cfunction:: PyObject* PyMarshal_ReadObjectFromFile(FILE *file) +.. c:function:: PyObject* PyMarshal_ReadObjectFromFile(FILE *file) - Return a Python object from the data stream in a :ctype:`FILE\*` opened for + Return a Python object from the data stream in a :c:type:`FILE\*` opened for reading. On error, sets the appropriate exception (:exc:`EOFError` or :exc:`TypeError`) and returns *NULL*. -.. cfunction:: PyObject* PyMarshal_ReadLastObjectFromFile(FILE *file) +.. c:function:: PyObject* PyMarshal_ReadLastObjectFromFile(FILE *file) - Return a Python object from the data stream in a :ctype:`FILE\*` opened for - reading. Unlike :cfunc:`PyMarshal_ReadObjectFromFile`, this function + Return a Python object from the data stream in a :c:type:`FILE\*` opened for + reading. Unlike :c:func:`PyMarshal_ReadObjectFromFile`, this function assumes that no further objects will be read from the file, allowing it to aggressively load file data into memory so that the de-serialization can operate from data in memory rather than reading a byte at a time from the @@ -88,7 +88,7 @@ (:exc:`EOFError` or :exc:`TypeError`) and returns *NULL*. -.. cfunction:: PyObject* PyMarshal_ReadObjectFromString(char *string, Py_ssize_t len) +.. c:function:: PyObject* PyMarshal_ReadObjectFromString(char *string, Py_ssize_t len) Return a Python object from the data stream in a character buffer containing *len* bytes pointed to by *string*. On error, sets the @@ -96,5 +96,5 @@ *NULL*. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *len*. This might require + This function used an :c:type:`int` type for *len*. This might require changes in your code for properly supporting 64-bit systems. diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -47,8 +47,8 @@ single: free() To avoid memory corruption, extension writers should never try to operate on -Python objects with the functions exported by the C library: :cfunc:`malloc`, -:cfunc:`calloc`, :cfunc:`realloc` and :cfunc:`free`. This will result in mixed +Python objects with the functions exported by the C library: :c:func:`malloc`, +:c:func:`calloc`, :c:func:`realloc` and :c:func:`free`. This will result in mixed calls between the C allocator and the Python memory manager with fatal consequences, because they implement different algorithms and operate on different heaps. However, one may safely allocate and release memory blocks @@ -94,65 +94,65 @@ memory from the Python heap: -.. cfunction:: void* PyMem_Malloc(size_t n) +.. c:function:: void* PyMem_Malloc(size_t n) - Allocates *n* bytes and returns a pointer of type :ctype:`void\*` to the + Allocates *n* bytes and returns a pointer of type :c:type:`void\*` to the allocated memory, or *NULL* if the request fails. Requesting zero bytes returns - a distinct non-*NULL* pointer if possible, as if :cfunc:`PyMem_Malloc(1)` had + a distinct non-*NULL* pointer if possible, as if :c:func:`PyMem_Malloc(1)` had been called instead. The memory will not have been initialized in any way. -.. cfunction:: void* PyMem_Realloc(void *p, size_t n) +.. c:function:: void* PyMem_Realloc(void *p, size_t n) Resizes the memory block pointed to by *p* to *n* bytes. The contents will be unchanged to the minimum of the old and the new sizes. If *p* is *NULL*, the - call is equivalent to :cfunc:`PyMem_Malloc(n)`; else if *n* is equal to zero, + call is equivalent to :c:func:`PyMem_Malloc(n)`; else if *n* is equal to zero, the memory block is resized but is not freed, and the returned pointer is non-*NULL*. Unless *p* is *NULL*, it must have been returned by a previous call - to :cfunc:`PyMem_Malloc` or :cfunc:`PyMem_Realloc`. If the request fails, - :cfunc:`PyMem_Realloc` returns *NULL* and *p* remains a valid pointer to the + to :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`. If the request fails, + :c:func:`PyMem_Realloc` returns *NULL* and *p* remains a valid pointer to the previous memory area. -.. cfunction:: void PyMem_Free(void *p) +.. c:function:: void PyMem_Free(void *p) Frees the memory block pointed to by *p*, which must have been returned by a - previous call to :cfunc:`PyMem_Malloc` or :cfunc:`PyMem_Realloc`. Otherwise, or - if :cfunc:`PyMem_Free(p)` has been called before, undefined behavior occurs. If + previous call to :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc`. Otherwise, or + if :c:func:`PyMem_Free(p)` has been called before, undefined behavior occurs. If *p* is *NULL*, no operation is performed. The following type-oriented macros are provided for convenience. Note that *TYPE* refers to any C type. -.. cfunction:: TYPE* PyMem_New(TYPE, size_t n) +.. c:function:: TYPE* PyMem_New(TYPE, size_t n) - Same as :cfunc:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes of - memory. Returns a pointer cast to :ctype:`TYPE\*`. The memory will not have + Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes of + memory. Returns a pointer cast to :c:type:`TYPE\*`. The memory will not have been initialized in any way. -.. cfunction:: TYPE* PyMem_Resize(void *p, TYPE, size_t n) +.. c:function:: TYPE* PyMem_Resize(void *p, TYPE, size_t n) - Same as :cfunc:`PyMem_Realloc`, but the memory block is resized to ``(n * - sizeof(TYPE))`` bytes. Returns a pointer cast to :ctype:`TYPE\*`. On return, + Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * + sizeof(TYPE))`` bytes. Returns a pointer cast to :c:type:`TYPE\*`. On return, *p* will be a pointer to the new memory area, or *NULL* in the event of failure. This is a C preprocessor macro; p is always reassigned. Save the original value of p to avoid losing memory when handling errors. -.. cfunction:: void PyMem_Del(void *p) +.. c:function:: void PyMem_Del(void *p) - Same as :cfunc:`PyMem_Free`. + Same as :c:func:`PyMem_Free`. In addition, the following macro sets are provided for calling the Python memory allocator directly, without involving the C API functions listed above. However, note that their use does not preserve binary compatibility across Python versions and is therefore deprecated in extension modules. -:cfunc:`PyMem_MALLOC`, :cfunc:`PyMem_REALLOC`, :cfunc:`PyMem_FREE`. +:c:func:`PyMem_MALLOC`, :c:func:`PyMem_REALLOC`, :c:func:`PyMem_FREE`. -:cfunc:`PyMem_NEW`, :cfunc:`PyMem_RESIZE`, :cfunc:`PyMem_DEL`. +:c:func:`PyMem_NEW`, :c:func:`PyMem_RESIZE`, :c:func:`PyMem_DEL`. .. _memoryexamples: @@ -201,8 +201,8 @@ free(buf1); /* Fatal -- should be PyMem_Del() */ In addition to the functions aimed at handling raw memory blocks from the Python -heap, objects in Python are allocated and released with :cfunc:`PyObject_New`, -:cfunc:`PyObject_NewVar` and :cfunc:`PyObject_Del`. +heap, objects in Python are allocated and released with :c:func:`PyObject_New`, +:c:func:`PyObject_NewVar` and :c:func:`PyObject_Del`. These will be explained in the next chapter on defining and implementing new object types in C. diff --git a/Doc/c-api/method.rst b/Doc/c-api/method.rst --- a/Doc/c-api/method.rst +++ b/Doc/c-api/method.rst @@ -10,21 +10,21 @@ There are some useful functions that are useful for working with method objects. -.. cvar:: PyTypeObject PyMethod_Type +.. c:var:: PyTypeObject PyMethod_Type .. index:: single: MethodType (in module types) - This instance of :ctype:`PyTypeObject` represents the Python method type. This + This instance of :c:type:`PyTypeObject` represents the Python method type. This is exposed to Python programs as ``types.MethodType``. -.. cfunction:: int PyMethod_Check(PyObject *o) +.. c:function:: int PyMethod_Check(PyObject *o) - Return true if *o* is a method object (has type :cdata:`PyMethod_Type`). The + Return true if *o* is a method object (has type :c:data:`PyMethod_Type`). The parameter must not be *NULL*. -.. cfunction:: PyObject* PyMethod_New(PyObject *func, PyObject *self, PyObject *class) +.. c:function:: PyObject* PyMethod_New(PyObject *func, PyObject *self, PyObject *class) Return a new method object, with *func* being any callable object; this is the function that will be called when the method is called. If this method should @@ -33,39 +33,39 @@ class which provides the unbound method.. -.. cfunction:: PyObject* PyMethod_Class(PyObject *meth) +.. c:function:: PyObject* PyMethod_Class(PyObject *meth) Return the class object from which the method *meth* was created; if this was created from an instance, it will be the class of the instance. -.. cfunction:: PyObject* PyMethod_GET_CLASS(PyObject *meth) +.. c:function:: PyObject* PyMethod_GET_CLASS(PyObject *meth) - Macro version of :cfunc:`PyMethod_Class` which avoids error checking. + Macro version of :c:func:`PyMethod_Class` which avoids error checking. -.. cfunction:: PyObject* PyMethod_Function(PyObject *meth) +.. c:function:: PyObject* PyMethod_Function(PyObject *meth) Return the function object associated with the method *meth*. -.. cfunction:: PyObject* PyMethod_GET_FUNCTION(PyObject *meth) +.. c:function:: PyObject* PyMethod_GET_FUNCTION(PyObject *meth) - Macro version of :cfunc:`PyMethod_Function` which avoids error checking. + Macro version of :c:func:`PyMethod_Function` which avoids error checking. -.. cfunction:: PyObject* PyMethod_Self(PyObject *meth) +.. c:function:: PyObject* PyMethod_Self(PyObject *meth) Return the instance associated with the method *meth* if it is bound, otherwise return *NULL*. -.. cfunction:: PyObject* PyMethod_GET_SELF(PyObject *meth) +.. c:function:: PyObject* PyMethod_GET_SELF(PyObject *meth) - Macro version of :cfunc:`PyMethod_Self` which avoids error checking. + Macro version of :c:func:`PyMethod_Self` which avoids error checking. -.. cfunction:: int PyMethod_ClearFreeList() +.. c:function:: int PyMethod_ClearFreeList() Clear the free list. Return the total number of freed items. diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -10,15 +10,15 @@ There are only a few functions special to module objects. -.. cvar:: PyTypeObject PyModule_Type +.. c:var:: PyTypeObject PyModule_Type .. index:: single: ModuleType (in module types) - This instance of :ctype:`PyTypeObject` represents the Python module type. This + This instance of :c:type:`PyTypeObject` represents the Python module type. This is exposed to Python programs as ``types.ModuleType``. -.. cfunction:: int PyModule_Check(PyObject *p) +.. c:function:: int PyModule_Check(PyObject *p) Return true if *p* is a module object, or a subtype of a module object. @@ -26,15 +26,15 @@ Allowed subtypes to be accepted. -.. cfunction:: int PyModule_CheckExact(PyObject *p) +.. c:function:: int PyModule_CheckExact(PyObject *p) Return true if *p* is a module object, but not a subtype of - :cdata:`PyModule_Type`. + :c:data:`PyModule_Type`. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyModule_New(const char *name) +.. c:function:: PyObject* PyModule_New(const char *name) .. index:: single: __name__ (module attribute) @@ -46,18 +46,18 @@ the caller is responsible for providing a :attr:`__file__` attribute. -.. cfunction:: PyObject* PyModule_GetDict(PyObject *module) +.. c:function:: PyObject* PyModule_GetDict(PyObject *module) .. index:: single: __dict__ (module attribute) Return the dictionary object that implements *module*'s namespace; this object is the same as the :attr:`__dict__` attribute of the module object. This function never fails. It is recommended extensions use other - :cfunc:`PyModule_\*` and :cfunc:`PyObject_\*` functions rather than directly + :c:func:`PyModule_\*` and :c:func:`PyObject_\*` functions rather than directly manipulate a module's :attr:`__dict__`. -.. cfunction:: char* PyModule_GetName(PyObject *module) +.. c:function:: char* PyModule_GetName(PyObject *module) .. index:: single: __name__ (module attribute) @@ -67,7 +67,7 @@ or if it is not a string, :exc:`SystemError` is raised and *NULL* is returned. -.. cfunction:: char* PyModule_GetFilename(PyObject *module) +.. c:function:: char* PyModule_GetFilename(PyObject *module) .. index:: single: __file__ (module attribute) @@ -78,7 +78,7 @@ raise :exc:`SystemError` and return *NULL*. -.. cfunction:: int PyModule_AddObject(PyObject *module, const char *name, PyObject *value) +.. c:function:: int PyModule_AddObject(PyObject *module, const char *name, PyObject *value) Add an object to *module* as *name*. This is a convenience function which can be used from the module's initialization function. This steals a reference to @@ -87,7 +87,7 @@ .. versionadded:: 2.0 -.. cfunction:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value) +.. c:function:: int PyModule_AddIntConstant(PyObject *module, const char *name, long value) Add an integer constant to *module* as *name*. This convenience function can be used from the module's initialization function. Return ``-1`` on error, ``0`` on @@ -96,7 +96,7 @@ .. versionadded:: 2.0 -.. cfunction:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value) +.. c:function:: int PyModule_AddStringConstant(PyObject *module, const char *name, const char *value) Add a string constant to *module* as *name*. This convenience function can be used from the module's initialization function. The string *value* must be @@ -104,7 +104,7 @@ .. versionadded:: 2.0 -.. cfunction:: int PyModule_AddIntMacro(PyObject *module, macro) +.. c:function:: int PyModule_AddIntMacro(PyObject *module, macro) Add an int constant to *module*. The name and the value are taken from *macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int @@ -113,7 +113,7 @@ .. versionadded:: 2.6 -.. cfunction:: int PyModule_AddStringMacro(PyObject *module, macro) +.. c:function:: int PyModule_AddStringMacro(PyObject *module, macro) Add a string constant to *module*. diff --git a/Doc/c-api/none.rst b/Doc/c-api/none.rst --- a/Doc/c-api/none.rst +++ b/Doc/c-api/none.rst @@ -7,22 +7,22 @@ .. index:: object: None -Note that the :ctype:`PyTypeObject` for ``None`` is not directly exposed in the +Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the Python/C API. Since ``None`` is a singleton, testing for object identity (using -``==`` in C) is sufficient. There is no :cfunc:`PyNone_Check` function for the +``==`` in C) is sufficient. There is no :c:func:`PyNone_Check` function for the same reason. -.. cvar:: PyObject* Py_None +.. c:var:: PyObject* Py_None The Python ``None`` object, denoting lack of value. This object has no methods. It needs to be treated just like any other object with respect to reference counts. -.. cmacro:: Py_RETURN_NONE +.. c:macro:: Py_RETURN_NONE - Properly handle returning :cdata:`Py_None` from within a C function. + Properly handle returning :c:data:`Py_None` from within a C function. .. versionadded:: 2.4 diff --git a/Doc/c-api/number.rst b/Doc/c-api/number.rst --- a/Doc/c-api/number.rst +++ b/Doc/c-api/number.rst @@ -6,37 +6,37 @@ =============== -.. cfunction:: int PyNumber_Check(PyObject *o) +.. c:function:: int PyNumber_Check(PyObject *o) Returns ``1`` if the object *o* provides numeric protocols, and false otherwise. This function always succeeds. -.. cfunction:: PyObject* PyNumber_Add(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Add(PyObject *o1, PyObject *o2) Returns the result of adding *o1* and *o2*, or *NULL* on failure. This is the equivalent of the Python expression ``o1 + o2``. -.. cfunction:: PyObject* PyNumber_Subtract(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Subtract(PyObject *o1, PyObject *o2) Returns the result of subtracting *o2* from *o1*, or *NULL* on failure. This is the equivalent of the Python expression ``o1 - o2``. -.. cfunction:: PyObject* PyNumber_Multiply(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Multiply(PyObject *o1, PyObject *o2) Returns the result of multiplying *o1* and *o2*, or *NULL* on failure. This is the equivalent of the Python expression ``o1 * o2``. -.. cfunction:: PyObject* PyNumber_Divide(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Divide(PyObject *o1, PyObject *o2) Returns the result of dividing *o1* by *o2*, or *NULL* on failure. This is the equivalent of the Python expression ``o1 / o2``. -.. cfunction:: PyObject* PyNumber_FloorDivide(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_FloorDivide(PyObject *o1, PyObject *o2) Return the floor of *o1* divided by *o2*, or *NULL* on failure. This is equivalent to the "classic" division of integers. @@ -44,7 +44,7 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_TrueDivide(PyObject *o1, PyObject *o2) Return a reasonable approximation for the mathematical value of *o1* divided by *o2*, or *NULL* on failure. The return value is "approximate" because binary @@ -55,13 +55,13 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Remainder(PyObject *o1, PyObject *o2) Returns the remainder of dividing *o1* by *o2*, or *NULL* on failure. This is the equivalent of the Python expression ``o1 % o2``. -.. cfunction:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Divmod(PyObject *o1, PyObject *o2) .. index:: builtin: divmod @@ -69,29 +69,29 @@ the equivalent of the Python expression ``divmod(o1, o2)``. -.. cfunction:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3) +.. c:function:: PyObject* PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3) .. index:: builtin: pow See the built-in function :func:`pow`. Returns *NULL* on failure. This is the equivalent of the Python expression ``pow(o1, o2, o3)``, where *o3* is optional. - If *o3* is to be ignored, pass :cdata:`Py_None` in its place (passing *NULL* for + If *o3* is to be ignored, pass :c:data:`Py_None` in its place (passing *NULL* for *o3* would cause an illegal memory access). -.. cfunction:: PyObject* PyNumber_Negative(PyObject *o) +.. c:function:: PyObject* PyNumber_Negative(PyObject *o) Returns the negation of *o* on success, or *NULL* on failure. This is the equivalent of the Python expression ``-o``. -.. cfunction:: PyObject* PyNumber_Positive(PyObject *o) +.. c:function:: PyObject* PyNumber_Positive(PyObject *o) Returns *o* on success, or *NULL* on failure. This is the equivalent of the Python expression ``+o``. -.. cfunction:: PyObject* PyNumber_Absolute(PyObject *o) +.. c:function:: PyObject* PyNumber_Absolute(PyObject *o) .. index:: builtin: abs @@ -99,71 +99,71 @@ of the Python expression ``abs(o)``. -.. cfunction:: PyObject* PyNumber_Invert(PyObject *o) +.. c:function:: PyObject* PyNumber_Invert(PyObject *o) Returns the bitwise negation of *o* on success, or *NULL* on failure. This is the equivalent of the Python expression ``~o``. -.. cfunction:: PyObject* PyNumber_Lshift(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Lshift(PyObject *o1, PyObject *o2) Returns the result of left shifting *o1* by *o2* on success, or *NULL* on failure. This is the equivalent of the Python expression ``o1 << o2``. -.. cfunction:: PyObject* PyNumber_Rshift(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Rshift(PyObject *o1, PyObject *o2) Returns the result of right shifting *o1* by *o2* on success, or *NULL* on failure. This is the equivalent of the Python expression ``o1 >> o2``. -.. cfunction:: PyObject* PyNumber_And(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_And(PyObject *o1, PyObject *o2) Returns the "bitwise and" of *o1* and *o2* on success and *NULL* on failure. This is the equivalent of the Python expression ``o1 & o2``. -.. cfunction:: PyObject* PyNumber_Xor(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Xor(PyObject *o1, PyObject *o2) Returns the "bitwise exclusive or" of *o1* by *o2* on success, or *NULL* on failure. This is the equivalent of the Python expression ``o1 ^ o2``. -.. cfunction:: PyObject* PyNumber_Or(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_Or(PyObject *o1, PyObject *o2) Returns the "bitwise or" of *o1* and *o2* on success, or *NULL* on failure. This is the equivalent of the Python expression ``o1 | o2``. -.. cfunction:: PyObject* PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2) Returns the result of adding *o1* and *o2*, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 += o2``. -.. cfunction:: PyObject* PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2) Returns the result of subtracting *o2* from *o1*, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 -= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2) Returns the result of multiplying *o1* and *o2*, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 *= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2) Returns the result of dividing *o1* by *o2*, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 /= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2) Returns the mathematical floor of dividing *o1* by *o2*, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent @@ -172,7 +172,7 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2) Return a reasonable approximation for the mathematical value of *o1* divided by *o2*, or *NULL* on failure. The return value is "approximate" because binary @@ -183,64 +183,64 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2) Returns the remainder of dividing *o1* by *o2*, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 %= o2``. -.. cfunction:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3) +.. c:function:: PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3) .. index:: builtin: pow See the built-in function :func:`pow`. Returns *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python - statement ``o1 **= o2`` when o3 is :cdata:`Py_None`, or an in-place variant of - ``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, pass :cdata:`Py_None` + statement ``o1 **= o2`` when o3 is :c:data:`Py_None`, or an in-place variant of + ``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, pass :c:data:`Py_None` in its place (passing *NULL* for *o3* would cause an illegal memory access). -.. cfunction:: PyObject* PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2) Returns the result of left shifting *o1* by *o2* on success, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 <<= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2) Returns the result of right shifting *o1* by *o2* on success, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 >>= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2) Returns the "bitwise and" of *o1* and *o2* on success and *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 &= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceXor(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceXor(PyObject *o1, PyObject *o2) Returns the "bitwise exclusive or" of *o1* by *o2* on success, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 ^= o2``. -.. cfunction:: PyObject* PyNumber_InPlaceOr(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PyNumber_InPlaceOr(PyObject *o1, PyObject *o2) Returns the "bitwise or" of *o1* and *o2* on success, or *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python statement ``o1 |= o2``. -.. cfunction:: int PyNumber_Coerce(PyObject **p1, PyObject **p2) +.. c:function:: int PyNumber_Coerce(PyObject **p1, PyObject **p2) .. index:: builtin: coerce - This function takes the addresses of two variables of type :ctype:`PyObject\*`. + This function takes the addresses of two variables of type :c:type:`PyObject\*`. If the objects pointed to by ``*p1`` and ``*p2`` have the same type, increment their reference count and return ``0`` (success). If the objects can be converted to a common numeric type, replace ``*p1`` and ``*p2`` by their @@ -250,14 +250,14 @@ &o2)`` is equivalent to the Python statement ``o1, o2 = coerce(o1, o2)``. -.. cfunction:: int PyNumber_CoerceEx(PyObject **p1, PyObject **p2) +.. c:function:: int PyNumber_CoerceEx(PyObject **p1, PyObject **p2) - This function is similar to :cfunc:`PyNumber_Coerce`, except that it returns + This function is similar to :c:func:`PyNumber_Coerce`, except that it returns ``1`` when the conversion is not possible and when no error is raised. Reference counts are still not increased in this case. -.. cfunction:: PyObject* PyNumber_Int(PyObject *o) +.. c:function:: PyObject* PyNumber_Int(PyObject *o) .. index:: builtin: int @@ -266,7 +266,7 @@ instead. This is the equivalent of the Python expression ``int(o)``. -.. cfunction:: PyObject* PyNumber_Long(PyObject *o) +.. c:function:: PyObject* PyNumber_Long(PyObject *o) .. index:: builtin: long @@ -274,7 +274,7 @@ failure. This is the equivalent of the Python expression ``long(o)``. -.. cfunction:: PyObject* PyNumber_Float(PyObject *o) +.. c:function:: PyObject* PyNumber_Float(PyObject *o) .. index:: builtin: float @@ -282,7 +282,7 @@ This is the equivalent of the Python expression ``float(o)``. -.. cfunction:: PyObject* PyNumber_Index(PyObject *o) +.. c:function:: PyObject* PyNumber_Index(PyObject *o) Returns the *o* converted to a Python int or long on success or *NULL* with a :exc:`TypeError` exception raised on failure. @@ -290,18 +290,18 @@ .. versionadded:: 2.5 -.. cfunction:: PyObject* PyNumber_ToBase(PyObject *n, int base) +.. c:function:: PyObject* PyNumber_ToBase(PyObject *n, int base) Returns the integer *n* converted to *base* as a string with a base marker of ``'0b'``, ``'0o'``, or ``'0x'`` if applicable. When *base* is not 2, 8, 10, or 16, the format is ``'x#num'`` where x is the base. If *n* is not an int object, it is converted with - :cfunc:`PyNumber_Index` first. + :c:func:`PyNumber_Index` first. .. versionadded:: 2.6 -.. cfunction:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) +.. c:function:: Py_ssize_t PyNumber_AsSsize_t(PyObject *o, PyObject *exc) Returns *o* converted to a Py_ssize_t value if *o* can be interpreted as an integer. If *o* can be converted to a Python int or long but the attempt to @@ -314,7 +314,7 @@ .. versionadded:: 2.5 -.. cfunction:: int PyIndex_Check(PyObject *o) +.. c:function:: int PyIndex_Check(PyObject *o) Returns True if *o* is an index integer (has the nb_index slot of the tp_as_number structure filled in). diff --git a/Doc/c-api/objbuffer.rst b/Doc/c-api/objbuffer.rst --- a/Doc/c-api/objbuffer.rst +++ b/Doc/c-api/objbuffer.rst @@ -13,7 +13,7 @@ :ref:`bufferobjects` for more information. -.. cfunction:: int PyObject_AsCharBuffer(PyObject *obj, const char **buffer, Py_ssize_t *buffer_len) +.. c:function:: int PyObject_AsCharBuffer(PyObject *obj, const char **buffer, Py_ssize_t *buffer_len) Returns a pointer to a read-only memory location usable as character-based input. The *obj* argument must support the single-segment character buffer @@ -24,11 +24,11 @@ .. versionadded:: 1.6 .. versionchanged:: 2.5 - This function used an :ctype:`int *` type for *buffer_len*. This might + This function used an :c:type:`int *` type for *buffer_len*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len) +.. c:function:: int PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len) Returns a pointer to a read-only memory location containing arbitrary data. The *obj* argument must support the single-segment readable buffer @@ -39,11 +39,11 @@ .. versionadded:: 1.6 .. versionchanged:: 2.5 - This function used an :ctype:`int *` type for *buffer_len*. This might + This function used an :c:type:`int *` type for *buffer_len*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyObject_CheckReadBuffer(PyObject *o) +.. c:function:: int PyObject_CheckReadBuffer(PyObject *o) Returns ``1`` if *o* supports the single-segment readable buffer interface. Otherwise returns ``0``. @@ -51,7 +51,7 @@ .. versionadded:: 2.2 -.. cfunction:: int PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len) +.. c:function:: int PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len) Returns a pointer to a writeable memory location. The *obj* argument must support the single-segment, character buffer interface. On success, @@ -61,6 +61,6 @@ .. versionadded:: 1.6 .. versionchanged:: 2.5 - This function used an :ctype:`int *` type for *buffer_len*. This might + This function used an :c:type:`int *` type for *buffer_len*. This might require changes in your code for properly supporting 64-bit systems. diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -6,7 +6,7 @@ =============== -.. cfunction:: int PyObject_Print(PyObject *o, FILE *fp, int flags) +.. c:function:: int PyObject_Print(PyObject *o, FILE *fp, int flags) Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags argument is used to enable certain printing options. The only option currently supported @@ -14,35 +14,35 @@ instead of the :func:`repr`. -.. cfunction:: int PyObject_HasAttr(PyObject *o, PyObject *attr_name) +.. c:function:: int PyObject_HasAttr(PyObject *o, PyObject *attr_name) Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This is equivalent to the Python expression ``hasattr(o, attr_name)``. This function always succeeds. -.. cfunction:: int PyObject_HasAttrString(PyObject *o, const char *attr_name) +.. c:function:: int PyObject_HasAttrString(PyObject *o, const char *attr_name) Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This is equivalent to the Python expression ``hasattr(o, attr_name)``. This function always succeeds. -.. cfunction:: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name) +.. c:function:: PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name) Retrieve an attribute named *attr_name* from object *o*. Returns the attribute value on success, or *NULL* on failure. This is the equivalent of the Python expression ``o.attr_name``. -.. cfunction:: PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name) +.. c:function:: PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name) Retrieve an attribute named *attr_name* from object *o*. Returns the attribute value on success, or *NULL* on failure. This is the equivalent of the Python expression ``o.attr_name``. -.. cfunction:: PyObject* PyObject_GenericGetAttr(PyObject *o, PyObject *name) +.. c:function:: PyObject* PyObject_GenericGetAttr(PyObject *o, PyObject *name) Generic attribute getter function that is meant to be put into a type object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary @@ -52,21 +52,21 @@ descriptors don't. Otherwise, an :exc:`AttributeError` is raised. -.. cfunction:: int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v) +.. c:function:: int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v) Set the value of the attribute named *attr_name*, for object *o*, to the value *v*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o.attr_name = v``. -.. cfunction:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v) +.. c:function:: int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v) Set the value of the attribute named *attr_name*, for object *o*, to the value *v*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o.attr_name = v``. -.. cfunction:: int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value) +.. c:function:: int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value) Generic attribute setter function that is meant to be put into a type object's ``tp_setattro`` slot. It looks for a data descriptor in the @@ -76,19 +76,19 @@ an :exc:`AttributeError` is raised and ``-1`` is returned. -.. cfunction:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name) +.. c:function:: int PyObject_DelAttr(PyObject *o, PyObject *attr_name) Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o.attr_name``. -.. cfunction:: int PyObject_DelAttrString(PyObject *o, const char *attr_name) +.. c:function:: int PyObject_DelAttrString(PyObject *o, const char *attr_name) Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o.attr_name``. -.. cfunction:: PyObject* PyObject_RichCompare(PyObject *o1, PyObject *o2, int opid) +.. c:function:: PyObject* PyObject_RichCompare(PyObject *o1, PyObject *o2, int opid) Compare the values of *o1* and *o2* using the operation specified by *opid*, which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`, @@ -98,7 +98,7 @@ to *opid*. Returns the value of the comparison on success, or *NULL* on failure. -.. cfunction:: int PyObject_RichCompareBool(PyObject *o1, PyObject *o2, int opid) +.. c:function:: int PyObject_RichCompareBool(PyObject *o1, PyObject *o2, int opid) Compare the values of *o1* and *o2* using the operation specified by *opid*, which must be one of :const:`Py_LT`, :const:`Py_LE`, :const:`Py_EQ`, @@ -109,10 +109,10 @@ *opid*. .. note:: - If *o1* and *o2* are the same object, :cfunc:`PyObject_RichCompareBool` + If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`. -.. cfunction:: int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) +.. c:function:: int PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) .. index:: builtin: cmp @@ -122,18 +122,18 @@ the Python statement ``result = cmp(o1, o2)``. -.. cfunction:: int PyObject_Compare(PyObject *o1, PyObject *o2) +.. c:function:: int PyObject_Compare(PyObject *o1, PyObject *o2) .. index:: builtin: cmp Compare the values of *o1* and *o2* using a routine provided by *o1*, if one exists, otherwise with a routine provided by *o2*. Returns the result of the comparison on success. On error, the value returned is undefined; use - :cfunc:`PyErr_Occurred` to detect an error. This is equivalent to the Python + :c:func:`PyErr_Occurred` to detect an error. This is equivalent to the Python expression ``cmp(o1, o2)``. -.. cfunction:: PyObject* PyObject_Repr(PyObject *o) +.. c:function:: PyObject* PyObject_Repr(PyObject *o) .. index:: builtin: repr @@ -143,7 +143,7 @@ by reverse quotes. -.. cfunction:: PyObject* PyObject_Str(PyObject *o) +.. c:function:: PyObject* PyObject_Str(PyObject *o) .. index:: builtin: str @@ -153,15 +153,15 @@ by the :keyword:`print` statement. -.. cfunction:: PyObject* PyObject_Bytes(PyObject *o) +.. c:function:: PyObject* PyObject_Bytes(PyObject *o) .. index:: builtin: bytes Compute a bytes representation of object *o*. In 2.x, this is just a alias - for :cfunc:`PyObject_Str`. + for :c:func:`PyObject_Str`. -.. cfunction:: PyObject* PyObject_Unicode(PyObject *o) +.. c:function:: PyObject* PyObject_Unicode(PyObject *o) .. index:: builtin: unicode @@ -171,11 +171,11 @@ function. -.. cfunction:: int PyObject_IsInstance(PyObject *inst, PyObject *cls) +.. c:function:: int PyObject_IsInstance(PyObject *inst, PyObject *cls) Returns ``1`` if *inst* is an instance of the class *cls* or a subclass of *cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception. If - *cls* is a type object rather than a class object, :cfunc:`PyObject_IsInstance` + *cls* is a type object rather than a class object, :c:func:`PyObject_IsInstance` returns ``1`` if *inst* is of type *cls*. If *cls* is a tuple, the check will be done against every entry in *cls*. The result will be ``1`` when at least one of the checks returns ``1``, otherwise it will be ``0``. If *inst* is not a @@ -195,13 +195,13 @@ :class:`A` if it inherits from :class:`A` either directly or indirectly. If either is not a class object, a more general mechanism is used to determine the class relationship of the two objects. When testing if *B* is a subclass of -*A*, if *A* is *B*, :cfunc:`PyObject_IsSubclass` returns true. If *A* and *B* +*A*, if *A* is *B*, :c:func:`PyObject_IsSubclass` returns true. If *A* and *B* are different objects, *B*'s :attr:`__bases__` attribute is searched in a depth-first fashion for *A* --- the presence of the :attr:`__bases__` attribute is considered sufficient for this determination. -.. cfunction:: int PyObject_IsSubclass(PyObject *derived, PyObject *cls) +.. c:function:: int PyObject_IsSubclass(PyObject *derived, PyObject *cls) Returns ``1`` if the class *derived* is identical to or derived from the class *cls*, otherwise returns ``0``. In case of an error, returns ``-1``. If *cls* @@ -216,13 +216,13 @@ Older versions of Python did not support a tuple as the second argument. -.. cfunction:: int PyCallable_Check(PyObject *o) +.. c:function:: int PyCallable_Check(PyObject *o) Determine if the object *o* is callable. Return ``1`` if the object is callable and ``0`` otherwise. This function always succeeds. -.. cfunction:: PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw) +.. c:function:: PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw) .. index:: builtin: apply @@ -236,7 +236,7 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args) +.. c:function:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args) .. index:: builtin: apply @@ -247,52 +247,52 @@ ``callable_object(*args)``. -.. cfunction:: PyObject* PyObject_CallFunction(PyObject *callable, char *format, ...) +.. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, char *format, ...) .. index:: builtin: apply Call a callable Python object *callable*, with a variable number of C arguments. - The C arguments are described using a :cfunc:`Py_BuildValue` style format + The C arguments are described using a :c:func:`Py_BuildValue` style format string. The format may be *NULL*, indicating that no arguments are provided. Returns the result of the call on success, or *NULL* on failure. This is the equivalent of the Python expression ``apply(callable, args)`` or - ``callable(*args)``. Note that if you only pass :ctype:`PyObject \*` args, - :cfunc:`PyObject_CallFunctionObjArgs` is a faster alternative. + ``callable(*args)``. Note that if you only pass :c:type:`PyObject \*` args, + :c:func:`PyObject_CallFunctionObjArgs` is a faster alternative. -.. cfunction:: PyObject* PyObject_CallMethod(PyObject *o, char *method, char *format, ...) +.. c:function:: PyObject* PyObject_CallMethod(PyObject *o, char *method, char *format, ...) Call the method named *method* of object *o* with a variable number of C - arguments. The C arguments are described by a :cfunc:`Py_BuildValue` format + arguments. The C arguments are described by a :c:func:`Py_BuildValue` format string that should produce a tuple. The format may be *NULL*, indicating that no arguments are provided. Returns the result of the call on success, or *NULL* on failure. This is the equivalent of the Python expression ``o.method(args)``. - Note that if you only pass :ctype:`PyObject \*` args, - :cfunc:`PyObject_CallMethodObjArgs` is a faster alternative. + Note that if you only pass :c:type:`PyObject \*` args, + :c:func:`PyObject_CallMethodObjArgs` is a faster alternative. -.. cfunction:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL) +.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL) Call a callable Python object *callable*, with a variable number of - :ctype:`PyObject\*` arguments. The arguments are provided as a variable number + :c:type:`PyObject\*` arguments. The arguments are provided as a variable number of parameters followed by *NULL*. Returns the result of the call on success, or *NULL* on failure. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL) +.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL) Calls a method of the object *o*, where the name of the method is given as a Python string object in *name*. It is called with a variable number of - :ctype:`PyObject\*` arguments. The arguments are provided as a variable number + :c:type:`PyObject\*` arguments. The arguments are provided as a variable number of parameters followed by *NULL*. Returns the result of the call on success, or *NULL* on failure. .. versionadded:: 2.2 -.. cfunction:: long PyObject_Hash(PyObject *o) +.. c:function:: long PyObject_Hash(PyObject *o) .. index:: builtin: hash @@ -300,7 +300,7 @@ This is the equivalent of the Python expression ``hash(o)``. -.. cfunction:: long PyObject_HashNotImplemented(PyObject *o) +.. c:function:: long PyObject_HashNotImplemented(PyObject *o) Set a :exc:`TypeError` indicating that ``type(o)`` is not hashable and return ``-1``. This function receives special treatment when stored in a ``tp_hash`` slot, @@ -310,21 +310,21 @@ .. versionadded:: 2.6 -.. cfunction:: int PyObject_IsTrue(PyObject *o) +.. c:function:: int PyObject_IsTrue(PyObject *o) Returns ``1`` if the object *o* is considered to be true, and ``0`` otherwise. This is equivalent to the Python expression ``not not o``. On failure, return ``-1``. -.. cfunction:: int PyObject_Not(PyObject *o) +.. c:function:: int PyObject_Not(PyObject *o) Returns ``0`` if the object *o* is considered to be true, and ``1`` otherwise. This is equivalent to the Python expression ``not o``. On failure, return ``-1``. -.. cfunction:: PyObject* PyObject_Type(PyObject *o) +.. c:function:: PyObject* PyObject_Type(PyObject *o) .. index:: builtin: type @@ -333,11 +333,11 @@ is equivalent to the Python expression ``type(o)``. This function increments the reference count of the return value. There's really no reason to use this function instead of the common expression ``o->ob_type``, which returns a - pointer of type :ctype:`PyTypeObject\*`, except when the incremented reference + pointer of type :c:type:`PyTypeObject\*`, except when the incremented reference count is needed. -.. cfunction:: int PyObject_TypeCheck(PyObject *o, PyTypeObject *type) +.. c:function:: int PyObject_TypeCheck(PyObject *o, PyTypeObject *type) Return true if the object *o* is of type *type* or a subtype of *type*. Both parameters must be non-*NULL*. @@ -345,7 +345,7 @@ .. versionadded:: 2.2 -.. cfunction:: Py_ssize_t PyObject_Length(PyObject *o) +.. c:function:: Py_ssize_t PyObject_Length(PyObject *o) Py_ssize_t PyObject_Size(PyObject *o) .. index:: builtin: len @@ -355,29 +355,29 @@ returned. This is the equivalent to the Python expression ``len(o)``. .. versionchanged:: 2.5 - These functions returned an :ctype:`int` type. This might require + These functions returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key) +.. c:function:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key) Return element of *o* corresponding to the object *key* or *NULL* on failure. This is the equivalent of the Python expression ``o[key]``. -.. cfunction:: int PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v) +.. c:function:: int PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v) Map the object *key* to the value *v*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o[key] = v``. -.. cfunction:: int PyObject_DelItem(PyObject *o, PyObject *key) +.. c:function:: int PyObject_DelItem(PyObject *o, PyObject *key) Delete the mapping for *key* from *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[key]``. -.. cfunction:: int PyObject_AsFileDescriptor(PyObject *o) +.. c:function:: int PyObject_AsFileDescriptor(PyObject *o) Derives a file descriptor from a Python object. If the object is an integer or long integer, its value is returned. If not, the object's :meth:`fileno` method @@ -385,16 +385,16 @@ is returned as the file descriptor value. Returns ``-1`` on failure. -.. cfunction:: PyObject* PyObject_Dir(PyObject *o) +.. c:function:: PyObject* PyObject_Dir(PyObject *o) This is equivalent to the Python expression ``dir(o)``, returning a (possibly empty) list of strings appropriate for the object argument, or *NULL* if there was an error. If the argument is *NULL*, this is like the Python ``dir()``, returning the names of the current locals; in this case, if no execution frame - is active then *NULL* is returned but :cfunc:`PyErr_Occurred` will return false. + is active then *NULL* is returned but :c:func:`PyErr_Occurred` will return false. -.. cfunction:: PyObject* PyObject_GetIter(PyObject *o) +.. c:function:: PyObject* PyObject_GetIter(PyObject *o) This is equivalent to the Python expression ``iter(o)``. It returns a new iterator for the object argument, or the object itself if the object is already diff --git a/Doc/c-api/refcounting.rst b/Doc/c-api/refcounting.rst --- a/Doc/c-api/refcounting.rst +++ b/Doc/c-api/refcounting.rst @@ -11,22 +11,22 @@ objects. -.. cfunction:: void Py_INCREF(PyObject *o) +.. c:function:: void Py_INCREF(PyObject *o) Increment the reference count for object *o*. The object must not be *NULL*; if - you aren't sure that it isn't *NULL*, use :cfunc:`Py_XINCREF`. + you aren't sure that it isn't *NULL*, use :c:func:`Py_XINCREF`. -.. cfunction:: void Py_XINCREF(PyObject *o) +.. c:function:: void Py_XINCREF(PyObject *o) Increment the reference count for object *o*. The object may be *NULL*, in which case the macro has no effect. -.. cfunction:: void Py_DECREF(PyObject *o) +.. c:function:: void Py_DECREF(PyObject *o) Decrement the reference count for object *o*. The object must not be *NULL*; if - you aren't sure that it isn't *NULL*, use :cfunc:`Py_XDECREF`. If the reference + you aren't sure that it isn't *NULL*, use :c:func:`Py_XDECREF`. If the reference count reaches zero, the object's type's deallocation function (which must not be *NULL*) is invoked. @@ -36,25 +36,25 @@ when a class instance with a :meth:`__del__` method is deallocated). While exceptions in such code are not propagated, the executed code has free access to all Python global variables. This means that any object that is reachable from - a global variable should be in a consistent state before :cfunc:`Py_DECREF` is + a global variable should be in a consistent state before :c:func:`Py_DECREF` is invoked. For example, code to delete an object from a list should copy a reference to the deleted object in a temporary variable, update the list data - structure, and then call :cfunc:`Py_DECREF` for the temporary variable. + structure, and then call :c:func:`Py_DECREF` for the temporary variable. -.. cfunction:: void Py_XDECREF(PyObject *o) +.. c:function:: void Py_XDECREF(PyObject *o) Decrement the reference count for object *o*. The object may be *NULL*, in which case the macro has no effect; otherwise the effect is the same as for - :cfunc:`Py_DECREF`, and the same warning applies. + :c:func:`Py_DECREF`, and the same warning applies. -.. cfunction:: void Py_CLEAR(PyObject *o) +.. c:function:: void Py_CLEAR(PyObject *o) Decrement the reference count for object *o*. The object may be *NULL*, in which case the macro has no effect; otherwise the effect is the same as for - :cfunc:`Py_DECREF`, except that the argument is also set to *NULL*. The warning - for :cfunc:`Py_DECREF` does not apply with respect to the object passed because + :c:func:`Py_DECREF`, except that the argument is also set to *NULL*. The warning + for :c:func:`Py_DECREF` does not apply with respect to the object passed because the macro carefully uses a temporary variable and sets the argument to *NULL* before decrementing its reference count. @@ -65,10 +65,10 @@ The following functions are for runtime dynamic embedding of Python: ``Py_IncRef(PyObject *o)``, ``Py_DecRef(PyObject *o)``. They are -simply exported function versions of :cfunc:`Py_XINCREF` and -:cfunc:`Py_XDECREF`, respectively. +simply exported function versions of :c:func:`Py_XINCREF` and +:c:func:`Py_XDECREF`, respectively. The following functions or macros are only for use within the interpreter core: -:cfunc:`_Py_Dealloc`, :cfunc:`_Py_ForgetReference`, :cfunc:`_Py_NewReference`, -as well as the global variable :cdata:`_Py_RefTotal`. +:c:func:`_Py_Dealloc`, :c:func:`_Py_ForgetReference`, :c:func:`_Py_NewReference`, +as well as the global variable :c:data:`_Py_RefTotal`. diff --git a/Doc/c-api/reflection.rst b/Doc/c-api/reflection.rst --- a/Doc/c-api/reflection.rst +++ b/Doc/c-api/reflection.rst @@ -5,51 +5,51 @@ Reflection ========== -.. cfunction:: PyObject* PyEval_GetBuiltins() +.. c:function:: PyObject* PyEval_GetBuiltins() Return a dictionary of the builtins in the current execution frame, or the interpreter of the thread state if no frame is currently executing. -.. cfunction:: PyObject* PyEval_GetLocals() +.. c:function:: PyObject* PyEval_GetLocals() Return a dictionary of the local variables in the current execution frame, or *NULL* if no frame is currently executing. -.. cfunction:: PyObject* PyEval_GetGlobals() +.. c:function:: PyObject* PyEval_GetGlobals() Return a dictionary of the global variables in the current execution frame, or *NULL* if no frame is currently executing. -.. cfunction:: PyFrameObject* PyEval_GetFrame() +.. c:function:: PyFrameObject* PyEval_GetFrame() Return the current thread state's frame, which is *NULL* if no frame is currently executing. -.. cfunction:: int PyFrame_GetLineNumber(PyFrameObject *frame) +.. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame) Return the line number that *frame* is currently executing. -.. cfunction:: int PyEval_GetRestricted() +.. c:function:: int PyEval_GetRestricted() If there is a current frame and it is executing in restricted mode, return true, otherwise false. -.. cfunction:: const char* PyEval_GetFuncName(PyObject *func) +.. c:function:: const char* PyEval_GetFuncName(PyObject *func) Return the name of *func* if it is a function, class or instance object, else the name of *func*\s type. -.. cfunction:: const char* PyEval_GetFuncDesc(PyObject *func) +.. c:function:: const char* PyEval_GetFuncDesc(PyObject *func) Return a description string, depending on the type of *func*. Return values include "()" for functions and methods, " constructor", " instance", and " object". Concatenated with the result of - :cfunc:`PyEval_GetFuncName`, the result will be a description of + :c:func:`PyEval_GetFuncName`, the result will be a description of *func*. diff --git a/Doc/c-api/sequence.rst b/Doc/c-api/sequence.rst --- a/Doc/c-api/sequence.rst +++ b/Doc/c-api/sequence.rst @@ -6,13 +6,13 @@ ================= -.. cfunction:: int PySequence_Check(PyObject *o) +.. c:function:: int PySequence_Check(PyObject *o) Return ``1`` if the object provides sequence protocol, and ``0`` otherwise. This function always succeeds. -.. cfunction:: Py_ssize_t PySequence_Size(PyObject *o) +.. c:function:: Py_ssize_t PySequence_Size(PyObject *o) Py_ssize_t PySequence_Length(PyObject *o) .. index:: builtin: len @@ -22,140 +22,140 @@ Python expression ``len(o)``. .. versionchanged:: 2.5 - These functions returned an :ctype:`int` type. This might require + These functions returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PySequence_Concat(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PySequence_Concat(PyObject *o1, PyObject *o2) Return the concatenation of *o1* and *o2* on success, and *NULL* on failure. This is the equivalent of the Python expression ``o1 + o2``. -.. cfunction:: PyObject* PySequence_Repeat(PyObject *o, Py_ssize_t count) +.. c:function:: PyObject* PySequence_Repeat(PyObject *o, Py_ssize_t count) Return the result of repeating sequence object *o* *count* times, or *NULL* on failure. This is the equivalent of the Python expression ``o * count``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *count*. This might require + This function used an :c:type:`int` type for *count*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PySequence_InPlaceConcat(PyObject *o1, PyObject *o2) +.. c:function:: PyObject* PySequence_InPlaceConcat(PyObject *o1, PyObject *o2) Return the concatenation of *o1* and *o2* on success, and *NULL* on failure. The operation is done *in-place* when *o1* supports it. This is the equivalent of the Python expression ``o1 += o2``. -.. cfunction:: PyObject* PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count) +.. c:function:: PyObject* PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count) Return the result of repeating sequence object *o* *count* times, or *NULL* on failure. The operation is done *in-place* when *o* supports it. This is the equivalent of the Python expression ``o *= count``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *count*. This might require + This function used an :c:type:`int` type for *count*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PySequence_GetItem(PyObject *o, Py_ssize_t i) +.. c:function:: PyObject* PySequence_GetItem(PyObject *o, Py_ssize_t i) Return the *i*\ th element of *o*, or *NULL* on failure. This is the equivalent of the Python expression ``o[i]``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i*. This might require + This function used an :c:type:`int` type for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) +.. c:function:: PyObject* PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) Return the slice of sequence object *o* between *i1* and *i2*, or *NULL* on failure. This is the equivalent of the Python expression ``o[i1:i2]``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i1* and *i2*. This might + This function used an :c:type:`int` type for *i1* and *i2*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) +.. c:function:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) Assign object *v* to the *i*\ th element of *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o[i] = v``. This function *does not* steal a reference to *v*. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i*. This might require + This function used an :c:type:`int` type for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) +.. c:function:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) Delete the *i*\ th element of object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[i]``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i*. This might require + This function used an :c:type:`int` type for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v) +.. c:function:: int PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v) Assign the sequence object *v* to the slice in sequence object *o* from *i1* to *i2*. This is the equivalent of the Python statement ``o[i1:i2] = v``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i1* and *i2*. This might + This function used an :c:type:`int` type for *i1* and *i2*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) +.. c:function:: int PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2) Delete the slice in sequence object *o* from *i1* to *i2*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[i1:i2]``. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i1* and *i2*. This might + This function used an :c:type:`int` type for *i1* and *i2*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PySequence_Count(PyObject *o, PyObject *value) +.. c:function:: Py_ssize_t PySequence_Count(PyObject *o, PyObject *value) Return the number of occurrences of *value* in *o*, that is, return the number of keys for which ``o[key] == value``. On failure, return ``-1``. This is equivalent to the Python expression ``o.count(value)``. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PySequence_Contains(PyObject *o, PyObject *value) +.. c:function:: int PySequence_Contains(PyObject *o, PyObject *value) Determine if *o* contains *value*. If an item in *o* is equal to *value*, return ``1``, otherwise return ``0``. On error, return ``-1``. This is equivalent to the Python expression ``value in o``. -.. cfunction:: Py_ssize_t PySequence_Index(PyObject *o, PyObject *value) +.. c:function:: Py_ssize_t PySequence_Index(PyObject *o, PyObject *value) Return the first index *i* for which ``o[i] == value``. On error, return ``-1``. This is equivalent to the Python expression ``o.index(value)``. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PySequence_List(PyObject *o) +.. c:function:: PyObject* PySequence_List(PyObject *o) Return a list object with the same contents as the arbitrary sequence *o*. The returned list is guaranteed to be new. -.. cfunction:: PyObject* PySequence_Tuple(PyObject *o) +.. c:function:: PyObject* PySequence_Tuple(PyObject *o) .. index:: builtin: tuple @@ -165,28 +165,28 @@ equivalent to the Python expression ``tuple(o)``. -.. cfunction:: PyObject* PySequence_Fast(PyObject *o, const char *m) +.. c:function:: PyObject* PySequence_Fast(PyObject *o, const char *m) Returns the sequence *o* as a tuple, unless it is already a tuple or list, in - which case *o* is returned. Use :cfunc:`PySequence_Fast_GET_ITEM` to access the + which case *o* is returned. Use :c:func:`PySequence_Fast_GET_ITEM` to access the members of the result. Returns *NULL* on failure. If the object is not a sequence, raises :exc:`TypeError` with *m* as the message text. -.. cfunction:: PyObject* PySequence_Fast_GET_ITEM(PyObject *o, Py_ssize_t i) +.. c:function:: PyObject* PySequence_Fast_GET_ITEM(PyObject *o, Py_ssize_t i) Return the *i*\ th element of *o*, assuming that *o* was returned by - :cfunc:`PySequence_Fast`, *o* is not *NULL*, and that *i* is within bounds. + :c:func:`PySequence_Fast`, *o* is not *NULL*, and that *i* is within bounds. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i*. This might require + This function used an :c:type:`int` type for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject** PySequence_Fast_ITEMS(PyObject *o) +.. c:function:: PyObject** PySequence_Fast_ITEMS(PyObject *o) Return the underlying array of PyObject pointers. Assumes that *o* was returned - by :cfunc:`PySequence_Fast` and *o* is not *NULL*. + by :c:func:`PySequence_Fast` and *o* is not *NULL*. Note, if a list gets resized, the reallocation may relocate the items array. So, only use the underlying array pointer in contexts where the sequence @@ -195,24 +195,24 @@ .. versionadded:: 2.4 -.. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) +.. c:function:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) Return the *i*\ th element of *o* or *NULL* on failure. Macro form of - :cfunc:`PySequence_GetItem` but without checking that - :cfunc:`PySequence_Check` on *o* is true and without adjustment for negative + :c:func:`PySequence_GetItem` but without checking that + :c:func:`PySequence_Check` on *o* is true and without adjustment for negative indices. .. versionadded:: 2.3 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *i*. This might require + This function used an :c:type:`int` type for *i*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o) +.. c:function:: Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o) Returns the length of *o*, assuming that *o* was returned by - :cfunc:`PySequence_Fast` and that *o* is not *NULL*. The size can also be - gotten by calling :cfunc:`PySequence_Size` on *o*, but - :cfunc:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list + :c:func:`PySequence_Fast` and that *o* is not *NULL*. The size can also be + gotten by calling :c:func:`PySequence_Size` on *o*, but + :c:func:`PySequence_Fast_GET_SIZE` is faster because it can assume *o* is a list or tuple. diff --git a/Doc/c-api/set.rst b/Doc/c-api/set.rst --- a/Doc/c-api/set.rst +++ b/Doc/c-api/set.rst @@ -16,20 +16,20 @@ This section details the public API for :class:`set` and :class:`frozenset` objects. Any functionality not listed below is best accessed using the either -the abstract object protocol (including :cfunc:`PyObject_CallMethod`, -:cfunc:`PyObject_RichCompareBool`, :cfunc:`PyObject_Hash`, -:cfunc:`PyObject_Repr`, :cfunc:`PyObject_IsTrue`, :cfunc:`PyObject_Print`, and -:cfunc:`PyObject_GetIter`) or the abstract number protocol (including -:cfunc:`PyNumber_And`, :cfunc:`PyNumber_Subtract`, :cfunc:`PyNumber_Or`, -:cfunc:`PyNumber_Xor`, :cfunc:`PyNumber_InPlaceAnd`, -:cfunc:`PyNumber_InPlaceSubtract`, :cfunc:`PyNumber_InPlaceOr`, and -:cfunc:`PyNumber_InPlaceXor`). +the abstract object protocol (including :c:func:`PyObject_CallMethod`, +:c:func:`PyObject_RichCompareBool`, :c:func:`PyObject_Hash`, +:c:func:`PyObject_Repr`, :c:func:`PyObject_IsTrue`, :c:func:`PyObject_Print`, and +:c:func:`PyObject_GetIter`) or the abstract number protocol (including +:c:func:`PyNumber_And`, :c:func:`PyNumber_Subtract`, :c:func:`PyNumber_Or`, +:c:func:`PyNumber_Xor`, :c:func:`PyNumber_InPlaceAnd`, +:c:func:`PyNumber_InPlaceSubtract`, :c:func:`PyNumber_InPlaceOr`, and +:c:func:`PyNumber_InPlaceXor`). -.. ctype:: PySetObject +.. c:type:: PySetObject - This subtype of :ctype:`PyObject` is used to hold the internal data for both - :class:`set` and :class:`frozenset` objects. It is like a :ctype:`PyDictObject` + This subtype of :c:type:`PyObject` is used to hold the internal data for both + :class:`set` and :class:`frozenset` objects. It is like a :c:type:`PyDictObject` in that it is a fixed size for small sets (much like tuple storage) and will point to a separate, variable sized block of memory for medium and large sized sets (much like list storage). None of the fields of this structure should be @@ -37,53 +37,53 @@ the documented API rather than by manipulating the values in the structure. -.. cvar:: PyTypeObject PySet_Type +.. c:var:: PyTypeObject PySet_Type - This is an instance of :ctype:`PyTypeObject` representing the Python + This is an instance of :c:type:`PyTypeObject` representing the Python :class:`set` type. -.. cvar:: PyTypeObject PyFrozenSet_Type +.. c:var:: PyTypeObject PyFrozenSet_Type - This is an instance of :ctype:`PyTypeObject` representing the Python + This is an instance of :c:type:`PyTypeObject` representing the Python :class:`frozenset` type. The following type check macros work on pointers to any Python object. Likewise, the constructor functions work with any iterable Python object. -.. cfunction:: int PySet_Check(PyObject *p) +.. c:function:: int PySet_Check(PyObject *p) Return true if *p* is a :class:`set` object or an instance of a subtype. .. versionadded:: 2.6 -.. cfunction:: int PyFrozenSet_Check(PyObject *p) +.. c:function:: int PyFrozenSet_Check(PyObject *p) Return true if *p* is a :class:`frozenset` object or an instance of a subtype. .. versionadded:: 2.6 -.. cfunction:: int PyAnySet_Check(PyObject *p) +.. c:function:: int PyAnySet_Check(PyObject *p) Return true if *p* is a :class:`set` object, a :class:`frozenset` object, or an instance of a subtype. -.. cfunction:: int PyAnySet_CheckExact(PyObject *p) +.. c:function:: int PyAnySet_CheckExact(PyObject *p) Return true if *p* is a :class:`set` object or a :class:`frozenset` object but not an instance of a subtype. -.. cfunction:: int PyFrozenSet_CheckExact(PyObject *p) +.. c:function:: int PyFrozenSet_CheckExact(PyObject *p) Return true if *p* is a :class:`frozenset` object but not an instance of a subtype. -.. cfunction:: PyObject* PySet_New(PyObject *iterable) +.. c:function:: PyObject* PySet_New(PyObject *iterable) Return a new :class:`set` containing objects returned by the *iterable*. The *iterable* may be *NULL* to create a new empty set. Return the new set on @@ -92,7 +92,7 @@ (``c=set(s)``). -.. cfunction:: PyObject* PyFrozenSet_New(PyObject *iterable) +.. c:function:: PyObject* PyFrozenSet_New(PyObject *iterable) Return a new :class:`frozenset` containing objects returned by the *iterable*. The *iterable* may be *NULL* to create a new empty frozenset. Return the new @@ -108,7 +108,7 @@ or :class:`frozenset` or instances of their subtypes. -.. cfunction:: Py_ssize_t PySet_Size(PyObject *anyset) +.. c:function:: Py_ssize_t PySet_Size(PyObject *anyset) .. index:: builtin: len @@ -117,16 +117,16 @@ :class:`set`, :class:`frozenset`, or an instance of a subtype. .. versionchanged:: 2.5 - This function returned an :ctype:`int`. This might require changes in + This function returned an :c:type:`int`. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PySet_GET_SIZE(PyObject *anyset) +.. c:function:: Py_ssize_t PySet_GET_SIZE(PyObject *anyset) - Macro form of :cfunc:`PySet_Size` without error checking. + Macro form of :c:func:`PySet_Size` without error checking. -.. cfunction:: int PySet_Contains(PyObject *anyset, PyObject *key) +.. c:function:: int PySet_Contains(PyObject *anyset, PyObject *key) Return 1 if found, 0 if not found, and -1 if an error is encountered. Unlike the Python :meth:`__contains__` method, this function does not automatically @@ -135,7 +135,7 @@ :class:`set`, :class:`frozenset`, or an instance of a subtype. -.. cfunction:: int PySet_Add(PyObject *set, PyObject *key) +.. c:function:: int PySet_Add(PyObject *set, PyObject *key) Add *key* to a :class:`set` instance. Does not apply to :class:`frozenset` instances. Return 0 on success or -1 on failure. Raise a :exc:`TypeError` if @@ -145,14 +145,14 @@ .. versionchanged:: 2.6 Now works with instances of :class:`frozenset` or its subtypes. - Like :cfunc:`PyTuple_SetItem` in that it can be used to fill-in the + Like :c:func:`PyTuple_SetItem` in that it can be used to fill-in the values of brand new frozensets before they are exposed to other code. The following functions are available for instances of :class:`set` or its subtypes but not for instances of :class:`frozenset` or its subtypes. -.. cfunction:: int PySet_Discard(PyObject *set, PyObject *key) +.. c:function:: int PySet_Discard(PyObject *set, PyObject *key) Return 1 if found and removed, 0 if not found (no action taken), and -1 if an error is encountered. Does not raise :exc:`KeyError` for missing keys. Raise a @@ -162,7 +162,7 @@ instance of :class:`set` or its subtype. -.. cfunction:: PyObject* PySet_Pop(PyObject *set) +.. c:function:: PyObject* PySet_Pop(PyObject *set) Return a new reference to an arbitrary object in the *set*, and removes the object from the *set*. Return *NULL* on failure. Raise :exc:`KeyError` if the @@ -170,6 +170,6 @@ :class:`set` or its subtype. -.. cfunction:: int PySet_Clear(PyObject *set) +.. c:function:: int PySet_Clear(PyObject *set) Empty an existing set of all elements. diff --git a/Doc/c-api/slice.rst b/Doc/c-api/slice.rst --- a/Doc/c-api/slice.rst +++ b/Doc/c-api/slice.rst @@ -6,7 +6,7 @@ ------------- -.. cvar:: PyTypeObject PySlice_Type +.. c:var:: PyTypeObject PySlice_Type .. index:: single: SliceType (in module types) @@ -14,12 +14,12 @@ ``types.SliceType``. -.. cfunction:: int PySlice_Check(PyObject *ob) +.. c:function:: int PySlice_Check(PyObject *ob) Return true if *ob* is a slice object; *ob* must not be *NULL*. -.. cfunction:: PyObject* PySlice_New(PyObject *start, PyObject *stop, PyObject *step) +.. c:function:: PyObject* PySlice_New(PyObject *start, PyObject *stop, PyObject *step) Return a new slice object with the given values. The *start*, *stop*, and *step* parameters are used as the values of the slice object attributes of @@ -28,7 +28,7 @@ the new object could not be allocated. -.. cfunction:: int PySlice_GetIndices(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) +.. c:function:: int PySlice_GetIndices(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) Retrieve the start, stop and step indices from the slice object *slice*, assuming a sequence of length *length*. Treats indices greater than @@ -40,18 +40,18 @@ You probably do not want to use this function. If you want to use slice objects in versions of Python prior to 2.3, you would probably do well to - incorporate the source of :cfunc:`PySlice_GetIndicesEx`, suitably renamed, + incorporate the source of :c:func:`PySlice_GetIndicesEx`, suitably renamed, in the source of your extension. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *length* and an - :ctype:`int *` type for *start*, *stop*, and *step*. This might require + This function used an :c:type:`int` type for *length* and an + :c:type:`int *` type for *start*, *stop*, and *step*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PySlice_GetIndicesEx(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) +.. c:function:: int PySlice_GetIndicesEx(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) - Usable replacement for :cfunc:`PySlice_GetIndices`. Retrieve the start, + Usable replacement for :c:func:`PySlice_GetIndices`. Retrieve the start, stop, and step indices from the slice object *slice* assuming a sequence of length *length*, and store the length of the slice in *slicelength*. Out of bounds indices are clipped in a manner consistent with the handling of @@ -62,7 +62,7 @@ .. versionadded:: 2.3 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *length* and an - :ctype:`int *` type for *start*, *stop*, *step*, and *slicelength*. This + This function used an :c:type:`int` type for *length* and an + :c:type:`int *` type for *start*, *stop*, *step*, and *slicelength*. This might require changes in your code for properly supporting 64-bit systems. diff --git a/Doc/c-api/string.rst b/Doc/c-api/string.rst --- a/Doc/c-api/string.rst +++ b/Doc/c-api/string.rst @@ -17,20 +17,20 @@ .. index:: object: string -.. ctype:: PyStringObject +.. c:type:: PyStringObject - This subtype of :ctype:`PyObject` represents a Python string object. + This subtype of :c:type:`PyObject` represents a Python string object. -.. cvar:: PyTypeObject PyString_Type +.. c:var:: PyTypeObject PyString_Type .. index:: single: StringType (in module types) - This instance of :ctype:`PyTypeObject` represents the Python string type; it is + This instance of :c:type:`PyTypeObject` represents the Python string type; it is the same object as ``str`` and ``types.StringType`` in the Python layer. . -.. cfunction:: int PyString_Check(PyObject *o) +.. c:function:: int PyString_Check(PyObject *o) Return true if the object *o* is a string object or an instance of a subtype of the string type. @@ -39,7 +39,7 @@ Allowed subtypes to be accepted. -.. cfunction:: int PyString_CheckExact(PyObject *o) +.. c:function:: int PyString_CheckExact(PyObject *o) Return true if the object *o* is a string object, but not an instance of a subtype of the string type. @@ -47,27 +47,27 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyString_FromString(const char *v) +.. c:function:: PyObject* PyString_FromString(const char *v) Return a new string object with a copy of the string *v* as value on success, and *NULL* on failure. The parameter *v* must not be *NULL*; it will not be checked. -.. cfunction:: PyObject* PyString_FromStringAndSize(const char *v, Py_ssize_t len) +.. c:function:: PyObject* PyString_FromStringAndSize(const char *v, Py_ssize_t len) Return a new string object with a copy of the string *v* as value and length *len* on success, and *NULL* on failure. If *v* is *NULL*, the contents of the string are uninitialized. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *len*. This might require + This function used an :c:type:`int` type for *len*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyString_FromFormat(const char *format, ...) +.. c:function:: PyObject* PyString_FromFormat(const char *format, ...) - Take a C :cfunc:`printf`\ -style *format* string and a variable number of + Take a C :c:func:`printf`\ -style *format* string and a variable number of arguments, calculate the size of the resulting Python string and return a string with the values formatted into it. The variable arguments must be C types and must correspond exactly to the format characters in the *format* string. The @@ -144,31 +144,31 @@ Support for `"%lld"` and `"%llu"` added. -.. cfunction:: PyObject* PyString_FromFormatV(const char *format, va_list vargs) +.. c:function:: PyObject* PyString_FromFormatV(const char *format, va_list vargs) - Identical to :cfunc:`PyString_FromFormat` except that it takes exactly two + Identical to :c:func:`PyString_FromFormat` except that it takes exactly two arguments. -.. cfunction:: Py_ssize_t PyString_Size(PyObject *string) +.. c:function:: Py_ssize_t PyString_Size(PyObject *string) Return the length of the string in string object *string*. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyString_GET_SIZE(PyObject *string) +.. c:function:: Py_ssize_t PyString_GET_SIZE(PyObject *string) - Macro form of :cfunc:`PyString_Size` but without error checking. + Macro form of :c:func:`PyString_Size` but without error checking. .. versionchanged:: 2.5 - This macro returned an :ctype:`int` type. This might require changes in + This macro returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: char* PyString_AsString(PyObject *string) +.. c:function:: char* PyString_AsString(PyObject *string) Return a NUL-terminated representation of the contents of *string*. The pointer refers to the internal buffer of *string*, not a copy. The data must not be @@ -176,16 +176,16 @@ ``PyString_FromStringAndSize(NULL, size)``. It must not be deallocated. If *string* is a Unicode object, this function computes the default encoding of *string* and operates on that. If *string* is not a string object at all, - :cfunc:`PyString_AsString` returns *NULL* and raises :exc:`TypeError`. + :c:func:`PyString_AsString` returns *NULL* and raises :exc:`TypeError`. -.. cfunction:: char* PyString_AS_STRING(PyObject *string) +.. c:function:: char* PyString_AS_STRING(PyObject *string) - Macro form of :cfunc:`PyString_AsString` but without error checking. Only + Macro form of :c:func:`PyString_AsString` but without error checking. Only string objects are supported; no Unicode objects should be passed. -.. cfunction:: int PyString_AsStringAndSize(PyObject *obj, char **buffer, Py_ssize_t *length) +.. c:function:: int PyString_AsStringAndSize(PyObject *obj, char **buffer, Py_ssize_t *length) Return a NUL-terminated representation of the contents of the object *obj* through the output variables *buffer* and *length*. @@ -200,14 +200,14 @@ ``PyString_FromStringAndSize(NULL, size)``. It must not be deallocated. If *string* is a Unicode object, this function computes the default encoding of *string* and operates on that. If *string* is not a string object at all, - :cfunc:`PyString_AsStringAndSize` returns ``-1`` and raises :exc:`TypeError`. + :c:func:`PyString_AsStringAndSize` returns ``-1`` and raises :exc:`TypeError`. .. versionchanged:: 2.5 - This function used an :ctype:`int *` type for *length*. This might + This function used an :c:type:`int *` type for *length*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: void PyString_Concat(PyObject **string, PyObject *newpart) +.. c:function:: void PyString_Concat(PyObject **string, PyObject *newpart) Create a new string object in *\*string* containing the contents of *newpart* appended to *string*; the caller will own the new reference. The reference to @@ -216,13 +216,13 @@ *\*string* will be set to *NULL*; the appropriate exception will be set. -.. cfunction:: void PyString_ConcatAndDel(PyObject **string, PyObject *newpart) +.. c:function:: void PyString_ConcatAndDel(PyObject **string, PyObject *newpart) Create a new string object in *\*string* containing the contents of *newpart* appended to *string*. This version decrements the reference count of *newpart*. -.. cfunction:: int _PyString_Resize(PyObject **string, Py_ssize_t newsize) +.. c:function:: int _PyString_Resize(PyObject **string, Py_ssize_t newsize) A way to resize a string object even though it is "immutable". Only use this to build up a brand new string object; don't use this if the string may already be @@ -235,16 +235,16 @@ set to *NULL*, a memory exception is set, and ``-1`` is returned. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *newsize*. This might + This function used an :c:type:`int` type for *newsize*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyString_Format(PyObject *format, PyObject *args) +.. c:function:: PyObject* PyString_Format(PyObject *format, PyObject *args) Return a new string object from *format* and *args*. Analogous to ``format % args``. The *args* argument must be a tuple. -.. cfunction:: void PyString_InternInPlace(PyObject **string) +.. c:function:: void PyString_InternInPlace(PyObject **string) Intern the argument *\*string* in place. The argument must be the address of a pointer variable pointing to a Python string object. If there is an existing @@ -261,10 +261,10 @@ This function is not available in 3.x and does not have a PyBytes alias. -.. cfunction:: PyObject* PyString_InternFromString(const char *v) +.. c:function:: PyObject* PyString_InternFromString(const char *v) - A combination of :cfunc:`PyString_FromString` and - :cfunc:`PyString_InternInPlace`, returning either a new string object that has + A combination of :c:func:`PyString_FromString` and + :c:func:`PyString_InternInPlace`, returning either a new string object that has been interned, or a new ("owned") reference to an earlier interned string object with the same value. @@ -273,7 +273,7 @@ This function is not available in 3.x and does not have a PyBytes alias. -.. cfunction:: PyObject* PyString_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) +.. c:function:: PyObject* PyString_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) Create an object by decoding *size* bytes of the encoded buffer *s* using the codec registered for *encoding*. *encoding* and *errors* have the same meaning @@ -286,11 +286,11 @@ This function is not available in 3.x and does not have a PyBytes alias. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyString_AsDecodedObject(PyObject *str, const char *encoding, const char *errors) +.. c:function:: PyObject* PyString_AsDecodedObject(PyObject *str, const char *encoding, const char *errors) Decode a string object by passing it to the codec registered for *encoding* and return the result as Python object. *encoding* and *errors* have the same @@ -303,9 +303,9 @@ This function is not available in 3.x and does not have a PyBytes alias. -.. cfunction:: PyObject* PyString_Encode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) +.. c:function:: PyObject* PyString_Encode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) - Encode the :ctype:`char` buffer of the given size by passing it to the codec + Encode the :c:type:`char` buffer of the given size by passing it to the codec registered for *encoding* and return a Python object. *encoding* and *errors* have the same meaning as the parameters of the same name in the string :meth:`encode` method. The codec to be used is looked up using the Python codec @@ -316,11 +316,11 @@ This function is not available in 3.x and does not have a PyBytes alias. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyString_AsEncodedObject(PyObject *str, const char *encoding, const char *errors) +.. c:function:: PyObject* PyString_AsEncodedObject(PyObject *str, const char *encoding, const char *errors) Encode a string object using the codec registered for *encoding* and return the result as Python object. *encoding* and *errors* have the same meaning as the diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -11,12 +11,12 @@ All Python objects ultimately share a small number of fields at the beginning of the object's representation in memory. These are represented by the -:ctype:`PyObject` and :ctype:`PyVarObject` types, which are defined, in turn, +:c:type:`PyObject` and :c:type:`PyVarObject` types, which are defined, in turn, by the expansions of some macros also used, whether directly or indirectly, in the definition of all other Python objects. -.. ctype:: PyObject +.. c:type:: PyObject All object types are extensions of this type. This is a type which contains the information Python needs to treat a pointer to an object as an @@ -26,79 +26,79 @@ macro. -.. ctype:: PyVarObject +.. c:type:: PyVarObject - This is an extension of :ctype:`PyObject` that adds the :attr:`ob_size` + This is an extension of :c:type:`PyObject` that adds the :attr:`ob_size` field. This is only used for objects that have some notion of *length*. This type does not often appear in the Python/C API. It corresponds to the fields defined by the expansion of the ``PyObject_VAR_HEAD`` macro. -These macros are used in the definition of :ctype:`PyObject` and -:ctype:`PyVarObject`: +These macros are used in the definition of :c:type:`PyObject` and +:c:type:`PyVarObject`: -.. cmacro:: PyObject_HEAD +.. c:macro:: PyObject_HEAD This is a macro which expands to the declarations of the fields of the - :ctype:`PyObject` type; it is used when declaring new types which represent + :c:type:`PyObject` type; it is used when declaring new types which represent objects without a varying length. The specific fields it expands to depend - on the definition of :cmacro:`Py_TRACE_REFS`. By default, that macro is - not defined, and :cmacro:`PyObject_HEAD` expands to:: + on the definition of :c:macro:`Py_TRACE_REFS`. By default, that macro is + not defined, and :c:macro:`PyObject_HEAD` expands to:: Py_ssize_t ob_refcnt; PyTypeObject *ob_type; - When :cmacro:`Py_TRACE_REFS` is defined, it expands to:: + When :c:macro:`Py_TRACE_REFS` is defined, it expands to:: PyObject *_ob_next, *_ob_prev; Py_ssize_t ob_refcnt; PyTypeObject *ob_type; -.. cmacro:: PyObject_VAR_HEAD +.. c:macro:: PyObject_VAR_HEAD This is a macro which expands to the declarations of the fields of the - :ctype:`PyVarObject` type; it is used when declaring new types which + :c:type:`PyVarObject` type; it is used when declaring new types which represent objects with a length that varies from instance to instance. This macro always expands to:: PyObject_HEAD Py_ssize_t ob_size; - Note that :cmacro:`PyObject_HEAD` is part of the expansion, and that its own - expansion varies depending on the definition of :cmacro:`Py_TRACE_REFS`. + Note that :c:macro:`PyObject_HEAD` is part of the expansion, and that its own + expansion varies depending on the definition of :c:macro:`Py_TRACE_REFS`. -.. cmacro:: PyObject_HEAD_INIT(type) +.. c:macro:: PyObject_HEAD_INIT(type) This is a macro which expands to initialization values for a new - :ctype:`PyObject` type. This macro expands to:: + :c:type:`PyObject` type. This macro expands to:: _PyObject_EXTRA_INIT 1, type, -.. cmacro:: PyVarObject_HEAD_INIT(type, size) +.. c:macro:: PyVarObject_HEAD_INIT(type, size) This is a macro which expands to initialization values for a new - :ctype:`PyVarObject` type, including the :attr:`ob_size` field. + :c:type:`PyVarObject` type, including the :attr:`ob_size` field. This macro expands to:: _PyObject_EXTRA_INIT 1, type, size, -.. ctype:: PyCFunction +.. c:type:: PyCFunction Type of the functions used to implement most Python callables in C. - Functions of this type take two :ctype:`PyObject\*` parameters and return + Functions of this type take two :c:type:`PyObject\*` parameters and return one such value. If the return value is *NULL*, an exception shall have been set. If not *NULL*, the return value is interpreted as the return value of the function as exposed in Python. The function must return a new reference. -.. ctype:: PyMethodDef +.. c:type:: PyMethodDef Structure used to describe a method of an extension type. This structure has four fields: @@ -119,10 +119,10 @@ +------------------+-------------+-------------------------------+ The :attr:`ml_meth` is a C function pointer. The functions may be of different -types, but they always return :ctype:`PyObject\*`. If the function is not of -the :ctype:`PyCFunction`, the compiler will require a cast in the method table. -Even though :ctype:`PyCFunction` defines the first parameter as -:ctype:`PyObject\*`, it is common that the method implementation uses a the +types, but they always return :c:type:`PyObject\*`. If the function is not of +the :c:type:`PyCFunction`, the compiler will require a cast in the method table. +Even though :c:type:`PyCFunction` defines the first parameter as +:c:type:`PyObject\*`, it is common that the method implementation uses a the specific C type of the *self* object. The :attr:`ml_flags` field is a bitfield which can include the following flags. @@ -136,27 +136,27 @@ .. data:: METH_VARARGS This is the typical calling convention, where the methods have the type - :ctype:`PyCFunction`. The function expects two :ctype:`PyObject\*` values. + :c:type:`PyCFunction`. The function expects two :c:type:`PyObject\*` values. The first one is the *self* object for methods; for module functions, it is the module object. The second parameter (often called *args*) is a tuple object representing all arguments. This parameter is typically processed - using :cfunc:`PyArg_ParseTuple` or :cfunc:`PyArg_UnpackTuple`. + using :c:func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`. .. data:: METH_KEYWORDS - Methods with these flags must be of type :ctype:`PyCFunctionWithKeywords`. + Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. The function expects three parameters: *self*, *args*, and a dictionary of all the keyword arguments. The flag is typically combined with :const:`METH_VARARGS`, and the parameters are typically processed using - :cfunc:`PyArg_ParseTupleAndKeywords`. + :c:func:`PyArg_ParseTupleAndKeywords`. .. data:: METH_NOARGS Methods without parameters don't need to check whether arguments are given if they are listed with the :const:`METH_NOARGS` flag. They need to be of type - :ctype:`PyCFunction`. The first parameter is typically named ``self`` and + :c:type:`PyCFunction`. The first parameter is typically named ``self`` and will hold a reference to the module or object instance. In all cases the second parameter will be *NULL*. @@ -164,15 +164,15 @@ .. data:: METH_O Methods with a single object argument can be listed with the :const:`METH_O` - flag, instead of invoking :cfunc:`PyArg_ParseTuple` with a ``"O"`` argument. - They have the type :ctype:`PyCFunction`, with the *self* parameter, and a - :ctype:`PyObject\*` parameter representing the single argument. + flag, instead of invoking :c:func:`PyArg_ParseTuple` with a ``"O"`` argument. + They have the type :c:type:`PyCFunction`, with the *self* parameter, and a + :c:type:`PyObject\*` parameter representing the single argument. .. data:: METH_OLDARGS This calling convention is deprecated. The method must be of type - :ctype:`PyCFunction`. The second argument is *NULL* if no arguments are + :c:type:`PyCFunction`. The second argument is *NULL* if no arguments are given, a single object if exactly one argument is given, and a tuple of objects if more than one argument is given. There is no way for a function using this convention to distinguish between a call with multiple arguments @@ -225,7 +225,7 @@ .. versionadded:: 2.4 -.. ctype:: PyMemberDef +.. c:type:: PyMemberDef Structure which describes an attribute of a type which corresponds to a C struct member. Its fields are: @@ -277,22 +277,22 @@ T_PYSSIZET Py_ssize_t =============== ================== - :cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX` differ in that - :cmacro:`T_OBJECT` returns ``None`` if the member is *NULL* and - :cmacro:`T_OBJECT_EX` raises an :exc:`AttributeError`. Try to use - :cmacro:`T_OBJECT_EX` over :cmacro:`T_OBJECT` because :cmacro:`T_OBJECT_EX` + :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` differ in that + :c:macro:`T_OBJECT` returns ``None`` if the member is *NULL* and + :c:macro:`T_OBJECT_EX` raises an :exc:`AttributeError`. Try to use + :c:macro:`T_OBJECT_EX` over :c:macro:`T_OBJECT` because :c:macro:`T_OBJECT_EX` handles use of the :keyword:`del` statement on that attribute more correctly - than :cmacro:`T_OBJECT`. + than :c:macro:`T_OBJECT`. - :attr:`flags` can be 0 for write and read access or :cmacro:`READONLY` for - read-only access. Using :cmacro:`T_STRING` for :attr:`type` implies - :cmacro:`READONLY`. Only :cmacro:`T_OBJECT` and :cmacro:`T_OBJECT_EX` + :attr:`flags` can be 0 for write and read access or :c:macro:`READONLY` for + read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies + :c:macro:`READONLY`. Only :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` members can be deleted. (They are set to *NULL*). -.. cfunction:: PyObject* Py_FindMethod(PyMethodDef table[], PyObject *ob, char *name) +.. c:function:: PyObject* Py_FindMethod(PyMethodDef table[], PyObject *ob, char *name) Return a bound method object for an extension type implemented in C. This can be useful in the implementation of a :attr:`tp_getattro` or :attr:`tp_getattr` handler that does not use the - :cfunc:`PyObject_GenericGetAttr` function. + :c:func:`PyObject_GenericGetAttr` function. diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst --- a/Doc/c-api/sys.rst +++ b/Doc/c-api/sys.rst @@ -6,16 +6,16 @@ ========================== -.. cfunction:: int Py_FdIsInteractive(FILE *fp, const char *filename) +.. c:function:: int Py_FdIsInteractive(FILE *fp, const char *filename) Return true (nonzero) if the standard I/O file *fp* with name *filename* is deemed interactive. This is the case for files for which ``isatty(fileno(fp))`` - is true. If the global flag :cdata:`Py_InteractiveFlag` is true, this function + is true. If the global flag :c:data:`Py_InteractiveFlag` is true, this function also returns true if the *filename* pointer is *NULL* or if the name is equal to one of the strings ``''`` or ``'???'``. -.. cfunction:: void PyOS_AfterFork() +.. c:function:: void PyOS_AfterFork() Function to update some internal state after a process fork; this should be called in the new process if the Python interpreter will continue to be used. @@ -23,7 +23,7 @@ to be called. -.. cfunction:: int PyOS_CheckStack() +.. c:function:: int PyOS_CheckStack() Return true when the interpreter runs out of stack space. This is a reliable check, but is only available when :const:`USE_STACKCHECK` is defined (currently @@ -32,20 +32,20 @@ own code. -.. cfunction:: PyOS_sighandler_t PyOS_getsig(int i) +.. c:function:: PyOS_sighandler_t PyOS_getsig(int i) Return the current signal handler for signal *i*. This is a thin wrapper around - either :cfunc:`sigaction` or :cfunc:`signal`. Do not call those functions - directly! :ctype:`PyOS_sighandler_t` is a typedef alias for :ctype:`void + either :c:func:`sigaction` or :c:func:`signal`. Do not call those functions + directly! :c:type:`PyOS_sighandler_t` is a typedef alias for :c:type:`void (\*)(int)`. -.. cfunction:: PyOS_sighandler_t PyOS_setsig(int i, PyOS_sighandler_t h) +.. c:function:: PyOS_sighandler_t PyOS_setsig(int i, PyOS_sighandler_t h) Set the signal handler for signal *i* to be *h*; return the old signal handler. - This is a thin wrapper around either :cfunc:`sigaction` or :cfunc:`signal`. Do - not call those functions directly! :ctype:`PyOS_sighandler_t` is a typedef - alias for :ctype:`void (\*)(int)`. + This is a thin wrapper around either :c:func:`sigaction` or :c:func:`signal`. Do + not call those functions directly! :c:type:`PyOS_sighandler_t` is a typedef + alias for :c:type:`void (\*)(int)`. .. _systemfunctions: @@ -56,38 +56,38 @@ accessible to C code. They all work with the current interpreter thread's :mod:`sys` module's dict, which is contained in the internal thread state structure. -.. cfunction:: PyObject *PySys_GetObject(char *name) +.. c:function:: PyObject *PySys_GetObject(char *name) Return the object *name* from the :mod:`sys` module or *NULL* if it does not exist, without setting an exception. -.. cfunction:: FILE *PySys_GetFile(char *name, FILE *def) +.. c:function:: FILE *PySys_GetFile(char *name, FILE *def) - Return the :ctype:`FILE*` associated with the object *name* in the + Return the :c:type:`FILE*` associated with the object *name* in the :mod:`sys` module, or *def* if *name* is not in the module or is not associated - with a :ctype:`FILE*`. + with a :c:type:`FILE*`. -.. cfunction:: int PySys_SetObject(char *name, PyObject *v) +.. c:function:: int PySys_SetObject(char *name, PyObject *v) Set *name* in the :mod:`sys` module to *v* unless *v* is *NULL*, in which case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` on error. -.. cfunction:: void PySys_ResetWarnOptions() +.. c:function:: void PySys_ResetWarnOptions() Reset :data:`sys.warnoptions` to an empty list. -.. cfunction:: void PySys_AddWarnOption(char *s) +.. c:function:: void PySys_AddWarnOption(char *s) Append *s* to :data:`sys.warnoptions`. -.. cfunction:: void PySys_SetPath(char *path) +.. c:function:: void PySys_SetPath(char *path) Set :data:`sys.path` to a list object of paths found in *path* which should be a list of paths separated with the platform's search path delimiter (``:`` on Unix, ``;`` on Windows). -.. cfunction:: void PySys_WriteStdout(const char *format, ...) +.. c:function:: void PySys_WriteStdout(const char *format, ...) Write the output string described by *format* to :data:`sys.stdout`. No exceptions are raised, even if truncation occurs (see below). @@ -103,7 +103,7 @@ If a problem occurs, or :data:`sys.stdout` is unset, the formatted message is written to the real (C level) *stdout*. -.. cfunction:: void PySys_WriteStderr(const char *format, ...) +.. c:function:: void PySys_WriteStderr(const char *format, ...) As above, but write to :data:`sys.stderr` or *stderr* instead. @@ -114,7 +114,7 @@ =============== -.. cfunction:: void Py_FatalError(const char *message) +.. c:function:: void Py_FatalError(const char *message) .. index:: single: abort() @@ -122,30 +122,30 @@ This function should only be invoked when a condition is detected that would make it dangerous to continue using the Python interpreter; e.g., when the object administration appears to be corrupted. On Unix, the standard C library - function :cfunc:`abort` is called which will attempt to produce a :file:`core` + function :c:func:`abort` is called which will attempt to produce a :file:`core` file. -.. cfunction:: void Py_Exit(int status) +.. c:function:: void Py_Exit(int status) .. index:: single: Py_Finalize() single: exit() - Exit the current process. This calls :cfunc:`Py_Finalize` and then calls the + Exit the current process. This calls :c:func:`Py_Finalize` and then calls the standard C library function ``exit(status)``. -.. cfunction:: int Py_AtExit(void (*func) ()) +.. c:function:: int Py_AtExit(void (*func) ()) .. index:: single: Py_Finalize() single: cleanup functions - Register a cleanup function to be called by :cfunc:`Py_Finalize`. The cleanup + Register a cleanup function to be called by :c:func:`Py_Finalize`. The cleanup function will be called with no arguments and should return no value. At most 32 cleanup functions can be registered. When the registration is successful, - :cfunc:`Py_AtExit` returns ``0``; on failure, it returns ``-1``. The cleanup + :c:func:`Py_AtExit` returns ``0``; on failure, it returns ``-1``. The cleanup function registered last is called first. Each cleanup function will be called at most once. Since Python's internal finalization will have completed before the cleanup function, no Python APIs should be called by *func*. diff --git a/Doc/c-api/tuple.rst b/Doc/c-api/tuple.rst --- a/Doc/c-api/tuple.rst +++ b/Doc/c-api/tuple.rst @@ -8,20 +8,20 @@ .. index:: object: tuple -.. ctype:: PyTupleObject +.. c:type:: PyTupleObject - This subtype of :ctype:`PyObject` represents a Python tuple object. + This subtype of :c:type:`PyObject` represents a Python tuple object. -.. cvar:: PyTypeObject PyTuple_Type +.. c:var:: PyTypeObject PyTuple_Type .. index:: single: TupleType (in module types) - This instance of :ctype:`PyTypeObject` represents the Python tuple type; it is + This instance of :c:type:`PyTypeObject` represents the Python tuple type; it is the same object as ``tuple`` and ``types.TupleType`` in the Python layer.. -.. cfunction:: int PyTuple_Check(PyObject *p) +.. c:function:: int PyTuple_Check(PyObject *p) Return true if *p* is a tuple object or an instance of a subtype of the tuple type. @@ -30,7 +30,7 @@ Allowed subtypes to be accepted. -.. cfunction:: int PyTuple_CheckExact(PyObject *p) +.. c:function:: int PyTuple_CheckExact(PyObject *p) Return true if *p* is a tuple object, but not an instance of a subtype of the tuple type. @@ -38,16 +38,16 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyTuple_New(Py_ssize_t len) +.. c:function:: PyObject* PyTuple_New(Py_ssize_t len) Return a new tuple object of size *len*, or *NULL* on failure. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *len*. This might require + This function used an :c:type:`int` type for *len*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyTuple_Pack(Py_ssize_t n, ...) +.. c:function:: PyObject* PyTuple_Pack(Py_ssize_t n, ...) Return a new tuple object of size *n*, or *NULL* on failure. The tuple values are initialized to the subsequent *n* C arguments pointing to Python objects. @@ -56,59 +56,59 @@ .. versionadded:: 2.4 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *n*. This might require + This function used an :c:type:`int` type for *n*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyTuple_Size(PyObject *p) +.. c:function:: Py_ssize_t PyTuple_Size(PyObject *p) Take a pointer to a tuple object, and return the size of that tuple. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyTuple_GET_SIZE(PyObject *p) +.. c:function:: Py_ssize_t PyTuple_GET_SIZE(PyObject *p) Return the size of the tuple *p*, which must be non-*NULL* and point to a tuple; no error checking is performed. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos) +.. c:function:: PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos) Return the object at position *pos* in the tuple pointed to by *p*. If *pos* is out of bounds, return *NULL* and sets an :exc:`IndexError` exception. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *pos*. This might require + This function used an :c:type:`int` type for *pos*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos) +.. c:function:: PyObject* PyTuple_GET_ITEM(PyObject *p, Py_ssize_t pos) - Like :cfunc:`PyTuple_GetItem`, but does no checking of its arguments. + Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *pos*. This might require + This function used an :c:type:`int` type for *pos*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high) +.. c:function:: PyObject* PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high) Take a slice of the tuple pointed to by *p* from *low* to *high* and return it as a new tuple. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *low* and *high*. This might + This function used an :c:type:`int` type for *low* and *high*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o) +.. c:function:: int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o) Insert a reference to object *o* at position *pos* of the tuple pointed to by *p*. Return ``0`` on success. @@ -118,13 +118,13 @@ This function "steals" a reference to *o*. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *pos*. This might require + This function used an :c:type:`int` type for *pos*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: void PyTuple_SET_ITEM(PyObject *p, Py_ssize_t pos, PyObject *o) +.. c:function:: void PyTuple_SET_ITEM(PyObject *p, Py_ssize_t pos, PyObject *o) - Like :cfunc:`PyTuple_SetItem`, but does no error checking, and should *only* be + Like :c:func:`PyTuple_SetItem`, but does no error checking, and should *only* be used to fill in brand new tuples. .. note:: @@ -132,11 +132,11 @@ This function "steals" a reference to *o*. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *pos*. This might require + This function used an :c:type:`int` type for *pos*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize) +.. c:function:: int _PyTuple_Resize(PyObject **p, Py_ssize_t newsize) Can be used to resize a tuple. *newsize* will be the new length of the tuple. Because tuples are *supposed* to be immutable, this should only be used if there @@ -153,11 +153,11 @@ Removed unused third parameter, *last_is_sticky*. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *newsize*. This might + This function used an :c:type:`int` type for *newsize*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyTuple_ClearFreeList() +.. c:function:: int PyTuple_ClearFreeList() Clear the free list. Return the total number of freed items. diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst --- a/Doc/c-api/type.rst +++ b/Doc/c-api/type.rst @@ -8,12 +8,12 @@ .. index:: object: type -.. ctype:: PyTypeObject +.. c:type:: PyTypeObject The C structure of the objects used to describe built-in types. -.. cvar:: PyObject* PyType_Type +.. c:var:: PyObject* PyType_Type .. index:: single: TypeType (in module types) @@ -21,13 +21,13 @@ ``types.TypeType`` in the Python layer. -.. cfunction:: int PyType_Check(PyObject *o) +.. c:function:: int PyType_Check(PyObject *o) Return true if the object *o* is a type object, including instances of types derived from the standard type object. Return false in all other cases. -.. cfunction:: int PyType_CheckExact(PyObject *o) +.. c:function:: int PyType_CheckExact(PyObject *o) Return true if the object *o* is a type object, but not a subtype of the standard type object. Return false in all other cases. @@ -35,14 +35,14 @@ .. versionadded:: 2.2 -.. cfunction:: unsigned int PyType_ClearCache() +.. c:function:: unsigned int PyType_ClearCache() Clear the internal lookup cache. Return the current version tag. .. versionadded:: 2.6 -.. cfunction:: void PyType_Modified(PyTypeObject *type) +.. c:function:: void PyType_Modified(PyTypeObject *type) Invalidate the internal lookup cache for the type and all of its subtypes. This function must be called after any manual @@ -51,13 +51,13 @@ .. versionadded:: 2.6 -.. cfunction:: int PyType_HasFeature(PyObject *o, int feature) +.. c:function:: int PyType_HasFeature(PyObject *o, int feature) Return true if the type object *o* sets the feature *feature*. Type features are denoted by single bit flags. -.. cfunction:: int PyType_IS_GC(PyObject *o) +.. c:function:: int PyType_IS_GC(PyObject *o) Return true if the type object includes support for the cycle detector; this tests the type flag :const:`Py_TPFLAGS_HAVE_GC`. @@ -65,28 +65,28 @@ .. versionadded:: 2.0 -.. cfunction:: int PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b) +.. c:function:: int PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b) Return true if *a* is a subtype of *b*. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) +.. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) .. versionadded:: 2.2 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *nitems*. This might require + This function used an :c:type:`int` type for *nitems*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds) +.. c:function:: PyObject* PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds) .. versionadded:: 2.2 -.. cfunction:: int PyType_Ready(PyTypeObject *type) +.. c:function:: int PyType_Ready(PyTypeObject *type) Finalize a type object. This should be called on all type objects to finish their initialization. This function is responsible for adding inherited slots diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -6,9 +6,9 @@ ============ Perhaps one of the most important structures of the Python object system is the -structure that defines a new type: the :ctype:`PyTypeObject` structure. Type -objects can be handled using any of the :cfunc:`PyObject_\*` or -:cfunc:`PyType_\*` functions, but do not offer much that's interesting to most +structure that defines a new type: the :c:type:`PyTypeObject` structure. Type +objects can be handled using any of the :c:func:`PyObject_\*` or +:c:func:`PyType_\*` functions, but do not offer much that's interesting to most Python applications. These objects are fundamental to how objects behave, so they are very important to the interpreter itself and to any extension module that implements new types. @@ -25,21 +25,21 @@ freefunc, printfunc, getattrfunc, getattrofunc, setattrfunc, setattrofunc, cmpfunc, reprfunc, hashfunc -The structure definition for :ctype:`PyTypeObject` can be found in +The structure definition for :c:type:`PyTypeObject` can be found in :file:`Include/object.h`. For convenience of reference, this repeats the definition found there: .. literalinclude:: ../includes/typestruct.h -The type object structure extends the :ctype:`PyVarObject` structure. The +The type object structure extends the :c:type:`PyVarObject` structure. The :attr:`ob_size` field is used for dynamic types (created by :func:`type_new`, -usually called from a class statement). Note that :cdata:`PyType_Type` (the +usually called from a class statement). Note that :c:data:`PyType_Type` (the metatype) initializes :attr:`tp_itemsize`, which means that its instances (i.e. type objects) *must* have the :attr:`ob_size` field. -.. cmember:: PyObject* PyObject._ob_next +.. c:member:: PyObject* PyObject._ob_next PyObject* PyObject._ob_prev These fields are only present when the macro ``Py_TRACE_REFS`` is defined. @@ -54,7 +54,7 @@ These fields are not inherited by subtypes. -.. cmember:: Py_ssize_t PyObject.ob_refcnt +.. c:member:: Py_ssize_t PyObject.ob_refcnt This is the type object's reference count, initialized to ``1`` by the ``PyObject_HEAD_INIT`` macro. Note that for statically allocated type objects, @@ -65,11 +65,11 @@ This field is not inherited by subtypes. .. versionchanged:: 2.5 - This field used to be an :ctype:`int` type. This might require changes + This field used to be an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cmember:: PyTypeObject* PyObject.ob_type +.. c:member:: PyTypeObject* PyObject.ob_type This is the type's type, in other words its metatype. It is initialized by the argument to the ``PyObject_HEAD_INIT`` macro, and its value should normally be @@ -83,16 +83,16 @@ Foo_Type.ob_type = &PyType_Type; This should be done before any instances of the type are created. - :cfunc:`PyType_Ready` checks if :attr:`ob_type` is *NULL*, and if so, + :c:func:`PyType_Ready` checks if :attr:`ob_type` is *NULL*, and if so, initializes it: in Python 2.2, it is set to ``&PyType_Type``; in Python 2.2.1 and later it is initialized to the :attr:`ob_type` field of the base class. - :cfunc:`PyType_Ready` will not change this field if it is non-zero. + :c:func:`PyType_Ready` will not change this field if it is non-zero. In Python 2.2, this field is not inherited by subtypes. In 2.2.1, and in 2.3 and beyond, it is inherited by subtypes. -.. cmember:: Py_ssize_t PyVarObject.ob_size +.. c:member:: Py_ssize_t PyVarObject.ob_size For statically allocated type objects, this should be initialized to zero. For dynamically allocated type objects, this field has a special internal meaning. @@ -100,7 +100,7 @@ This field is not inherited by subtypes. -.. cmember:: char* PyTypeObject.tp_name +.. c:member:: char* PyTypeObject.tp_name Pointer to a NUL-terminated string containing the name of the type. For types that are accessible as module globals, the string should be the full module @@ -127,7 +127,7 @@ This field is not inherited by subtypes. -.. cmember:: Py_ssize_t PyTypeObject.tp_basicsize +.. c:member:: Py_ssize_t PyTypeObject.tp_basicsize Py_ssize_t PyTypeObject.tp_itemsize These fields allow calculating the size in bytes of instances of the type. @@ -149,7 +149,7 @@ field). The basic size includes the fields in the instance declared by the macro - :cmacro:`PyObject_HEAD` or :cmacro:`PyObject_VAR_HEAD` (whichever is used to + :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to declare the instance struct) and this in turn includes the :attr:`_ob_prev` and :attr:`_ob_next` fields if they are present. This means that the only correct way to get an initializer for the :attr:`tp_basicsize` is to use the @@ -170,14 +170,14 @@ alignment requirement for ``double``). -.. cmember:: destructor PyTypeObject.tp_dealloc +.. c:member:: destructor PyTypeObject.tp_dealloc A pointer to the instance destructor function. This function must be defined unless the type guarantees that its instances will never be deallocated (as is the case for the singletons ``None`` and ``Ellipsis``). - The destructor function is called by the :cfunc:`Py_DECREF` and - :cfunc:`Py_XDECREF` macros when the new reference count is zero. At this point, + The destructor function is called by the :c:func:`Py_DECREF` and + :c:func:`Py_XDECREF` macros when the new reference count is zero. At this point, the instance is still in existence, but there are no references to it. The destructor function should free all references which the instance owns, free all memory buffers owned by the instance (using the freeing function corresponding @@ -186,15 +186,15 @@ subtypable (doesn't have the :const:`Py_TPFLAGS_BASETYPE` flag bit set), it is permissible to call the object deallocator directly instead of via :attr:`tp_free`. The object deallocator should be the one used to allocate the - instance; this is normally :cfunc:`PyObject_Del` if the instance was allocated - using :cfunc:`PyObject_New` or :cfunc:`PyObject_VarNew`, or - :cfunc:`PyObject_GC_Del` if the instance was allocated using - :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar`. + instance; this is normally :c:func:`PyObject_Del` if the instance was allocated + using :c:func:`PyObject_New` or :c:func:`PyObject_VarNew`, or + :c:func:`PyObject_GC_Del` if the instance was allocated using + :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`. This field is inherited by subtypes. -.. cmember:: printfunc PyTypeObject.tp_print +.. c:member:: printfunc PyTypeObject.tp_print An optional pointer to the instance print function. @@ -205,7 +205,7 @@ *NULL*. A type should never implement :attr:`tp_print` in a way that produces different output than :attr:`tp_repr` or :attr:`tp_str` would. - The print function is called with the same signature as :cfunc:`PyObject_Print`: + The print function is called with the same signature as :c:func:`PyObject_Print`: ``int tp_print(PyObject *self, FILE *file, int flags)``. The *self* argument is the instance to be printed. The *file* argument is the stdio file to which it is to be printed. The *flags* argument is composed of flag bits. The only flag @@ -223,39 +223,39 @@ This field is inherited by subtypes. -.. cmember:: getattrfunc PyTypeObject.tp_getattr +.. c:member:: getattrfunc PyTypeObject.tp_getattr An optional pointer to the get-attribute-string function. This field is deprecated. When it is defined, it should point to a function that acts the same as the :attr:`tp_getattro` function, but taking a C string instead of a Python string object to give the attribute name. The signature is - the same as for :cfunc:`PyObject_GetAttrString`. + the same as for :c:func:`PyObject_GetAttrString`. This field is inherited by subtypes together with :attr:`tp_getattro`: a subtype inherits both :attr:`tp_getattr` and :attr:`tp_getattro` from its base type when the subtype's :attr:`tp_getattr` and :attr:`tp_getattro` are both *NULL*. -.. cmember:: setattrfunc PyTypeObject.tp_setattr +.. c:member:: setattrfunc PyTypeObject.tp_setattr An optional pointer to the set-attribute-string function. This field is deprecated. When it is defined, it should point to a function that acts the same as the :attr:`tp_setattro` function, but taking a C string instead of a Python string object to give the attribute name. The signature is - the same as for :cfunc:`PyObject_SetAttrString`. + the same as for :c:func:`PyObject_SetAttrString`. This field is inherited by subtypes together with :attr:`tp_setattro`: a subtype inherits both :attr:`tp_setattr` and :attr:`tp_setattro` from its base type when the subtype's :attr:`tp_setattr` and :attr:`tp_setattro` are both *NULL*. -.. cmember:: cmpfunc PyTypeObject.tp_compare +.. c:member:: cmpfunc PyTypeObject.tp_compare An optional pointer to the three-way comparison function. - The signature is the same as for :cfunc:`PyObject_Compare`. The function should + The signature is the same as for :c:func:`PyObject_Compare`. The function should return ``1`` if *self* greater than *other*, ``0`` if *self* is equal to *other*, and ``-1`` if *self* less than *other*. It should return ``-1`` and set an exception condition when an error occurred during the comparison. @@ -266,14 +266,14 @@ :attr:`tp_compare`, :attr:`tp_richcompare`, and :attr:`tp_hash` are all *NULL*. -.. cmember:: reprfunc PyTypeObject.tp_repr +.. c:member:: reprfunc PyTypeObject.tp_repr .. index:: builtin: repr An optional pointer to a function that implements the built-in function :func:`repr`. - The signature is the same as for :cfunc:`PyObject_Repr`; it must return a string + The signature is the same as for :c:func:`PyObject_Repr`; it must return a string or a Unicode object. Ideally, this function should return a string that, when passed to :func:`eval`, given a suitable environment, returns an object with the same value. If this is not feasible, it should return a string starting with @@ -286,7 +286,7 @@ This field is inherited by subtypes. -.. cmember:: PyNumberMethods* tp_as_number +.. c:member:: PyNumberMethods* tp_as_number Pointer to an additional structure that contains fields relevant only to objects which implement the number protocol. These fields are documented in @@ -296,7 +296,7 @@ inherited individually. -.. cmember:: PySequenceMethods* tp_as_sequence +.. c:member:: PySequenceMethods* tp_as_sequence Pointer to an additional structure that contains fields relevant only to objects which implement the sequence protocol. These fields are documented @@ -306,7 +306,7 @@ are inherited individually. -.. cmember:: PyMappingMethods* tp_as_mapping +.. c:member:: PyMappingMethods* tp_as_mapping Pointer to an additional structure that contains fields relevant only to objects which implement the mapping protocol. These fields are documented in @@ -316,25 +316,25 @@ are inherited individually. -.. cmember:: hashfunc PyTypeObject.tp_hash +.. c:member:: hashfunc PyTypeObject.tp_hash .. index:: builtin: hash An optional pointer to a function that implements the built-in function :func:`hash`. - The signature is the same as for :cfunc:`PyObject_Hash`; it must return a C + The signature is the same as for :c:func:`PyObject_Hash`; it must return a C long. The value ``-1`` should not be returned as a normal return value; when an error occurs during the computation of the hash value, the function should set an exception and return ``-1``. - This field can be set explicitly to :cfunc:`PyObject_HashNotImplemented` to + This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to block inheritance of the hash method from a parent type. This is interpreted as the equivalent of ``__hash__ = None`` at the Python level, causing ``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note that the converse is also true - setting ``__hash__ = None`` on a class at the Python level will result in the ``tp_hash`` slot being set to - :cfunc:`PyObject_HashNotImplemented`. + :c:func:`PyObject_HashNotImplemented`. When this field is not set, two possibilities exist: if the :attr:`tp_compare` and :attr:`tp_richcompare` fields are both *NULL*, a default hash value based on @@ -346,39 +346,39 @@ :attr:`tp_compare`, :attr:`tp_richcompare` and :attr:`tp_hash` are all *NULL*. -.. cmember:: ternaryfunc PyTypeObject.tp_call +.. c:member:: ternaryfunc PyTypeObject.tp_call An optional pointer to a function that implements calling the object. This should be *NULL* if the object is not callable. The signature is the same as - for :cfunc:`PyObject_Call`. + for :c:func:`PyObject_Call`. This field is inherited by subtypes. -.. cmember:: reprfunc PyTypeObject.tp_str +.. c:member:: reprfunc PyTypeObject.tp_str An optional pointer to a function that implements the built-in operation :func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls the - constructor for that type. This constructor calls :cfunc:`PyObject_Str` to do - the actual work, and :cfunc:`PyObject_Str` will call this handler.) + constructor for that type. This constructor calls :c:func:`PyObject_Str` to do + the actual work, and :c:func:`PyObject_Str` will call this handler.) - The signature is the same as for :cfunc:`PyObject_Str`; it must return a string + The signature is the same as for :c:func:`PyObject_Str`; it must return a string or a Unicode object. This function should return a "friendly" string representation of the object, as this is the representation that will be used by the print statement. - When this field is not set, :cfunc:`PyObject_Repr` is called to return a string + When this field is not set, :c:func:`PyObject_Repr` is called to return a string representation. This field is inherited by subtypes. -.. cmember:: getattrofunc PyTypeObject.tp_getattro +.. c:member:: getattrofunc PyTypeObject.tp_getattro An optional pointer to the get-attribute function. - The signature is the same as for :cfunc:`PyObject_GetAttr`. It is usually - convenient to set this field to :cfunc:`PyObject_GenericGetAttr`, which + The signature is the same as for :c:func:`PyObject_GetAttr`. It is usually + convenient to set this field to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of looking for object attributes. This field is inherited by subtypes together with :attr:`tp_getattr`: a subtype @@ -386,12 +386,12 @@ the subtype's :attr:`tp_getattr` and :attr:`tp_getattro` are both *NULL*. -.. cmember:: setattrofunc PyTypeObject.tp_setattro +.. c:member:: setattrofunc PyTypeObject.tp_setattro An optional pointer to the set-attribute function. - The signature is the same as for :cfunc:`PyObject_SetAttr`. It is usually - convenient to set this field to :cfunc:`PyObject_GenericSetAttr`, which + The signature is the same as for :c:func:`PyObject_SetAttr`. It is usually + convenient to set this field to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of setting object attributes. This field is inherited by subtypes together with :attr:`tp_setattr`: a subtype @@ -399,7 +399,7 @@ the subtype's :attr:`tp_setattr` and :attr:`tp_setattro` are both *NULL*. -.. cmember:: PyBufferProcs* PyTypeObject.tp_as_buffer +.. c:member:: PyBufferProcs* PyTypeObject.tp_as_buffer Pointer to an additional structure that contains fields relevant only to objects which implement the buffer interface. These fields are documented in @@ -409,7 +409,7 @@ inherited individually. -.. cmember:: long PyTypeObject.tp_flags +.. c:member:: long PyTypeObject.tp_flags This field is a bit mask of various flags. Some flags indicate variant semantics for certain situations; others are used to indicate that certain @@ -433,19 +433,19 @@ The following bit masks are currently defined; these can be ORed together using the ``|`` operator to form the value of the :attr:`tp_flags` field. The macro - :cfunc:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and + :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-zero. .. data:: Py_TPFLAGS_HAVE_GETCHARBUFFER - If this bit is set, the :ctype:`PyBufferProcs` struct referenced by + If this bit is set, the :c:type:`PyBufferProcs` struct referenced by :attr:`tp_as_buffer` has the :attr:`bf_getcharbuffer` field. .. data:: Py_TPFLAGS_HAVE_SEQUENCE_IN - If this bit is set, the :ctype:`PySequenceMethods` struct referenced by + If this bit is set, the :c:type:`PySequenceMethods` struct referenced by :attr:`tp_as_sequence` has the :attr:`sq_contains` field. @@ -457,23 +457,23 @@ .. data:: Py_TPFLAGS_HAVE_INPLACEOPS - If this bit is set, the :ctype:`PySequenceMethods` struct referenced by - :attr:`tp_as_sequence` and the :ctype:`PyNumberMethods` structure referenced by + If this bit is set, the :c:type:`PySequenceMethods` struct referenced by + :attr:`tp_as_sequence` and the :c:type:`PyNumberMethods` structure referenced by :attr:`tp_as_number` contain the fields for in-place operators. In particular, - this means that the :ctype:`PyNumberMethods` structure has the fields + this means that the :c:type:`PyNumberMethods` structure has the fields :attr:`nb_inplace_add`, :attr:`nb_inplace_subtract`, :attr:`nb_inplace_multiply`, :attr:`nb_inplace_divide`, :attr:`nb_inplace_remainder`, :attr:`nb_inplace_power`, :attr:`nb_inplace_lshift`, :attr:`nb_inplace_rshift`, :attr:`nb_inplace_and`, :attr:`nb_inplace_xor`, and :attr:`nb_inplace_or`; and the - :ctype:`PySequenceMethods` struct has the fields :attr:`sq_inplace_concat` and + :c:type:`PySequenceMethods` struct has the fields :attr:`sq_inplace_concat` and :attr:`sq_inplace_repeat`. .. data:: Py_TPFLAGS_CHECKTYPES If this bit is set, the binary and ternary operations in the - :ctype:`PyNumberMethods` structure referenced by :attr:`tp_as_number` accept + :c:type:`PyNumberMethods` structure referenced by :attr:`tp_as_number` accept arguments of arbitrary object types, and do their own type conversions if needed. If this bit is clear, those operations require that all arguments have the current type as their type, and the caller is supposed to perform a coercion @@ -532,20 +532,20 @@ .. data:: Py_TPFLAGS_READY This bit is set when the type object has been fully initialized by - :cfunc:`PyType_Ready`. + :c:func:`PyType_Ready`. .. data:: Py_TPFLAGS_READYING - This bit is set while :cfunc:`PyType_Ready` is in the process of initializing + This bit is set while :c:func:`PyType_Ready` is in the process of initializing the type object. .. data:: Py_TPFLAGS_HAVE_GC This bit is set when the object supports garbage collection. If this bit - is set, instances must be created using :cfunc:`PyObject_GC_New` and - destroyed using :cfunc:`PyObject_GC_Del`. More information in section + is set, instances must be created using :c:func:`PyObject_GC_New` and + destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:`supporting-cycle-detection`. This bit also implies that the GC-related fields :attr:`tp_traverse` and :attr:`tp_clear` are present in the type object; but those fields also exist when @@ -563,7 +563,7 @@ :const:`Py_TPFLAGS_HAVE_ITER`, and :const:`Py_TPFLAGS_HAVE_CLASS`. -.. cmember:: char* PyTypeObject.tp_doc +.. c:member:: char* PyTypeObject.tp_doc An optional pointer to a NUL-terminated C string giving the docstring for this type object. This is exposed as the :attr:`__doc__` attribute on the type and @@ -575,7 +575,7 @@ :const:`Py_TPFLAGS_HAVE_RICHCOMPARE` flag bit is set. -.. cmember:: traverseproc PyTypeObject.tp_traverse +.. c:member:: traverseproc PyTypeObject.tp_traverse An optional pointer to a traversal function for the garbage collector. This is only used if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is set. More information @@ -584,8 +584,8 @@ The :attr:`tp_traverse` pointer is used by the garbage collector to detect reference cycles. A typical implementation of a :attr:`tp_traverse` function - simply calls :cfunc:`Py_VISIT` on each of the instance's members that are Python - objects. For example, this is function :cfunc:`local_traverse` from the + simply calls :c:func:`Py_VISIT` on each of the instance's members that are Python + objects. For example, this is function :c:func:`local_traverse` from the :mod:`thread` extension module:: static int @@ -597,7 +597,7 @@ return 0; } - Note that :cfunc:`Py_VISIT` is called only on those members that can participate + Note that :c:func:`Py_VISIT` is called only on those members that can participate in reference cycles. Although there is also a ``self->key`` member, it can only be *NULL* or a Python string and therefore cannot be part of a reference cycle. @@ -605,8 +605,8 @@ debugging aid you may want to visit it anyway just so the :mod:`gc` module's :func:`get_referents` function will include it. - Note that :cfunc:`Py_VISIT` requires the *visit* and *arg* parameters to - :cfunc:`local_traverse` to have these specific names; don't name them just + Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to + :c:func:`local_traverse` to have these specific names; don't name them just anything. This field is inherited by subtypes together with :attr:`tp_clear` and the @@ -616,7 +616,7 @@ bit set. -.. cmember:: inquiry PyTypeObject.tp_clear +.. c:member:: inquiry PyTypeObject.tp_clear An optional pointer to a clear function for the garbage collector. This is only used if the :const:`Py_TPFLAGS_HAVE_GC` flag bit is set. @@ -645,7 +645,7 @@ return 0; } - The :cfunc:`Py_CLEAR` macro should be used, because clearing references is + The :c:func:`Py_CLEAR` macro should be used, because clearing references is delicate: the reference to the contained object must not be decremented until after the pointer to the contained object is set to *NULL*. This is because decrementing the reference count may cause the contained object to become trash, @@ -654,7 +654,7 @@ contained object). If it's possible for such code to reference *self* again, it's important that the pointer to the contained object be *NULL* at that time, so that *self* knows the contained object can no longer be used. The - :cfunc:`Py_CLEAR` macro performs the operations in a safe order. + :c:func:`Py_CLEAR` macro performs the operations in a safe order. Because the goal of :attr:`tp_clear` functions is to break reference cycles, it's not necessary to clear contained objects like Python strings or Python @@ -672,7 +672,7 @@ bit set. -.. cmember:: richcmpfunc PyTypeObject.tp_richcompare +.. c:member:: richcmpfunc PyTypeObject.tp_richcompare An optional pointer to the rich comparison function, whose signature is ``PyObject *tp_richcompare(PyObject *a, PyObject *b, int op)``. @@ -694,7 +694,7 @@ :attr:`tp_compare`, :attr:`tp_richcompare`, and :attr:`tp_hash` are all *NULL*. The following constants are defined to be used as the third argument for - :attr:`tp_richcompare` and for :cfunc:`PyObject_RichCompare`: + :attr:`tp_richcompare` and for :c:func:`PyObject_RichCompare`: +----------------+------------+ | Constant | Comparison | @@ -716,13 +716,13 @@ The next field only exists if the :const:`Py_TPFLAGS_HAVE_WEAKREFS` flag bit is set. -.. cmember:: long PyTypeObject.tp_weaklistoffset +.. c:member:: long PyTypeObject.tp_weaklistoffset If the instances of this type are weakly referenceable, this field is greater than zero and contains the offset in the instance structure of the weak reference list head (ignoring the GC header, if present); this offset is used by - :cfunc:`PyObject_ClearWeakRefs` and the :cfunc:`PyWeakref_\*` functions. The - instance structure needs to include a field of type :ctype:`PyObject\*` which is + :c:func:`PyObject_ClearWeakRefs` and the :c:func:`PyWeakref_\*` functions. The + instance structure needs to include a field of type :c:type:`PyObject\*` which is initialized to *NULL*. Do not confuse this field with :attr:`tp_weaklist`; that is the list head for @@ -751,19 +751,19 @@ set. -.. cmember:: getiterfunc PyTypeObject.tp_iter +.. c:member:: getiterfunc PyTypeObject.tp_iter An optional pointer to a function that returns an iterator for the object. Its presence normally signals that the instances of this type are iterable (although sequences may be iterable without this function, and classic instances always have this function, even if they don't define an :meth:`__iter__` method). - This function has the same signature as :cfunc:`PyObject_GetIter`. + This function has the same signature as :c:func:`PyObject_GetIter`. This field is inherited by subtypes. -.. cmember:: iternextfunc PyTypeObject.tp_iternext +.. c:member:: iternextfunc PyTypeObject.tp_iternext An optional pointer to a function that returns the next item in an iterator. When the iterator is exhausted, it must return *NULL*; a :exc:`StopIteration` @@ -776,7 +776,7 @@ function should return the iterator instance itself (not a new iterator instance). - This function has the same signature as :cfunc:`PyIter_Next`. + This function has the same signature as :c:func:`PyIter_Next`. This field is inherited by subtypes. @@ -784,9 +784,9 @@ :const:`Py_TPFLAGS_HAVE_CLASS` flag bit is set. -.. cmember:: struct PyMethodDef* PyTypeObject.tp_methods +.. c:member:: struct PyMethodDef* PyTypeObject.tp_methods - An optional pointer to a static *NULL*-terminated array of :ctype:`PyMethodDef` + An optional pointer to a static *NULL*-terminated array of :c:type:`PyMethodDef` structures, declaring regular methods of this type. For each entry in the array, an entry is added to the type's dictionary (see @@ -796,9 +796,9 @@ different mechanism). -.. cmember:: struct PyMemberDef* PyTypeObject.tp_members +.. c:member:: struct PyMemberDef* PyTypeObject.tp_members - An optional pointer to a static *NULL*-terminated array of :ctype:`PyMemberDef` + An optional pointer to a static *NULL*-terminated array of :c:type:`PyMemberDef` structures, declaring regular data members (fields or slots) of instances of this type. @@ -809,9 +809,9 @@ different mechanism). -.. cmember:: struct PyGetSetDef* PyTypeObject.tp_getset +.. c:member:: struct PyGetSetDef* PyTypeObject.tp_getset - An optional pointer to a static *NULL*-terminated array of :ctype:`PyGetSetDef` + An optional pointer to a static *NULL*-terminated array of :c:type:`PyGetSetDef` structures, declaring computed attributes of instances of this type. For each entry in the array, an entry is added to the type's dictionary (see @@ -836,7 +836,7 @@ } PyGetSetDef; -.. cmember:: PyTypeObject* PyTypeObject.tp_base +.. c:member:: PyTypeObject* PyTypeObject.tp_base An optional pointer to a base type from which type properties are inherited. At this level, only single inheritance is supported; multiple inheritance require @@ -847,13 +847,13 @@ :class:`object`). -.. cmember:: PyObject* PyTypeObject.tp_dict +.. c:member:: PyObject* PyTypeObject.tp_dict - The type's dictionary is stored here by :cfunc:`PyType_Ready`. + The type's dictionary is stored here by :c:func:`PyType_Ready`. This field should normally be initialized to *NULL* before PyType_Ready is called; it may also be initialized to a dictionary containing initial attributes - for the type. Once :cfunc:`PyType_Ready` has initialized the type, extra + for the type. Once :c:func:`PyType_Ready` has initialized the type, extra attributes for the type may be added to this dictionary only if they don't correspond to overloaded operations (like :meth:`__add__`). @@ -861,7 +861,7 @@ are inherited through a different mechanism). -.. cmember:: descrgetfunc PyTypeObject.tp_descr_get +.. c:member:: descrgetfunc PyTypeObject.tp_descr_get An optional pointer to a "descriptor get" function. @@ -874,7 +874,7 @@ This field is inherited by subtypes. -.. cmember:: descrsetfunc PyTypeObject.tp_descr_set +.. c:member:: descrsetfunc PyTypeObject.tp_descr_set An optional pointer to a "descriptor set" function. @@ -887,12 +887,12 @@ .. XXX explain. -.. cmember:: long PyTypeObject.tp_dictoffset +.. c:member:: long PyTypeObject.tp_dictoffset If the instances of this type have a dictionary containing instance variables, this field is non-zero and contains the offset in the instances of the type of the instance variable dictionary; this offset is used by - :cfunc:`PyObject_GenericGetAttr`. + :c:func:`PyObject_GenericGetAttr`. Do not confuse this field with :attr:`tp_dict`; that is the dictionary for attributes of the type object itself. @@ -920,7 +920,7 @@ taken from the type object, and :attr:`ob_size` is taken from the instance. The absolute value is taken because long ints use the sign of :attr:`ob_size` to store the sign of the number. (There's never a need to do this calculation - yourself; it is done for you by :cfunc:`_PyObject_GetDictPtr`.) + yourself; it is done for you by :c:func:`_PyObject_GetDictPtr`.) This field is inherited by subtypes, but see the rules listed below. A subtype may override this offset; this means that the subtype instances store the @@ -940,7 +940,7 @@ added as a feature just like :attr:`__weakref__` though.) -.. cmember:: initproc PyTypeObject.tp_init +.. c:member:: initproc PyTypeObject.tp_init An optional pointer to an instance initialization function. @@ -970,7 +970,7 @@ This field is inherited by subtypes. -.. cmember:: allocfunc PyTypeObject.tp_alloc +.. c:member:: allocfunc PyTypeObject.tp_alloc An optional pointer to an instance allocation function. @@ -993,11 +993,11 @@ This field is inherited by static subtypes, but not by dynamic subtypes (subtypes created by a class statement); in the latter, this field is always set - to :cfunc:`PyType_GenericAlloc`, to force a standard heap allocation strategy. + to :c:func:`PyType_GenericAlloc`, to force a standard heap allocation strategy. That is also the recommended value for statically defined types. -.. cmember:: newfunc PyTypeObject.tp_new +.. c:member:: newfunc PyTypeObject.tp_new An optional pointer to an instance creation function. @@ -1029,16 +1029,16 @@ being linked with Python 2.2. -.. cmember:: destructor PyTypeObject.tp_free +.. c:member:: destructor PyTypeObject.tp_free An optional pointer to an instance deallocation function. The signature of this function has changed slightly: in Python 2.2 and 2.2.1, - its signature is :ctype:`destructor`:: + its signature is :c:type:`destructor`:: void tp_free(PyObject *) - In Python 2.3 and beyond, its signature is :ctype:`freefunc`:: + In Python 2.3 and beyond, its signature is :c:type:`freefunc`:: void tp_free(void *) @@ -1047,11 +1047,11 @@ This field is inherited by static subtypes, but not by dynamic subtypes (subtypes created by a class statement); in the latter, this field is set to a - deallocator suitable to match :cfunc:`PyType_GenericAlloc` and the value of the + deallocator suitable to match :c:func:`PyType_GenericAlloc` and the value of the :const:`Py_TPFLAGS_HAVE_GC` flag bit. -.. cmember:: inquiry PyTypeObject.tp_is_gc +.. c:member:: inquiry PyTypeObject.tp_is_gc An optional pointer to a function called by the garbage collector. @@ -1066,14 +1066,14 @@ int tp_is_gc(PyObject *self) (The only example of this are types themselves. The metatype, - :cdata:`PyType_Type`, defines this function to distinguish between statically + :c:data:`PyType_Type`, defines this function to distinguish between statically and dynamically allocated types.) This field is inherited by subtypes. (VERSION NOTE: in Python 2.2, it was not inherited. It is inherited in 2.2.1 and later versions.) -.. cmember:: PyObject* PyTypeObject.tp_bases +.. c:member:: PyObject* PyTypeObject.tp_bases Tuple of base types. @@ -1083,25 +1083,25 @@ This field is not inherited. -.. cmember:: PyObject* PyTypeObject.tp_mro +.. c:member:: PyObject* PyTypeObject.tp_mro Tuple containing the expanded set of base types, starting with the type itself and ending with :class:`object`, in Method Resolution Order. - This field is not inherited; it is calculated fresh by :cfunc:`PyType_Ready`. + This field is not inherited; it is calculated fresh by :c:func:`PyType_Ready`. -.. cmember:: PyObject* PyTypeObject.tp_cache +.. c:member:: PyObject* PyTypeObject.tp_cache Unused. Not inherited. Internal use only. -.. cmember:: PyObject* PyTypeObject.tp_subclasses +.. c:member:: PyObject* PyTypeObject.tp_subclasses List of weak references to subclasses. Not inherited. Internal use only. -.. cmember:: PyObject* PyTypeObject.tp_weaklist +.. c:member:: PyObject* PyTypeObject.tp_weaklist Weak reference list head, for weak references to this type object. Not inherited. Internal use only. @@ -1112,22 +1112,22 @@ subtypes. -.. cmember:: Py_ssize_t PyTypeObject.tp_allocs +.. c:member:: Py_ssize_t PyTypeObject.tp_allocs Number of allocations. -.. cmember:: Py_ssize_t PyTypeObject.tp_frees +.. c:member:: Py_ssize_t PyTypeObject.tp_frees Number of frees. -.. cmember:: Py_ssize_t PyTypeObject.tp_maxalloc +.. c:member:: Py_ssize_t PyTypeObject.tp_maxalloc Maximum simultaneously allocated objects. -.. cmember:: PyTypeObject* PyTypeObject.tp_next +.. c:member:: PyTypeObject* PyTypeObject.tp_next Pointer to the next type object with a non-zero :attr:`tp_allocs` field. @@ -1150,7 +1150,7 @@ .. sectionauthor:: Amaury Forgeot d'Arc -.. ctype:: PyNumberMethods +.. c:type:: PyNumberMethods This structure holds pointers to the functions which an object uses to implement the number protocol. Almost every function below is used by the @@ -1215,9 +1215,9 @@ the coercion method specified by the :attr:`nb_coerce` member to convert the arguments: - .. cmember:: coercion PyNumberMethods.nb_coerce + .. c:member:: coercion PyNumberMethods.nb_coerce - This function is used by :cfunc:`PyNumber_CoerceEx` and has the same + This function is used by :c:func:`PyNumber_CoerceEx` and has the same signature. The first argument is always a pointer to an object of the defined type. If the conversion to a common "larger" type is possible, the function replaces the pointers with new references to the converted objects @@ -1243,26 +1243,26 @@ .. sectionauthor:: Amaury Forgeot d'Arc -.. ctype:: PyMappingMethods +.. c:type:: PyMappingMethods This structure holds pointers to the functions which an object uses to implement the mapping protocol. It has three members: -.. cmember:: lenfunc PyMappingMethods.mp_length +.. c:member:: lenfunc PyMappingMethods.mp_length - This function is used by :cfunc:`PyMapping_Length` and - :cfunc:`PyObject_Size`, and has the same signature. This slot may be set to + This function is used by :c:func:`PyMapping_Length` and + :c:func:`PyObject_Size`, and has the same signature. This slot may be set to *NULL* if the object has no defined length. -.. cmember:: binaryfunc PyMappingMethods.mp_subscript +.. c:member:: binaryfunc PyMappingMethods.mp_subscript - This function is used by :cfunc:`PyObject_GetItem` and has the same - signature. This slot must be filled for the :cfunc:`PyMapping_Check` + This function is used by :c:func:`PyObject_GetItem` and has the same + signature. This slot must be filled for the :c:func:`PyMapping_Check` function to return ``1``, it can be *NULL* otherwise. -.. cmember:: objobjargproc PyMappingMethods.mp_ass_subscript +.. c:member:: objobjargproc PyMappingMethods.mp_ass_subscript - This function is used by :cfunc:`PyObject_SetItem` and has the same + This function is used by :c:func:`PyObject_SetItem` and has the same signature. If this slot is *NULL*, the object does not support item assignment. @@ -1275,32 +1275,32 @@ .. sectionauthor:: Amaury Forgeot d'Arc -.. ctype:: PySequenceMethods +.. c:type:: PySequenceMethods This structure holds pointers to the functions which an object uses to implement the sequence protocol. -.. cmember:: lenfunc PySequenceMethods.sq_length +.. c:member:: lenfunc PySequenceMethods.sq_length - This function is used by :cfunc:`PySequence_Size` and :cfunc:`PyObject_Size`, + This function is used by :c:func:`PySequence_Size` and :c:func:`PyObject_Size`, and has the same signature. -.. cmember:: binaryfunc PySequenceMethods.sq_concat +.. c:member:: binaryfunc PySequenceMethods.sq_concat - This function is used by :cfunc:`PySequence_Concat` and has the same + This function is used by :c:func:`PySequence_Concat` and has the same signature. It is also used by the ``+`` operator, after trying the numeric addition via the :attr:`tp_as_number.nb_add` slot. -.. cmember:: ssizeargfunc PySequenceMethods.sq_repeat +.. c:member:: ssizeargfunc PySequenceMethods.sq_repeat - This function is used by :cfunc:`PySequence_Repeat` and has the same + This function is used by :c:func:`PySequence_Repeat` and has the same signature. It is also used by the ``*`` operator, after trying numeric multiplication via the :attr:`tp_as_number.nb_mul` slot. -.. cmember:: ssizeargfunc PySequenceMethods.sq_item +.. c:member:: ssizeargfunc PySequenceMethods.sq_item - This function is used by :cfunc:`PySequence_GetItem` and has the same - signature. This slot must be filled for the :cfunc:`PySequence_Check` + This function is used by :c:func:`PySequence_GetItem` and has the same + signature. This slot must be filled for the :c:func:`PySequence_Check` function to return ``1``, it can be *NULL* otherwise. Negative indexes are handled as follows: if the :attr:`sq_length` slot is @@ -1308,27 +1308,27 @@ index which is passed to :attr:`sq_item`. If :attr:`sq_length` is *NULL*, the index is passed as is to the function. -.. cmember:: ssizeobjargproc PySequenceMethods.sq_ass_item +.. c:member:: ssizeobjargproc PySequenceMethods.sq_ass_item - This function is used by :cfunc:`PySequence_SetItem` and has the same + This function is used by :c:func:`PySequence_SetItem` and has the same signature. This slot may be left to *NULL* if the object does not support item assignment. -.. cmember:: objobjproc PySequenceMethods.sq_contains +.. c:member:: objobjproc PySequenceMethods.sq_contains - This function may be used by :cfunc:`PySequence_Contains` and has the same + This function may be used by :c:func:`PySequence_Contains` and has the same signature. This slot may be left to *NULL*, in this case - :cfunc:`PySequence_Contains` simply traverses the sequence until it finds a + :c:func:`PySequence_Contains` simply traverses the sequence until it finds a match. -.. cmember:: binaryfunc PySequenceMethods.sq_inplace_concat +.. c:member:: binaryfunc PySequenceMethods.sq_inplace_concat - This function is used by :cfunc:`PySequence_InPlaceConcat` and has the same + This function is used by :c:func:`PySequence_InPlaceConcat` and has the same signature. It should modify its first operand, and return it. -.. cmember:: ssizeargfunc PySequenceMethods.sq_inplace_repeat +.. c:member:: ssizeargfunc PySequenceMethods.sq_inplace_repeat - This function is used by :cfunc:`PySequence_InPlaceRepeat` and has the same + This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same signature. It should modify its first operand, and return it. .. XXX need to explain precedence between mapping and sequence @@ -1349,45 +1349,45 @@ to be non-contiguous in memory. If an object does not export the buffer interface, then its :attr:`tp_as_buffer` -member in the :ctype:`PyTypeObject` structure should be *NULL*. Otherwise, the -:attr:`tp_as_buffer` will point to a :ctype:`PyBufferProcs` structure. +member in the :c:type:`PyTypeObject` structure should be *NULL*. Otherwise, the +:attr:`tp_as_buffer` will point to a :c:type:`PyBufferProcs` structure. .. note:: - It is very important that your :ctype:`PyTypeObject` structure uses + It is very important that your :c:type:`PyTypeObject` structure uses :const:`Py_TPFLAGS_DEFAULT` for the value of the :attr:`tp_flags` member rather - than ``0``. This tells the Python runtime that your :ctype:`PyBufferProcs` + than ``0``. This tells the Python runtime that your :c:type:`PyBufferProcs` structure contains the :attr:`bf_getcharbuffer` slot. Older versions of Python did not have this member, so a new Python interpreter using an old extension needs to be able to test for its presence before using it. -.. ctype:: PyBufferProcs +.. c:type:: PyBufferProcs Structure used to hold the function pointers which define an implementation of the buffer protocol. - The first slot is :attr:`bf_getreadbuffer`, of type :ctype:`getreadbufferproc`. + The first slot is :attr:`bf_getreadbuffer`, of type :c:type:`getreadbufferproc`. If this slot is *NULL*, then the object does not support reading from the internal data. This is non-sensical, so implementors should fill this in, but callers should test that the slot contains a non-*NULL* value. The next slot is :attr:`bf_getwritebuffer` having type - :ctype:`getwritebufferproc`. This slot may be *NULL* if the object does not + :c:type:`getwritebufferproc`. This slot may be *NULL* if the object does not allow writing into its returned buffers. - The third slot is :attr:`bf_getsegcount`, with type :ctype:`getsegcountproc`. + The third slot is :attr:`bf_getsegcount`, with type :c:type:`getsegcountproc`. This slot must not be *NULL* and is used to inform the caller how many segments - the object contains. Simple objects such as :ctype:`PyString_Type` and - :ctype:`PyBuffer_Type` objects contain a single segment. + the object contains. Simple objects such as :c:type:`PyString_Type` and + :c:type:`PyBuffer_Type` objects contain a single segment. .. index:: single: PyType_HasFeature() - The last slot is :attr:`bf_getcharbuffer`, of type :ctype:`getcharbufferproc`. + The last slot is :attr:`bf_getcharbuffer`, of type :c:type:`getcharbufferproc`. This slot will only be present if the :const:`Py_TPFLAGS_HAVE_GETCHARBUFFER` flag is present in the :attr:`tp_flags` field of the object's - :ctype:`PyTypeObject`. Before using this slot, the caller should test whether it - is present by using the :cfunc:`PyType_HasFeature` function. If the flag is + :c:type:`PyTypeObject`. Before using this slot, the caller should test whether it + is present by using the :c:func:`PyType_HasFeature` function. If the flag is present, :attr:`bf_getcharbuffer` may be *NULL*, indicating that the object's contents cannot be used as *8-bit characters*. The slot function may also raise an error if the object's contents cannot be interpreted as 8-bit characters. @@ -1411,7 +1411,7 @@ buffer interface or that the :attr:`bf_getcharbuffer` slot is non-*NULL*. -.. ctype:: Py_ssize_t (*readbufferproc) (PyObject *self, Py_ssize_t segment, void **ptrptr) +.. c:type:: Py_ssize_t (*readbufferproc) (PyObject *self, Py_ssize_t segment, void **ptrptr) Return a pointer to a readable segment of the buffer in ``*ptrptr``. This function is allowed to raise an exception, in which case it must return ``-1``. @@ -1421,7 +1421,7 @@ ``*ptrptr`` to a pointer to that memory. -.. ctype:: Py_ssize_t (*writebufferproc) (PyObject *self, Py_ssize_t segment, void **ptrptr) +.. c:type:: Py_ssize_t (*writebufferproc) (PyObject *self, Py_ssize_t segment, void **ptrptr) Return a pointer to a writable memory buffer in ``*ptrptr``, and the length of that segment as the function return value. The memory buffer must correspond to @@ -1435,14 +1435,14 @@ segment. That indicates a blatant programming error in the C code. -.. ctype:: Py_ssize_t (*segcountproc) (PyObject *self, Py_ssize_t *lenp) +.. c:type:: Py_ssize_t (*segcountproc) (PyObject *self, Py_ssize_t *lenp) Return the number of memory segments which comprise the buffer. If *lenp* is not *NULL*, the implementation must report the sum of the sizes (in bytes) of all segments in ``*lenp``. The function cannot fail. -.. ctype:: Py_ssize_t (*charbufferproc) (PyObject *self, Py_ssize_t segment, const char **ptrptr) +.. c:type:: Py_ssize_t (*charbufferproc) (PyObject *self, Py_ssize_t segment, const char **ptrptr) Return the size of the segment *segment* that *ptrptr* is set to. ``*ptrptr`` is set to the memory buffer. Returns ``-1`` on error. diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -18,39 +18,39 @@ Python: -.. ctype:: Py_UNICODE +.. c:type:: Py_UNICODE This type represents the storage type which is used by Python internally as basis for holding Unicode ordinals. Python's default builds use a 16-bit type - for :ctype:`Py_UNICODE` and store Unicode values internally as UCS2. It is also + for :c:type:`Py_UNICODE` and store Unicode values internally as UCS2. It is also possible to build a UCS4 version of Python (most recent Linux distributions come with UCS4 builds of Python). These builds then use a 32-bit type for - :ctype:`Py_UNICODE` and store Unicode data internally as UCS4. On platforms - where :ctype:`wchar_t` is available and compatible with the chosen Python - Unicode build variant, :ctype:`Py_UNICODE` is a typedef alias for - :ctype:`wchar_t` to enhance native platform compatibility. On all other - platforms, :ctype:`Py_UNICODE` is a typedef alias for either :ctype:`unsigned - short` (UCS2) or :ctype:`unsigned long` (UCS4). + :c:type:`Py_UNICODE` and store Unicode data internally as UCS4. On platforms + where :c:type:`wchar_t` is available and compatible with the chosen Python + Unicode build variant, :c:type:`Py_UNICODE` is a typedef alias for + :c:type:`wchar_t` to enhance native platform compatibility. On all other + platforms, :c:type:`Py_UNICODE` is a typedef alias for either :c:type:`unsigned + short` (UCS2) or :c:type:`unsigned long` (UCS4). Note that UCS2 and UCS4 Python builds are not binary compatible. Please keep this in mind when writing extensions or interfaces. -.. ctype:: PyUnicodeObject +.. c:type:: PyUnicodeObject - This subtype of :ctype:`PyObject` represents a Python Unicode object. + This subtype of :c:type:`PyObject` represents a Python Unicode object. -.. cvar:: PyTypeObject PyUnicode_Type +.. c:var:: PyTypeObject PyUnicode_Type - This instance of :ctype:`PyTypeObject` represents the Python Unicode type. It + This instance of :c:type:`PyTypeObject` represents the Python Unicode type. It is exposed to Python code as ``unicode`` and ``types.UnicodeType``. The following APIs are really C macros and can be used to do fast checks and to access internal read-only data of Unicode objects: -.. cfunction:: int PyUnicode_Check(PyObject *o) +.. c:function:: int PyUnicode_Check(PyObject *o) Return true if the object *o* is a Unicode object or an instance of a Unicode subtype. @@ -59,7 +59,7 @@ Allowed subtypes to be accepted. -.. cfunction:: int PyUnicode_CheckExact(PyObject *o) +.. c:function:: int PyUnicode_CheckExact(PyObject *o) Return true if the object *o* is a Unicode object, but not an instance of a subtype. @@ -67,39 +67,39 @@ .. versionadded:: 2.2 -.. cfunction:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o) +.. c:function:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o) - Return the size of the object. *o* has to be a :ctype:`PyUnicodeObject` (not + Return the size of the object. *o* has to be a :c:type:`PyUnicodeObject` (not checked). .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o) +.. c:function:: Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *o) Return the size of the object's internal buffer in bytes. *o* has to be a - :ctype:`PyUnicodeObject` (not checked). + :c:type:`PyUnicodeObject` (not checked). .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o) +.. c:function:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o) - Return a pointer to the internal :ctype:`Py_UNICODE` buffer of the object. *o* - has to be a :ctype:`PyUnicodeObject` (not checked). + Return a pointer to the internal :c:type:`Py_UNICODE` buffer of the object. *o* + has to be a :c:type:`PyUnicodeObject` (not checked). -.. cfunction:: const char* PyUnicode_AS_DATA(PyObject *o) +.. c:function:: const char* PyUnicode_AS_DATA(PyObject *o) Return a pointer to the internal buffer of the object. *o* has to be a - :ctype:`PyUnicodeObject` (not checked). + :c:type:`PyUnicodeObject` (not checked). -.. cfunction:: int PyUnicode_ClearFreeList() +.. c:function:: int PyUnicode_ClearFreeList() Clear the free list. Return the total number of freed items. @@ -114,86 +114,86 @@ the Python configuration. -.. cfunction:: int Py_UNICODE_ISSPACE(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISSPACE(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a whitespace character. -.. cfunction:: int Py_UNICODE_ISLOWER(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISLOWER(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a lowercase character. -.. cfunction:: int Py_UNICODE_ISUPPER(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISUPPER(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is an uppercase character. -.. cfunction:: int Py_UNICODE_ISTITLE(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISTITLE(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a titlecase character. -.. cfunction:: int Py_UNICODE_ISLINEBREAK(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISLINEBREAK(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a linebreak character. -.. cfunction:: int Py_UNICODE_ISDECIMAL(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISDECIMAL(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a decimal character. -.. cfunction:: int Py_UNICODE_ISDIGIT(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISDIGIT(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a digit character. -.. cfunction:: int Py_UNICODE_ISNUMERIC(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISNUMERIC(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is a numeric character. -.. cfunction:: int Py_UNICODE_ISALPHA(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISALPHA(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is an alphabetic character. -.. cfunction:: int Py_UNICODE_ISALNUM(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_ISALNUM(Py_UNICODE ch) Return 1 or 0 depending on whether *ch* is an alphanumeric character. These APIs can be used for fast direct character conversions: -.. cfunction:: Py_UNICODE Py_UNICODE_TOLOWER(Py_UNICODE ch) +.. c:function:: Py_UNICODE Py_UNICODE_TOLOWER(Py_UNICODE ch) Return the character *ch* converted to lower case. -.. cfunction:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch) +.. c:function:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch) Return the character *ch* converted to upper case. -.. cfunction:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch) +.. c:function:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch) Return the character *ch* converted to title case. -.. cfunction:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch) Return the character *ch* converted to a decimal positive integer. Return ``-1`` if this is not possible. This macro does not raise exceptions. -.. cfunction:: int Py_UNICODE_TODIGIT(Py_UNICODE ch) +.. c:function:: int Py_UNICODE_TODIGIT(Py_UNICODE ch) Return the character *ch* converted to a single digit integer. Return ``-1`` if this is not possible. This macro does not raise exceptions. -.. cfunction:: double Py_UNICODE_TONUMERIC(Py_UNICODE ch) +.. c:function:: double Py_UNICODE_TONUMERIC(Py_UNICODE ch) Return the character *ch* converted to a double. Return ``-1.0`` if this is not possible. This macro does not raise exceptions. @@ -206,7 +206,7 @@ APIs: -.. cfunction:: PyObject* PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size) +.. c:function:: PyObject* PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size) Create a Unicode object from the Py_UNICODE buffer *u* of the given size. *u* may be *NULL* which causes the contents to be undefined. It is the user's @@ -216,11 +216,11 @@ is *NULL*. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size) +.. c:function:: PyObject* PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size) Create a Unicode object from the char buffer *u*. The bytes will be interpreted as being UTF-8 encoded. *u* may also be *NULL* which @@ -232,7 +232,7 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject *PyUnicode_FromString(const char *u) +.. c:function:: PyObject *PyUnicode_FromString(const char *u) Create a Unicode object from an UTF-8 encoded null-terminated char buffer *u*. @@ -240,9 +240,9 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyUnicode_FromFormat(const char *format, ...) +.. c:function:: PyObject* PyUnicode_FromFormat(const char *format, ...) - Take a C :cfunc:`printf`\ -style *format* string and a variable number of + Take a C :c:func:`printf`\ -style *format* string and a variable number of arguments, calculate the size of the resulting Python unicode string and return a string with the values formatted into it. The variable arguments must be C types and must correspond exactly to the format characters in the *format* @@ -317,7 +317,7 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs) +.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs) Identical to :func:`PyUnicode_FromFormat` except that it takes exactly two arguments. @@ -325,25 +325,25 @@ .. versionadded:: 2.6 -.. cfunction:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode) +.. c:function:: Py_UNICODE* PyUnicode_AsUnicode(PyObject *unicode) Return a read-only pointer to the Unicode object's internal - :ctype:`Py_UNICODE` buffer, *NULL* if *unicode* is not a Unicode object. - Note that the resulting :ctype:`Py_UNICODE*` string may contain embedded + :c:type:`Py_UNICODE` buffer, *NULL* if *unicode* is not a Unicode object. + Note that the resulting :c:type:`Py_UNICODE*` string may contain embedded null characters, which would cause the string to be truncated when used in most C functions. -.. cfunction:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode) +.. c:function:: Py_ssize_t PyUnicode_GetSize(PyObject *unicode) Return the length of the Unicode object. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type. This might require changes + This function returned an :c:type:`int` type. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors) +.. c:function:: PyObject* PyUnicode_FromEncodedObject(PyObject *obj, const char *encoding, const char *errors) Coerce an encoded object *obj* to an Unicode object and return a reference with incremented refcount. @@ -360,46 +360,46 @@ decref'ing the returned objects. -.. cfunction:: PyObject* PyUnicode_FromObject(PyObject *obj) +.. c:function:: PyObject* PyUnicode_FromObject(PyObject *obj) Shortcut for ``PyUnicode_FromEncodedObject(obj, NULL, "strict")`` which is used throughout the interpreter whenever coercion to Unicode is needed. -If the platform supports :ctype:`wchar_t` and provides a header file wchar.h, +If the platform supports :c:type:`wchar_t` and provides a header file wchar.h, Python can interface directly to this type using the following functions. -Support is optimized if Python's own :ctype:`Py_UNICODE` type is identical to -the system's :ctype:`wchar_t`. +Support is optimized if Python's own :c:type:`Py_UNICODE` type is identical to +the system's :c:type:`wchar_t`. wchar_t Support """"""""""""""" -:ctype:`wchar_t` support for platforms which support it: +:c:type:`wchar_t` support for platforms which support it: -.. cfunction:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size) +.. c:function:: PyObject* PyUnicode_FromWideChar(const wchar_t *w, Py_ssize_t size) - Create a Unicode object from the :ctype:`wchar_t` buffer *w* of the given *size*. + Create a Unicode object from the :c:type:`wchar_t` buffer *w* of the given *size*. Return *NULL* on failure. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, wchar_t *w, Py_ssize_t size) +.. c:function:: Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, wchar_t *w, Py_ssize_t size) - Copy the Unicode object contents into the :ctype:`wchar_t` buffer *w*. At most - *size* :ctype:`wchar_t` characters are copied (excluding a possibly trailing - 0-termination character). Return the number of :ctype:`wchar_t` characters - copied or -1 in case of an error. Note that the resulting :ctype:`wchar_t` + Copy the Unicode object contents into the :c:type:`wchar_t` buffer *w*. At most + *size* :c:type:`wchar_t` characters are copied (excluding a possibly trailing + 0-termination character). Return the number of :c:type:`wchar_t` characters + copied or -1 in case of an error. Note that the resulting :c:type:`wchar_t` string may or may not be 0-terminated. It is the responsibility of the caller - to make sure that the :ctype:`wchar_t` string is 0-terminated in case this is - required by the application. Also, note that the :ctype:`wchar_t*` string + to make sure that the :c:type:`wchar_t` string is 0-terminated in case this is + required by the application. Also, note that the :c:type:`wchar_t*` string might contain null characters, which would cause the string to be truncated when used with most C functions. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type and used an :ctype:`int` + This function returned an :c:type:`int` type and used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. @@ -417,7 +417,7 @@ object constructor. Setting encoding to *NULL* causes the default encoding to be used which is -ASCII. The file system calls should use :cdata:`Py_FileSystemDefaultEncoding` +ASCII. The file system calls should use :c:data:`Py_FileSystemDefaultEncoding` as the encoding for file names. This variable should be treated as read-only: on some systems, it will be a pointer to a static string, on others, it will change at run-time (such as when the application invokes setlocale). @@ -436,7 +436,7 @@ These are the generic codec APIs: -.. cfunction:: PyObject* PyUnicode_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) +.. c:function:: PyObject* PyUnicode_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) Create a Unicode object by decoding *size* bytes of the encoded string *s*. *encoding* and *errors* have the same meaning as the parameters of the same name @@ -445,24 +445,24 @@ the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, const char *encoding, const char *errors) +.. c:function:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, const char *encoding, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer *s* of the given *size* and return a Python + Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* and return a Python string object. *encoding* and *errors* have the same meaning as the parameters of the same name in the Unicode :meth:`encode` method. The codec to be used is looked up using the Python codec registry. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, const char *encoding, const char *errors) +.. c:function:: PyObject* PyUnicode_AsEncodedString(PyObject *unicode, const char *encoding, const char *errors) Encode a Unicode object and return the result as Python string object. *encoding* and *errors* have the same meaning as the parameters of the same name @@ -477,19 +477,19 @@ These are the UTF-8 codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeUTF8(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeUTF8(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string *s*. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed) +.. c:function:: PyObject* PyUnicode_DecodeUTF8Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed) - If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF8`. If + If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF8`. If *consumed* is not *NULL*, trailing incomplete UTF-8 byte sequences will not be treated as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. @@ -497,21 +497,21 @@ .. versionadded:: 2.4 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and return a + Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsUTF8String(PyObject *unicode) Encode a Unicode object using UTF-8 and return the result as Python string object. Error handling is "strict". Return *NULL* if an exception was raised @@ -524,7 +524,7 @@ These are the UTF-32 codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeUTF32(const char *s, Py_ssize_t size, const char *errors, int *byteorder) +.. c:function:: PyObject* PyUnicode_DecodeUTF32(const char *s, Py_ssize_t size, const char *errors, int *byteorder) Decode *size* bytes from a UTF-32 encoded buffer string and return the corresponding Unicode object. *errors* (if non-*NULL*) defines the error @@ -554,10 +554,10 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyUnicode_DecodeUTF32Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed) +.. c:function:: PyObject* PyUnicode_DecodeUTF32Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed) - If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF32`. If - *consumed* is not *NULL*, :cfunc:`PyUnicode_DecodeUTF32Stateful` will not treat + If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF32`. If + *consumed* is not *NULL*, :c:func:`PyUnicode_DecodeUTF32Stateful` will not treat trailing incomplete UTF-32 byte sequences (such as a number of bytes not divisible by four) as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. @@ -565,7 +565,7 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder) +.. c:function:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder) Return a Python bytes object holding the UTF-32 encoded value of the Unicode data in *s*. Output is written according to the following byte order:: @@ -585,7 +585,7 @@ .. versionadded:: 2.6 -.. cfunction:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsUTF32String(PyObject *unicode) Return a Python string using the UTF-32 encoding in native byte order. The string always starts with a BOM mark. Error handling is "strict". Return @@ -600,7 +600,7 @@ These are the UTF-16 codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors, int *byteorder) +.. c:function:: PyObject* PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors, int *byteorder) Decode *size* bytes from a UTF-16 encoded buffer string and return the corresponding Unicode object. *errors* (if non-*NULL*) defines the error @@ -627,14 +627,14 @@ Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_DecodeUTF16Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed) +.. c:function:: PyObject* PyUnicode_DecodeUTF16Stateful(const char *s, Py_ssize_t size, const char *errors, int *byteorder, Py_ssize_t *consumed) - If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF16`. If - *consumed* is not *NULL*, :cfunc:`PyUnicode_DecodeUTF16Stateful` will not treat + If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF16`. If + *consumed* is not *NULL*, :c:func:`PyUnicode_DecodeUTF16Stateful` will not treat trailing incomplete UTF-16 byte sequences (such as an odd number of bytes or a split surrogate pair) as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. @@ -642,12 +642,12 @@ .. versionadded:: 2.4 .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size* and an :ctype:`int *` + This function used an :c:type:`int` type for *size* and an :c:type:`int *` type for *consumed*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder) +.. c:function:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, const char *errors, int byteorder) Return a Python string object holding the UTF-16 encoded value of the Unicode data in *s*. Output is written according to the following byte order:: @@ -659,18 +659,18 @@ If byteorder is ``0``, the output string will always start with the Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is prepended. - If *Py_UNICODE_WIDE* is defined, a single :ctype:`Py_UNICODE` value may get - represented as a surrogate pair. If it is not defined, each :ctype:`Py_UNICODE` + If *Py_UNICODE_WIDE* is defined, a single :c:type:`Py_UNICODE` value may get + represented as a surrogate pair. If it is not defined, each :c:type:`Py_UNICODE` values is interpreted as an UCS-2 character. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsUTF16String(PyObject *unicode) Return a Python string using the UTF-16 encoding in native byte order. The string always starts with a BOM mark. Error handling is "strict". Return @@ -683,23 +683,23 @@ These are the UTF-7 codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeUTF7(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeUTF7(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string *s*. Return *NULL* if an exception was raised by the codec. -.. cfunction:: PyObject* PyUnicode_DecodeUTF7Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed) +.. c:function:: PyObject* PyUnicode_DecodeUTF7Stateful(const char *s, Py_ssize_t size, const char *errors, Py_ssize_t *consumed) - If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeUTF7`. If + If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF7`. If *consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not be treated as an error. Those bytes will not be decoded and the number of bytes that have been decoded will be stored in *consumed*. -.. cfunction:: PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE *s, Py_ssize_t size, int base64SetO, int base64WhiteSpace, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE *s, Py_ssize_t size, int base64SetO, int base64WhiteSpace, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer of the given size using UTF-7 and + Encode the :c:type:`Py_UNICODE` buffer of the given size using UTF-7 and return a Python bytes object. Return *NULL* if an exception was raised by the codec. @@ -715,28 +715,28 @@ These are the "Unicode Escape" codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeUnicodeEscape(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeUnicodeEscape(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the Unicode-Escape encoded string *s*. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size) +.. c:function:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size) - Encode the :ctype:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsUnicodeEscapeString(PyObject *unicode) Encode a Unicode object using Unicode-Escape and return the result as Python string object. Error handling is "strict". Return *NULL* if an exception was @@ -749,28 +749,28 @@ These are the "Raw Unicode Escape" codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeRawUnicodeEscape(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeRawUnicodeEscape(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape encoded string *s*. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-Escape + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-Escape and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode) Encode a Unicode object using Raw-Unicode-Escape and return the result as Python string object. Error handling is "strict". Return *NULL* if an exception @@ -784,27 +784,27 @@ ordinals and only these are accepted by the codecs during encoding. -.. cfunction:: PyObject* PyUnicode_DecodeLatin1(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeLatin1(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the Latin-1 encoded string *s*. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer of the given *size* using Latin-1 and return + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Latin-1 and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsLatin1String(PyObject *unicode) Encode a Unicode object using Latin-1 and return the result as Python string object. Error handling is "strict". Return *NULL* if an exception was raised @@ -818,27 +818,27 @@ codes generate errors. -.. cfunction:: PyObject* PyUnicode_DecodeASCII(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeASCII(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the ASCII encoded string *s*. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer of the given *size* using ASCII and return a + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using ASCII and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsASCIIString(PyObject *unicode) Encode a Unicode object using ASCII and return the result as Python string object. Error handling is "strict". Return *NULL* if an exception was raised @@ -871,7 +871,7 @@ These are the mapping codec APIs: -.. cfunction:: PyObject* PyUnicode_DecodeCharmap(const char *s, Py_ssize_t size, PyObject *mapping, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeCharmap(const char *s, Py_ssize_t size, PyObject *mapping, const char *errors) Create a Unicode object by decoding *size* bytes of the encoded string *s* using the given *mapping* object. Return *NULL* if an exception was raised by the @@ -884,22 +884,22 @@ Allowed unicode string as mapping argument. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *mapping, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *mapping, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer of the given *size* using the given + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given *mapping* object and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping) +.. c:function:: PyObject* PyUnicode_AsCharmapString(PyObject *unicode, PyObject *mapping) Encode a Unicode object using the given *mapping* object and return the result as Python string object. Error handling is "strict". Return *NULL* if an @@ -908,9 +908,9 @@ The following codec API is special in that maps Unicode to Unicode. -.. cfunction:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *table, const char *errors) +.. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, PyObject *table, const char *errors) - Translate a :ctype:`Py_UNICODE` buffer of the given *size* by applying a + Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a character mapping *table* to it and return the resulting Unicode object. Return *NULL* when an exception was raised by the codec. @@ -922,7 +922,7 @@ :exc:`LookupError`) are left untouched and are copied as-is. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. @@ -935,37 +935,37 @@ the user settings on the machine running the codec. -.. cfunction:: PyObject* PyUnicode_DecodeMBCS(const char *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_DecodeMBCS(const char *s, Py_ssize_t size, const char *errors) Create a Unicode object by decoding *size* bytes of the MBCS encoded string *s*. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_DecodeMBCSStateful(const char *s, int size, const char *errors, int *consumed) +.. c:function:: PyObject* PyUnicode_DecodeMBCSStateful(const char *s, int size, const char *errors, int *consumed) - If *consumed* is *NULL*, behave like :cfunc:`PyUnicode_DecodeMBCS`. If - *consumed* is not *NULL*, :cfunc:`PyUnicode_DecodeMBCSStateful` will not decode + If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeMBCS`. If + *consumed* is not *NULL*, :c:func:`PyUnicode_DecodeMBCSStateful` will not decode trailing lead byte and the number of bytes that have been decoded will be stored in *consumed*. .. versionadded:: 2.5 -.. cfunction:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors) +.. c:function:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :ctype:`Py_UNICODE` buffer of the given *size* using MBCS and return a + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using MBCS and return a Python string object. Return *NULL* if an exception was raised by the codec. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *size*. This might require + This function used an :c:type:`int` type for *size*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode) +.. c:function:: PyObject* PyUnicode_AsMBCSString(PyObject *unicode) Encode a Unicode object using MBCS and return the result as Python string object. Error handling is "strict". Return *NULL* if an exception was raised @@ -987,12 +987,12 @@ They all return *NULL* or ``-1`` if an exception occurs. -.. cfunction:: PyObject* PyUnicode_Concat(PyObject *left, PyObject *right) +.. c:function:: PyObject* PyUnicode_Concat(PyObject *left, PyObject *right) Concat two strings giving a new Unicode string. -.. cfunction:: PyObject* PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit) +.. c:function:: PyObject* PyUnicode_Split(PyObject *s, PyObject *sep, Py_ssize_t maxsplit) Split a string giving a list of Unicode strings. If *sep* is *NULL*, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given @@ -1000,18 +1000,18 @@ set. Separators are not included in the resulting list. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *maxsplit*. This might require + This function used an :c:type:`int` type for *maxsplit*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_Splitlines(PyObject *s, int keepend) +.. c:function:: PyObject* PyUnicode_Splitlines(PyObject *s, int keepend) Split a Unicode string at line breaks, returning a list of Unicode strings. CRLF is considered to be one line break. If *keepend* is 0, the Line break characters are not included in the resulting strings. -.. cfunction:: PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors) +.. c:function:: PyObject* PyUnicode_Translate(PyObject *str, PyObject *table, const char *errors) Translate a string by applying a character mapping table to it and return the resulting Unicode object. @@ -1027,25 +1027,25 @@ use the default error handling. -.. cfunction:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq) +.. c:function:: PyObject* PyUnicode_Join(PyObject *separator, PyObject *seq) Join a sequence of strings using the given *separator* and return the resulting Unicode string. -.. cfunction:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) +.. c:function:: int PyUnicode_Tailmatch(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) Return 1 if *substr* matches ``str[start:end]`` at the given tail end (*direction* == -1 means to do a prefix match, *direction* == 1 a suffix match), 0 otherwise. Return ``-1`` if an error occurred. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *start* and *end*. This + This function used an :c:type:`int` type for *start* and *end*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyUnicode_Find(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) +.. c:function:: Py_ssize_t PyUnicode_Find(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end, int direction) Return the first position of *substr* in ``str[start:end]`` using the given *direction* (*direction* == 1 means to do a forward search, *direction* == -1 a @@ -1054,40 +1054,40 @@ occurred and an exception has been set. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *start* and *end*. This + This function used an :c:type:`int` type for *start* and *end*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end) +.. c:function:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, Py_ssize_t start, Py_ssize_t end) Return the number of non-overlapping occurrences of *substr* in ``str[start:end]``. Return ``-1`` if an error occurred. .. versionchanged:: 2.5 - This function returned an :ctype:`int` type and used an :ctype:`int` + This function returned an :c:type:`int` type and used an :c:type:`int` type for *start* and *end*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: PyObject* PyUnicode_Replace(PyObject *str, PyObject *substr, PyObject *replstr, Py_ssize_t maxcount) +.. c:function:: PyObject* PyUnicode_Replace(PyObject *str, PyObject *substr, PyObject *replstr, Py_ssize_t maxcount) Replace at most *maxcount* occurrences of *substr* in *str* with *replstr* and return the resulting Unicode object. *maxcount* == -1 means replace all occurrences. .. versionchanged:: 2.5 - This function used an :ctype:`int` type for *maxcount*. This might + This function used an :c:type:`int` type for *maxcount*. This might require changes in your code for properly supporting 64-bit systems. -.. cfunction:: int PyUnicode_Compare(PyObject *left, PyObject *right) +.. c:function:: int PyUnicode_Compare(PyObject *left, PyObject *right) Compare two strings and return -1, 0, 1 for less than, equal, and greater than, respectively. -.. cfunction:: int PyUnicode_RichCompare(PyObject *left, PyObject *right, int op) +.. c:function:: int PyUnicode_RichCompare(PyObject *left, PyObject *right, int op) Rich compare two unicode strings and return one of the following: @@ -1103,13 +1103,13 @@ :const:`Py_NE`, :const:`Py_LT`, and :const:`Py_LE`. -.. cfunction:: PyObject* PyUnicode_Format(PyObject *format, PyObject *args) +.. c:function:: PyObject* PyUnicode_Format(PyObject *format, PyObject *args) Return a new string object from *format* and *args*; this is analogous to ``format % args``. The *args* argument must be a tuple. -.. cfunction:: int PyUnicode_Contains(PyObject *container, PyObject *element) +.. c:function:: int PyUnicode_Contains(PyObject *container, PyObject *element) Check whether *element* is contained in *container* and return true or false accordingly. diff --git a/Doc/c-api/veryhigh.rst b/Doc/c-api/veryhigh.rst --- a/Doc/c-api/veryhigh.rst +++ b/Doc/c-api/veryhigh.rst @@ -16,20 +16,20 @@ :const:`Py_file_input`, and :const:`Py_single_input`. These are described following the functions which accept them as parameters. -Note also that several of these functions take :ctype:`FILE\*` parameters. One -particular issue which needs to be handled carefully is that the :ctype:`FILE` +Note also that several of these functions take :c:type:`FILE\*` parameters. One +particular issue which needs to be handled carefully is that the :c:type:`FILE` structure for different C libraries can be different and incompatible. Under Windows (at least), it is possible for dynamically linked extensions to actually -use different libraries, so care should be taken that :ctype:`FILE\*` parameters +use different libraries, so care should be taken that :c:type:`FILE\*` parameters are only passed to these functions if it is certain that they were created by the same library that the Python runtime is using. -.. cfunction:: int Py_Main(int argc, char **argv) +.. c:function:: int Py_Main(int argc, char **argv) The main program for the standard interpreter. This is made available for programs which embed Python. The *argc* and *argv* parameters should be - prepared exactly as those which are passed to a C program's :cfunc:`main` + prepared exactly as those which are passed to a C program's :c:func:`main` function. 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 ``0`` if the interpreter exits normally (ie, without an @@ -41,40 +41,40 @@ ``Py_InspectFlag`` is not set. -.. cfunction:: int PyRun_AnyFile(FILE *fp, const char *filename) +.. c:function:: int PyRun_AnyFile(FILE *fp, const char *filename) - This is a simplified interface to :cfunc:`PyRun_AnyFileExFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving *closeit* set to ``0`` and *flags* set to *NULL*. -.. cfunction:: int PyRun_AnyFileFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) +.. c:function:: int PyRun_AnyFileFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) - This is a simplified interface to :cfunc:`PyRun_AnyFileExFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving the *closeit* argument set to ``0``. -.. cfunction:: int PyRun_AnyFileEx(FILE *fp, const char *filename, int closeit) +.. c:function:: int PyRun_AnyFileEx(FILE *fp, const char *filename, int closeit) - This is a simplified interface to :cfunc:`PyRun_AnyFileExFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, leaving the *flags* argument set to *NULL*. -.. cfunction:: int PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags) +.. c:function:: int PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags) If *fp* refers to a file associated with an interactive device (console or terminal input or Unix pseudo-terminal), return the value of - :cfunc:`PyRun_InteractiveLoop`, otherwise return the result of - :cfunc:`PyRun_SimpleFile`. If *filename* is *NULL*, this function uses + :c:func:`PyRun_InteractiveLoop`, otherwise return the result of + :c:func:`PyRun_SimpleFile`. If *filename* is *NULL*, this function uses ``"???"`` as the filename. -.. cfunction:: int PyRun_SimpleString(const char *command) +.. c:function:: int PyRun_SimpleString(const char *command) - This is a simplified interface to :cfunc:`PyRun_SimpleStringFlags` below, + This is a simplified interface to :c:func:`PyRun_SimpleStringFlags` below, leaving the *PyCompilerFlags\** argument set to NULL. -.. cfunction:: int PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags) +.. c:function:: int PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags) Executes the Python source code from *command* in the :mod:`__main__` module according to the *flags* argument. If :mod:`__main__` does not already exist, it @@ -87,39 +87,39 @@ ``Py_InspectFlag`` is not set. -.. cfunction:: int PyRun_SimpleFile(FILE *fp, const char *filename) +.. c:function:: int PyRun_SimpleFile(FILE *fp, const char *filename) - This is a simplified interface to :cfunc:`PyRun_SimpleFileExFlags` below, + This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, leaving *closeit* set to ``0`` and *flags* set to *NULL*. -.. cfunction:: int PyRun_SimpleFileFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) +.. c:function:: int PyRun_SimpleFileFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) - This is a simplified interface to :cfunc:`PyRun_SimpleFileExFlags` below, + This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, leaving *closeit* set to ``0``. -.. cfunction:: int PyRun_SimpleFileEx(FILE *fp, const char *filename, int closeit) +.. c:function:: int PyRun_SimpleFileEx(FILE *fp, const char *filename, int closeit) - This is a simplified interface to :cfunc:`PyRun_SimpleFileExFlags` below, + This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, leaving *flags* set to *NULL*. -.. cfunction:: int PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags) +.. c:function:: int PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, PyCompilerFlags *flags) - Similar to :cfunc:`PyRun_SimpleStringFlags`, but the Python source code is read + Similar to :c:func:`PyRun_SimpleStringFlags`, but the Python source code is read from *fp* instead of an in-memory string. *filename* should be the name of the file. If *closeit* is true, the file is closed before PyRun_SimpleFileExFlags returns. -.. cfunction:: int PyRun_InteractiveOne(FILE *fp, const char *filename) +.. c:function:: int PyRun_InteractiveOne(FILE *fp, const char *filename) - This is a simplified interface to :cfunc:`PyRun_InteractiveOneFlags` below, + This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below, leaving *flags* set to *NULL*. -.. cfunction:: int PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) +.. c:function:: int PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) Read and execute a single statement from a file associated with an interactive device according to the *flags* argument. The user will be @@ -130,34 +130,34 @@ :file:`Python.h`, so must be included specifically if needed.) -.. cfunction:: int PyRun_InteractiveLoop(FILE *fp, const char *filename) +.. c:function:: int PyRun_InteractiveLoop(FILE *fp, const char *filename) - This is a simplified interface to :cfunc:`PyRun_InteractiveLoopFlags` below, + This is a simplified interface to :c:func:`PyRun_InteractiveLoopFlags` below, leaving *flags* set to *NULL*. -.. cfunction:: int PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) +.. c:function:: int PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) Read and execute statements from a file associated with an interactive device until EOF is reached. The user will be prompted using ``sys.ps1`` and ``sys.ps2``. Returns ``0`` at EOF. -.. cfunction:: struct _node* PyParser_SimpleParseString(const char *str, int start) +.. c:function:: struct _node* PyParser_SimpleParseString(const char *str, int start) This is a simplified interface to - :cfunc:`PyParser_SimpleParseStringFlagsFilename` below, leaving *filename* set + :c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving *filename* set to *NULL* and *flags* set to ``0``. -.. cfunction:: struct _node* PyParser_SimpleParseStringFlags( const char *str, int start, int flags) +.. c:function:: struct _node* PyParser_SimpleParseStringFlags( const char *str, int start, int flags) This is a simplified interface to - :cfunc:`PyParser_SimpleParseStringFlagsFilename` below, leaving *filename* set + :c:func:`PyParser_SimpleParseStringFlagsFilename` below, leaving *filename* set to *NULL*. -.. cfunction:: struct _node* PyParser_SimpleParseStringFlagsFilename( const char *str, const char *filename, int start, int flags) +.. c:function:: struct _node* PyParser_SimpleParseStringFlagsFilename( const char *str, const char *filename, int start, int flags) Parse Python source code from *str* using the start token *start* according to the *flags* argument. The result can be used to create a code object which can @@ -165,25 +165,25 @@ many times. -.. cfunction:: struct _node* PyParser_SimpleParseFile(FILE *fp, const char *filename, int start) +.. c:function:: struct _node* PyParser_SimpleParseFile(FILE *fp, const char *filename, int start) - This is a simplified interface to :cfunc:`PyParser_SimpleParseFileFlags` below, + This is a simplified interface to :c:func:`PyParser_SimpleParseFileFlags` below, leaving *flags* set to ``0`` -.. cfunction:: struct _node* PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags) +.. c:function:: struct _node* PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags) - Similar to :cfunc:`PyParser_SimpleParseStringFlagsFilename`, but the Python + Similar to :c:func:`PyParser_SimpleParseStringFlagsFilename`, but the Python source code is read from *fp* instead of an in-memory string. -.. cfunction:: PyObject* PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals) +.. c:function:: PyObject* PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals) - This is a simplified interface to :cfunc:`PyRun_StringFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_StringFlags` below, leaving *flags* set to *NULL*. -.. cfunction:: PyObject* PyRun_StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) +.. c:function:: PyObject* PyRun_StringFlags(const char *str, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) Execute Python source code from *str* in the context specified by the dictionaries *globals* and *locals* with the compiler flags specified by @@ -194,39 +194,39 @@ exception was raised. -.. cfunction:: PyObject* PyRun_File(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals) +.. c:function:: PyObject* PyRun_File(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals) - This is a simplified interface to :cfunc:`PyRun_FileExFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving *closeit* set to ``0`` and *flags* set to *NULL*. -.. cfunction:: PyObject* PyRun_FileEx(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals, int closeit) +.. c:function:: PyObject* PyRun_FileEx(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals, int closeit) - This is a simplified interface to :cfunc:`PyRun_FileExFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving *flags* set to *NULL*. -.. cfunction:: PyObject* PyRun_FileFlags(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) +.. c:function:: PyObject* PyRun_FileFlags(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals, PyCompilerFlags *flags) - This is a simplified interface to :cfunc:`PyRun_FileExFlags` below, leaving + This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving *closeit* set to ``0``. -.. cfunction:: PyObject* PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals, int closeit, PyCompilerFlags *flags) +.. c:function:: PyObject* PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals, PyObject *locals, int closeit, PyCompilerFlags *flags) - Similar to :cfunc:`PyRun_StringFlags`, but the Python source code is read from + Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read from *fp* instead of an in-memory string. *filename* should be the name of the file. - If *closeit* is true, the file is closed before :cfunc:`PyRun_FileExFlags` + If *closeit* is true, the file is closed before :c:func:`PyRun_FileExFlags` returns. -.. cfunction:: PyObject* Py_CompileString(const char *str, const char *filename, int start) +.. c:function:: PyObject* Py_CompileString(const char *str, const char *filename, int start) - This is a simplified interface to :cfunc:`Py_CompileStringFlags` below, leaving + This is a simplified interface to :c:func:`Py_CompileStringFlags` below, leaving *flags* set to *NULL*. -.. cfunction:: PyObject* Py_CompileStringFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags) +.. c:function:: PyObject* Py_CompileStringFlags(const char *str, const char *filename, int start, PyCompilerFlags *flags) Parse and compile the Python source code in *str*, returning the resulting code object. The start token is given by *start*; this can be used to constrain the @@ -237,14 +237,14 @@ be parsed or compiled. -.. cfunction:: PyObject* PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) +.. c:function:: PyObject* PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) - This is a simplified interface to :cfunc:`PyEval_EvalCodeEx`, with just + This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the code object, and the dictionaries of global and local variables. The other arguments are set to *NULL*. -.. cfunction:: PyObject* PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure) +.. c:function:: PyObject* PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure) Evaluate a precompiled code object, given a particular environment for its evaluation. This environment consists of dictionaries of global and local @@ -252,13 +252,13 @@ cells. -.. cfunction:: PyObject* PyEval_EvalFrame(PyFrameObject *f) +.. c:function:: PyObject* PyEval_EvalFrame(PyFrameObject *f) Evaluate an execution frame. This is a simplified interface to PyEval_EvalFrameEx, for backward compatibility. -.. cfunction:: PyObject* PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) +.. c:function:: PyObject* PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) This is the main, unvarnished function of Python interpretation. It is literally 2000 lines long. The code object associated with the execution @@ -268,39 +268,39 @@ :meth:`throw` methods of generator objects. -.. cfunction:: int PyEval_MergeCompilerFlags(PyCompilerFlags *cf) +.. c:function:: int PyEval_MergeCompilerFlags(PyCompilerFlags *cf) This function changes the flags of the current evaluation frame, and returns true on success, false on failure. -.. cvar:: int Py_eval_input +.. c:var:: int Py_eval_input .. index:: single: Py_CompileString() The start symbol from the Python grammar for isolated expressions; for use with - :cfunc:`Py_CompileString`. + :c:func:`Py_CompileString`. -.. cvar:: int Py_file_input +.. c:var:: int Py_file_input .. index:: single: Py_CompileString() The start symbol from the Python grammar for sequences of statements as read - from a file or other source; for use with :cfunc:`Py_CompileString`. This is + from a file or other source; for use with :c:func:`Py_CompileString`. This is the symbol to use when compiling arbitrarily long Python source code. -.. cvar:: int Py_single_input +.. c:var:: int Py_single_input .. index:: single: Py_CompileString() The start symbol from the Python grammar for a single statement; for use with - :cfunc:`Py_CompileString`. This is the symbol used for the interactive + :c:func:`Py_CompileString`. This is the symbol used for the interactive interpreter loop. -.. ctype:: struct PyCompilerFlags +.. c:type:: struct PyCompilerFlags This is the structure used to hold compiler flags. In cases where code is only being compiled, it is passed as ``int flags``, and in cases where code is being @@ -316,7 +316,7 @@ } -.. cvar:: int CO_FUTURE_DIVISION +.. c:var:: int CO_FUTURE_DIVISION This bit can be set in *flags* to cause division operator ``/`` to be interpreted as "true division" according to :pep:`238`. diff --git a/Doc/c-api/weakref.rst b/Doc/c-api/weakref.rst --- a/Doc/c-api/weakref.rst +++ b/Doc/c-api/weakref.rst @@ -11,28 +11,28 @@ as much as it can. -.. cfunction:: int PyWeakref_Check(ob) +.. c:function:: int PyWeakref_Check(ob) Return true if *ob* is either a reference or proxy object. .. versionadded:: 2.2 -.. cfunction:: int PyWeakref_CheckRef(ob) +.. c:function:: int PyWeakref_CheckRef(ob) Return true if *ob* is a reference object. .. versionadded:: 2.2 -.. cfunction:: int PyWeakref_CheckProxy(ob) +.. c:function:: int PyWeakref_CheckProxy(ob) Return true if *ob* is a proxy object. .. versionadded:: 2.2 -.. cfunction:: PyObject* PyWeakref_NewRef(PyObject *ob, PyObject *callback) +.. c:function:: PyObject* PyWeakref_NewRef(PyObject *ob, PyObject *callback) Return a weak reference object for the object *ob*. This will always return a new reference, but is not guaranteed to create a new object; an existing @@ -46,7 +46,7 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyWeakref_NewProxy(PyObject *ob, PyObject *callback) +.. c:function:: PyObject* PyWeakref_NewProxy(PyObject *ob, PyObject *callback) Return a weak reference proxy object for the object *ob*. This will always return a new reference, but is not guaranteed to create a new object; an @@ -60,7 +60,7 @@ .. versionadded:: 2.2 -.. cfunction:: PyObject* PyWeakref_GetObject(PyObject *ref) +.. c:function:: PyObject* PyWeakref_GetObject(PyObject *ref) Return the referenced object from a weak reference, *ref*. If the referent is no longer live, returns :const:`Py_None`. @@ -70,14 +70,14 @@ .. warning:: This function returns a **borrowed reference** to the referenced object. - This means that you should always call :cfunc:`Py_INCREF` on the object + This means that you should always call :c:func:`Py_INCREF` on the object except if you know that it cannot be destroyed while you are still using it. -.. cfunction:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref) +.. c:function:: PyObject* PyWeakref_GET_OBJECT(PyObject *ref) - Similar to :cfunc:`PyWeakref_GetObject`, but implemented as a macro that does no + Similar to :c:func:`PyWeakref_GetObject`, but implemented as a macro that does no error checking. .. versionadded:: 2.2 diff --git a/Doc/distutils/builtdist.rst b/Doc/distutils/builtdist.rst --- a/Doc/distutils/builtdist.rst +++ b/Doc/distutils/builtdist.rst @@ -426,7 +426,7 @@ Which folders are available depends on the exact Windows version, and probably also the configuration. For details refer to Microsoft's documentation of the - :cfunc:`SHGetSpecialFolderPath` function. + :c:func:`SHGetSpecialFolderPath` function. .. function:: create_shortcut(target, description, filename[, arguments[, workdir[, iconpath[, iconindex]]]]) diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst --- a/Doc/documenting/markup.rst +++ b/Doc/documenting/markup.rst @@ -112,7 +112,7 @@ Describes a C function. The signature should be given as in C, e.g.:: - .. cfunction:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) + .. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) This is also used to describe function-like preprocessor macros. The names of the arguments should be given so they may be used in the description. @@ -124,7 +124,7 @@ Describes a C struct member. Example signature:: - .. cmember:: PyObject* PyTypeObject.tp_bases + .. c:member:: PyObject* PyTypeObject.tp_bases The text of the description should include the range of values allowed, how the value should be interpreted, and whether the value can be changed. @@ -135,8 +135,8 @@ Describes a "simple" C macro. Simple macros are macros which are used for code expansion, but which do not take arguments so cannot be described as functions. This is not to be used for simple constant definitions. Examples - of its use in the Python documentation include :cmacro:`PyObject_HEAD` and - :cmacro:`Py_BEGIN_ALLOW_THREADS`. + of its use in the Python documentation include :c:macro:`PyObject_HEAD` and + :c:macro:`Py_BEGIN_ALLOW_THREADS`. .. describe:: ctype @@ -147,7 +147,7 @@ Describes a global C variable. The signature should include the type, such as:: - .. cvar:: PyObject* PyClass_Type + .. c:var:: PyObject* PyClass_Type .. describe:: data diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst --- a/Doc/extending/embedding.rst +++ b/Doc/extending/embedding.rst @@ -25,14 +25,14 @@ So if you are embedding Python, you are providing your own main program. One of the things this main program has to do is initialize the Python interpreter. At -the very least, you have to call the function :cfunc:`Py_Initialize`. There are +the very least, you have to call the function :c:func:`Py_Initialize`. There are optional calls to pass command line arguments to Python. Then later you can call the interpreter from any part of the application. There are several different ways to call the interpreter: you can pass a string -containing Python statements to :cfunc:`PyRun_SimpleString`, or you can pass a +containing Python statements to :c:func:`PyRun_SimpleString`, or you can pass a stdio file pointer and a file name (for identification in error messages only) -to :cfunc:`PyRun_SimpleFile`. You can also call the lower-level operations +to :c:func:`PyRun_SimpleFile`. You can also call the lower-level operations described in the previous chapters to construct and use Python objects. A simple demo of embedding Python can be found in the directory @@ -69,12 +69,12 @@ } The above code first initializes the Python interpreter with -:cfunc:`Py_Initialize`, followed by the execution of a hard-coded Python script -that print the date and time. Afterwards, the :cfunc:`Py_Finalize` call shuts +:c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script +that print the date and time. Afterwards, the :c:func:`Py_Finalize` call shuts the interpreter down, followed by the end of the program. In a real program, you may want to get the Python script from another source, perhaps a text-editor routine, a file, or a database. Getting the Python code from a file can better -be done by using the :cfunc:`PyRun_SimpleFile` function, which saves you the +be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the trouble of allocating memory space and loading the file contents. @@ -162,8 +162,8 @@ pModule = PyImport_Import(pName); After initializing the interpreter, the script is loaded using -:cfunc:`PyImport_Import`. This routine needs a Python string as its argument, -which is constructed using the :cfunc:`PyString_FromString` data conversion +:c:func:`PyImport_Import`. This routine needs a Python string as its argument, +which is constructed using the :c:func:`PyString_FromString` data conversion routine. :: pFunc = PyObject_GetAttrString(pModule, argv[2]); @@ -175,7 +175,7 @@ Py_XDECREF(pFunc); Once the script is loaded, the name we're looking for is retrieved using -:cfunc:`PyObject_GetAttrString`. If the name exists, and the object returned is +:c:func:`PyObject_GetAttrString`. If the name exists, and the object returned is callable, you can safely assume that it is a function. The program then proceeds by constructing a tuple of arguments as normal. The call to the Python function is then made with:: @@ -218,8 +218,8 @@ {NULL, NULL, 0, NULL} }; -Insert the above code just above the :cfunc:`main` function. Also, insert the -following two statements directly after :cfunc:`Py_Initialize`:: +Insert the above code just above the :c:func:`main` function. Also, insert the +following two statements directly after :c:func:`Py_Initialize`:: numargs = argc; Py_InitModule("emb", EmbMethods); diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -35,7 +35,7 @@ Let's create an extension module called ``spam`` (the favorite food of Monty Python fans...) and let's say we want to create a Python interface to the C -library function :cfunc:`system`. [#]_ This function takes a null-terminated +library function :c:func:`system`. [#]_ This function takes a null-terminated character string as argument and returns an integer. We want this function to be callable from Python as follows:: @@ -65,8 +65,8 @@ since they are used extensively by the Python interpreter, ``"Python.h"`` includes a few standard header files: ````, ````, ````, and ````. If the latter header file does not exist on -your system, it declares the functions :cfunc:`malloc`, :cfunc:`free` and -:cfunc:`realloc` directly. +your system, it declares the functions :c:func:`malloc`, :c:func:`free` and +:c:func:`realloc` directly. The next thing we add to our module file is the C function that will be called when the Python expression ``spam.system(string)`` is evaluated (we'll see @@ -96,12 +96,12 @@ arguments. Each item of the tuple corresponds to an argument in the call's argument list. The arguments are Python objects --- in order to do anything with them in our C function we have to convert them to C values. The function -:cfunc:`PyArg_ParseTuple` in the Python API checks the argument types and +:c:func:`PyArg_ParseTuple` in the Python API checks the argument types and converts them to C values. It uses a template string to determine the required types of the arguments as well as the types of the C variables into which to store the converted values. More about this later. -:cfunc:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the right +:c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the right type and its components have been stored in the variables whose addresses are passed. It returns false (zero) if an invalid argument list was passed. In the latter case it also raises an appropriate exception so the calling function can @@ -127,77 +127,77 @@ The Python API defines a number of functions to set various types of exceptions. -The most common one is :cfunc:`PyErr_SetString`. Its arguments are an exception +The most common one is :c:func:`PyErr_SetString`. Its arguments are an exception object and a C string. The exception object is usually a predefined object like -:cdata:`PyExc_ZeroDivisionError`. The C string indicates the cause of the error +:c:data:`PyExc_ZeroDivisionError`. The C string indicates the cause of the error and is converted to a Python string object and stored as the "associated value" of the exception. -Another useful function is :cfunc:`PyErr_SetFromErrno`, which only takes an +Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an exception argument and constructs the associated value by inspection of the -global variable :cdata:`errno`. The most general function is -:cfunc:`PyErr_SetObject`, which takes two object arguments, the exception and -its associated value. You don't need to :cfunc:`Py_INCREF` the objects passed +global variable :c:data:`errno`. The most general function is +:c:func:`PyErr_SetObject`, which takes two object arguments, the exception and +its associated value. You don't need to :c:func:`Py_INCREF` the objects passed to any of these functions. You can test non-destructively whether an exception has been set with -:cfunc:`PyErr_Occurred`. This returns the current exception object, or *NULL* +:c:func:`PyErr_Occurred`. This returns the current exception object, or *NULL* if no exception has occurred. You normally don't need to call -:cfunc:`PyErr_Occurred` to see whether an error occurred in a function call, +:c:func:`PyErr_Occurred` to see whether an error occurred in a function call, since you should be able to tell from the return value. When a function *f* that calls another function *g* detects that the latter fails, *f* should itself return an error value (usually *NULL* or ``-1``). It -should *not* call one of the :cfunc:`PyErr_\*` functions --- one has already +should *not* call one of the :c:func:`PyErr_\*` functions --- one has already been called by *g*. *f*'s caller is then supposed to also return an error -indication to *its* caller, again *without* calling :cfunc:`PyErr_\*`, and so on +indication to *its* caller, again *without* calling :c:func:`PyErr_\*`, and so on --- the most detailed cause of the error was already reported by the function that first detected it. Once the error reaches the Python interpreter's main loop, this aborts the currently executing Python code and tries to find an exception handler specified by the Python programmer. (There are situations where a module can actually give a more detailed error -message by calling another :cfunc:`PyErr_\*` function, and in such cases it is +message by calling another :c:func:`PyErr_\*` function, and in such cases it is fine to do so. As a general rule, however, this is not necessary, and can cause information about the cause of the error to be lost: most operations can fail for a variety of reasons.) To ignore an exception set by a function call that failed, the exception -condition must be cleared explicitly by calling :cfunc:`PyErr_Clear`. The only -time C code should call :cfunc:`PyErr_Clear` is if it doesn't want to pass the +condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The only +time C code should call :c:func:`PyErr_Clear` is if it doesn't want to pass the error on to the interpreter but wants to handle it completely by itself (possibly by trying something else, or pretending nothing went wrong). -Every failing :cfunc:`malloc` call must be turned into an exception --- the -direct caller of :cfunc:`malloc` (or :cfunc:`realloc`) must call -:cfunc:`PyErr_NoMemory` and return a failure indicator itself. All the -object-creating functions (for example, :cfunc:`PyInt_FromLong`) already do -this, so this note is only relevant to those who call :cfunc:`malloc` directly. +Every failing :c:func:`malloc` call must be turned into an exception --- the +direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call +:c:func:`PyErr_NoMemory` and return a failure indicator itself. All the +object-creating functions (for example, :c:func:`PyInt_FromLong`) already do +this, so this note is only relevant to those who call :c:func:`malloc` directly. -Also note that, with the important exception of :cfunc:`PyArg_ParseTuple` and +Also note that, with the important exception of :c:func:`PyArg_ParseTuple` and friends, functions that return an integer status usually return a positive value or zero for success and ``-1`` for failure, like Unix system calls. -Finally, be careful to clean up garbage (by making :cfunc:`Py_XDECREF` or -:cfunc:`Py_DECREF` calls for objects you have already created) when you return +Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or +:c:func:`Py_DECREF` calls for objects you have already created) when you return an error indicator! The choice of which exception to raise is entirely yours. There are predeclared C objects corresponding to all built-in Python exceptions, such as -:cdata:`PyExc_ZeroDivisionError`, which you can use directly. Of course, you -should choose exceptions wisely --- don't use :cdata:`PyExc_TypeError` to mean -that a file couldn't be opened (that should probably be :cdata:`PyExc_IOError`). -If something's wrong with the argument list, the :cfunc:`PyArg_ParseTuple` -function usually raises :cdata:`PyExc_TypeError`. If you have an argument whose +:c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, you +should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` to mean +that a file couldn't be opened (that should probably be :c:data:`PyExc_IOError`). +If something's wrong with the argument list, the :c:func:`PyArg_ParseTuple` +function usually raises :c:data:`PyExc_TypeError`. If you have an argument whose value must be in a particular range or must satisfy other conditions, -:cdata:`PyExc_ValueError` is appropriate. +:c:data:`PyExc_ValueError` is appropriate. You can also define a new exception that is unique to your module. For this, you usually declare a static object variable at the beginning of your file:: static PyObject *SpamError; -and initialize it in your module's initialization function (:cfunc:`initspam`) +and initialize it in your module's initialization function (:c:func:`initspam`) with an exception object (leaving out the error checking for now):: PyMODINIT_FUNC @@ -215,14 +215,14 @@ } Note that the Python name for the exception object is :exc:`spam.error`. The -:cfunc:`PyErr_NewException` function may create a class with the base class +:c:func:`PyErr_NewException` function may create a class with the base class being :exc:`Exception` (unless another class is passed in instead of *NULL*), described in :ref:`bltin-exceptions`. -Note also that the :cdata:`SpamError` variable retains a reference to the newly +Note also that the :c:data:`SpamError` variable retains a reference to the newly created exception class; this is intentional! Since the exception could be removed from the module by external code, an owned reference to the class is -needed to ensure that it will not be discarded, causing :cdata:`SpamError` to +needed to ensure that it will not be discarded, causing :c:data:`SpamError` to become a dangling pointer. Should it become a dangling pointer, C code which raises the exception could cause a core dump or other unintended side effects. @@ -230,7 +230,7 @@ sample. The :exc:`spam.error` exception can be raised in your extension module using a -call to :cfunc:`PyErr_SetString` as shown below:: +call to :c:func:`PyErr_SetString` as shown below:: static PyObject * spam_system(PyObject *self, PyObject *args) @@ -262,22 +262,22 @@ It returns *NULL* (the error indicator for functions returning object pointers) if an error is detected in the argument list, relying on the exception set by -:cfunc:`PyArg_ParseTuple`. Otherwise the string value of the argument has been -copied to the local variable :cdata:`command`. This is a pointer assignment and +:c:func:`PyArg_ParseTuple`. Otherwise the string value of the argument has been +copied to the local variable :c:data:`command`. This is a pointer assignment and you are not supposed to modify the string to which it points (so in Standard C, -the variable :cdata:`command` should properly be declared as ``const char +the variable :c:data:`command` should properly be declared as ``const char *command``). -The next statement is a call to the Unix function :cfunc:`system`, passing it -the string we just got from :cfunc:`PyArg_ParseTuple`:: +The next statement is a call to the Unix function :c:func:`system`, passing it +the string we just got from :c:func:`PyArg_ParseTuple`:: sts = system(command); -Our :func:`spam.system` function must return the value of :cdata:`sts` as a -Python object. This is done using the function :cfunc:`Py_BuildValue`, which is -something like the inverse of :cfunc:`PyArg_ParseTuple`: it takes a format +Our :func:`spam.system` function must return the value of :c:data:`sts` as a +Python object. This is done using the function :c:func:`Py_BuildValue`, which is +something like the inverse of :c:func:`PyArg_ParseTuple`: it takes a format string and an arbitrary number of C values, and returns a new Python object. -More info on :cfunc:`Py_BuildValue` is given later. :: +More info on :c:func:`Py_BuildValue` is given later. :: return Py_BuildValue("i", sts); @@ -285,14 +285,14 @@ on the heap in Python!) If you have a C function that returns no useful argument (a function returning -:ctype:`void`), the corresponding Python function must return ``None``. You -need this idiom to do so (which is implemented by the :cmacro:`Py_RETURN_NONE` +:c:type:`void`), the corresponding Python function must return ``None``. You +need this idiom to do so (which is implemented by the :c:macro:`Py_RETURN_NONE` macro):: Py_INCREF(Py_None); return Py_None; -:cdata:`Py_None` is the C name for the special Python object ``None``. It is a +:c:data:`Py_None` is the C name for the special Python object ``None``. It is a genuine Python object rather than a *NULL* pointer, which means "error" in most contexts, as we have seen. @@ -302,7 +302,7 @@ The Module's Method Table and Initialization Function ===================================================== -I promised to show how :cfunc:`spam_system` is called from Python programs. +I promised to show how :c:func:`spam_system` is called from Python programs. First, we need to list its name and address in a "method table":: static PyMethodDef SpamMethods[] = { @@ -316,21 +316,21 @@ Note the third entry (``METH_VARARGS``). This is a flag telling the interpreter the calling convention to be used for the C function. It should normally always be ``METH_VARARGS`` or ``METH_VARARGS | METH_KEYWORDS``; a value of ``0`` means -that an obsolete variant of :cfunc:`PyArg_ParseTuple` is used. +that an obsolete variant of :c:func:`PyArg_ParseTuple` is used. When using only ``METH_VARARGS``, the function should expect the Python-level parameters to be passed in as a tuple acceptable for parsing via -:cfunc:`PyArg_ParseTuple`; more information on this function is provided below. +:c:func:`PyArg_ParseTuple`; more information on this function is provided below. The :const:`METH_KEYWORDS` bit may be set in the third field if keyword arguments should be passed to the function. In this case, the C function should accept a third ``PyObject *`` parameter which will be a dictionary of keywords. -Use :cfunc:`PyArg_ParseTupleAndKeywords` to parse the arguments to such a +Use :c:func:`PyArg_ParseTupleAndKeywords` to parse the arguments to such a function. The method table must be passed to the interpreter in the module's initialization function. The initialization function must be named -:cfunc:`initname`, where *name* is the name of the module, and should be the +:c:func:`initname`, where *name* is the name of the module, and should be the only non-\ ``static`` item defined in the module file:: PyMODINIT_FUNC @@ -344,21 +344,21 @@ declares the function as ``extern "C"``. When the Python program imports module :mod:`spam` for the first time, -:cfunc:`initspam` is called. (See below for comments about embedding Python.) -It calls :cfunc:`Py_InitModule`, which creates a "module object" (which is +:c:func:`initspam` is called. (See below for comments about embedding Python.) +It calls :c:func:`Py_InitModule`, which creates a "module object" (which is inserted in the dictionary ``sys.modules`` under the key ``"spam"``), and inserts built-in function objects into the newly created module based upon the -table (an array of :ctype:`PyMethodDef` structures) that was passed as its -second argument. :cfunc:`Py_InitModule` returns a pointer to the module object +table (an array of :c:type:`PyMethodDef` structures) that was passed as its +second argument. :c:func:`Py_InitModule` returns a pointer to the module object that it creates (which is unused here). It may abort with a fatal error for certain errors, or return *NULL* if the module could not be initialized satisfactorily. -When embedding Python, the :cfunc:`initspam` function is not called -automatically unless there's an entry in the :cdata:`_PyImport_Inittab` table. +When embedding Python, the :c:func:`initspam` function is not called +automatically unless there's an entry in the :c:data:`_PyImport_Inittab` table. The easiest way to handle this is to statically initialize your -statically-linked modules by directly calling :cfunc:`initspam` after the call -to :cfunc:`Py_Initialize`:: +statically-linked modules by directly calling :c:func:`initspam` after the call +to :c:func:`Py_Initialize`:: int main(int argc, char *argv[]) @@ -378,12 +378,12 @@ .. note:: Removing entries from ``sys.modules`` or importing compiled modules into - multiple interpreters within a process (or following a :cfunc:`fork` without an - intervening :cfunc:`exec`) can create problems for some extension modules. + multiple interpreters within a process (or following a :c:func:`fork` without an + intervening :c:func:`exec`) can create problems for some extension modules. Extension module authors should exercise caution when initializing internal data structures. Note also that the :func:`reload` function can be used with extension modules, and will call the module initialization function - (:cfunc:`initspam` in the example), but will not load the module again if it was + (:c:func:`initspam` in the example), but will not load the module again if it was loaded from a dynamically loadable object file (:file:`.so` on Unix, :file:`.dll` on Windows). @@ -447,7 +447,7 @@ Calling a Python function is easy. First, the Python program must somehow pass you the Python function object. You should provide a function (or some other interface) to do this. When this function is called, save a pointer to the -Python function object (be careful to :cfunc:`Py_INCREF` it!) in a global +Python function object (be careful to :c:func:`Py_INCREF` it!) in a global variable --- or wherever you see fit. For example, the following function might be part of a module definition:: @@ -476,10 +476,10 @@ This function must be registered with the interpreter using the :const:`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The -:cfunc:`PyArg_ParseTuple` function and its arguments are documented in section +:c:func:`PyArg_ParseTuple` function and its arguments are documented in section :ref:`parsetuple`. -The macros :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF` increment/decrement the +The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement the reference count of an object and are safe in the presence of *NULL* pointers (but note that *temp* will not be *NULL* in this context). More info on them in section :ref:`refcounts`. @@ -487,12 +487,12 @@ .. index:: single: PyObject_CallObject() Later, when it is time to call the function, you call the C function -:cfunc:`PyObject_CallObject`. This function has two arguments, both pointers to +:c:func:`PyObject_CallObject`. This function has two arguments, both pointers to arbitrary Python objects: the Python function, and the argument list. The argument list must always be a tuple object, whose length is the number of arguments. To call the Python function with no arguments, pass in NULL, or an empty tuple; to call it with one argument, pass a singleton tuple. -:cfunc:`Py_BuildValue` returns a tuple when its format string consists of zero +:c:func:`Py_BuildValue` returns a tuple when its format string consists of zero or more format codes between parentheses. For example:: int arg; @@ -506,25 +506,25 @@ result = PyObject_CallObject(my_callback, arglist); Py_DECREF(arglist); -:cfunc:`PyObject_CallObject` returns a Python object pointer: this is the return -value of the Python function. :cfunc:`PyObject_CallObject` is +:c:func:`PyObject_CallObject` returns a Python object pointer: this is the return +value of the Python function. :c:func:`PyObject_CallObject` is "reference-count-neutral" with respect to its arguments. In the example a new -tuple was created to serve as the argument list, which is :cfunc:`Py_DECREF`\ +tuple was created to serve as the argument list, which is :c:func:`Py_DECREF`\ -ed immediately after the call. -The return value of :cfunc:`PyObject_CallObject` is "new": either it is a brand +The return value of :c:func:`PyObject_CallObject` is "new": either it is a brand new object, or it is an existing object whose reference count has been incremented. So, unless you want to save it in a global variable, you should -somehow :cfunc:`Py_DECREF` the result, even (especially!) if you are not +somehow :c:func:`Py_DECREF` the result, even (especially!) if you are not interested in its value. Before you do this, however, it is important to check that the return value isn't *NULL*. If it is, the Python function terminated by raising an exception. -If the C code that called :cfunc:`PyObject_CallObject` is called from Python, it +If the C code that called :c:func:`PyObject_CallObject` is called from Python, it should now return an error indication to its Python caller, so the interpreter can print a stack trace, or the calling Python code can handle the exception. If this is not possible or desirable, the exception should be cleared by calling -:cfunc:`PyErr_Clear`. For example:: +:c:func:`PyErr_Clear`. For example:: if (result == NULL) return NULL; /* Pass error back */ @@ -532,12 +532,12 @@ Py_DECREF(result); Depending on the desired interface to the Python callback function, you may also -have to provide an argument list to :cfunc:`PyObject_CallObject`. In some cases +have to provide an argument list to :c:func:`PyObject_CallObject`. In some cases the argument list is also provided by the Python program, through the same interface that specified the callback function. It can then be saved and used in the same manner as the function object. In other cases, you may have to construct a new tuple to pass as the argument list. The simplest way to do this -is to call :cfunc:`Py_BuildValue`. For example, if you want to pass an integral +is to call :c:func:`Py_BuildValue`. For example, if you want to pass an integral event code, you might use the following code:: PyObject *arglist; @@ -552,11 +552,11 @@ Note the placement of ``Py_DECREF(arglist)`` immediately after the call, before the error check! Also note that strictly speaking this code is not complete: -:cfunc:`Py_BuildValue` may run out of memory, and this should be checked. +:c:func:`Py_BuildValue` may run out of memory, and this should be checked. You may also call a function with keyword arguments by using -:cfunc:`PyObject_Call`, which supports arguments and keyword arguments. As in -the above example, we use :cfunc:`Py_BuildValue` to construct the dictionary. :: +:c:func:`PyObject_Call`, which supports arguments and keyword arguments. As in +the above example, we use :c:func:`Py_BuildValue` to construct the dictionary. :: PyObject *dict; ... @@ -576,7 +576,7 @@ .. index:: single: PyArg_ParseTuple() -The :cfunc:`PyArg_ParseTuple` function is declared as follows:: +The :c:func:`PyArg_ParseTuple` function is declared as follows:: int PyArg_ParseTuple(PyObject *arg, char *format, ...); @@ -586,7 +586,7 @@ Manual. The remaining arguments must be addresses of variables whose type is determined by the format string. -Note that while :cfunc:`PyArg_ParseTuple` checks that the Python arguments have +Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments have the required types, it cannot check the validity of the addresses of C variables passed to the call: if you make mistakes there, your code will probably crash or at least overwrite random bits in memory. So be careful! @@ -663,17 +663,17 @@ .. index:: single: PyArg_ParseTupleAndKeywords() -The :cfunc:`PyArg_ParseTupleAndKeywords` function is declared as follows:: +The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows:: int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict, char *format, char *kwlist[], ...); The *arg* and *format* parameters are identical to those of the -:cfunc:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of +:c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of keywords received as the third parameter from the Python runtime. The *kwlist* parameter is a *NULL*-terminated list of strings which identify the parameters; the names are matched with the type information from *format* from left to -right. On success, :cfunc:`PyArg_ParseTupleAndKeywords` returns true, otherwise +right. On success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and raises an appropriate exception. .. note:: @@ -737,19 +737,19 @@ Building Arbitrary Values ========================= -This function is the counterpart to :cfunc:`PyArg_ParseTuple`. It is declared +This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is declared as follows:: PyObject *Py_BuildValue(char *format, ...); It recognizes a set of format units similar to the ones recognized by -:cfunc:`PyArg_ParseTuple`, but the arguments (which are input to the function, +:c:func:`PyArg_ParseTuple`, but the arguments (which are input to the function, not output) must not be pointers, just values. It returns a new Python object, suitable for returning from a C function called from Python. -One difference with :cfunc:`PyArg_ParseTuple`: while the latter requires its +One difference with :c:func:`PyArg_ParseTuple`: while the latter requires its first argument to be a tuple (since Python argument lists are always represented -as tuples internally), :cfunc:`Py_BuildValue` does not always build a tuple. It +as tuples internally), :c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple only if its format string contains two or more format units. If the format string is empty, it returns ``None``; if it contains exactly one format unit, it returns whatever object is described by that format unit. To @@ -781,18 +781,18 @@ In languages like C or C++, the programmer is responsible for dynamic allocation and deallocation of memory on the heap. In C, this is done using the functions -:cfunc:`malloc` and :cfunc:`free`. In C++, the operators ``new`` and +:c:func:`malloc` and :c:func:`free`. In C++, the operators ``new`` and ``delete`` are used with essentially the same meaning and we'll restrict the following discussion to the C case. -Every block of memory allocated with :cfunc:`malloc` should eventually be -returned to the pool of available memory by exactly one call to :cfunc:`free`. -It is important to call :cfunc:`free` at the right time. If a block's address -is forgotten but :cfunc:`free` is not called for it, the memory it occupies +Every block of memory allocated with :c:func:`malloc` should eventually be +returned to the pool of available memory by exactly one call to :c:func:`free`. +It is important to call :c:func:`free` at the right time. If a block's address +is forgotten but :c:func:`free` is not called for it, the memory it occupies cannot be reused until the program terminates. This is called a :dfn:`memory -leak`. On the other hand, if a program calls :cfunc:`free` for a block and then +leak`. On the other hand, if a program calls :c:func:`free` for a block and then continues to use the block, it creates a conflict with re-use of the block -through another :cfunc:`malloc` call. This is called :dfn:`using freed memory`. +through another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It has the same bad consequences as referencing uninitialized data --- core dumps, wrong results, mysterious crashes. @@ -809,7 +809,7 @@ important to prevent leaks from happening by having a coding convention or strategy that minimizes this kind of errors. -Since Python makes heavy use of :cfunc:`malloc` and :cfunc:`free`, it needs a +Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it needs a strategy to avoid memory leaks as well as the use of freed memory. The chosen method is called :dfn:`reference counting`. The principle is simple: every object contains a counter, which is incremented when a reference to the object @@ -821,11 +821,11 @@ (Sometimes, reference counting is also referred to as a garbage collection strategy, hence my use of "automatic" to distinguish the two.) The big advantage of automatic garbage collection is that the user doesn't need to call -:cfunc:`free` explicitly. (Another claimed advantage is an improvement in speed +:c:func:`free` explicitly. (Another claimed advantage is an improvement in speed or memory usage --- this is no hard fact however.) The disadvantage is that for C, there is no truly portable automatic garbage collector, while reference -counting can be implemented portably (as long as the functions :cfunc:`malloc` -and :cfunc:`free` are available --- which the C Standard guarantees). Maybe some +counting can be implemented portably (as long as the functions :c:func:`malloc` +and :c:func:`free` are available --- which the C Standard guarantees). Maybe some day a sufficiently portable automatic garbage collector will be available for C. Until then, we'll have to live with reference counts. @@ -861,9 +861,9 @@ ---------------------------- There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle the -incrementing and decrementing of the reference count. :cfunc:`Py_DECREF` also +incrementing and decrementing of the reference count. :c:func:`Py_DECREF` also frees the object when the count reaches zero. For flexibility, it doesn't call -:cfunc:`free` directly --- rather, it makes a call through a function pointer in +:c:func:`free` directly --- rather, it makes a call through a function pointer in the object's :dfn:`type object`. For this purpose (and others), every object also contains a pointer to its type object. @@ -871,13 +871,13 @@ Let's first introduce some terms. Nobody "owns" an object; however, you can :dfn:`own a reference` to an object. An object's reference count is now defined as the number of owned references to it. The owner of a reference is -responsible for calling :cfunc:`Py_DECREF` when the reference is no longer +responsible for calling :c:func:`Py_DECREF` when the reference is no longer needed. Ownership of a reference can be transferred. There are three ways to -dispose of an owned reference: pass it on, store it, or call :cfunc:`Py_DECREF`. +dispose of an owned reference: pass it on, store it, or call :c:func:`Py_DECREF`. Forgetting to dispose of an owned reference creates a memory leak. It is also possible to :dfn:`borrow` [#]_ a reference to an object. The -borrower of a reference should not call :cfunc:`Py_DECREF`. The borrower must +borrower of a reference should not call :c:func:`Py_DECREF`. The borrower must not hold on to the object longer than the owner from which it was borrowed. Using a borrowed reference after the owner has disposed of it risks using freed memory and should be avoided completely. [#]_ @@ -891,7 +891,7 @@ disposed of it. A borrowed reference can be changed into an owned reference by calling -:cfunc:`Py_INCREF`. This does not affect the status of the owner from which the +:c:func:`Py_INCREF`. This does not affect the status of the owner from which the reference was borrowed --- it creates a new owned reference, and gives full owner responsibilities (the new owner must dispose of the reference properly, as well as the previous owner). @@ -908,36 +908,36 @@ Most functions that return a reference to an object pass on ownership with the reference. In particular, all functions whose function it is to create a new -object, such as :cfunc:`PyInt_FromLong` and :cfunc:`Py_BuildValue`, pass +object, such as :c:func:`PyInt_FromLong` and :c:func:`Py_BuildValue`, pass ownership to the receiver. Even if the object is not actually new, you still receive ownership of a new reference to that object. For instance, -:cfunc:`PyInt_FromLong` maintains a cache of popular values and can return a +:c:func:`PyInt_FromLong` maintains a cache of popular values and can return a reference to a cached item. Many functions that extract objects from other objects also transfer ownership -with the reference, for instance :cfunc:`PyObject_GetAttrString`. The picture +with the reference, for instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, however, since a few common routines are exceptions: -:cfunc:`PyTuple_GetItem`, :cfunc:`PyList_GetItem`, :cfunc:`PyDict_GetItem`, and -:cfunc:`PyDict_GetItemString` all return references that you borrow from the +:c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, and +:c:func:`PyDict_GetItemString` all return references that you borrow from the tuple, list or dictionary. -The function :cfunc:`PyImport_AddModule` also returns a borrowed reference, even +The function :c:func:`PyImport_AddModule` also returns a borrowed reference, even though it may actually create the object it returns: this is possible because an owned reference to the object is stored in ``sys.modules``. When you pass an object reference into another function, in general, the function borrows the reference from you --- if it needs to store it, it will use -:cfunc:`Py_INCREF` to become an independent owner. There are exactly two -important exceptions to this rule: :cfunc:`PyTuple_SetItem` and -:cfunc:`PyList_SetItem`. These functions take over ownership of the item passed -to them --- even if they fail! (Note that :cfunc:`PyDict_SetItem` and friends +:c:func:`Py_INCREF` to become an independent owner. There are exactly two +important exceptions to this rule: :c:func:`PyTuple_SetItem` and +:c:func:`PyList_SetItem`. These functions take over ownership of the item passed +to them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they are "normal.") When a C function is called from Python, it borrows references to its arguments from the caller. The caller owns a reference to the object, so the borrowed reference's lifetime is guaranteed until the function returns. Only when such a borrowed reference must be stored or passed on, it must be turned into an owned -reference by calling :cfunc:`Py_INCREF`. +reference by calling :c:func:`Py_INCREF`. The object reference returned from a C function that is called from Python must be an owned reference --- ownership is transferred from the function to its @@ -953,7 +953,7 @@ can lead to problems. These all have to do with implicit invocations of the interpreter, which can cause the owner of a reference to dispose of it. -The first and most important case to know about is using :cfunc:`Py_DECREF` on +The first and most important case to know about is using :c:func:`Py_DECREF` on an unrelated object while borrowing a reference to a list item. For instance:: void @@ -969,7 +969,7 @@ ``list[1]`` with the value ``0``, and finally prints the borrowed reference. Looks harmless, right? But it's not! -Let's follow the control flow into :cfunc:`PyList_SetItem`. The list owns +Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns references to all its items, so when item 1 is replaced, it has to dispose of the original item 1. Now let's suppose the original item 1 was an instance of a user-defined class, and let's further suppose that the class defined a @@ -978,8 +978,8 @@ Since it is written in Python, the :meth:`__del__` method can execute arbitrary Python code. Could it perhaps do something to invalidate the reference to -``item`` in :cfunc:`bug`? You bet! Assuming that the list passed into -:cfunc:`bug` is accessible to the :meth:`__del__` method, it could execute a +``item`` in :c:func:`bug`? You bet! Assuming that the list passed into +:c:func:`bug` is accessible to the :meth:`__del__` method, it could execute a statement to the effect of ``del list[0]``, and assuming this was the last reference to that object, it would free the memory associated with it, thereby invalidating ``item``. @@ -1006,8 +1006,8 @@ threads. Normally, multiple threads in the Python interpreter can't get in each other's way, because there is a global lock protecting Python's entire object space. However, it is possible to temporarily release this lock using the macro -:cmacro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it using -:cmacro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O calls, to +:c:macro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it using +:c:macro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O calls, to let other threads use the processor while waiting for the I/O to complete. Obviously, the following function has the same problem as the previous one:: @@ -1036,11 +1036,11 @@ redundant tests and the code would run more slowly. It is better to test for *NULL* only at the "source:" when a pointer that may be -*NULL* is received, for example, from :cfunc:`malloc` or from a function that +*NULL* is received, for example, from :c:func:`malloc` or from a function that may raise an exception. -The macros :cfunc:`Py_INCREF` and :cfunc:`Py_DECREF` do not check for *NULL* -pointers --- however, their variants :cfunc:`Py_XINCREF` and :cfunc:`Py_XDECREF` +The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for *NULL* +pointers --- however, their variants :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` do. The macros for checking for a particular object type (``Pytype_Check()``) don't @@ -1114,7 +1114,7 @@ Python provides a special mechanism to pass C-level information (pointers) from one extension module to another one: Capsules. A Capsule is a Python data type -which stores a pointer (:ctype:`void \*`). Capsules can only be created and +which stores a pointer (:c:type:`void \*`). Capsules can only be created and accessed via their C API, but they can be passed around like any other Python object. In particular, they can be assigned to a name in an extension module's namespace. Other extension modules can then import this module, retrieve the @@ -1127,8 +1127,8 @@ different ways between the module providing the code and the client modules. Whichever method you choose, it's important to name your Capsules properly. -The function :cfunc:`PyCapsule_New` takes a name parameter -(:ctype:`const char \*`); you're permitted to pass in a *NULL* name, but +The function :c:func:`PyCapsule_New` takes a name parameter +(:c:type:`const char \*`); you're permitted to pass in a *NULL* name, but we strongly encourage you to specify a name. Properly named Capsules provide a degree of runtime type-safety; there is no feasible way to tell one unnamed Capsule from another. @@ -1138,7 +1138,7 @@ modulename.attributename -The convenience function :cfunc:`PyCapsule_Import` makes it easy to +The convenience function :c:func:`PyCapsule_Import` makes it easy to load a C API provided via a Capsule, but only if the Capsule's name matches this convention. This behavior gives C API users a high degree of certainty that the Capsule they load contains the correct C API. @@ -1146,19 +1146,19 @@ The following example demonstrates an approach that puts most of the burden on the writer of the exporting module, which is appropriate for commonly used library modules. It stores all C API pointers (just one in the example!) in an -array of :ctype:`void` pointers which becomes the value of a Capsule. The header +array of :c:type:`void` pointers which becomes the value of a Capsule. The header file corresponding to the module provides a macro that takes care of importing the module and retrieving its C API pointers; client modules only have to call this macro before accessing the C API. The exporting module is a modification of the :mod:`spam` module from section :ref:`extending-simpleexample`. The function :func:`spam.system` does not call -the C library function :cfunc:`system` directly, but a function -:cfunc:`PySpam_System`, which would of course do something more complicated in +the C library function :c:func:`system` directly, but a function +:c:func:`PySpam_System`, which would of course do something more complicated in reality (such as adding "spam" to every command). This function -:cfunc:`PySpam_System` is also exported to other extension modules. +:c:func:`PySpam_System` is also exported to other extension modules. -The function :cfunc:`PySpam_System` is a plain C function, declared +The function :c:func:`PySpam_System` is a plain C function, declared ``static`` like everything else:: static int @@ -1167,7 +1167,7 @@ return system(command); } -The function :cfunc:`spam_system` is modified in a trivial way:: +The function :c:func:`spam_system` is modified in a trivial way:: static PyObject * spam_system(PyObject *self, PyObject *args) @@ -1270,8 +1270,8 @@ #endif /* !defined(Py_SPAMMODULE_H) */ All that a client module must do in order to have access to the function -:cfunc:`PySpam_System` is to call the function (or rather macro) -:cfunc:`import_spam` in its initialization function:: +:c:func:`PySpam_System` is to call the function (or rather macro) +:c:func:`import_spam` in its initialization function:: PyMODINIT_FUNC initclient(void) diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst --- a/Doc/extending/newtypes.rst +++ b/Doc/extending/newtypes.rst @@ -34,7 +34,7 @@ ========== The Python runtime sees all Python objects as variables of type -:ctype:`PyObject\*`. A :ctype:`PyObject` is not a very magnificent object - it +:c:type:`PyObject\*`. A :c:type:`PyObject` is not a very magnificent object - it just contains the refcount and a pointer to the object's "type object". This is where the action is; the type object determines which (C) functions get called when, for instance, an attribute gets looked up on an object or it is multiplied @@ -103,7 +103,7 @@ "Noddy objects", /* tp_doc */ }; -Now if you go and look up the definition of :ctype:`PyTypeObject` in +Now if you go and look up the definition of :c:type:`PyTypeObject` in :file:`object.h` you'll see that it has many more fields that the definition above. The remaining fields will be filled with zeros by the C compiler, and it's common practice to not specify them explicitly unless you need them. @@ -119,7 +119,7 @@ as the type of a type object is "type", but this isn't strictly conforming C and some compilers complain. Fortunately, this member will be filled in for us by -:cfunc:`PyType_Ready`. :: +:c:func:`PyType_Ready`. :: 0, /* ob_size */ @@ -145,7 +145,7 @@ sizeof(noddy_NoddyObject), /* tp_basicsize */ This is so that Python knows how much memory to allocate when you call -:cfunc:`PyObject_New`. +:c:func:`PyObject_New`. .. note:: @@ -185,12 +185,12 @@ For now, all we want to be able to do is to create new :class:`Noddy` objects. To enable object creation, we have to provide a :attr:`tp_new` implementation. In this case, we can just use the default implementation provided by the API -function :cfunc:`PyType_GenericNew`. We'd like to just assign this to the +function :c:func:`PyType_GenericNew`. We'd like to just assign this to the :attr:`tp_new` slot, but we can't, for portability sake, On some platforms or compilers, we can't statically initialize a structure member with a function defined in another C module, so, instead, we'll assign the :attr:`tp_new` slot in the module initialization function just before calling -:cfunc:`PyType_Ready`:: +:c:func:`PyType_Ready`:: noddy_NoddyType.tp_new = PyType_GenericNew; if (PyType_Ready(&noddy_NoddyType) < 0) @@ -200,7 +200,7 @@ for a later section! Everything else in the file should be familiar, except for some code in -:cfunc:`initnoddy`:: +:c:func:`initnoddy`:: if (PyType_Ready(&noddy_NoddyType) < 0) return; @@ -288,7 +288,7 @@ (destructor)Noddy_dealloc, /*tp_dealloc*/ This method decrements the reference counts of the two Python attributes. We use -:cfunc:`Py_XDECREF` here because the :attr:`first` and :attr:`last` members +:c:func:`Py_XDECREF` here because the :attr:`first` and :attr:`last` members could be *NULL*. It then calls the :attr:`tp_free` member of the object's type to free the object's memory. Note that the object's type might not be :class:`NoddyType`, because the object may be an instance of a subclass. @@ -334,8 +334,8 @@ the initial values of instance variables. In this case, we use the new method to make sure that the initial values of the members :attr:`first` and :attr:`last` are not *NULL*. If we didn't care whether the initial values were -*NULL*, we could have used :cfunc:`PyType_GenericNew` as our new method, as we -did before. :cfunc:`PyType_GenericNew` initializes all of the instance variable +*NULL*, we could have used :c:func:`PyType_GenericNew` as our new method, as we +did before. :c:func:`PyType_GenericNew` initializes all of the instance variable members to *NULL*. The new method is a static method that is passed the type being instantiated and @@ -345,7 +345,7 @@ methods. Note that if the type supports subclassing, the type passed may not be the type being defined. The new method calls the tp_alloc slot to allocate memory. We don't fill the :attr:`tp_alloc` slot ourselves. Rather -:cfunc:`PyType_Ready` fills it for us by inheriting it from our base class, +:c:func:`PyType_Ready` fills it for us by inheriting it from our base class, which is :class:`object` by default. Most types use the default allocation. .. note:: @@ -530,8 +530,8 @@ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ -We rename :cfunc:`initnoddy` to :cfunc:`initnoddy2` and update the module name -passed to :cfunc:`Py_InitModule3`. +We rename :c:func:`initnoddy` to :c:func:`initnoddy2` and update the module name +passed to :c:func:`Py_InitModule3`. Finally, we update our :file:`setup.py` file to build the new module:: @@ -597,7 +597,7 @@ deleted. In our setter, we raise an error if the attribute is deleted or if the attribute value is not a string. -We create an array of :ctype:`PyGetSetDef` structures:: +We create an array of :c:type:`PyGetSetDef` structures:: static PyGetSetDef Noddy_getseters[] = { {"first", @@ -617,7 +617,7 @@ to register our attribute getters and setters. -The last item in a :ctype:`PyGetSetDef` structure is the closure mentioned +The last item in a :c:type:`PyGetSetDef` structure is the closure mentioned above. In this case, we aren't using the closure, so we just pass *NULL*. We also remove the member definitions for these attributes:: @@ -662,8 +662,8 @@ With these changes, we can assure that the :attr:`first` and :attr:`last` members are never *NULL* so we can remove checks for *NULL* values in almost all -cases. This means that most of the :cfunc:`Py_XDECREF` calls can be converted to -:cfunc:`Py_DECREF` calls. The only place we can't change these calls is in the +cases. This means that most of the :c:func:`Py_XDECREF` calls can be converted to +:c:func:`Py_DECREF` calls. The only place we can't change these calls is in the deallocator, where there is the possibility that the initialization of these members failed in the constructor. @@ -728,13 +728,13 @@ } For each subobject that can participate in cycles, we need to call the -:cfunc:`visit` function, which is passed to the traversal method. The -:cfunc:`visit` function takes as arguments the subobject and the extra argument +:c:func:`visit` function, which is passed to the traversal method. The +:c:func:`visit` function takes as arguments the subobject and the extra argument *arg* passed to the traversal method. It returns an integer value that must be returned if it is non-zero. -Python 2.4 and higher provide a :cfunc:`Py_VISIT` macro that automates calling -visit functions. With :cfunc:`Py_VISIT`, :cfunc:`Noddy_traverse` can be +Python 2.4 and higher provide a :c:func:`Py_VISIT` macro that automates calling +visit functions. With :c:func:`Py_VISIT`, :c:func:`Noddy_traverse` can be simplified:: static int @@ -748,7 +748,7 @@ .. note:: Note that the :attr:`tp_traverse` implementation must name its arguments exactly - *visit* and *arg* in order to use :cfunc:`Py_VISIT`. This is to encourage + *visit* and *arg* in order to use :c:func:`Py_VISIT`. This is to encourage uniformity across these boring implementations. We also need to provide a method for clearing any subobjects that can @@ -778,19 +778,19 @@ self->ob_type->tp_free((PyObject*)self); } -Notice the use of a temporary variable in :cfunc:`Noddy_clear`. We use the +Notice the use of a temporary variable in :c:func:`Noddy_clear`. We use the temporary variable so that we can set each member to *NULL* before decrementing its reference count. We do this because, as was discussed earlier, if the reference count drops to zero, we might cause code to run that calls back into the object. In addition, because we now support garbage collection, we also have to worry about code being run that triggers garbage collection. If garbage collection is run, our :attr:`tp_traverse` handler could get called. We can't -take a chance of having :cfunc:`Noddy_traverse` called when a member's reference +take a chance of having :c:func:`Noddy_traverse` called when a member's reference count has dropped to zero and its value hasn't been set to *NULL*. -Python 2.4 and higher provide a :cfunc:`Py_CLEAR` that automates the careful -decrementing of reference counts. With :cfunc:`Py_CLEAR`, the -:cfunc:`Noddy_clear` function can be simplified:: +Python 2.4 and higher provide a :c:func:`Py_CLEAR` that automates the careful +decrementing of reference counts. With :c:func:`Py_CLEAR`, the +:c:func:`Noddy_clear` function can be simplified:: static int Noddy_clear(Noddy *self) @@ -845,7 +845,7 @@ The primary difference for derived type objects is that the base type's object structure must be the first value. The base type will already include the -:cfunc:`PyObject_HEAD` at the beginning of its structure. +:c:func:`PyObject_HEAD` at the beginning of its structure. When a Python object is a :class:`Shoddy` instance, its *PyObject\** pointer can be safely cast to both *PyListObject\** and *Shoddy\**. :: @@ -867,10 +867,10 @@ memory for the object with :attr:`tp_alloc`, that will be handled by the base class when calling its :attr:`tp_new`. -When filling out the :cfunc:`PyTypeObject` for the :class:`Shoddy` type, you see -a slot for :cfunc:`tp_base`. Due to cross platform compiler issues, you can't -fill that field directly with the :cfunc:`PyList_Type`; it can be done later in -the module's :cfunc:`init` function. :: +When filling out the :c:func:`PyTypeObject` for the :class:`Shoddy` type, you see +a slot for :c:func:`tp_base`. Due to cross platform compiler issues, you can't +fill that field directly with the :c:func:`PyList_Type`; it can be done later in +the module's :c:func:`init` function. :: PyMODINIT_FUNC initshoddy(void) @@ -889,12 +889,12 @@ PyModule_AddObject(m, "Shoddy", (PyObject *) &ShoddyType); } -Before calling :cfunc:`PyType_Ready`, the type structure must have the +Before calling :c:func:`PyType_Ready`, the type structure must have the :attr:`tp_base` slot filled in. When we are deriving a new type, it is not -necessary to fill out the :attr:`tp_alloc` slot with :cfunc:`PyType_GenericNew` +necessary to fill out the :attr:`tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocate function from the base type will be inherited. -After that, calling :cfunc:`PyType_Ready` and adding the type object to the +After that, calling :c:func:`PyType_Ready` and adding the type object to the module is the same as with the basic :class:`Noddy` examples. @@ -906,7 +906,7 @@ This section aims to give a quick fly-by on the various type methods you can implement and what they do. -Here is the definition of :ctype:`PyTypeObject`, with some fields only used in +Here is the definition of :c:type:`PyTypeObject`, with some fields only used in debug builds omitted: .. literalinclude:: ../includes/typestruct.h @@ -984,8 +984,8 @@ executed may detect that an exception has been set. This can lead to misleading errors from the interpreter. The proper way to protect against this is to save a pending exception before performing the unsafe action, and restoring it when -done. This can be done using the :cfunc:`PyErr_Fetch` and -:cfunc:`PyErr_Restore` functions:: +done. This can be done using the :c:func:`PyErr_Fetch` and +:c:func:`PyErr_Restore` functions:: static void my_dealloc(PyObject *obj) @@ -1026,7 +1026,7 @@ object: the :func:`repr` function (or equivalent back-tick syntax), the :func:`str` function, and the :keyword:`print` statement. For most objects, the :keyword:`print` statement is equivalent to the :func:`str` function, but it is -possible to special-case printing to a :ctype:`FILE\*` if necessary; this should +possible to special-case printing to a :c:type:`FILE\*` if necessary; this should only be done if efficiency is identified as a problem and profiling suggests that creating a temporary string object to be written to a file is too expensive. @@ -1110,8 +1110,8 @@ Python supports two pairs of attribute handlers; a type that supports attributes only needs to implement the functions for one pair. The difference is that one -pair takes the name of the attribute as a :ctype:`char\*`, while the other -accepts a :ctype:`PyObject\*`. Each type can use whichever pair makes more +pair takes the name of the attribute as a :c:type:`char\*`, while the other +accepts a :c:type:`PyObject\*`. Each type can use whichever pair makes more sense for the implementation's convenience. :: getattrfunc tp_getattr; /* char * version */ @@ -1122,7 +1122,7 @@ If accessing attributes of an object is always a simple operation (this will be explained shortly), there are generic implementations which can be used to -provide the :ctype:`PyObject\*` version of the attribute management functions. +provide the :c:type:`PyObject\*` version of the attribute management functions. The actual need for type-specific attribute handlers almost completely disappeared starting with Python 2.2, though there are many examples which have not been updated to use some of the new generic mechanism that is available. @@ -1138,7 +1138,7 @@ Most extension types only use *simple* attributes. So, what makes the attributes simple? There are only a couple of conditions that must be met: -#. The name of the attributes must be known when :cfunc:`PyType_Ready` is +#. The name of the attributes must be known when :c:func:`PyType_Ready` is called. #. No special processing is needed to record that an attribute was looked up or @@ -1147,7 +1147,7 @@ Note that this list does not place any restrictions on the values of the attributes, when the values are computed, or how relevant data is stored. -When :cfunc:`PyType_Ready` is called, it uses three tables referenced by the +When :c:func:`PyType_Ready` is called, it uses three tables referenced by the type object to create :term:`descriptor`\s which are placed in the dictionary of the type object. Each descriptor controls access to one attribute of the instance object. Each of the tables is optional; if all three are *NULL*, instances of @@ -1162,7 +1162,7 @@ struct PyGetSetDef *tp_getset; If :attr:`tp_methods` is not *NULL*, it must refer to an array of -:ctype:`PyMethodDef` structures. Each entry in the table is an instance of this +:c:type:`PyMethodDef` structures. Each entry in the table is an instance of this structure:: typedef struct PyMethodDef { @@ -1247,9 +1247,9 @@ Type-specific Attribute Management ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For simplicity, only the :ctype:`char\*` version will be demonstrated here; the -type of the name parameter is the only difference between the :ctype:`char\*` -and :ctype:`PyObject\*` flavors of the interface. This example effectively does +For simplicity, only the :c:type:`char\*` version will be demonstrated here; the +type of the name parameter is the only difference between the :c:type:`char\*` +and :c:type:`PyObject\*` flavors of the interface. This example effectively does the same thing as the generic example above, but does not use the generic support added in Python 2.2. The value in showing this is two-fold: it demonstrates how basic attribute management can be done in a way that is @@ -1262,7 +1262,7 @@ method of a class would be called. A likely way to handle this is (1) to implement a set of functions (such as -:cfunc:`newdatatype_getSize` and :cfunc:`newdatatype_setSize` in the example +:c:func:`newdatatype_getSize` and :c:func:`newdatatype_setSize` in the example below), (2) provide a method table listing these functions, and (3) provide a getattr function that returns the result of a lookup in that table. The method table uses the same structure as the :attr:`tp_methods` field of the type @@ -1308,7 +1308,7 @@ The :attr:`tp_compare` handler is called when comparisons are needed and the object does not implement the specific rich comparison method which matches the requested comparison. (It is always used if defined and the -:cfunc:`PyObject_Compare` or :cfunc:`PyObject_Cmp` functions are used, or if +:c:func:`PyObject_Compare` or :c:func:`PyObject_Cmp` functions are used, or if :func:`cmp` is used from Python.) It is analogous to the :meth:`__cmp__` method. This function should return ``-1`` if *obj1* is less than *obj2*, ``0`` if they are equal, and ``1`` if *obj1* is greater than *obj2*. (It was previously @@ -1318,7 +1318,7 @@ A :attr:`tp_compare` handler may raise an exception. In this case it should return a negative value. The caller has to test for the exception using -:cfunc:`PyErr_Occurred`. +:c:func:`PyErr_Occurred`. Here is a sample implementation:: @@ -1366,8 +1366,8 @@ If you wish your object to be able to act like a number, a sequence, or a mapping object, then you place the address of a structure that implements the C -type :ctype:`PyNumberMethods`, :ctype:`PySequenceMethods`, or -:ctype:`PyMappingMethods`, respectively. It is up to you to fill in this +type :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, or +:c:type:`PyMappingMethods`, respectively. It is up to you to fill in this structure with appropriate values. You can find examples of the use of each of these in the :file:`Objects` directory of the Python source distribution. :: @@ -1399,11 +1399,11 @@ the call is ``obj1('hello')``, then *arg1* is ``obj1``. #. *arg2* is a tuple containing the arguments to the call. You can use - :cfunc:`PyArg_ParseTuple` to extract the arguments. + :c:func:`PyArg_ParseTuple` to extract the arguments. #. *arg3* is a dictionary of keyword arguments that were passed. If this is non-*NULL* and you support keyword arguments, use - :cfunc:`PyArg_ParseTupleAndKeywords` to extract the arguments. If you do not + :c:func:`PyArg_ParseTupleAndKeywords` to extract the arguments. If you do not want to support keyword arguments and this is non-*NULL*, raise a :exc:`TypeError` with a message saying that keyword arguments are not supported. @@ -1478,7 +1478,7 @@ those objects which do not benefit by weak referencing (such as numbers). For an object to be weakly referencable, the extension must include a -:ctype:`PyObject\*` field in the instance structure for the use of the weak +:c:type:`PyObject\*` field in the instance structure for the use of the weak reference mechanism; it must be initialized to *NULL* by the object's constructor. It must also set the :attr:`tp_weaklistoffset` field of the corresponding type object to the offset of the field. For example, the instance @@ -1554,7 +1554,7 @@ examples of the function you want to implement. When you need to verify that an object is an instance of the type you are -implementing, use the :cfunc:`PyObject_TypeCheck` function. A sample of its use +implementing, use the :c:func:`PyObject_TypeCheck` function. A sample of its use might be something like the following:: if (! PyObject_TypeCheck(some_object, &MyType)) { diff --git a/Doc/extending/windows.rst b/Doc/extending/windows.rst --- a/Doc/extending/windows.rst +++ b/Doc/extending/windows.rst @@ -98,8 +98,8 @@ it. Copy your C sources into it. Note that the module source file name does not necessarily have to match the module name, but the name of the initialization function should match the module name --- you can only import a - module :mod:`spam` if its initialization function is called :cfunc:`initspam`, - and it should call :cfunc:`Py_InitModule` with the string ``"spam"`` as its + module :mod:`spam` if its initialization function is called :c:func:`initspam`, + and it should call :c:func:`Py_InitModule` with the string ``"spam"`` as its first argument (use the minimal :file:`example.c` in this directory as a guide). By convention, it lives in a file called :file:`spam.c` or :file:`spammodule.c`. The output file should be called :file:`spam.pyd` (in Release mode) or @@ -263,7 +263,7 @@ The first command created three files: :file:`spam.obj`, :file:`spam.dll` and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python functions (such -as :cfunc:`PyArg_ParseTuple`), but it does know how to find the Python code +as :c:func:`PyArg_ParseTuple`), but it does know how to find the Python code thanks to :file:`pythonXY.lib`. The second command created :file:`ni.dll` (and :file:`.obj` and :file:`.lib`), diff --git a/Doc/faq/extending.rst b/Doc/faq/extending.rst --- a/Doc/faq/extending.rst +++ b/Doc/faq/extending.rst @@ -60,41 +60,41 @@ How can I execute arbitrary Python statements from C? ----------------------------------------------------- -The highest-level function to do this is :cfunc:`PyRun_SimpleString` which takes +The highest-level function to do this is :c:func:`PyRun_SimpleString` which takes a single string argument to be executed in the context of the module ``__main__`` and returns 0 for success and -1 when an exception occurred (including ``SyntaxError``). If you want more control, use -:cfunc:`PyRun_String`; see the source for :cfunc:`PyRun_SimpleString` in +:c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in ``Python/pythonrun.c``. How can I evaluate an arbitrary Python expression from C? --------------------------------------------------------- -Call the function :cfunc:`PyRun_String` from the previous question with the -start symbol :cdata:`Py_eval_input`; it parses an expression, evaluates it and +Call the function :c:func:`PyRun_String` from the previous question with the +start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it and returns its value. How do I extract C values from a Python object? ----------------------------------------------- -That depends on the object's type. If it's a tuple, :cfunc:`PyTuple_Size` -returns its length and :cfunc:`PyTuple_GetItem` returns the item at a specified -index. Lists have similar functions, :cfunc:`PyListSize` and -:cfunc:`PyList_GetItem`. +That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` +returns its length and :c:func:`PyTuple_GetItem` returns the item at a specified +index. Lists have similar functions, :c:func:`PyListSize` and +:c:func:`PyList_GetItem`. -For strings, :cfunc:`PyString_Size` returns its length and -:cfunc:`PyString_AsString` a pointer to its value. Note that Python strings may -contain null bytes so C's :cfunc:`strlen` should not be used. +For strings, :c:func:`PyString_Size` returns its length and +:c:func:`PyString_AsString` a pointer to its value. Note that Python strings may +contain null bytes so C's :c:func:`strlen` should not be used. To test the type of an object, first make sure it isn't *NULL*, and then use -:cfunc:`PyString_Check`, :cfunc:`PyTuple_Check`, :cfunc:`PyList_Check`, etc. +:c:func:`PyString_Check`, :c:func:`PyTuple_Check`, :c:func:`PyList_Check`, etc. There is also a high-level API to Python objects which is provided by the so-called 'abstract' interface -- read ``Include/abstract.h`` for further details. It allows interfacing with any kind of Python sequence using calls -like :cfunc:`PySequence_Length`, :cfunc:`PySequence_GetItem`, etc.) as well as +like :c:func:`PySequence_Length`, :c:func:`PySequence_GetItem`, etc.) as well as many other useful protocols. @@ -103,7 +103,7 @@ You can't. Use ``t = PyTuple_New(n)`` instead, and fill it with objects using ``PyTuple_SetItem(t, i, o)`` -- note that this "eats" a reference count of -``o``, so you have to :cfunc:`Py_INCREF` it. Lists have similar functions +``o``, so you have to :c:func:`Py_INCREF` it. Lists have similar functions ``PyList_New(n)`` and ``PyList_SetItem(l, i, o)``. Note that you *must* set all the tuple items to some value before you pass the tuple to Python code -- ``PyTuple_New(n)`` initializes them to NULL, which isn't a valid Python value. @@ -112,9 +112,9 @@ How do I call an object's method from C? ---------------------------------------- -The :cfunc:`PyObject_CallMethod` function can be used to call an arbitrary +The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary method of an object. The parameters are the object, the name of the method to -call, a format string like that used with :cfunc:`Py_BuildValue`, and the +call, a format string like that used with :c:func:`Py_BuildValue`, and the argument values:: PyObject * @@ -122,7 +122,7 @@ char *arg_format, ...); This works for any object that has methods -- whether built-in or user-defined. -You are responsible for eventually :cfunc:`Py_DECREF`\ 'ing the return value. +You are responsible for eventually :c:func:`Py_DECREF`\ 'ing the return value. To call, e.g., a file object's "seek" method with arguments 10, 0 (assuming the file object pointer is "f"):: @@ -135,7 +135,7 @@ Py_DECREF(res); } -Note that since :cfunc:`PyObject_CallObject` *always* wants a tuple for the +Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the argument list, to call a function without arguments, pass "()" for the format, and to call a function with one argument, surround the argument in parentheses, e.g. "(i)". @@ -186,7 +186,7 @@ attr = PyObject_GetAttrString(module, ""); -Calling :cfunc:`PyObject_SetAttrString` to assign to variables in the module +Calling :c:func:`PyObject_SetAttrString` to assign to variables in the module also works. @@ -267,16 +267,16 @@ In Python you can use the :mod:`codeop` module, which approximates the parser's behavior sufficiently. IDLE uses this, for example. -The easiest way to do it in C is to call :cfunc:`PyRun_InteractiveLoop` (perhaps +The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` (perhaps in a separate thread) and let the Python interpreter handle the input for -you. You can also set the :cfunc:`PyOS_ReadlineFunctionPointer` to point at your +you. You can also set the :c:func:`PyOS_ReadlineFunctionPointer` to point at your custom input function. See ``Modules/readline.c`` and ``Parser/myreadline.c`` for more hints. However sometimes you have to run the embedded Python interpreter in the same thread as your rest application and you can't allow the -:cfunc:`PyRun_InteractiveLoop` to stop while waiting for user input. The one -solution then is to call :cfunc:`PyParser_ParseString` and test for ``e.error`` +:c:func:`PyRun_InteractiveLoop` to stop while waiting for user input. The one +solution then is to call :c:func:`PyParser_ParseString` and test for ``e.error`` equal to ``E_EOF``, which means the input is incomplete). Here's a sample code fragment, untested, inspired by code from Alex Farber:: @@ -307,8 +307,8 @@ } Another solution is trying to compile the received string with -:cfunc:`Py_CompileString`. If it compiles without errors, try to execute the -returned code object by calling :cfunc:`PyEval_EvalCode`. Otherwise save the +:c:func:`Py_CompileString`. If it compiles without errors, try to execute the +returned code object by calling :c:func:`PyEval_EvalCode`. Otherwise save the input for later. If the compilation fails, find out if it's an error or just more input is required - by extracting the message string from the exception tuple and comparing it to the string "unexpected EOF while parsing". Here is a @@ -460,8 +460,8 @@ 7.x, in particular, provided a "python2" binary that is compiled with 4-byte Unicode. This only causes the link failure if the extension uses any of the ``PyUnicode_*()`` functions. It is also a problem if an extension uses any of -the Unicode-related format specifiers for :cfunc:`Py_BuildValue` (or similar) or -parameter specifications for :cfunc:`PyArg_ParseTuple`. +the Unicode-related format specifiers for :c:func:`Py_BuildValue` (or similar) or +parameter specifications for :c:func:`PyArg_ParseTuple`. You can check the size of the Unicode character a Python interpreter is using by checking the value of sys.maxunicode: diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst --- a/Doc/faq/gui.rst +++ b/Doc/faq/gui.rst @@ -117,7 +117,7 @@ (http://tix.sourceforge.net/). Build Tix with SAM enabled, perform the appropriate call to -:cfunc:`Tclsam_init`, etc. inside Python's +:c:func:`Tclsam_init`, etc. inside Python's :file:`Modules/tkappinit.c`, and link with libtclsam and libtksam (you might include the Tix libraries as well). @@ -126,7 +126,7 @@ --------------------------------------------------- Yes, and you don't even need threads! But you'll have to restructure your I/O -code a bit. Tk has the equivalent of Xt's :cfunc:`XtAddInput()` call, which allows you +code a bit. Tk has the equivalent of Xt's :c:func:`XtAddInput()` call, which allows you to register a callback function which will be called from the Tk mainloop when I/O is possible on a file descriptor. Here's what you need:: diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -980,7 +980,7 @@ if the line uses something other than whitespace as a separator. For more complicated input parsing, regular expressions are more powerful -than C's :cfunc:`sscanf` and better suited for the task. +than C's :c:func:`sscanf` and better suited for the task. What does 'UnicodeError: ASCII [decoding,encoding] error: ordinal not in range(128)' mean? diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -537,7 +537,7 @@ The Python 1.5.* DLLs (``python15.dll``) are all compiled with MS VC++ 5.0 and with multithreading-DLL options (``/MD``). -If you can't change compilers or flags, try using :cfunc:`Py_RunSimpleString`. +If you can't change compilers or flags, try using :c:func:`Py_RunSimpleString`. A trick to get it to run an arbitrary file is to construct a call to :func:`execfile` with the name of your file as argument. diff --git a/Doc/howto/cporting.rst b/Doc/howto/cporting.rst --- a/Doc/howto/cporting.rst +++ b/Doc/howto/cporting.rst @@ -22,7 +22,7 @@ ======================= The easiest way to compile only some code for 3.0 is to check if -:cmacro:`PY_MAJOR_VERSION` is greater than or equal to 3. :: +:c:macro:`PY_MAJOR_VERSION` is greater than or equal to 3. :: #if PY_MAJOR_VERSION >= 3 #define IS_PY3K @@ -47,12 +47,12 @@ 2.x's :func:`unicode` (``PyUnicode_*``). The old 8-bit string type has become :func:`bytes`. Python 2.6 and later provide a compatibility header, :file:`bytesobject.h`, mapping ``PyBytes`` names to ``PyString`` ones. For best -compatibility with 3.0, :ctype:`PyUnicode` should be used for textual data and -:ctype:`PyBytes` for binary data. It's also important to remember that -:ctype:`PyBytes` and :ctype:`PyUnicode` in 3.0 are not interchangeable like -:ctype:`PyString` and :ctype:`PyUnicode` are in 2.x. The following example -shows best practices with regards to :ctype:`PyUnicode`, :ctype:`PyString`, -and :ctype:`PyBytes`. :: +compatibility with 3.0, :c:type:`PyUnicode` should be used for textual data and +:c:type:`PyBytes` for binary data. It's also important to remember that +:c:type:`PyBytes` and :c:type:`PyUnicode` in 3.0 are not interchangeable like +:c:type:`PyString` and :c:type:`PyUnicode` are in 2.x. The following example +shows best practices with regards to :c:type:`PyUnicode`, :c:type:`PyString`, +and :c:type:`PyBytes`. :: #include "stdlib.h" #include "Python.h" @@ -212,43 +212,43 @@ CObject replaced with Capsule ============================= -The :ctype:`Capsule` object was introduced in Python 3.1 and 2.7 to replace -:ctype:`CObject`. CObjects were useful, -but the :ctype:`CObject` API was problematic: it didn't permit distinguishing +The :c:type:`Capsule` object was introduced in Python 3.1 and 2.7 to replace +:c:type:`CObject`. CObjects were useful, +but the :c:type:`CObject` API was problematic: it didn't permit distinguishing between valid CObjects, which allowed mismatched CObjects to crash the interpreter, and some of its APIs relied on undefined behavior in C. (For further reading on the rationale behind Capsules, please see :issue:`5630`.) If you're currently using CObjects, and you want to migrate to 3.1 or newer, you'll need to switch to Capsules. -:ctype:`CObject` was deprecated in 3.1 and 2.7 and completely removed in +:c:type:`CObject` was deprecated in 3.1 and 2.7 and completely removed in Python 3.2. If you only support 2.7, or 3.1 and above, you -can simply switch to :ctype:`Capsule`. If you need to support 3.0 or +can simply switch to :c:type:`Capsule`. If you need to support 3.0 or versions of Python earlier than 2.7 you'll have to support both CObjects and Capsules. The following example header file :file:`capsulethunk.h` may solve the problem for you; -simply write your code against the :ctype:`Capsule` API, include +simply write your code against the :c:type:`Capsule` API, include this header file after ``"Python.h"``, and you'll automatically use CObjects in Python 3.0 or versions earlier than 2.7. :file:`capsulethunk.h` simulates Capsules using CObjects. However, -:ctype:`CObject` provides no place to store the capsule's "name". As a -result the simulated :ctype:`Capsule` objects created by :file:`capsulethunk.h` +:c:type:`CObject` provides no place to store the capsule's "name". As a +result the simulated :c:type:`Capsule` objects created by :file:`capsulethunk.h` behave slightly differently from real Capsules. Specifically: - * The name parameter passed in to :cfunc:`PyCapsule_New` is ignored. + * The name parameter passed in to :c:func:`PyCapsule_New` is ignored. - * The name parameter passed in to :cfunc:`PyCapsule_IsValid` and - :cfunc:`PyCapsule_GetPointer` is ignored, and no error checking + * The name parameter passed in to :c:func:`PyCapsule_IsValid` and + :c:func:`PyCapsule_GetPointer` is ignored, and no error checking of the name is performed. - * :cfunc:`PyCapsule_GetName` always returns NULL. + * :c:func:`PyCapsule_GetName` always returns NULL. - * :cfunc:`PyCapsule_SetName` always throws an exception and + * :c:func:`PyCapsule_SetName` always throws an exception and returns failure. (Since there's no way to store a name - in a CObject, noisy failure of :cfunc:`PyCapsule_SetName` + in a CObject, noisy failure of :c:func:`PyCapsule_SetName` was deemed preferable to silent failure here. If this is inconveient, feel free to modify your local copy as you see fit.) diff --git a/Doc/howto/descriptor.rst b/Doc/howto/descriptor.rst --- a/Doc/howto/descriptor.rst +++ b/Doc/howto/descriptor.rst @@ -97,7 +97,7 @@ implementation works through a precedence chain that gives data descriptors priority over instance variables, instance variables priority over non-data descriptors, and assigns lowest priority to :meth:`__getattr__` if provided. The -full C implementation can be found in :cfunc:`PyObject_GenericGetAttr()` in +full C implementation can be found in :c:func:`PyObject_GenericGetAttr()` in `Objects/object.c `_\. For classes, the machinery is in :meth:`type.__getattribute__` which transforms @@ -131,7 +131,7 @@ Note, in Python 2.2, ``super(B, obj).m()`` would only invoke :meth:`__get__` if ``m`` was a data descriptor. In Python 2.3, non-data descriptors also get invoked unless an old-style class is involved. The implementation details are -in :cfunc:`super_getattro()` in +in :c:func:`super_getattro()` in `Objects/typeobject.c `_ and a pure Python equivalent can be found in `Guido's Tutorial`_. @@ -297,7 +297,7 @@ The output suggests that bound and unbound methods are two different types. While they could have been implemented that way, the actual C implementation of -:ctype:`PyMethod_Type` in +:c:type:`PyMethod_Type` in `Objects/classobject.c `_ is a single object with two different representations depending on whether the :attr:`im_self` field is set or is *NULL* (the C equivalent of *None*). diff --git a/Doc/library/al.rst b/Doc/library/al.rst --- a/Doc/library/al.rst +++ b/Doc/library/al.rst @@ -53,7 +53,7 @@ .. function:: queryparams(device) The device argument is an integer. The return value is a list of integers - containing the data returned by :cfunc:`ALqueryparams`. + containing the data returned by :c:func:`ALqueryparams`. .. function:: getparams(device, list) diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -107,7 +107,7 @@ memory buffer in bytes can be computed as ``array.buffer_info()[1] * array.itemsize``. This is occasionally useful when working with low-level (and inherently unsafe) I/O interfaces that require memory addresses, such as certain - :cfunc:`ioctl` operations. The returned numbers are valid as long as the array + :c:func:`ioctl` operations. The returned numbers are valid as long as the array exists and no length-changing operations are applied to it. .. note:: diff --git a/Doc/library/asynchat.rst b/Doc/library/asynchat.rst --- a/Doc/library/asynchat.rst +++ b/Doc/library/asynchat.rst @@ -34,7 +34,7 @@ Like :class:`asyncore.dispatcher`, :class:`async_chat` defines a set of events that are generated by an analysis of socket conditions after a - :cfunc:`select` call. Once the polling loop has been started the + :c:func:`select` call. Once the polling loop has been started the :class:`async_chat` object's methods are called by the event-processing framework with no action on the part of the programmer. diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst --- a/Doc/library/asyncore.rst +++ b/Doc/library/asyncore.rst @@ -25,7 +25,7 @@ are probably what you really need. Network servers are rarely processor bound, however. -If your operating system supports the :cfunc:`select` system call in its I/O +If your operating system supports the :c:func:`select` system call in its I/O library (and nearly all do), then you can use it to juggle multiple communication channels at once; doing other work while your I/O is taking place in the "background." Although this strategy can seem strange and @@ -95,8 +95,8 @@ During asynchronous processing, each mapped channel's :meth:`readable` and :meth:`writable` methods are used to determine whether the channel's socket - should be added to the list of channels :cfunc:`select`\ ed or - :cfunc:`poll`\ ed for read and write events. + should be added to the list of channels :c:func:`select`\ ed or + :c:func:`poll`\ ed for read and write events. Thus, the set of channel events is larger than the basic socket events. The full set of methods that can be overridden in your subclass follows: @@ -238,9 +238,9 @@ .. class:: file_dispatcher() A file_dispatcher takes a file descriptor or file object along with an - optional map argument and wraps it for use with the :cfunc:`poll` or - :cfunc:`loop` functions. If provided a file object or anything with a - :cfunc:`fileno` method, that method will be called and passed to the + optional map argument and wraps it for use with the :c:func:`poll` or + :c:func:`loop` functions. If provided a file object or anything with a + :c:func:`fileno` method, that method will be called and passed to the :class:`file_wrapper` constructor. Availability: UNIX. .. class:: file_wrapper() diff --git a/Doc/library/bsddb.rst b/Doc/library/bsddb.rst --- a/Doc/library/bsddb.rst +++ b/Doc/library/bsddb.rst @@ -54,7 +54,7 @@ optional *flag* identifies the mode used to open the file. It may be ``'r'`` (read only), ``'w'`` (read-write) , ``'c'`` (read-write - create if necessary; the default) or ``'n'`` (read-write - truncate to zero length). The other - arguments are rarely used and are just passed to the low-level :cfunc:`dbopen` + arguments are rarely used and are just passed to the low-level :c:func:`dbopen` function. Consult the Berkeley DB documentation for their use and interpretation. diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -759,9 +759,9 @@ --------------------- Unicode strings are stored internally as sequences of codepoints (to be precise -as :ctype:`Py_UNICODE` arrays). Depending on the way Python is compiled (either +as :c:type:`Py_UNICODE` arrays). Depending on the way Python is compiled (either via ``--enable-unicode=ucs2`` or ``--enable-unicode=ucs4``, with the -former being the default) :ctype:`Py_UNICODE` is either a 16-bit or 32-bit data +former being the default) :c:type:`Py_UNICODE` is either a 16-bit or 32-bit data type. Once a Unicode object is used outside of CPU and memory, CPU endianness and how these arrays are stored as bytes become an issue. Transforming a unicode object into a sequence of bytes is called encoding and recreating the diff --git a/Doc/library/commands.rst b/Doc/library/commands.rst --- a/Doc/library/commands.rst +++ b/Doc/library/commands.rst @@ -38,7 +38,7 @@ ``(status, output)``. *cmd* is actually run as ``{ cmd ; } 2>&1``, so that the returned output will contain output or error messages. A trailing newline is stripped from the output. The exit status for the command can be interpreted - according to the rules for the C function :cfunc:`wait`. + according to the rules for the C function :c:func:`wait`. .. function:: getoutput(cmd) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -40,7 +40,7 @@ loads libraries which export functions using the standard ``cdecl`` calling convention, while *windll* libraries call functions using the ``stdcall`` calling convention. *oledll* also uses the ``stdcall`` calling convention, and -assumes the functions return a Windows :ctype:`HRESULT` error code. The error +assumes the functions return a Windows :c:type:`HRESULT` error code. The error code is used to automatically raise a :class:`WindowsError` exception when the function call fails. @@ -201,9 +201,9 @@ ``None``, integers, longs, byte strings and unicode strings are the only native Python objects that can directly be used as parameters in these function calls. ``None`` is passed as a C ``NULL`` pointer, byte strings and unicode strings are -passed as pointer to the memory block that contains their data (:ctype:`char *` -or :ctype:`wchar_t *`). Python integers and Python longs are passed as the -platforms default C :ctype:`int` type, their value is masked to fit into the C +passed as pointer to the memory block that contains their data (:c:type:`char *` +or :c:type:`wchar_t *`). Python integers and Python longs are passed as the +platforms default C :c:type:`int` type, their value is masked to fit into the C type. Before we move on calling functions with other parameter types, we have to learn @@ -217,48 +217,48 @@ :mod:`ctypes` defines a number of primitive C compatible data types : -+----------------------+----------------------------------------+----------------------------+ -| ctypes type | C type | Python type | -+======================+========================================+============================+ -| :class:`c_bool` | :ctype:`_Bool` | bool (1) | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_char` | :ctype:`char` | 1-character string | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_wchar` | :ctype:`wchar_t` | 1-character unicode string | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_byte` | :ctype:`char` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_ubyte` | :ctype:`unsigned char` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_short` | :ctype:`short` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_ushort` | :ctype:`unsigned short` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_int` | :ctype:`int` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_uint` | :ctype:`unsigned int` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_long` | :ctype:`long` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_ulong` | :ctype:`unsigned long` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_longlong` | :ctype:`__int64` or :ctype:`long long` | int/long | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_ulonglong` | :ctype:`unsigned __int64` or | int/long | -| | :ctype:`unsigned long long` | | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_float` | :ctype:`float` | float | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_double` | :ctype:`double` | float | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_longdouble`| :ctype:`long double` | float | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_char_p` | :ctype:`char *` (NUL terminated) | string or ``None`` | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_wchar_p` | :ctype:`wchar_t *` (NUL terminated) | unicode or ``None`` | -+----------------------+----------------------------------------+----------------------------+ -| :class:`c_void_p` | :ctype:`void *` | int/long or ``None`` | -+----------------------+----------------------------------------+----------------------------+ ++----------------------+------------------------------------------+----------------------------+ +| ctypes type | C type | Python type | ++======================+==========================================+============================+ +| :class:`c_bool` | :c:type:`_Bool` | bool (1) | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_char` | :c:type:`char` | 1-character string | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_wchar` | :c:type:`wchar_t` | 1-character unicode string | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_byte` | :c:type:`char` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_ubyte` | :c:type:`unsigned char` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_short` | :c:type:`short` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_ushort` | :c:type:`unsigned short` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_int` | :c:type:`int` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_uint` | :c:type:`unsigned int` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_long` | :c:type:`long` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_ulong` | :c:type:`unsigned long` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_longlong` | :c:type:`__int64` or :c:type:`long long` | int/long | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_ulonglong` | :c:type:`unsigned __int64` or | int/long | +| | :c:type:`unsigned long long` | | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_float` | :c:type:`float` | float | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_double` | :c:type:`double` | float | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_longdouble`| :c:type:`long double` | float | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_char_p` | :c:type:`char *` (NUL terminated) | string or ``None`` | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_wchar_p` | :c:type:`wchar_t *` (NUL terminated) | unicode or ``None`` | ++----------------------+------------------------------------------+----------------------------+ +| :class:`c_void_p` | :c:type:`void *` | int/long or ``None`` | ++----------------------+------------------------------------------+----------------------------+ (1) The constructor accepts any object with a truth value. @@ -329,7 +329,7 @@ The :func:`create_string_buffer` function replaces the :func:`c_buffer` function (which is still available as an alias), as well as the :func:`c_string` function from earlier ctypes releases. To create a mutable memory block containing -unicode characters of the C type :ctype:`wchar_t` use the +unicode characters of the C type :c:type:`wchar_t` use the :func:`create_unicode_buffer` function. @@ -440,7 +440,7 @@ Return types ^^^^^^^^^^^^ -By default functions are assumed to return the C :ctype:`int` type. Other +By default functions are assumed to return the C :c:type:`int` type. Other return types can be specified by setting the :attr:`restype` attribute of the function object. @@ -1338,7 +1338,7 @@ Instances of this class represent loaded shared libraries. Functions in these libraries use the standard C calling convention, and are assumed to return - :ctype:`int`. + :c:type:`int`. .. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False) @@ -1355,7 +1355,7 @@ Windows only: Instances of this class represent loaded shared libraries, functions in these libraries use the ``stdcall`` calling convention, and are - assumed to return :ctype:`int` by default. + assumed to return :c:type:`int` by default. On Windows CE only the standard calling convention is used, for convenience the :class:`WinDLL` and :class:`OleDLL` use the standard calling convention on this @@ -1500,7 +1500,7 @@ An instance of :class:`PyDLL` that exposes Python C API functions as attributes. Note that all these functions are assumed to return C - :ctype:`int`, which is of course not always the truth, so you have to assign + :c:type:`int`, which is of course not always the truth, so you have to assign the correct :attr:`restype` attribute to use these functions. @@ -1530,10 +1530,10 @@ .. attribute:: restype Assign a ctypes type to specify the result type of the foreign function. - Use ``None`` for :ctype:`void`, a function not returning anything. + Use ``None`` for :c:type:`void`, a function not returning anything. It is possible to assign a callable Python object that is not a ctypes - type, in this case the function is assumed to return a C :ctype:`int`, and + type, in this case the function is assumed to return a C :c:type:`int`, and the callable will be called with this integer, allowing to do further processing or error checking. Using this is deprecated, for more flexible post processing or error checking use a ctypes data type as @@ -2159,21 +2159,21 @@ .. class:: c_byte - Represents the C :ctype:`signed char` datatype, and interprets the value as + Represents the C :c:type:`signed char` datatype, and interprets the value as small integer. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_char - Represents the C :ctype:`char` datatype, and interprets the value as a single + Represents the C :c:type:`char` datatype, and interprets the value as a single character. The constructor accepts an optional string initializer, the length of the string must be exactly one character. .. class:: c_char_p - Represents the C :ctype:`char *` datatype when it points to a zero-terminated + Represents the C :c:type:`char *` datatype when it points to a zero-terminated string. For a general character pointer that may also point to binary data, ``POINTER(c_char)`` must be used. The constructor accepts an integer address, or a string. @@ -2181,13 +2181,13 @@ .. class:: c_double - Represents the C :ctype:`double` datatype. The constructor accepts an + Represents the C :c:type:`double` datatype. The constructor accepts an optional float initializer. .. class:: c_longdouble - Represents the C :ctype:`long double` datatype. The constructor accepts an + Represents the C :c:type:`long double` datatype. The constructor accepts an optional float initializer. On platforms where ``sizeof(long double) == sizeof(double)`` it is an alias to :class:`c_double`. @@ -2195,150 +2195,150 @@ .. class:: c_float - Represents the C :ctype:`float` datatype. The constructor accepts an + Represents the C :c:type:`float` datatype. The constructor accepts an optional float initializer. .. class:: c_int - Represents the C :ctype:`signed int` datatype. The constructor accepts an + Represents the C :c:type:`signed int` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`. .. class:: c_int8 - Represents the C 8-bit :ctype:`signed int` datatype. Usually an alias for + Represents the C 8-bit :c:type:`signed int` datatype. Usually an alias for :class:`c_byte`. .. class:: c_int16 - Represents the C 16-bit :ctype:`signed int` datatype. Usually an alias for + Represents the C 16-bit :c:type:`signed int` datatype. Usually an alias for :class:`c_short`. .. class:: c_int32 - Represents the C 32-bit :ctype:`signed int` datatype. Usually an alias for + Represents the C 32-bit :c:type:`signed int` datatype. Usually an alias for :class:`c_int`. .. class:: c_int64 - Represents the C 64-bit :ctype:`signed int` datatype. Usually an alias for + Represents the C 64-bit :c:type:`signed int` datatype. Usually an alias for :class:`c_longlong`. .. class:: c_long - Represents the C :ctype:`signed long` datatype. The constructor accepts an + Represents the C :c:type:`signed long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_longlong - Represents the C :ctype:`signed long long` datatype. The constructor accepts + Represents the C :c:type:`signed long long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_short - Represents the C :ctype:`signed short` datatype. The constructor accepts an + Represents the C :c:type:`signed short` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_size_t - Represents the C :ctype:`size_t` datatype. + Represents the C :c:type:`size_t` datatype. .. class:: c_ssize_t - Represents the C :ctype:`ssize_t` datatype. + Represents the C :c:type:`ssize_t` datatype. .. versionadded:: 2.7 .. class:: c_ubyte - Represents the C :ctype:`unsigned char` datatype, it interprets the value as + Represents the C :c:type:`unsigned char` datatype, it interprets the value as small integer. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_uint - Represents the C :ctype:`unsigned int` datatype. The constructor accepts an + Represents the C :c:type:`unsigned int` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. On platforms where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`. .. class:: c_uint8 - Represents the C 8-bit :ctype:`unsigned int` datatype. Usually an alias for + Represents the C 8-bit :c:type:`unsigned int` datatype. Usually an alias for :class:`c_ubyte`. .. class:: c_uint16 - Represents the C 16-bit :ctype:`unsigned int` datatype. Usually an alias for + Represents the C 16-bit :c:type:`unsigned int` datatype. Usually an alias for :class:`c_ushort`. .. class:: c_uint32 - Represents the C 32-bit :ctype:`unsigned int` datatype. Usually an alias for + Represents the C 32-bit :c:type:`unsigned int` datatype. Usually an alias for :class:`c_uint`. .. class:: c_uint64 - Represents the C 64-bit :ctype:`unsigned int` datatype. Usually an alias for + Represents the C 64-bit :c:type:`unsigned int` datatype. Usually an alias for :class:`c_ulonglong`. .. class:: c_ulong - Represents the C :ctype:`unsigned long` datatype. The constructor accepts an + Represents the C :c:type:`unsigned long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_ulonglong - Represents the C :ctype:`unsigned long long` datatype. The constructor + Represents the C :c:type:`unsigned long long` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_ushort - Represents the C :ctype:`unsigned short` datatype. The constructor accepts + Represents the C :c:type:`unsigned short` datatype. The constructor accepts an optional integer initializer; no overflow checking is done. .. class:: c_void_p - Represents the C :ctype:`void *` type. The value is represented as integer. + Represents the C :c:type:`void *` type. The value is represented as integer. The constructor accepts an optional integer initializer. .. class:: c_wchar - Represents the C :ctype:`wchar_t` datatype, and interprets the value as a + Represents the C :c:type:`wchar_t` datatype, and interprets the value as a single character unicode string. The constructor accepts an optional string initializer, the length of the string must be exactly one character. .. class:: c_wchar_p - Represents the C :ctype:`wchar_t *` datatype, which must be a pointer to a + Represents the C :c:type:`wchar_t *` datatype, which must be a pointer to a zero-terminated wide character string. The constructor accepts an integer address, or a string. .. class:: c_bool - Represent the C :ctype:`bool` datatype (more accurately, :ctype:`_Bool` from + Represent the C :c:type:`bool` datatype (more accurately, :c:type:`_Bool` from C99). Its value can be True or False, and the constructor accepts any object that has a truth value. @@ -2347,18 +2347,18 @@ .. class:: HRESULT - Windows only: Represents a :ctype:`HRESULT` value, which contains success or + Windows only: Represents a :c:type:`HRESULT` value, which contains success or error information for a function or method call. .. class:: py_object - Represents the C :ctype:`PyObject *` datatype. Calling this without an - argument creates a ``NULL`` :ctype:`PyObject *` pointer. + Represents the C :c:type:`PyObject *` datatype. Calling this without an + argument creates a ``NULL`` :c:type:`PyObject *` pointer. The :mod:`ctypes.wintypes` module provides quite some other Windows specific -data types, for example :ctype:`HWND`, :ctype:`WPARAM`, or :ctype:`DWORD`. Some -useful structures like :ctype:`MSG` or :ctype:`RECT` are also defined. +data types, for example :c:type:`HWND`, :c:type:`WPARAM`, or :c:type:`DWORD`. Some +useful structures like :c:type:`MSG` or :c:type:`RECT` are also defined. .. _ctypes-structured-data-types: diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -360,7 +360,7 @@ Return the local date corresponding to the POSIX timestamp, such as is returned by :func:`time.time`. This may raise :exc:`ValueError`, if the timestamp is out - of the range of values supported by the platform C :cfunc:`localtime` function. + of the range of values supported by the platform C :c:func:`localtime` function. It's common for this to be restricted to years from 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by :meth:`fromtimestamp`. @@ -534,7 +534,7 @@ Return a string representing the date, for example ``date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'``. ``d.ctime()`` is equivalent to ``time.ctime(time.mktime(d.timetuple()))`` on platforms where the native C - :cfunc:`ctime` function (which :func:`time.ctime` invokes, but which + :c:func:`ctime` function (which :func:`time.ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to the C standard. @@ -641,7 +641,7 @@ or not specified, this is like :meth:`today`, but, if possible, supplies more precision than can be gotten from going through a :func:`time.time` timestamp (for example, this may be possible on platforms supplying the C - :cfunc:`gettimeofday` function). + :c:func:`gettimeofday` function). Else *tz* must be an instance of a class :class:`tzinfo` subclass, and the current date and time are converted to *tz*'s time zone. In this case the @@ -669,8 +669,8 @@ ``tz.fromutc(datetime.utcfromtimestamp(timestamp).replace(tzinfo=tz))``. :meth:`fromtimestamp` may raise :exc:`ValueError`, if the timestamp is out of - the range of values supported by the platform C :cfunc:`localtime` or - :cfunc:`gmtime` functions. It's common for this to be restricted to years in + the range of values supported by the platform C :c:func:`localtime` or + :c:func:`gmtime` functions. It's common for this to be restricted to years in 1970 through 2038. Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by :meth:`fromtimestamp`, and then it's possible to have two timestamps differing by a second that yield @@ -681,7 +681,7 @@ Return the UTC :class:`datetime` corresponding to the POSIX timestamp, with :attr:`tzinfo` ``None``. This may raise :exc:`ValueError`, if the timestamp is - out of the range of values supported by the platform C :cfunc:`gmtime` function. + out of the range of values supported by the platform C :c:func:`gmtime` function. It's common for this to be restricted to years in 1970 through 2038. See also :meth:`fromtimestamp`. @@ -1024,7 +1024,7 @@ Return a string representing the date and time, for example ``datetime(2002, 12, 4, 20, 30, 40).ctime() == 'Wed Dec 4 20:30:40 2002'``. ``d.ctime()`` is equivalent to ``time.ctime(time.mktime(d.timetuple()))`` on platforms where the - native C :cfunc:`ctime` function (which :func:`time.ctime` invokes, but which + native C :c:func:`ctime` function (which :func:`time.ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms to the C standard. diff --git a/Doc/library/dl.rst b/Doc/library/dl.rst --- a/Doc/library/dl.rst +++ b/Doc/library/dl.rst @@ -13,7 +13,7 @@ .. sectionauthor:: Moshe Zadka -The :mod:`dl` module defines an interface to the :cfunc:`dlopen` function, which +The :mod:`dl` module defines an interface to the :c:func:`dlopen` function, which is the most common interface on Unix platforms for handling dynamically linked libraries. It allows the program to call arbitrary functions in such a library. @@ -105,10 +105,10 @@ Call the function named *name* in the referenced shared object. The arguments must be either Python integers, which will be passed as is, Python strings, to which a pointer will be passed, or ``None``, which will be passed as *NULL*. - Note that strings should only be passed to functions as :ctype:`const char\*`, + Note that strings should only be passed to functions as :c:type:`const char\*`, as Python will not like its string mutated. There must be at most 10 arguments, and arguments not given will be treated as - ``None``. The function's return value must be a C :ctype:`long`, which is a + ``None``. The function's return value must be a C :c:type:`long`, which is a Python integer. diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -220,7 +220,7 @@ Raised when an operation runs out of memory but the situation may still be rescued (by deleting some objects). The associated value is a string indicating what kind of (internal) operation ran out of memory. Note that because of the - underlying memory management architecture (C's :cfunc:`malloc` function), the + underlying memory management architecture (C's :c:func:`malloc` function), the interpreter may not always be able to completely recover from this situation; it nevertheless raises an exception so that a stack traceback can be printed, in case a run-away program was the cause. @@ -249,8 +249,8 @@ This exception is derived from :exc:`EnvironmentError`. It is raised when a function returns a system-related error (not for illegal argument types or other incidental errors). The :attr:`errno` attribute is a numeric error - code from :cdata:`errno`, and the :attr:`strerror` attribute is the - corresponding string, as would be printed by the C function :cfunc:`perror`. + code from :c:data:`errno`, and the :attr:`strerror` attribute is the + corresponding string, as would be printed by the C function :c:func:`perror`. See the module :mod:`errno`, which contains names for the error codes defined by the underlying operating system. @@ -342,7 +342,7 @@ This exception is raised by the :func:`sys.exit` function. When it is not handled, the Python interpreter exits; no stack traceback is printed. If the associated value is a plain integer, it specifies the system exit status (passed - to C's :cfunc:`exit` function); if it is ``None``, the exit status is zero; if + to C's :c:func:`exit` function); if it is ``None``, the exit status is zero; if it has another type (such as a string), the object's value is printed and the exit status is one. @@ -429,16 +429,16 @@ .. exception:: WindowsError Raised when a Windows-specific error occurs or when the error number does not - correspond to an :cdata:`errno` value. The :attr:`winerror` and + correspond to an :c:data:`errno` value. The :attr:`winerror` and :attr:`strerror` values are created from the return values of the - :cfunc:`GetLastError` and :cfunc:`FormatMessage` functions from the Windows + :c:func:`GetLastError` and :c:func:`FormatMessage` functions from the Windows Platform API. The :attr:`errno` value maps the :attr:`winerror` value to corresponding ``errno.h`` values. This is a subclass of :exc:`OSError`. .. versionadded:: 2.0 .. versionchanged:: 2.5 - Previous versions put the :cfunc:`GetLastError` codes into :attr:`errno`. + Previous versions put the :c:func:`GetLastError` codes into :attr:`errno`. .. exception:: ZeroDivisionError diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -13,7 +13,7 @@ pair: UNIX; I/O control This module performs file control and I/O control on file descriptors. It is an -interface to the :cfunc:`fcntl` and :cfunc:`ioctl` Unix routines. +interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. All functions in this module take a file descriptor *fd* as their first argument. This can be an integer file descriptor, such as returned by @@ -31,17 +31,17 @@ :mod:`fcntl` module. The argument *arg* is optional, and defaults to the integer value ``0``. When present, it can either be an integer value, or a string. With the argument missing or an integer value, the return value of this function - is the integer return value of the C :cfunc:`fcntl` call. When the argument is + is the integer return value of the C :c:func:`fcntl` call. When the argument is a string it represents a binary structure, e.g. created by :func:`struct.pack`. The binary data is copied to a buffer whose address is passed to the C - :cfunc:`fcntl` call. The return value after a successful call is the contents + :c:func:`fcntl` call. The return value after a successful call is the contents of the buffer, converted to a string object. The length of the returned string will be the same as the length of the *arg* argument. This is limited to 1024 bytes. If the information returned in the buffer by the operating system is larger than 1024 bytes, this is most likely to result in a segmentation violation or a more subtle data corruption. - If the :cfunc:`fcntl` fails, an :exc:`IOError` is raised. + If the :c:func:`fcntl` fails, an :exc:`IOError` is raised. .. function:: ioctl(fd, op[, arg[, mutate_flag]]) @@ -97,7 +97,7 @@ Perform the lock operation *op* on file descriptor *fd* (file objects providing a :meth:`fileno` method are accepted as well). See the Unix manual :manpage:`flock(2)` for details. (On some systems, this function is emulated - using :cfunc:`fcntl`.) + using :c:func:`fcntl`.) .. function:: lockf(fd, operation, [length, [start, [whence]]]) diff --git a/Doc/library/fl.rst b/Doc/library/fl.rst --- a/Doc/library/fl.rst +++ b/Doc/library/fl.rst @@ -29,8 +29,8 @@ the 'current form' maintained by the library to which new FORMS objects are added, all functions that add a FORMS object to a form are methods of the Python object representing the form. Consequently, there are no Python equivalents for -the C functions :cfunc:`fl_addto_form` and :cfunc:`fl_end_form`, and the -equivalent of :cfunc:`fl_bgn_form` is called :func:`fl.make_form`. +the C functions :c:func:`fl_addto_form` and :c:func:`fl_end_form`, and the +equivalent of :c:func:`fl_bgn_form` is called :func:`fl.make_form`. Watch out for the somewhat confusing terminology: FORMS uses the word :dfn:`object` for the buttons, sliders etc. that you can place in a form. In @@ -44,7 +44,7 @@ event handling is available, though, so you can mix FORMS with pure GL windows. **Please note:** importing :mod:`fl` implies a call to the GL function -:cfunc:`foreground` and to the FORMS routine :cfunc:`fl_init`. +:c:func:`foreground` and to the FORMS routine :c:func:`fl_init`. .. _fl-functions: @@ -88,7 +88,7 @@ .. function:: get_rgbmode() Return the current rgb mode. This is the value of the C global variable - :cdata:`fl_rgbmode`. + :c:data:`fl_rgbmode`. .. function:: show_message(str1, str2, str3) @@ -153,8 +153,8 @@ mapcolor() getmcolor() - See the description in the FORMS documentation of :cfunc:`fl_color`, - :cfunc:`fl_mapcolor` and :cfunc:`fl_getmcolor`. + See the description in the FORMS documentation of :c:func:`fl_color`, + :c:func:`fl_mapcolor` and :c:func:`fl_getmcolor`. .. _form-objects: diff --git a/Doc/library/fm.rst b/Doc/library/fm.rst --- a/Doc/library/fm.rst +++ b/Doc/library/fm.rst @@ -30,7 +30,7 @@ .. function:: init() - Initialization function. Calls :cfunc:`fminit`. It is normally not necessary to + Initialization function. Calls :c:func:`fminit`. It is normally not necessary to call this function, since it is called automatically the first time the :mod:`fm` module is imported. @@ -43,7 +43,7 @@ .. function:: enumerate() Returns a list of available font names. This is an interface to - :cfunc:`fmenumerate`. + :c:func:`fmenumerate`. .. function:: prstr(string) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -808,7 +808,7 @@ :exc:`IOError` is raised. When opening a file, it's preferable to use :func:`open` instead of invoking the :class:`file` constructor directly. - The first two arguments are the same as for ``stdio``'s :cfunc:`fopen`: + The first two arguments are the same as for ``stdio``'s :c:func:`fopen`: *name* is the file name to be opened, and *mode* is a string indicating how the file is to be opened. @@ -841,7 +841,7 @@ binary mode, on systems that differentiate between binary and text files; on systems that don't have this distinction, adding the ``'b'`` has no effect. - In addition to the standard :cfunc:`fopen` values *mode* may be ``'U'`` or + In addition to the standard :c:func:`fopen` values *mode* may be ``'U'`` or ``'rU'``. Python is usually built with universal newline support; supplying ``'U'`` opens the file as a text file, but lines may be terminated by any of the following: the Unix end-of-line convention ``'\n'``, the Macintosh convention @@ -1662,8 +1662,8 @@ .. [#] It is used relatively rarely so does not warrant being made into a statement. .. [#] Specifying a buffer size currently has no effect on systems that don't have - :cfunc:`setvbuf`. The interface to specify the buffer size is not done using a - method that calls :cfunc:`setvbuf`, because that may dump core when called after + :c:func:`setvbuf`. The interface to specify the buffer size is not done using a + method that calls :c:func:`setvbuf`, because that may dump core when called after any I/O has been performed, and there's no reliable way to determine whether this is the case. diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -11,13 +11,13 @@ .. note:: The :mod:`getopt` module is a parser for command line options whose API is - designed to be familiar to users of the C :cfunc:`getopt` function. Users who - are unfamiliar with the C :cfunc:`getopt` function or who would like to write + designed to be familiar to users of the C :c:func:`getopt` function. Users who + are unfamiliar with the C :c:func:`getopt` function or who would like to write less code and get better help and error messages should consider using the :mod:`argparse` module instead. This module helps scripts to parse the command line arguments in ``sys.argv``. -It supports the same conventions as the Unix :cfunc:`getopt` function (including +It supports the same conventions as the Unix :c:func:`getopt` function (including the special meanings of arguments of the form '``-``' and '``--``'). Long options similar to those supported by GNU software may be used as well via an optional third argument. @@ -32,11 +32,11 @@ be parsed, without the leading reference to the running program. Typically, this means ``sys.argv[1:]``. *options* is the string of option letters that the script wants to recognize, with options that require an argument followed by a - colon (``':'``; i.e., the same format that Unix :cfunc:`getopt` uses). + colon (``':'``; i.e., the same format that Unix :c:func:`getopt` uses). .. note:: - Unlike GNU :cfunc:`getopt`, after a non-option argument, all further + Unlike GNU :c:func:`getopt`, after a non-option argument, all further arguments are considered also non-options. This is similar to the way non-GNU Unix systems work. diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -366,7 +366,7 @@ .. impl-detail:: getsets are attributes defined in extension modules via - :ctype:`PyGetSetDef` structures. For Python implementations without such + :c:type:`PyGetSetDef` structures. For Python implementations without such types, this method will always return ``False``. .. versionadded:: 2.5 @@ -379,7 +379,7 @@ .. impl-detail:: Member descriptors are attributes defined in extension modules via - :ctype:`PyMemberDef` structures. For Python implementations without such + :c:type:`PyMemberDef` structures. For Python implementations without such types, this method will always return ``False``. .. versionadded:: 2.5 diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -219,7 +219,7 @@ .. note:: - The expression is in the syntax suitable for the :cfunc:`regex` function + The expression is in the syntax suitable for the :c:func:`regex` function from the C library, which might differ from the syntax used in :mod:`re`. .. data:: NOEXPR @@ -560,7 +560,7 @@ Python applications should normally find no need to invoke these functions, and should use :mod:`gettext` instead. A known exception to this rule are applications that link with additional C libraries which internally invoke -:cfunc:`gettext` or :func:`dcgettext`. For these applications, it may be +:c:func:`gettext` or :func:`dcgettext`. For these applications, it may be necessary to bind the text domain, so that the libraries can properly locate their message catalogs. diff --git a/Doc/library/macos.rst b/Doc/library/macos.rst --- a/Doc/library/macos.rst +++ b/Doc/library/macos.rst @@ -41,7 +41,7 @@ This exception is raised on MacOS generated errors, either from functions in this module or from other mac-specific modules like the toolbox interfaces. The - arguments are the integer error code (the :cdata:`OSErr` value) and a textual + arguments are the integer error code (the :c:data:`OSErr` value) and a textual description of the error code. Symbolic names for all known error codes are defined in the standard module :mod:`macerrors`. diff --git a/Doc/library/mailbox.rst b/Doc/library/mailbox.rst --- a/Doc/library/mailbox.rst +++ b/Doc/library/mailbox.rst @@ -459,7 +459,7 @@ unlock() Three locking mechanisms are used---dot locking and, if available, the - :cfunc:`flock` and :cfunc:`lockf` system calls. + :c:func:`flock` and :c:func:`lockf` system calls. .. seealso:: @@ -573,7 +573,7 @@ unlock() Three locking mechanisms are used---dot locking and, if available, the - :cfunc:`flock` and :cfunc:`lockf` system calls. For MH mailboxes, locking + :c:func:`flock` and :c:func:`lockf` system calls. For MH mailboxes, locking the mailbox means locking the :file:`.mh_sequences` file and, only for the duration of any operations that affect them, locking individual message files. @@ -671,7 +671,7 @@ unlock() Three locking mechanisms are used---dot locking and, if available, the - :cfunc:`flock` and :cfunc:`lockf` system calls. + :c:func:`flock` and :c:func:`lockf` system calls. .. seealso:: @@ -722,7 +722,7 @@ unlock() Three locking mechanisms are used---dot locking and, if available, the - :cfunc:`flock` and :cfunc:`lockf` system calls. + :c:func:`flock` and :c:func:`lockf` system calls. .. seealso:: diff --git a/Doc/library/msilib.rst b/Doc/library/msilib.rst --- a/Doc/library/msilib.rst +++ b/Doc/library/msilib.rst @@ -44,7 +44,7 @@ .. function:: UuidCreate() Return the string representation of a new unique identifier. This wraps the - Windows API functions :cfunc:`UuidCreate` and :cfunc:`UuidToString`. + Windows API functions :c:func:`UuidCreate` and :c:func:`UuidToString`. .. function:: OpenDatabase(path, persist) @@ -60,7 +60,7 @@ .. function:: CreateRecord(count) - Return a new record object by calling :cfunc:`MSICreateRecord`. *count* is the + Return a new record object by calling :c:func:`MSICreateRecord`. *count* is the number of fields of the record. @@ -135,20 +135,20 @@ .. method:: Database.OpenView(sql) - Return a view object, by calling :cfunc:`MSIDatabaseOpenView`. *sql* is the SQL + Return a view object, by calling :c:func:`MSIDatabaseOpenView`. *sql* is the SQL statement to execute. .. method:: Database.Commit() Commit the changes pending in the current transaction, by calling - :cfunc:`MSIDatabaseCommit`. + :c:func:`MSIDatabaseCommit`. .. method:: Database.GetSummaryInformation(count) Return a new summary information object, by calling - :cfunc:`MsiGetSummaryInformation`. *count* is the maximum number of updated + :c:func:`MsiGetSummaryInformation`. *count* is the maximum number of updated values. @@ -166,7 +166,7 @@ .. method:: View.Execute(params) - Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. If + Execute the SQL query of the view, through :c:func:`MSIViewExecute`. If *params* is not ``None``, it is a record describing actual values of the parameter tokens in the query. @@ -174,18 +174,18 @@ .. method:: View.GetColumnInfo(kind) Return a record describing the columns of the view, through calling - :cfunc:`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or + :c:func:`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or ``MSICOLINFO_TYPES``. .. method:: View.Fetch() - Return a result record of the query, through calling :cfunc:`MsiViewFetch`. + Return a result record of the query, through calling :c:func:`MsiViewFetch`. .. method:: View.Modify(kind, data) - Modify the view, by calling :cfunc:`MsiViewModify`. *kind* can be one of + Modify the view, by calling :c:func:`MsiViewModify`. *kind* can be one of ``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``, ``MSIMODIFY_UPDATE``, ``MSIMODIFY_ASSIGN``, ``MSIMODIFY_REPLACE``, ``MSIMODIFY_MERGE``, ``MSIMODIFY_DELETE``, ``MSIMODIFY_INSERT_TEMPORARY``, @@ -197,7 +197,7 @@ .. method:: View.Close() - Close the view, through :cfunc:`MsiViewClose`. + Close the view, through :c:func:`MsiViewClose`. .. seealso:: @@ -216,7 +216,7 @@ .. method:: SummaryInformation.GetProperty(field) - Return a property of the summary, through :cfunc:`MsiSummaryInfoGetProperty`. + Return a property of the summary, through :c:func:`MsiSummaryInfoGetProperty`. *field* is the name of the property, and can be one of the constants ``PID_CODEPAGE``, ``PID_TITLE``, ``PID_SUBJECT``, ``PID_AUTHOR``, ``PID_KEYWORDS``, ``PID_COMMENTS``, ``PID_TEMPLATE``, ``PID_LASTAUTHOR``, @@ -228,12 +228,12 @@ .. method:: SummaryInformation.GetPropertyCount() Return the number of summary properties, through - :cfunc:`MsiSummaryInfoGetPropertyCount`. + :c:func:`MsiSummaryInfoGetPropertyCount`. .. method:: SummaryInformation.SetProperty(field, value) - Set a property through :cfunc:`MsiSummaryInfoSetProperty`. *field* can have the + Set a property through :c:func:`MsiSummaryInfoSetProperty`. *field* can have the same values as in :meth:`GetProperty`, *value* is the new value of the property. Possible value types are integer and string. @@ -241,7 +241,7 @@ .. method:: SummaryInformation.Persist() Write the modified properties to the summary information stream, using - :cfunc:`MsiSummaryInfoPersist`. + :c:func:`MsiSummaryInfoPersist`. .. seealso:: @@ -260,7 +260,7 @@ .. method:: Record.GetFieldCount() Return the number of fields of the record, through - :cfunc:`MsiRecordGetFieldCount`. + :c:func:`MsiRecordGetFieldCount`. .. method:: Record.GetInteger(field) @@ -277,25 +277,25 @@ .. method:: Record.SetString(field, value) - Set *field* to *value* through :cfunc:`MsiRecordSetString`. *field* must be an + Set *field* to *value* through :c:func:`MsiRecordSetString`. *field* must be an integer; *value* a string. .. method:: Record.SetStream(field, value) Set *field* to the contents of the file named *value*, through - :cfunc:`MsiRecordSetStream`. *field* must be an integer; *value* a string. + :c:func:`MsiRecordSetStream`. *field* must be an integer; *value* a string. .. method:: Record.SetInteger(field, value) - Set *field* to *value* through :cfunc:`MsiRecordSetInteger`. Both *field* and + Set *field* to *value* through :c:func:`MsiRecordSetInteger`. Both *field* and *value* must be an integer. .. method:: Record.ClearData() - Set all fields of the record to 0, through :cfunc:`MsiRecordClearData`. + Set all fields of the record to 0, through :c:func:`MsiRecordClearData`. .. seealso:: diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -152,5 +152,5 @@ .. function:: heapmin() - Force the :cfunc:`malloc` heap to clean itself up and return unused blocks to + Force the :c:func:`malloc` heap to clean itself up and return unused blocks to the operating system. On failure, this raises :exc:`IOError`. diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -408,7 +408,7 @@ .. method:: terminate() Terminate the process. On Unix this is done using the ``SIGTERM`` signal; - on Windows :cfunc:`TerminateProcess` is used. Note that exit handlers and + on Windows :c:func:`TerminateProcess` is used. Note that exit handlers and finally clauses, etc., will not be executed. Note that descendant processes of the process will *not* be terminated -- diff --git a/Doc/library/new.rst b/Doc/library/new.rst --- a/Doc/library/new.rst +++ b/Doc/library/new.rst @@ -48,7 +48,7 @@ .. function:: code(argcount, nlocals, stacksize, flags, codestring, constants, names, varnames, filename, name, firstlineno, lnotab) - This function is an interface to the :cfunc:`PyCode_New` C function. + This function is an interface to the :c:func:`PyCode_New` C function. .. XXX This is still undocumented! diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -94,7 +94,7 @@ On some platforms, including FreeBSD and Mac OS X, setting ``environ`` may cause memory leaks. Refer to the system documentation for - :cfunc:`putenv`. + :c:func:`putenv`. If :func:`putenv` is not provided, a modified copy of this mapping may be passed to the appropriate process-creation functions to cause child processes @@ -309,7 +309,7 @@ .. function:: setpgrp() - Call the system call :cfunc:`setpgrp` or :cfunc:`setpgrp(0, 0)` depending on + Call the system call :c:func:`setpgrp` or :c:func:`setpgrp(0, 0)` depending on which version is implemented (if any). See the Unix manual for the semantics. Availability: Unix. @@ -317,7 +317,7 @@ .. function:: setpgid(pid, pgrp) - Call the system call :cfunc:`setpgid` to set the process group id of the + Call the system call :c:func:`setpgid` to set the process group id of the process with id *pid* to the process group with id *pgrp*. See the Unix manual for the semantics. @@ -358,7 +358,7 @@ .. function:: getsid(pid) - Call the system call :cfunc:`getsid`. See the Unix manual for the semantics. + Call the system call :c:func:`getsid`. See the Unix manual for the semantics. Availability: Unix. @@ -367,7 +367,7 @@ .. function:: setsid() - Call the system call :cfunc:`setsid`. See the Unix manual for the semantics. + Call the system call :c:func:`setsid`. See the Unix manual for the semantics. Availability: Unix. @@ -385,7 +385,7 @@ .. function:: strerror(code) Return the error message corresponding to the error code in *code*. - On platforms where :cfunc:`strerror` returns ``NULL`` when given an unknown + On platforms where :c:func:`strerror` returns ``NULL`` when given an unknown error number, :exc:`ValueError` is raised. Availability: Unix, Windows. @@ -454,7 +454,7 @@ .. versionchanged:: 2.5 On Unix, when the *mode* argument starts with ``'a'``, the *O_APPEND* flag is - set on the file descriptor (which the :cfunc:`fdopen` implementation already + set on the file descriptor (which the :c:func:`fdopen` implementation already does on most platforms). @@ -477,7 +477,7 @@ .. versionchanged:: 2.0 This function worked unreliably under Windows in earlier versions of Python. - This was due to the use of the :cfunc:`_popen` function from the libraries + This was due to the use of the :c:func:`_popen` function from the libraries provided with Windows. Newer versions of Python do not use the broken implementation from the Windows libraries. @@ -697,7 +697,7 @@ .. function:: fsync(fd) Force write of file with filedescriptor *fd* to disk. On Unix, this calls the - native :cfunc:`fsync` function; on Windows, the MS :cfunc:`_commit` function. + native :c:func:`fsync` function; on Windows, the MS :c:func:`_commit` function. If you're starting with a Python file object *f*, first do ``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all internal buffers associated @@ -1142,7 +1142,7 @@ .. function:: lstat(path) - Perform the equivalent of an :cfunc:`lstat` system call on the given path. + Perform the equivalent of an :c:func:`lstat` system call on the given path. Similar to :func:`~os.stat`, but does not follow symbolic links. On platforms that do not support symbolic links, this is an alias for :func:`~os.stat`. @@ -1180,7 +1180,7 @@ .. function:: major(device) Extract the device major number from a raw device number (usually the - :attr:`st_dev` or :attr:`st_rdev` field from :ctype:`stat`). + :attr:`st_dev` or :attr:`st_rdev` field from :c:type:`stat`). .. versionadded:: 2.3 @@ -1188,7 +1188,7 @@ .. function:: minor(device) Extract the device minor number from a raw device number (usually the - :attr:`st_dev` or :attr:`st_rdev` field from :ctype:`stat`). + :attr:`st_dev` or :attr:`st_rdev` field from :c:type:`stat`). .. versionadded:: 2.3 @@ -1343,11 +1343,11 @@ .. function:: stat(path) - Perform the equivalent of a :cfunc:`stat` system call on the given path. + Perform the equivalent of a :c:func:`stat` system call on the given path. (This function follows symlinks; to stat a symlink use :func:`lstat`.) The return value is an object whose attributes correspond to the members - of the :ctype:`stat` structure, namely: + of the :c:type:`stat` structure, namely: * :attr:`st_mode` - protection bits, * :attr:`st_ino` - inode number, @@ -1404,7 +1404,7 @@ For backward compatibility, the return value of :func:`~os.stat` is also accessible as a tuple of at least 10 integers giving the most important (and portable) - members of the :ctype:`stat` structure, in the order :attr:`st_mode`, + members of the :c:type:`stat` structure, in the order :attr:`st_mode`, :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:`st_uid`, :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:`st_mtime`, :attr:`st_ctime`. More items may be added at the end by some implementations. @@ -1412,7 +1412,7 @@ .. index:: module: stat The standard module :mod:`stat` defines functions and constants that are useful - for extracting information from a :ctype:`stat` structure. (On Windows, some + for extracting information from a :c:type:`stat` structure. (On Windows, some items are filled with dummy values.) Example:: @@ -1461,9 +1461,9 @@ .. function:: statvfs(path) - Perform a :cfunc:`statvfs` system call on the given path. The return value is + Perform a :c:func:`statvfs` system call on the given path. The return value is an object whose attributes describe the filesystem on the given path, and - correspond to the members of the :ctype:`statvfs` structure, namely: + correspond to the members of the :c:type:`statvfs` structure, namely: :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`, :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`, :attr:`f_flag`, :attr:`f_namemax`. @@ -1473,7 +1473,7 @@ For backward compatibility, the return value is also accessible as a tuple whose values correspond to the attributes, in the order given above. The standard module :mod:`statvfs` defines constants that are useful for extracting - information from a :ctype:`statvfs` structure when accessing it as a sequence; + information from a :c:type:`statvfs` structure when accessing it as a sequence; this remains useful when writing code that needs to work with versions of Python that don't support accessing the fields as attributes. @@ -1664,7 +1664,7 @@ program loaded into the process. In each case, the first of these arguments is passed to the new program as its own name rather than as an argument a user may have typed on a command line. For the C programmer, this is the ``argv[0]`` -passed to a program's :cfunc:`main`. For example, ``os.execv('/bin/echo', +passed to a program's :c:func:`main`. For example, ``os.execv('/bin/echo', ['foo', 'bar'])`` will only print ``bar`` on standard output; ``foo`` will seem to be ignored. @@ -2117,7 +2117,7 @@ There is no option to wait for the application to close, and no way to retrieve the application's exit status. The *path* parameter is relative to the current directory. If you want to use an absolute path, make sure the first character - is not a slash (``'/'``); the underlying Win32 :cfunc:`ShellExecute` function + is not a slash (``'/'``); the underlying Win32 :c:func:`ShellExecute` function doesn't work if it is. Use the :func:`os.path.normpath` function to ensure that the path is properly encoded for Win32. @@ -2132,13 +2132,13 @@ .. function:: system(command) Execute the command (a string) in a subshell. This is implemented by calling - the Standard C function :cfunc:`system`, and has the same limitations. + the Standard C function :c:func:`system`, and has the same limitations. Changes to :data:`sys.stdin`, etc. are not reflected in the environment of the executed command. On Unix, the return value is the exit status of the process encoded in the format specified for :func:`wait`. Note that POSIX does not specify the meaning - of the return value of the C :cfunc:`system` function, so the return value of + of the return value of the C :c:func:`system` function, so the return value of the Python function is system-dependent. On Windows, the return value is that returned by the system shell after running diff --git a/Doc/library/ossaudiodev.rst b/Doc/library/ossaudiodev.rst --- a/Doc/library/ossaudiodev.rst +++ b/Doc/library/ossaudiodev.rst @@ -59,7 +59,7 @@ what went wrong. (If :mod:`ossaudiodev` receives an error from a system call such as - :cfunc:`open`, :cfunc:`write`, or :cfunc:`ioctl`, it raises :exc:`IOError`. + :c:func:`open`, :c:func:`write`, or :c:func:`ioctl`, it raises :exc:`IOError`. Errors detected directly by :mod:`ossaudiodev` result in :exc:`OSSAudioError`.) (For backwards compatibility, the exception class is also available as diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -33,8 +33,8 @@ returned as strings. Values that cannot be determined are returned as given by the parameter presets. - If bits is given as ``''``, the :cfunc:`sizeof(pointer)` (or - :cfunc:`sizeof(long)` on Python version < 1.5.2) is used as indicator for the + If bits is given as ``''``, the :c:func:`sizeof(pointer)` (or + :c:func:`sizeof(long)` on Python version < 1.5.2) is used as indicator for the supported pointer size. The function relies on the system's :file:`file` command to do the actual work. diff --git a/Doc/library/popen2.rst b/Doc/library/popen2.rst --- a/Doc/library/popen2.rst +++ b/Doc/library/popen2.rst @@ -104,7 +104,7 @@ Waits for and returns the status code of the child process. The status code encodes both the return code of the process and information about whether it - exited using the :cfunc:`exit` system call or died due to a signal. Functions + exited using the :c:func:`exit` system call or died due to a signal. Functions to help interpret the status code are defined in the :mod:`os` module; see section :ref:`os-process` for the :func:`W\*` family of functions. diff --git a/Doc/library/posix.rst b/Doc/library/posix.rst --- a/Doc/library/posix.rst +++ b/Doc/library/posix.rst @@ -38,13 +38,13 @@ Several operating systems (including AIX, HP-UX, Irix and Solaris) provide support for files that are larger than 2 GB from a C programming model where -:ctype:`int` and :ctype:`long` are 32-bit values. This is typically accomplished +:c:type:`int` and :c:type:`long` are 32-bit values. This is typically accomplished by defining the relevant size and offset types as 64-bit values. Such files are sometimes referred to as :dfn:`large files`. -Large file support is enabled in Python when the size of an :ctype:`off_t` is -larger than a :ctype:`long` and the :ctype:`long long` type is available and is -at least as large as an :ctype:`off_t`. Python longs are then used to represent +Large file support is enabled in Python when the size of an :c:type:`off_t` is +larger than a :c:type:`long` and the :c:type:`long long` type is available and is +at least as large as an :c:type:`off_t`. Python longs are then used to represent file sizes, offsets and other values that can exceed the range of a Python int. It may be necessary to configure and compile Python with certain compiler flags to enable this mode. For example, it is enabled by default with recent versions diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -1053,14 +1053,14 @@ .. index:: single: scanf() -Python does not currently have an equivalent to :cfunc:`scanf`. Regular +Python does not currently have an equivalent to :c:func:`scanf`. Regular expressions are generally more powerful, though also more verbose, than -:cfunc:`scanf` format strings. The table below offers some more-or-less -equivalent mappings between :cfunc:`scanf` format tokens and regular +:c:func:`scanf` format strings. The table below offers some more-or-less +equivalent mappings between :c:func:`scanf` format tokens and regular expressions. +--------------------------------+---------------------------------------------+ -| :cfunc:`scanf` Token | Regular Expression | +| :c:func:`scanf` Token | Regular Expression | +================================+=============================================+ | ``%c`` | ``.`` | +--------------------------------+---------------------------------------------+ @@ -1085,7 +1085,7 @@ /usr/sbin/sendmail - 0 errors, 4 warnings -you would use a :cfunc:`scanf` format like :: +you would use a :c:func:`scanf` format like :: %s - %d errors, %d warnings diff --git a/Doc/library/restricted.rst b/Doc/library/restricted.rst --- a/Doc/library/restricted.rst +++ b/Doc/library/restricted.rst @@ -31,7 +31,7 @@ might be deemed "safe" for untrusted code to read any file within a specified directory, but never to write a file. In this case, the supervisor may redefine the built-in :func:`open` function so that it raises an exception whenever the -*mode* parameter is ``'w'``. It might also perform a :cfunc:`chroot`\ -like +*mode* parameter is ``'w'``. It might also perform a :c:func:`chroot`\ -like operation on the *filename* parameter, such that root is always relative to some safe "sandbox" area of the filesystem. In this case, the untrusted code would still see an built-in :func:`open` function in its environment, with the same diff --git a/Doc/library/rfc822.rst b/Doc/library/rfc822.rst --- a/Doc/library/rfc822.rst +++ b/Doc/library/rfc822.rst @@ -42,8 +42,8 @@ from a buffered stream. The optional *seekable* argument is provided as a workaround for certain stdio - libraries in which :cfunc:`tell` discards buffered data before discovering that - the :cfunc:`lseek` system call doesn't work. For maximum portability, you + libraries in which :c:func:`tell` discards buffered data before discovering that + the :c:func:`lseek` system call doesn't work. For maximum portability, you should set the seekable argument to zero to prevent that initial :meth:`tell` when passing in an unseekable object such as a file object created from a socket object. diff --git a/Doc/library/select.rst b/Doc/library/select.rst --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -6,9 +6,9 @@ :synopsis: Wait for I/O completion on multiple streams. -This module provides access to the :cfunc:`select` and :cfunc:`poll` functions -available in most operating systems, :cfunc:`epoll` available on Linux 2.5+ and -:cfunc:`kqueue` available on most BSD. +This module provides access to the :c:func:`select` and :c:func:`poll` functions +available in most operating systems, :c:func:`epoll` available on Linux 2.5+ and +:c:func:`kqueue` available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it also works for other file types (in particular, on Unix, it works on pipes). It cannot be used on regular files to determine whether a file has grown since @@ -20,8 +20,8 @@ .. exception:: error The exception raised when an error occurs. The accompanying value is a pair - containing the numeric error code from :cdata:`errno` and the corresponding - string, as would be printed by the C function :cfunc:`perror`. + containing the numeric error code from :c:data:`errno` and the corresponding + string, as would be printed by the C function :c:func:`perror`. .. function:: epoll([sizehint=-1]) @@ -60,7 +60,7 @@ .. function:: select(rlist, wlist, xlist[, timeout]) - This is a straightforward interface to the Unix :cfunc:`select` system call. + This is a straightforward interface to the Unix :c:func:`select` system call. The first three arguments are sequences of 'waitable objects': either integers representing file descriptors or objects with a parameterless method named :meth:`fileno` returning such an integer: @@ -96,7 +96,7 @@ .. index:: single: WinSock File objects on Windows are not acceptable, but sockets are. On Windows, - the underlying :cfunc:`select` function is provided by the WinSock + the underlying :c:func:`select` function is provided by the WinSock library, and does not handle file descriptors that don't originate from WinSock. @@ -195,13 +195,13 @@ Polling Objects --------------- -The :cfunc:`poll` system call, supported on most Unix systems, provides better +The :c:func:`poll` system call, supported on most Unix systems, provides better scalability for network servers that service many, many clients at the same -time. :cfunc:`poll` scales better because the system call only requires listing -the file descriptors of interest, while :cfunc:`select` builds a bitmap, turns +time. :c:func:`poll` scales better because the system call only requires listing +the file descriptors of interest, while :c:func:`select` builds a bitmap, turns on bits for the fds of interest, and then afterward the whole bitmap has to be -linearly scanned again. :cfunc:`select` is O(highest file descriptor), while -:cfunc:`poll` is O(number of file descriptors). +linearly scanned again. :c:func:`select` is O(highest file descriptor), while +:c:func:`poll` is O(number of file descriptors). .. method:: poll.register(fd[, eventmask]) diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -69,7 +69,7 @@ All the signal numbers are defined symbolically. For example, the hangup signal is defined as :const:`signal.SIGHUP`; the variable names are identical to the names used in C programs, as found in ````. The Unix man page for - ':cfunc:`signal`' lists the existing signals (on some systems this is + ':c:func:`signal`' lists the existing signals (on some systems this is :manpage:`signal(2)`, on others the list is in :manpage:`signal(7)`). Note that not all systems define the same set of signal names; only those names defined by the system are defined by this module. @@ -216,7 +216,7 @@ Note that installing a signal handler with :func:`signal` will reset the restart behaviour to interruptible by implicitly calling - :cfunc:`siginterrupt` with a true *flag* value for the given signal. + :c:func:`siginterrupt` with a true *flag* value for the given signal. .. versionadded:: 2.6 diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -119,7 +119,7 @@ The accompanying value is a pair ``(h_errno, string)`` representing an error returned by a library call. *string* represents the description of *h_errno*, as - returned by the :cfunc:`hstrerror` C function. + returned by the :c:func:`hstrerror` C function. .. exception:: gaierror @@ -127,7 +127,7 @@ This exception is raised for address-related errors, for :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying value is a pair ``(error, string)`` representing an error returned by a library call. *string* represents the - description of *error*, as returned by the :cfunc:`gai_strerror` C function. The + description of *error*, as returned by the :c:func:`gai_strerror` C function. The *error* value will match one of the :const:`EAI_\*` constants defined in this module. @@ -430,7 +430,7 @@ Convert an IPv4 address from dotted-quad string format (for example, '123.45.67.89') to 32-bit packed binary format, as a string four characters in length. This is useful when conversing with a program that uses the standard C - library and needs objects of type :ctype:`struct in_addr`, which is the C type + library and needs objects of type :c:type:`struct in_addr`, which is the C type for the 32-bit packed binary this function returns. :func:`inet_aton` also accepts strings with less than three dots; see the @@ -438,7 +438,7 @@ If the IPv4 address string passed to this function is invalid, :exc:`socket.error` will be raised. Note that exactly what is valid depends on - the underlying C implementation of :cfunc:`inet_aton`. + the underlying C implementation of :c:func:`inet_aton`. :func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be used instead for IPv4/v6 dual stack support. @@ -449,7 +449,7 @@ Convert a 32-bit packed IPv4 address (a string four characters in length) to its standard dotted-quad string representation (for example, '123.45.67.89'). This is useful when conversing with a program that uses the standard C library and - needs objects of type :ctype:`struct in_addr`, which is the C type for the + needs objects of type :c:type:`struct in_addr`, which is the C type for the 32-bit packed binary data this function takes as an argument. If the string passed to this function is not exactly 4 bytes in length, @@ -461,14 +461,14 @@ Convert an IP address from its family-specific string format to a packed, binary format. :func:`inet_pton` is useful when a library or network protocol calls for - an object of type :ctype:`struct in_addr` (similar to :func:`inet_aton`) or - :ctype:`struct in6_addr`. + an object of type :c:type:`struct in_addr` (similar to :func:`inet_aton`) or + :c:type:`struct in6_addr`. Supported values for *address_family* are currently :const:`AF_INET` and :const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:`socket.error` will be raised. Note that exactly what is valid depends on both the value of *address_family* and the underlying implementation of - :cfunc:`inet_pton`. + :c:func:`inet_pton`. Availability: Unix (maybe not all platforms). @@ -480,8 +480,8 @@ Convert a packed IP address (a string of some number of characters) to its standard, family-specific string representation (for example, ``'7.10.0.5'`` or ``'5aef:2b::8'``) :func:`inet_ntop` is useful when a library or network protocol - returns an object of type :ctype:`struct in_addr` (similar to :func:`inet_ntoa`) - or :ctype:`struct in6_addr`. + returns an object of type :c:type:`struct in_addr` (similar to :func:`inet_ntoa`) + or :c:type:`struct in6_addr`. Supported values for *address_family* are currently :const:`AF_INET` and :const:`AF_INET6`. If the string *packed_ip* is not the correct length for the @@ -583,10 +583,10 @@ .. method:: socket.connect_ex(address) Like ``connect(address)``, but return an error indicator instead of raising an - exception for errors returned by the C-level :cfunc:`connect` call (other + exception for errors returned by the C-level :c:func:`connect` call (other problems, such as "host not found," can still raise exceptions). The error indicator is ``0`` if the operation succeeded, otherwise the value of the - :cdata:`errno` variable. This is useful to support, for example, asynchronous + :c:data:`errno` variable. This is useful to support, for example, asynchronous connects. .. note:: @@ -661,7 +661,7 @@ Return a :dfn:`file object` associated with the socket. (File objects are described in :ref:`bltin-file-objects`.) The file object - references a :cfunc:`dup`\ ped version of the socket file descriptor, so the + references a :c:func:`dup`\ ped version of the socket file descriptor, so the file object and socket object may be closed or garbage-collected independently. The socket must be in blocking mode (it can not have a timeout). The optional *mode* and *bufsize* arguments are interpreted the same way as by the built-in diff --git a/Doc/library/stat.rst b/Doc/library/stat.rst --- a/Doc/library/stat.rst +++ b/Doc/library/stat.rst @@ -11,8 +11,8 @@ The :mod:`stat` module defines constants and functions for interpreting the results of :func:`os.stat`, :func:`os.fstat` and :func:`os.lstat` (if they -exist). For complete details about the :cfunc:`stat`, :cfunc:`fstat` and -:cfunc:`lstat` calls, consult the documentation for your system. +exist). For complete details about the :c:func:`stat`, :c:func:`fstat` and +:c:func:`lstat` calls, consult the documentation for your system. The :mod:`stat` module defines the following functions to test for specific file types: @@ -70,7 +70,7 @@ Normally, you would use the :func:`os.path.is\*` functions for testing the type of a file; the functions here are useful when you are doing multiple tests of -the same file and wish to avoid the overhead of the :cfunc:`stat` system call +the same file and wish to avoid the overhead of the :c:func:`stat` system call for each test. These are also useful when checking for information about a file that isn't handled by :mod:`os.path`, like the tests for block and character devices. diff --git a/Doc/library/statvfs.rst b/Doc/library/statvfs.rst --- a/Doc/library/statvfs.rst +++ b/Doc/library/statvfs.rst @@ -61,7 +61,7 @@ .. data:: F_FLAG - Flags. System dependent: see :cfunc:`statvfs` man page. + Flags. System dependent: see :c:func:`statvfs` man page. .. data:: F_NAMEMAX diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -226,11 +226,11 @@ There are four distinct numeric types: :dfn:`plain integers`, :dfn:`long integers`, :dfn:`floating point numbers`, and :dfn:`complex numbers`. In addition, Booleans are a subtype of plain integers. Plain integers (also just -called :dfn:`integers`) are implemented using :ctype:`long` in C, which gives +called :dfn:`integers`) are implemented using :c:type:`long` in C, which gives them at least 32 bits of precision (``sys.maxint`` is always set to the maximum plain integer value for the current platform, the minimum value is ``-sys.maxint - 1``). Long integers have unlimited precision. Floating point -numbers are usually implemented using :ctype:`double` in C; information about +numbers are usually implemented using :c:type:`double` in C; information about the precision and internal representation of floating point numbers for the machine on which your program is running is available in :data:`sys.float_info`. Complex numbers have a real and imaginary part, which @@ -1335,7 +1335,7 @@ *interpolation* operator. Given ``format % values`` (where *format* is a string or Unicode object), ``%`` conversion specifications in *format* are replaced with zero or more elements of *values*. The effect is similar to the using -:cfunc:`sprintf` in the C language. If *format* is a Unicode object, or if any +:c:func:`sprintf` in the C language. If *format* is a Unicode object, or if any of the objects being converted using the ``%s`` conversion are Unicode objects, the result will also be a Unicode object. @@ -2331,7 +2331,7 @@ .. method:: file.flush() - Flush the internal buffer, like ``stdio``'s :cfunc:`fflush`. This may be a + Flush the internal buffer, like ``stdio``'s :c:func:`fflush`. This may be a no-op on some file-like objects. .. note:: @@ -2392,14 +2392,14 @@ all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediately. (For certain files, like ttys, it makes sense to continue reading after an EOF is hit.) Note - that this method may call the underlying C function :cfunc:`fread` more than + that this method may call the underlying C function :c:func:`fread` more than once in an effort to acquire as close to *size* bytes as possible. Also note that when in non-blocking mode, less data than was requested may be returned, even if no *size* parameter was given. .. note:: This function is simply a wrapper for the underlying - :cfunc:`fread` C function, and will behave the same in corner cases, + :c:func:`fread` C function, and will behave the same in corner cases, such as whether the EOF value is cached. @@ -2414,7 +2414,7 @@ .. note:: - Unlike ``stdio``'s :cfunc:`fgets`, the returned string contains null characters + Unlike ``stdio``'s :c:func:`fgets`, the returned string contains null characters (``'\0'``) if they occurred in the input. @@ -2440,7 +2440,7 @@ .. method:: file.seek(offset[, whence]) - Set the file's current position, like ``stdio``'s :cfunc:`fseek`. The *whence* + Set the file's current position, like ``stdio``'s :c:func:`fseek`. The *whence* argument is optional and defaults to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are ``os.SEEK_CUR`` or ``1`` (seek relative to the current position) and ``os.SEEK_END`` or ``2`` (seek relative to the file's @@ -2465,11 +2465,11 @@ .. method:: file.tell() - Return the file's current position, like ``stdio``'s :cfunc:`ftell`. + Return the file's current position, like ``stdio``'s :c:func:`ftell`. .. note:: - On Windows, :meth:`tell` can return illegal values (after an :cfunc:`fgets`) + On Windows, :meth:`tell` can return illegal values (after an :c:func:`fgets`) when reading files with Unix-style line-endings. Use binary mode (``'rb'``) to circumvent this problem. diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -162,60 +162,60 @@ ``'='``. When using native size, the size of the packed value is platform-dependent. -+--------+-------------------------+--------------------+----------------+------------+ -| Format | C Type | Python type | Standard size | Notes | -+========+=========================+====================+================+============+ -| ``x`` | pad byte | no value | | | -+--------+-------------------------+--------------------+----------------+------------+ -| ``c`` | :ctype:`char` | string of length 1 | 1 | | -+--------+-------------------------+--------------------+----------------+------------+ -| ``b`` | :ctype:`signed char` | integer | 1 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``B`` | :ctype:`unsigned char` | integer | 1 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``?`` | :ctype:`_Bool` | bool | 1 | \(1) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``h`` | :ctype:`short` | integer | 2 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``H`` | :ctype:`unsigned short` | integer | 2 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``i`` | :ctype:`int` | integer | 4 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``I`` | :ctype:`unsigned int` | integer | 4 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``l`` | :ctype:`long` | integer | 4 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``L`` | :ctype:`unsigned long` | integer | 4 | \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``q`` | :ctype:`long long` | integer | 8 | \(2), \(3) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``Q`` | :ctype:`unsigned long | integer | 8 | \(2), \(3) | -| | long` | | | | -+--------+-------------------------+--------------------+----------------+------------+ -| ``f`` | :ctype:`float` | float | 4 | \(4) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``d`` | :ctype:`double` | float | 8 | \(4) | -+--------+-------------------------+--------------------+----------------+------------+ -| ``s`` | :ctype:`char[]` | string | | | -+--------+-------------------------+--------------------+----------------+------------+ -| ``p`` | :ctype:`char[]` | string | | | -+--------+-------------------------+--------------------+----------------+------------+ -| ``P`` | :ctype:`void \*` | integer | | \(5), \(3) | -+--------+-------------------------+--------------------+----------------+------------+ ++--------+--------------------------+--------------------+----------------+------------+ +| Format | C Type | Python type | Standard size | Notes | ++========+==========================+====================+================+============+ +| ``x`` | pad byte | no value | | | ++--------+--------------------------+--------------------+----------------+------------+ +| ``c`` | :c:type:`char` | string of length 1 | 1 | | ++--------+--------------------------+--------------------+----------------+------------+ +| ``b`` | :c:type:`signed char` | integer | 1 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``B`` | :c:type:`unsigned char` | integer | 1 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``?`` | :c:type:`_Bool` | bool | 1 | \(1) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``h`` | :c:type:`short` | integer | 2 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``H`` | :c:type:`unsigned short` | integer | 2 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``i`` | :c:type:`int` | integer | 4 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``I`` | :c:type:`unsigned int` | integer | 4 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``l`` | :c:type:`long` | integer | 4 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``L`` | :c:type:`unsigned long` | integer | 4 | \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``q`` | :c:type:`long long` | integer | 8 | \(2), \(3) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``Q`` | :c:type:`unsigned long | integer | 8 | \(2), \(3) | +| | long` | | | | ++--------+--------------------------+--------------------+----------------+------------+ +| ``f`` | :c:type:`float` | float | 4 | \(4) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``d`` | :c:type:`double` | float | 8 | \(4) | ++--------+--------------------------+--------------------+----------------+------------+ +| ``s`` | :c:type:`char[]` | string | | | ++--------+--------------------------+--------------------+----------------+------------+ +| ``p`` | :c:type:`char[]` | string | | | ++--------+--------------------------+--------------------+----------------+------------+ +| ``P`` | :c:type:`void \*` | integer | | \(5), \(3) | ++--------+--------------------------+--------------------+----------------+------------+ Notes: (1) - The ``'?'`` conversion code corresponds to the :ctype:`_Bool` type defined by - C99. If this type is not available, it is simulated using a :ctype:`char`. In + The ``'?'`` conversion code corresponds to the :c:type:`_Bool` type defined by + C99. If this type is not available, it is simulated using a :c:type:`char`. In standard mode, it is always represented by one byte. .. versionadded:: 2.6 (2) The ``'q'`` and ``'Q'`` conversion codes are available in native mode only if - the platform C compiler supports C :ctype:`long long`, or, on Windows, - :ctype:`__int64`. They are always available in standard modes. + the platform C compiler supports C :c:type:`long long`, or, on Windows, + :c:type:`__int64`. They are always available in standard modes. .. versionadded:: 2.2 diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -472,7 +472,7 @@ .. method:: Popen.terminate() Stop the child. On Posix OSs the method sends SIGTERM to the - child. On Windows the Win32 API function :cfunc:`TerminateProcess` is called + child. On Windows the Win32 API function :c:func:`TerminateProcess` is called to stop the child. .. versionadded:: 2.6 diff --git a/Doc/library/sunaudio.rst b/Doc/library/sunaudio.rst --- a/Doc/library/sunaudio.rst +++ b/Doc/library/sunaudio.rst @@ -93,10 +93,10 @@ names and meanings of the attributes are described in ```` and in the :manpage:`audio(7I)` manual page. Member names are slightly different from their C counterparts: a status object is only a single structure. Members of the - :cdata:`play` substructure have ``o_`` prepended to their name and members of - the :cdata:`record` structure have ``i_``. So, the C member - :cdata:`play.sample_rate` is accessed as :attr:`o_sample_rate`, - :cdata:`record.gain` as :attr:`i_gain` and :cdata:`monitor_gain` plainly as + :c:data:`play` substructure have ``o_`` prepended to their name and members of + the :c:data:`record` structure have ``i_``. So, the C member + :c:data:`play.sample_rate` is accessed as :attr:`o_sample_rate`, + :c:data:`record.gain` as :attr:`i_gain` and :c:data:`monitor_gain` plainly as :attr:`monitor_gain`. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -388,7 +388,7 @@ .. function:: getdlopenflags() - Return the current value of the flags that are used for :cfunc:`dlopen` calls. + Return the current value of the flags that are used for :c:func:`dlopen` calls. The flag constants are defined in the :mod:`dl` and :mod:`DLFCN` modules. Availability: Unix. @@ -533,8 +533,8 @@ +---------------------------------------+---------------------------------+ - This function wraps the Win32 :cfunc:`GetVersionEx` function; see the - Microsoft documentation on :cfunc:`OSVERSIONINFOEX` for more information + This function wraps the Win32 :c:func:`GetVersionEx` function; see the + Microsoft documentation on :c:func:`OSVERSIONINFOEX` for more information about these fields. Availability: Windows. @@ -827,7 +827,7 @@ .. function:: setdlopenflags(n) - Set the flags used by the interpreter for :cfunc:`dlopen` calls, such as when + Set the flags used by the interpreter for :c:func:`dlopen` calls, such as when the interpreter loads extension modules. Among other things, this will enable a lazy resolving of symbols when importing a module, if called as ``sys.setdlopenflags(0)``. To share symbols across extension modules, call as diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -74,8 +74,8 @@ * On the other hand, the precision of :func:`time` and :func:`sleep` is better than their Unix equivalents: times are expressed as floating point numbers, :func:`time` returns the most accurate time available (using Unix - :cfunc:`gettimeofday` where available), and :func:`sleep` will accept a time - with a nonzero fraction (Unix :cfunc:`select` is used to implement this, where + :c:func:`gettimeofday` where available), and :func:`sleep` will accept a time + with a nonzero fraction (Unix :c:func:`select` is used to implement this, where available). * The time value as returned by :func:`gmtime`, :func:`localtime`, and @@ -156,7 +156,7 @@ On Windows, this function returns wall-clock seconds elapsed since the first call to this function, as a floating point number, based on the Win32 function - :cfunc:`QueryPerformanceCounter`. The resolution is typically better than one + :c:func:`QueryPerformanceCounter`. The resolution is typically better than one microsecond. diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -19,7 +19,7 @@ might want to issue a warning when a program uses an obsolete module. Python programmers issue warnings by calling the :func:`warn` function defined -in this module. (C programmers use :cfunc:`PyErr_WarnEx`; see +in this module. (C programmers use :c:func:`PyErr_WarnEx`; see :ref:`exceptionhandling` for details). Warning messages are normally written to ``sys.stderr``, but their disposition diff --git a/Doc/library/winsound.rst b/Doc/library/winsound.rst --- a/Doc/library/winsound.rst +++ b/Doc/library/winsound.rst @@ -27,7 +27,7 @@ .. function:: PlaySound(sound, flags) - Call the underlying :cfunc:`PlaySound` function from the Platform API. The + Call the underlying :c:func:`PlaySound` function from the Platform API. The *sound* parameter may be a filename, audio data as a string, or ``None``. Its interpretation depends on the value of *flags*, which can be a bitwise ORed combination of the constants described below. If the *sound* parameter is @@ -37,7 +37,7 @@ .. function:: MessageBeep([type=MB_OK]) - Call the underlying :cfunc:`MessageBeep` function from the Platform API. This + Call the underlying :c:func:`MessageBeep` function from the Platform API. This plays a sound as specified in the registry. The *type* argument specifies which sound to play; possible values are ``-1``, ``MB_ICONASTERISK``, ``MB_ICONEXCLAMATION``, ``MB_ICONHAND``, ``MB_ICONQUESTION``, and ``MB_OK``, all diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst --- a/Doc/library/zlib.rst +++ b/Doc/library/zlib.rst @@ -132,7 +132,7 @@ *bufsize* is the initial size of the buffer used to hold decompressed data. If more space is required, the buffer size will be increased as needed, so you don't have to get this value exactly right; tuning it will only save a few calls - to :cfunc:`malloc`. The default size is 16384. + to :c:func:`malloc`. The default size is 16384. .. function:: decompressobj([wbits]) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -719,7 +719,7 @@ An implementation may provide built-in functions whose positional parameters do not have names, even if they are 'named' for the purpose of documentation, and which therefore cannot be supplied by keyword. In CPython, this is the - case for functions implemented in C that use :cfunc:`PyArg_ParseTuple` to + case for functions implemented in C that use :c:func:`PyArg_ParseTuple` to parse their arguments. If there are more positional arguments than there are formal parameter slots, a diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -236,9 +236,9 @@ documenting/markup,95,.. function:,.. function:: spam(eggs) documenting/markup,95,:noindex,:noindex: documenting/markup,101,.. method:,.. method:: FileInput.input(...) -documenting/markup,121,.. cfunction:,".. cfunction:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,131,.. cmember:,.. cmember:: PyObject* PyTypeObject.tp_bases -documenting/markup,150,.. cvar:,.. cvar:: PyObject* PyClass_Type +documenting/markup,121,.. cfunction:,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" +documenting/markup,131,.. cmember:,.. c:member:: PyObject* PyTypeObject.tp_bases +documenting/markup,150,.. cvar:,.. c:var:: PyObject* PyClass_Type documenting/markup,179,.. function:,".. function:: Timer.repeat([repeat=3[, number=1000000]])" documenting/markup,209,.. cmdoption:,.. cmdoption:: -m documenting/markup,227,.. describe:,.. describe:: opcode diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -207,7 +207,7 @@ --------------------- The ``%`` operator can also be used for string formatting. It interprets the -left argument much like a :cfunc:`sprintf`\ -style format string to be applied +left argument much like a :c:func:`sprintf`\ -style format string to be applied to the right argument, and returns the string resulting from this formatting operation. For example:: diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst --- a/Doc/whatsnew/2.2.rst +++ b/Doc/whatsnew/2.2.rst @@ -754,7 +754,7 @@ * Classes can define methods called :meth:`__truediv__` and :meth:`__floordiv__` to overload the two division operators. At the C level, there are also slots in - the :ctype:`PyNumberMethods` structure so extension types can define the two + the :c:type:`PyNumberMethods` structure so extension types can define the two operators. * Python 2.2 supports some command-line arguments for testing whether code will @@ -983,7 +983,7 @@ Jun-ichiro "itojun" Hagino.) * Two new format characters were added to the :mod:`struct` module for 64-bit - integers on platforms that support the C :ctype:`long long` type. ``q`` is for + integers on platforms that support the C :c:type:`long long` type. ``q`` is for a signed 64-bit integer, and ``Q`` is for an unsigned one. The value is returned in Python's long integer type. (Contributed by Tim Peters.) @@ -1057,16 +1057,16 @@ at much higher speeds than Python-based functions and should reduce the overhead of profiling and tracing. This will be of interest to authors of development environments for Python. Two new C functions were added to Python's API, - :cfunc:`PyEval_SetProfile` and :cfunc:`PyEval_SetTrace`. The existing + :c:func:`PyEval_SetProfile` and :c:func:`PyEval_SetTrace`. The existing :func:`sys.setprofile` and :func:`sys.settrace` functions still exist, and have simply been changed to use the new C-level interface. (Contributed by Fred L. Drake, Jr.) * Another low-level API, primarily of interest to implementors of Python - debuggers and development tools, was added. :cfunc:`PyInterpreterState_Head` and - :cfunc:`PyInterpreterState_Next` let a caller walk through all the existing - interpreter objects; :cfunc:`PyInterpreterState_ThreadHead` and - :cfunc:`PyThreadState_Next` allow looping over all the thread states for a given + debuggers and development tools, was added. :c:func:`PyInterpreterState_Head` and + :c:func:`PyInterpreterState_Next` let a caller walk through all the existing + interpreter objects; :c:func:`PyInterpreterState_ThreadHead` and + :c:func:`PyThreadState_Next` allow looping over all the thread states for a given interpreter. (Contributed by David Beazley.) * The C-level interface to the garbage collector has been changed to make it @@ -1078,19 +1078,19 @@ To upgrade an extension module to the new API, perform the following steps: -* Rename :cfunc:`Py_TPFLAGS_GC` to :cfunc:`PyTPFLAGS_HAVE_GC`. +* Rename :c:func:`Py_TPFLAGS_GC` to :c:func:`PyTPFLAGS_HAVE_GC`. -* Use :cfunc:`PyObject_GC_New` or :cfunc:`PyObject_GC_NewVar` to allocate - objects, and :cfunc:`PyObject_GC_Del` to deallocate them. +* Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate + objects, and :c:func:`PyObject_GC_Del` to deallocate them. -* Rename :cfunc:`PyObject_GC_Init` to :cfunc:`PyObject_GC_Track` and - :cfunc:`PyObject_GC_Fini` to :cfunc:`PyObject_GC_UnTrack`. +* Rename :c:func:`PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and + :c:func:`PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`. -* Remove :cfunc:`PyGC_HEAD_SIZE` from object size calculations. +* Remove :c:func:`PyGC_HEAD_SIZE` from object size calculations. -* Remove calls to :cfunc:`PyObject_AS_GC` and :cfunc:`PyObject_FROM_GC`. +* Remove calls to :c:func:`PyObject_AS_GC` and :c:func:`PyObject_FROM_GC`. -* A new ``et`` format sequence was added to :cfunc:`PyArg_ParseTuple`; ``et`` +* A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` takes both a parameter and an encoding name, and converts the parameter to the given encoding if the parameter turns out to be a Unicode string, or leaves it alone if it's an 8-bit string, assuming it to already be in the desired @@ -1099,10 +1099,10 @@ specified new encoding. (Contributed by M.-A. Lemburg, and used for the MBCS support on Windows described in the following section.) -* A different argument parsing function, :cfunc:`PyArg_UnpackTuple`, has been +* A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been added that's simpler and presumably faster. Instead of specifying a format string, the caller simply gives the minimum and maximum number of arguments - expected, and a set of pointers to :ctype:`PyObject\*` variables that will be + expected, and a set of pointers to :c:type:`PyObject\*` variables that will be filled in with argument values. * Two new flags :const:`METH_NOARGS` and :const:`METH_O` are available in method @@ -1111,14 +1111,14 @@ corresponding method that uses :const:`METH_VARARGS`. Also, the old :const:`METH_OLDARGS` style of writing C methods is now officially deprecated. -* Two new wrapper functions, :cfunc:`PyOS_snprintf` and :cfunc:`PyOS_vsnprintf` +* Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:`PyOS_vsnprintf` were added to provide cross-platform implementations for the relatively new - :cfunc:`snprintf` and :cfunc:`vsnprintf` C lib APIs. In contrast to the standard - :cfunc:`sprintf` and :cfunc:`vsprintf` functions, the Python versions check the + :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In contrast to the standard + :c:func:`sprintf` and :c:func:`vsprintf` functions, the Python versions check the bounds of the buffer used to protect against buffer overruns. (Contributed by M.-A. Lemburg.) -* The :cfunc:`_PyTuple_Resize` function has lost an unused parameter, so now it +* The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now it takes 2 parameters instead of 3. The third argument was never used, and can simply be discarded when porting code from earlier versions to Python 2.2. @@ -1219,7 +1219,7 @@ operator, but these features were rarely used and therefore buggy. The :meth:`tolist` method and the :attr:`start`, :attr:`stop`, and :attr:`step` attributes are also being deprecated. At the C level, the fourth argument to - the :cfunc:`PyRange_New` function, ``repeat``, has also been deprecated. + the :c:func:`PyRange_New` function, ``repeat``, has also been deprecated. * There were a bunch of patches to the dictionary implementation, mostly to fix potential core dumps if a dictionary contains objects that sneakily changed @@ -1242,8 +1242,8 @@ up to display the output. This patch makes it possible to import such scripts, in case they're also usable as modules. (Implemented by David Bolen.) -* On platforms where Python uses the C :cfunc:`dlopen` function to load - extension modules, it's now possible to set the flags used by :cfunc:`dlopen` +* On platforms where Python uses the C :c:func:`dlopen` function to load + extension modules, it's now possible to set the flags used by :c:func:`dlopen` using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` functions. (Contributed by Bram Stolk.) diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1797,8 +1797,8 @@ Pymalloc, a specialized object allocator written by Vladimir Marangozov, was a feature added to Python 2.1. Pymalloc is intended to be faster than the system -:cfunc:`malloc` and to have less memory overhead for allocation patterns typical -of Python programs. The allocator uses C's :cfunc:`malloc` function to get large +:c:func:`malloc` and to have less memory overhead for allocation patterns typical +of Python programs. The allocator uses C's :c:func:`malloc` function to get large pools of memory and then fulfills smaller memory requests from these pools. In 2.1 and 2.2, pymalloc was an experimental feature and wasn't enabled by @@ -1814,13 +1814,13 @@ There's one particularly common error that causes problems. There are a number of memory allocation functions in Python's C API that have previously just been -aliases for the C library's :cfunc:`malloc` and :cfunc:`free`, meaning that if +aliases for the C library's :c:func:`malloc` and :c:func:`free`, meaning that if you accidentally called mismatched functions the error wouldn't be noticeable. When the object allocator is enabled, these functions aren't aliases of -:cfunc:`malloc` and :cfunc:`free` any more, and calling the wrong function to +:c:func:`malloc` and :c:func:`free` any more, and calling the wrong function to free memory may get you a core dump. For example, if memory was allocated using -:cfunc:`PyObject_Malloc`, it has to be freed using :cfunc:`PyObject_Free`, not -:cfunc:`free`. A few modules included with Python fell afoul of this and had to +:c:func:`PyObject_Malloc`, it has to be freed using :c:func:`PyObject_Free`, not +:c:func:`free`. A few modules included with Python fell afoul of this and had to be fixed; doubtless there are more third-party modules that will have the same problem. @@ -1831,14 +1831,14 @@ specifically for allocating Python objects. * To allocate and free an undistinguished chunk of memory use the "raw memory" - family: :cfunc:`PyMem_Malloc`, :cfunc:`PyMem_Realloc`, and :cfunc:`PyMem_Free`. + family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free`. * The "object memory" family is the interface to the pymalloc facility described above and is biased towards a large number of "small" allocations: - :cfunc:`PyObject_Malloc`, :cfunc:`PyObject_Realloc`, and :cfunc:`PyObject_Free`. + :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:func:`PyObject_Free`. * To allocate and free Python objects, use the "object" family - :cfunc:`PyObject_New`, :cfunc:`PyObject_NewVar`, and :cfunc:`PyObject_Del`. + :c:func:`PyObject_New`, :c:func:`PyObject_NewVar`, and :c:func:`PyObject_Del`. Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides debugging features to catch memory overwrites and doubled frees in both extension modules @@ -1877,10 +1877,10 @@ (:file:`libpython2.3.so`) by supplying :option:`--enable-shared` when running Python's :program:`configure` script. (Contributed by Ondrej Palkovsky.) -* The :cmacro:`DL_EXPORT` and :cmacro:`DL_IMPORT` macros are now deprecated. +* The :c:macro:`DL_EXPORT` and :c:macro:`DL_IMPORT` macros are now deprecated. Initialization functions for Python extension modules should now be declared - using the new macro :cmacro:`PyMODINIT_FUNC`, while the Python core will - generally use the :cmacro:`PyAPI_FUNC` and :cmacro:`PyAPI_DATA` macros. + using the new macro :c:macro:`PyMODINIT_FUNC`, while the Python core will + generally use the :c:macro:`PyAPI_FUNC` and :c:macro:`PyAPI_DATA` macros. * The interpreter can be compiled without any docstrings for the built-in functions and modules by supplying :option:`--without-doc-strings` to the @@ -1888,19 +1888,19 @@ but will also mean that you can't get help for Python's built-ins. (Contributed by Gustavo Niemeyer.) -* The :cfunc:`PyArg_NoArgs` macro is now deprecated, and code that uses it +* The :c:func:`PyArg_NoArgs` macro is now deprecated, and code that uses it should be changed. For Python 2.2 and later, the method definition table can specify the :const:`METH_NOARGS` flag, signalling that there are no arguments, and the argument checking can then be removed. If compatibility with pre-2.2 versions of Python is important, the code could use ``PyArg_ParseTuple(args, "")`` instead, but this will be slower than using :const:`METH_NOARGS`. -* :cfunc:`PyArg_ParseTuple` accepts new format characters for various sizes of - unsigned integers: ``B`` for :ctype:`unsigned char`, ``H`` for :ctype:`unsigned - short int`, ``I`` for :ctype:`unsigned int`, and ``K`` for :ctype:`unsigned +* :c:func:`PyArg_ParseTuple` accepts new format characters for various sizes of + unsigned integers: ``B`` for :c:type:`unsigned char`, ``H`` for :c:type:`unsigned + short int`, ``I`` for :c:type:`unsigned int`, and ``K`` for :c:type:`unsigned long long`. -* A new function, :cfunc:`PyObject_DelItemString(mapping, char \*key)` was added +* A new function, :c:func:`PyObject_DelItemString(mapping, char \*key)` was added as shorthand for ``PyObject_DelItem(mapping, PyString_New(key))``. * File objects now manage their internal string buffer differently, increasing @@ -1910,7 +1910,7 @@ * It's now possible to define class and static methods for a C extension type by setting either the :const:`METH_CLASS` or :const:`METH_STATIC` flags in a - method's :ctype:`PyMethodDef` structure. + method's :c:type:`PyMethodDef` structure. * Python now includes a copy of the Expat XML parser's source code, removing any dependence on a system version or local installation of Expat. diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -469,7 +469,7 @@ ========================== Python has always supported floating-point (FP) numbers, based on the underlying -C :ctype:`double` type, as a data type. However, while most programming +C :c:type:`double` type, as a data type. However, while most programming languages provide a floating-point type, many people (even programmers) are unaware that floating-point numbers don't represent certain decimal fractions accurately. The new :class:`Decimal` type can represent these fractions @@ -498,7 +498,7 @@ 5. Modern systems usually provide floating-point support that conforms to a -standard called IEEE 754. C's :ctype:`double` type is usually implemented as a +standard called IEEE 754. C's :c:type:`double` type is usually implemented as a 64-bit IEEE 754 number, which uses 52 bits of space for the mantissa. This means that numbers can only be specified to 52 bits of precision. If you're trying to represent numbers whose expansion repeats endlessly, the expansion is @@ -736,7 +736,7 @@ However, the module was careful to not change the numeric locale because various functions in Python's implementation required that the numeric locale remain set to the ``'C'`` locale. Often this was because the code was using the C -library's :cfunc:`atof` function. +library's :c:func:`atof` function. Not setting the numeric locale caused trouble for extensions that used third- party C libraries, however, because they wouldn't have the correct locale set. @@ -746,11 +746,11 @@ The solution described in the PEP is to add three new functions to the Python API that perform ASCII-only conversions, ignoring the locale setting: -* :cfunc:`PyOS_ascii_strtod(str, ptr)` and :cfunc:`PyOS_ascii_atof(str, ptr)` - both convert a string to a C :ctype:`double`. +* :c:func:`PyOS_ascii_strtod(str, ptr)` and :c:func:`PyOS_ascii_atof(str, ptr)` + both convert a string to a C :c:type:`double`. -* :cfunc:`PyOS_ascii_formatd(buffer, buf_len, format, d)` converts a - :ctype:`double` to an ASCII string. +* :c:func:`PyOS_ascii_formatd(buffer, buf_len, format, d)` converts a + :c:type:`double` to an ASCII string. The code for these functions came from the GLib library (http://library.gnome.org/devel/glib/stable/), whose developers kindly @@ -938,7 +938,7 @@ * The machinery for growing and shrinking lists was optimized for speed and for space efficiency. Appending and popping from lists now runs faster due to more efficient code paths and less frequent use of the underlying system - :cfunc:`realloc`. List comprehensions also benefit. :meth:`list.extend` was + :c:func:`realloc`. List comprehensions also benefit. :meth:`list.extend` was also optimized and no longer converts its argument into a temporary list before extending the base list. (Contributed by Raymond Hettinger.) @@ -1445,34 +1445,34 @@ Some of the changes to Python's build process and to the C API are: * Three new convenience macros were added for common return values from - extension functions: :cmacro:`Py_RETURN_NONE`, :cmacro:`Py_RETURN_TRUE`, and - :cmacro:`Py_RETURN_FALSE`. (Contributed by Brett Cannon.) + extension functions: :c:macro:`Py_RETURN_NONE`, :c:macro:`Py_RETURN_TRUE`, and + :c:macro:`Py_RETURN_FALSE`. (Contributed by Brett Cannon.) -* Another new macro, :cmacro:`Py_CLEAR(obj)`, decreases the reference count of +* Another new macro, :c:macro:`Py_CLEAR(obj)`, decreases the reference count of *obj* and sets *obj* to the null pointer. (Contributed by Jim Fulton.) -* A new function, :cfunc:`PyTuple_Pack(N, obj1, obj2, ..., objN)`, constructs +* A new function, :c:func:`PyTuple_Pack(N, obj1, obj2, ..., objN)`, constructs tuples from a variable length argument list of Python objects. (Contributed by Raymond Hettinger.) -* A new function, :cfunc:`PyDict_Contains(d, k)`, implements fast dictionary +* A new function, :c:func:`PyDict_Contains(d, k)`, implements fast dictionary lookups without masking exceptions raised during the look-up process. (Contributed by Raymond Hettinger.) -* The :cmacro:`Py_IS_NAN(X)` macro returns 1 if its float or double argument +* The :c:macro:`Py_IS_NAN(X)` macro returns 1 if its float or double argument *X* is a NaN. (Contributed by Tim Peters.) * C code can avoid unnecessary locking by using the new - :cfunc:`PyEval_ThreadsInitialized` function to tell if any thread operations + :c:func:`PyEval_ThreadsInitialized` function to tell if any thread operations have been performed. If this function returns false, no lock operations are needed. (Contributed by Nick Coghlan.) -* A new function, :cfunc:`PyArg_VaParseTupleAndKeywords`, is the same as - :cfunc:`PyArg_ParseTupleAndKeywords` but takes a :ctype:`va_list` instead of a +* A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same as + :c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of a number of arguments. (Contributed by Greg Chapman.) * A new method flag, :const:`METH_COEXISTS`, allows a function defined in slots - to co-exist with a :ctype:`PyCFunction` having the same name. This can halve + to co-exist with a :c:type:`PyCFunction` having the same name. This can halve the access time for a method such as :meth:`set.__contains__`. (Contributed by Raymond Hettinger.) @@ -1486,8 +1486,8 @@ though that processor architecture doesn't call that register "the TSC register". (Contributed by Jeremy Hylton.) -* The :ctype:`tracebackobject` type has been renamed to - :ctype:`PyTracebackObject`. +* The :c:type:`tracebackobject` type has been renamed to + :c:type:`PyTracebackObject`. .. ====================================================================== diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -870,31 +870,31 @@ PEP 353: Using ssize_t as the index type ======================================== -A wide-ranging change to Python's C API, using a new :ctype:`Py_ssize_t` type -definition instead of :ctype:`int`, will permit the interpreter to handle more +A wide-ranging change to Python's C API, using a new :c:type:`Py_ssize_t` type +definition instead of :c:type:`int`, will permit the interpreter to handle more data on 64-bit platforms. This change doesn't affect Python's capacity on 32-bit platforms. -Various pieces of the Python interpreter used C's :ctype:`int` type to store +Various pieces of the Python interpreter used C's :c:type:`int` type to store sizes or counts; for example, the number of items in a list or tuple were stored -in an :ctype:`int`. The C compilers for most 64-bit platforms still define -:ctype:`int` as a 32-bit type, so that meant that lists could only hold up to +in an :c:type:`int`. The C compilers for most 64-bit platforms still define +:c:type:`int` as a 32-bit type, so that meant that lists could only hold up to ``2**31 - 1`` = 2147483647 items. (There are actually a few different programming models that 64-bit C compilers can use -- see http://www.unix.org/version2/whatsnew/lp64_wp.html for a discussion -- but the -most commonly available model leaves :ctype:`int` as 32 bits.) +most commonly available model leaves :c:type:`int` as 32 bits.) A limit of 2147483647 items doesn't really matter on a 32-bit platform because you'll run out of memory before hitting the length limit. Each list item requires space for a pointer, which is 4 bytes, plus space for a -:ctype:`PyObject` representing the item. 2147483647\*4 is already more bytes +:c:type:`PyObject` representing the item. 2147483647\*4 is already more bytes than a 32-bit address space can contain. It's possible to address that much memory on a 64-bit platform, however. The pointers for a list that size would only require 16 GiB of space, so it's not unreasonable that Python programmers might construct lists that large. Therefore, the Python interpreter had to be changed to use some type other than -:ctype:`int`, and this will be a 64-bit type on 64-bit platforms. The change +:c:type:`int`, and this will be a 64-bit type on 64-bit platforms. The change will cause incompatibilities on 64-bit machines, so it was deemed worth making the transition now, while the number of 64-bit users is still relatively small. (In 5 or 10 years, we may *all* be on 64-bit machines, and the transition would @@ -902,15 +902,15 @@ This change most strongly affects authors of C extension modules. Python strings and container types such as lists and tuples now use -:ctype:`Py_ssize_t` to store their size. Functions such as -:cfunc:`PyList_Size` now return :ctype:`Py_ssize_t`. Code in extension modules -may therefore need to have some variables changed to :ctype:`Py_ssize_t`. - -The :cfunc:`PyArg_ParseTuple` and :cfunc:`Py_BuildValue` functions have a new -conversion code, ``n``, for :ctype:`Py_ssize_t`. :cfunc:`PyArg_ParseTuple`'s -``s#`` and ``t#`` still output :ctype:`int` by default, but you can define the -macro :cmacro:`PY_SSIZE_T_CLEAN` before including :file:`Python.h` to make -them return :ctype:`Py_ssize_t`. +:c:type:`Py_ssize_t` to store their size. Functions such as +:c:func:`PyList_Size` now return :c:type:`Py_ssize_t`. Code in extension modules +may therefore need to have some variables changed to :c:type:`Py_ssize_t`. + +The :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` functions have a new +conversion code, ``n``, for :c:type:`Py_ssize_t`. :c:func:`PyArg_ParseTuple`'s +``s#`` and ``t#`` still output :c:type:`int` by default, but you can define the +macro :c:macro:`PY_SSIZE_T_CLEAN` before including :file:`Python.h` to make +them return :c:type:`Py_ssize_t`. :pep:`353` has a section on conversion guidelines that extension authors should read to learn about supporting 64-bit platforms. @@ -954,8 +954,8 @@ :exc:`TypeError` if this requirement isn't met. A corresponding :attr:`nb_index` slot was added to the C-level -:ctype:`PyNumberMethods` structure to let C extensions implement this protocol. -:cfunc:`PyNumber_Index(obj)` can be used in extension code to call the +:c:type:`PyNumberMethods` structure to let C extensions implement this protocol. +:c:func:`PyNumber_Index(obj)` can be used in extension code to call the :meth:`__index__` function and retrieve its result. @@ -1179,7 +1179,7 @@ (Contributed by Bob Ippolito at the NeedForSpeed sprint.) * The :mod:`re` module got a 1 or 2% speedup by switching to Python's allocator - functions instead of the system's :cfunc:`malloc` and :cfunc:`free`. + functions instead of the system's :c:func:`malloc` and :c:func:`free`. (Contributed by Jack Diederich at the NeedForSpeed sprint.) * The code generator's peephole optimizer now performs simple constant folding @@ -1203,7 +1203,7 @@ Sean Reifschneider at the NeedForSpeed sprint.) * Importing now caches the paths tried, recording whether they exist or not so - that the interpreter makes fewer :cfunc:`open` and :cfunc:`stat` calls on + that the interpreter makes fewer :c:func:`open` and :c:func:`stat` calls on startup. (Contributed by Martin von L?wis and Georg Brandl.) .. Patch 921466 @@ -1568,7 +1568,7 @@ reporting ``('CPython', 'trunk', '45313:45315')``. This information is also available to C extensions via the - :cfunc:`Py_GetBuildInfo` function that returns a string of build information + :c:func:`Py_GetBuildInfo` function that returns a string of build information like this: ``"trunk:45355:45356M, Apr 13 2006, 07:42:19"``. (Contributed by Barry Warsaw.) @@ -1690,7 +1690,7 @@ result = libc.printf("Line of output\n") Type constructors for the various C types are provided: :func:`c_int`, -:func:`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :ctype:`char +:func:`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :c:type:`char \*`), and so forth. Unlike Python's types, the C versions are all mutable; you can assign to their :attr:`value` attribute to change the wrapped value. Python integers and strings will be automatically converted to the corresponding C @@ -1720,7 +1720,7 @@ ``ctypes.pythonapi`` object. This object does *not* release the global interpreter lock before calling a function, because the lock must be held when calling into the interpreter's code. There's a :class:`py_object()` type -constructor that will create a :ctype:`PyObject \*` pointer. A simple usage:: +constructor that will create a :c:type:`PyObject \*` pointer. A simple usage:: import ctypes @@ -2087,8 +2087,8 @@ http://scan.coverity.com for the statistics. * The largest change to the C API came from :pep:`353`, which modifies the - interpreter to use a :ctype:`Py_ssize_t` type definition instead of - :ctype:`int`. See the earlier section :ref:`pep-353` for a discussion of this + interpreter to use a :c:type:`Py_ssize_t` type definition instead of + :c:type:`int`. See the earlier section :ref:`pep-353` for a discussion of this change. * The design of the bytecode compiler has changed a great deal, no longer @@ -2113,10 +2113,10 @@ discusses the design. To start learning about the code, read the definition of the various AST nodes in :file:`Parser/Python.asdl`. A Python script reads this file and generates a set of C structure definitions in - :file:`Include/Python-ast.h`. The :cfunc:`PyParser_ASTFromString` and - :cfunc:`PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take + :file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` and + :c:func:`PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take Python source as input and return the root of an AST representing the contents. - This AST can then be turned into a code object by :cfunc:`PyAST_Compile`. For + This AST can then be turned into a code object by :c:func:`PyAST_Compile`. For more information, read the source code, and then ask questions on python-dev. The AST code was developed under Jeremy Hylton's management, and implemented by @@ -2138,55 +2138,55 @@ Note that this change means extension modules must be more careful when allocating memory. Python's API has many different functions for allocating - memory that are grouped into families. For example, :cfunc:`PyMem_Malloc`, - :cfunc:`PyMem_Realloc`, and :cfunc:`PyMem_Free` are one family that allocates - raw memory, while :cfunc:`PyObject_Malloc`, :cfunc:`PyObject_Realloc`, and - :cfunc:`PyObject_Free` are another family that's supposed to be used for + memory that are grouped into families. For example, :c:func:`PyMem_Malloc`, + :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free` are one family that allocates + raw memory, while :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and + :c:func:`PyObject_Free` are another family that's supposed to be used for creating Python objects. Previously these different families all reduced to the platform's - :cfunc:`malloc` and :cfunc:`free` functions. This meant it didn't matter if - you got things wrong and allocated memory with the :cfunc:`PyMem` function but - freed it with the :cfunc:`PyObject` function. With 2.5's changes to obmalloc, + :c:func:`malloc` and :c:func:`free` functions. This meant it didn't matter if + you got things wrong and allocated memory with the :c:func:`PyMem` function but + freed it with the :c:func:`PyObject` function. With 2.5's changes to obmalloc, these families now do different things and mismatches will probably result in a segfault. You should carefully test your C extension modules with Python 2.5. -* The built-in set types now have an official C API. Call :cfunc:`PySet_New` - and :cfunc:`PyFrozenSet_New` to create a new set, :cfunc:`PySet_Add` and - :cfunc:`PySet_Discard` to add and remove elements, and :cfunc:`PySet_Contains` - and :cfunc:`PySet_Size` to examine the set's state. (Contributed by Raymond +* The built-in set types now have an official C API. Call :c:func:`PySet_New` + and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` and + :c:func:`PySet_Discard` to add and remove elements, and :c:func:`PySet_Contains` + and :c:func:`PySet_Size` to examine the set's state. (Contributed by Raymond Hettinger.) * C code can now obtain information about the exact revision of the Python - interpreter by calling the :cfunc:`Py_GetBuildInfo` function that returns a + interpreter by calling the :c:func:`Py_GetBuildInfo` function that returns a string of build information like this: ``"trunk:45355:45356M, Apr 13 2006, 07:42:19"``. (Contributed by Barry Warsaw.) * Two new macros can be used to indicate C functions that are local to the current file so that a faster calling convention can be used. - :cfunc:`Py_LOCAL(type)` declares the function as returning a value of the + :c:func:`Py_LOCAL(type)` declares the function as returning a value of the specified *type* and uses a fast-calling qualifier. - :cfunc:`Py_LOCAL_INLINE(type)` does the same thing and also requests the - function be inlined. If :cfunc:`PY_LOCAL_AGGRESSIVE` is defined before + :c:func:`Py_LOCAL_INLINE(type)` does the same thing and also requests the + function be inlined. If :c:func:`PY_LOCAL_AGGRESSIVE` is defined before :file:`python.h` is included, a set of more aggressive optimizations are enabled for the module; you should benchmark the results to find out if these optimizations actually make the code faster. (Contributed by Fredrik Lundh at the NeedForSpeed sprint.) -* :cfunc:`PyErr_NewException(name, base, dict)` can now accept a tuple of base +* :c:func:`PyErr_NewException(name, base, dict)` can now accept a tuple of base classes as its *base* argument. (Contributed by Georg Brandl.) -* The :cfunc:`PyErr_Warn` function for issuing warnings is now deprecated in - favour of :cfunc:`PyErr_WarnEx(category, message, stacklevel)` which lets you +* The :c:func:`PyErr_Warn` function for issuing warnings is now deprecated in + favour of :c:func:`PyErr_WarnEx(category, message, stacklevel)` which lets you specify the number of stack frames separating this function and the caller. A - *stacklevel* of 1 is the function calling :cfunc:`PyErr_WarnEx`, 2 is the + *stacklevel* of 1 is the function calling :c:func:`PyErr_WarnEx`, 2 is the function above that, and so forth. (Added by Neal Norwitz.) * The CPython interpreter is still written in C, but the code can now be compiled with a C++ compiler without errors. (Implemented by Anthony Baxter, Martin von L?wis, Skip Montanaro.) -* The :cfunc:`PyRange_New` function was removed. It was never documented, never +* The :c:func:`PyRange_New` function was removed. It was never documented, never used in the core code, and had dangerously lax error checking. In the unlikely case that your extensions were using it, you can replace it by something like the following:: @@ -2203,7 +2203,7 @@ --------------------- * MacOS X (10.3 and higher): dynamic loading of modules now uses the - :cfunc:`dlopen` function instead of MacOS-specific functions. + :c:func:`dlopen` function instead of MacOS-specific functions. * MacOS X: an :option:`--enable-universalsdk` switch was added to the :program:`configure` script that compiles the interpreter as a universal binary @@ -2259,15 +2259,15 @@ Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables this path checking. -* C API: Many functions now use :ctype:`Py_ssize_t` instead of :ctype:`int` to +* C API: Many functions now use :c:type:`Py_ssize_t` instead of :c:type:`int` to allow processing more data on 64-bit machines. Extension code may need to make the same change to avoid warnings and to support 64-bit machines. See the earlier section :ref:`pep-353` for a discussion of this change. * C API: The obmalloc changes mean that you must be careful to not mix usage - of the :cfunc:`PyMem_\*` and :cfunc:`PyObject_\*` families of functions. Memory - allocated with one family's :cfunc:`\*_Malloc` must be freed with the - corresponding family's :cfunc:`\*_Free` function. + of the :c:func:`PyMem_\*` and :c:func:`PyObject_\*` families of functions. Memory + allocated with one family's :c:func:`\*_Malloc` must be freed with the + corresponding family's :c:func:`\*_Free` function. .. ====================================================================== diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -121,7 +121,7 @@ with this switch to see how much work will be necessary to port code to 3.0. The value of this switch is available to Python code as the boolean variable :data:`sys.py3kwarning`, -and to C extension code as :cdata:`Py_Py3kWarningFlag`. +and to C extension code as :c:data:`Py_Py3kWarningFlag`. .. seealso:: @@ -975,10 +975,10 @@ print len(s) # 12 Unicode characters At the C level, Python 3.0 will rename the existing 8-bit -string type, called :ctype:`PyStringObject` in Python 2.x, -to :ctype:`PyBytesObject`. Python 2.6 uses ``#define`` -to support using the names :cfunc:`PyBytesObject`, -:cfunc:`PyBytes_Check`, :cfunc:`PyBytes_FromStringAndSize`, +string type, called :c:type:`PyStringObject` in Python 2.x, +to :c:type:`PyBytesObject`. Python 2.6 uses ``#define`` +to support using the names :c:func:`PyBytesObject`, +:c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`, and all the other functions and macros used with strings. Instances of the :class:`bytes` type are immutable just @@ -1010,8 +1010,8 @@ bytearray(b'ABCde') There's also a corresponding C API, with -:cfunc:`PyByteArray_FromObject`, -:cfunc:`PyByteArray_FromStringAndSize`, +:c:func:`PyByteArray_FromObject`, +:c:func:`PyByteArray_FromStringAndSize`, and various other functions. .. seealso:: @@ -1130,7 +1130,7 @@ .. XXX PyObject_GetBuffer not documented in c-api -The *flags* argument to :cfunc:`PyObject_GetBuffer` specifies +The *flags* argument to :c:func:`PyObject_GetBuffer` specifies constraints upon the memory returned. Some examples are: * :const:`PyBUF_WRITABLE` indicates that the memory must be writable. @@ -1141,7 +1141,7 @@ requests a C-contiguous (last dimension varies the fastest) or Fortran-contiguous (first dimension varies the fastest) array layout. -Two new argument codes for :cfunc:`PyArg_ParseTuple`, +Two new argument codes for :c:func:`PyArg_ParseTuple`, ``s*`` and ``z*``, return locked buffer objects for a parameter. .. seealso:: @@ -1635,7 +1635,7 @@ :meth:`__hash__` method inherited from a parent class, so assigning ``None`` was implemented as an override. At the C level, extensions can set ``tp_hash`` to - :cfunc:`PyObject_HashNotImplemented`. + :c:func:`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury Forgeot d'Arc; :issue:`2235`.) * The :exc:`GeneratorExit` exception now subclasses @@ -1705,7 +1705,7 @@ By default, this change is only applied to types that are included with the Python core. Extension modules may not necessarily be compatible with this cache, - so they must explicitly add :cmacro:`Py_TPFLAGS_HAVE_VERSION_TAG` + so they must explicitly add :c:macro:`Py_TPFLAGS_HAVE_VERSION_TAG` to the module's ``tp_flags`` field to enable the method cache. (To be compatible with the method cache, the extension module's code must not directly access and modify the ``tp_dict`` member of @@ -2284,7 +2284,7 @@ (Contributed by Raymond Hettinger; :issue:`1861`.) * The :mod:`select` module now has wrapper functions - for the Linux :cfunc:`epoll` and BSD :cfunc:`kqueue` system calls. + for the Linux :c:func:`epoll` and BSD :c:func:`kqueue` system calls. :meth:`modify` method was added to the existing :class:`poll` objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor or file object and an event mask, modifying the recorded event mask @@ -2317,13 +2317,13 @@ Calling ``signal.set_wakeup_fd(fd)`` sets a file descriptor to be used; when a signal is received, a byte is written to that file descriptor. There's also a C-level function, - :cfunc:`PySignal_SetWakeupFd`, for setting the descriptor. + :c:func:`PySignal_SetWakeupFd`, for setting the descriptor. Event loops will use this by opening a pipe to create two descriptors, one for reading and one for writing. The writable descriptor will be passed to :func:`set_wakeup_fd`, and the readable descriptor will be added to the list of descriptors monitored by the event loop via - :cfunc:`select` or :cfunc:`poll`. + :c:func:`select` or :c:func:`poll`. On receiving a signal, a byte will be written and the main event loop will be woken up, avoiding the need to poll. @@ -2384,7 +2384,7 @@ has been updated from version 2.3.2 in Python 2.5 to version 2.4.1. -* The :mod:`struct` module now supports the C99 :ctype:`_Bool` type, +* The :mod:`struct` module now supports the C99 :c:type:`_Bool` type, using the format character ``'?'``. (Contributed by David Remahl.) @@ -2392,7 +2392,7 @@ now have :meth:`terminate`, :meth:`kill`, and :meth:`send_signal` methods. On Windows, :meth:`send_signal` only supports the :const:`SIGTERM` signal, and all these methods are aliases for the Win32 API function - :cfunc:`TerminateProcess`. + :c:func:`TerminateProcess`. (Contributed by Christian Heimes.) * A new variable in the :mod:`sys` module, :attr:`float_info`, is an @@ -2977,7 +2977,7 @@ * Python now must be compiled with C89 compilers (after 19 years!). This means that the Python source tree has dropped its - own implementations of :cfunc:`memmove` and :cfunc:`strerror`, which + own implementations of :c:func:`memmove` and :c:func:`strerror`, which are in the C89 standard library. * Python 2.6 can be built with Microsoft Visual Studio 2008 (version @@ -2999,7 +2999,7 @@ * The new buffer interface, previously described in `the PEP 3118 section <#pep-3118-revised-buffer-protocol>`__, - adds :cfunc:`PyObject_GetBuffer` and :cfunc:`PyBuffer_Release`, + adds :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release`, as well as a few other functions. * Python's use of the C stdio library is now thread-safe, or at least @@ -3007,27 +3007,27 @@ bug occurred if one thread closed a file object while another thread was reading from or writing to the object. In 2.6 file objects have a reference count, manipulated by the - :cfunc:`PyFile_IncUseCount` and :cfunc:`PyFile_DecUseCount` + :c:func:`PyFile_IncUseCount` and :c:func:`PyFile_DecUseCount` functions. File objects can't be closed unless the reference count - is zero. :cfunc:`PyFile_IncUseCount` should be called while the GIL + is zero. :c:func:`PyFile_IncUseCount` should be called while the GIL is still held, before carrying out an I/O operation using the - ``FILE *`` pointer, and :cfunc:`PyFile_DecUseCount` should be called + ``FILE *`` pointer, and :c:func:`PyFile_DecUseCount` should be called immediately after the GIL is re-acquired. (Contributed by Antoine Pitrou and Gregory P. Smith.) * Importing modules simultaneously in two different threads no longer deadlocks; it will now raise an :exc:`ImportError`. A new API - function, :cfunc:`PyImport_ImportModuleNoBlock`, will look for a + function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a module in ``sys.modules`` first, then try to import it after acquiring an import lock. If the import lock is held by another thread, an :exc:`ImportError` is raised. (Contributed by Christian Heimes.) * Several functions return information about the platform's - floating-point support. :cfunc:`PyFloat_GetMax` returns + floating-point support. :c:func:`PyFloat_GetMax` returns the maximum representable floating point value, - and :cfunc:`PyFloat_GetMin` returns the minimum - positive value. :cfunc:`PyFloat_GetInfo` returns an object + and :c:func:`PyFloat_GetMin` returns the minimum + positive value. :c:func:`PyFloat_GetInfo` returns an object containing more information from the :file:`float.h` file, such as ``"mant_dig"`` (number of digits in the mantissa), ``"epsilon"`` (smallest difference between 1.0 and the next largest value @@ -3035,7 +3035,7 @@ (Contributed by Christian Heimes; :issue:`1534`.) * C functions and methods that use - :cfunc:`PyComplex_AsCComplex` will now accept arguments that + :c:func:`PyComplex_AsCComplex` will now accept arguments that have a :meth:`__complex__` method. In particular, the functions in the :mod:`cmath` module will now accept objects with this method. This is a backport of a Python 3.0 change. @@ -3049,15 +3049,15 @@ * Many C extensions define their own little macro for adding integers and strings to the module's dictionary in the ``init*`` function. Python 2.6 finally defines standard macros - for adding values to a module, :cmacro:`PyModule_AddStringMacro` - and :cmacro:`PyModule_AddIntMacro()`. (Contributed by + for adding values to a module, :c:macro:`PyModule_AddStringMacro` + and :c:macro:`PyModule_AddIntMacro()`. (Contributed by Christian Heimes.) * Some macros were renamed in both 3.0 and 2.6 to make it clearer that they are macros, - not functions. :cmacro:`Py_Size()` became :cmacro:`Py_SIZE()`, - :cmacro:`Py_Type()` became :cmacro:`Py_TYPE()`, and - :cmacro:`Py_Refcnt()` became :cmacro:`Py_REFCNT()`. + not functions. :c:macro:`Py_Size()` became :c:macro:`Py_SIZE()`, + :c:macro:`Py_Type()` became :c:macro:`Py_TYPE()`, and + :c:macro:`Py_Refcnt()` became :c:macro:`Py_REFCNT()`. The mixed-case macros are still available in Python 2.6 for backward compatibility. (:issue:`1629`) @@ -3115,7 +3115,7 @@ * The :mod:`socket` module's socket objects now have an :meth:`ioctl` method that provides a limited interface to the - :cfunc:`WSAIoctl` system interface. + :c:func:`WSAIoctl` system interface. * The :mod:`_winreg` module now has a function, :func:`ExpandEnvironmentStrings`, @@ -3261,13 +3261,13 @@ the implementation now explicitly checks for this case and raises an :exc:`ImportError`. -* C API: the :cfunc:`PyImport_Import` and :cfunc:`PyImport_ImportModule` +* C API: the :c:func:`PyImport_Import` and :c:func:`PyImport_ImportModule` functions now default to absolute imports, not relative imports. This will affect C extensions that import other modules. * C API: extension data types that shouldn't be hashable should define their ``tp_hash`` slot to - :cfunc:`PyObject_HashNotImplemented`. + :c:func:`PyObject_HashNotImplemented`. * The :mod:`socket` module exception :exc:`socket.error` now inherits from :exc:`IOError`. Previously it wasn't a subclass of diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -147,8 +147,8 @@ ``float(repr(x))`` recovers ``x``. * Float-to-string and string-to-float conversions are correctly rounded. The :func:`round` function is also now correctly rounded. -* The :ctype:`PyCapsule` type, used to provide a C API for extension modules. -* The :cfunc:`PyLong_AsLongAndOverflow` C API function. +* The :c:type:`PyCapsule` type, used to provide a C API for extension modules. +* The :c:func:`PyLong_AsLongAndOverflow` C API function. Other new Python3-mode warnings include: @@ -311,7 +311,7 @@ This means Python now supports three different modules for parsing command-line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. The :mod:`getopt` module closely resembles the C -library's :cfunc:`getopt` function, so it remains useful if you're writing a +library's :c:func:`getopt` function, so it remains useful if you're writing a Python prototype that will eventually be rewritten in C. :mod:`optparse` becomes redundant, but there are no plans to remove it because there are many scripts still using it, and there's no @@ -1478,7 +1478,7 @@ * The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:`7133`) and automatically set - OpenSSL's :cmacro:`SSL_MODE_AUTO_RETRY`, which will prevent an error + OpenSSL's :c:macro:`SSL_MODE_AUTO_RETRY`, which will prevent an error code being returned from :meth:`recv` operations that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`). @@ -2050,49 +2050,49 @@ debugged doesn't hold the GIL; the macro now acquires it before printing. (Contributed by Victor Stinner; :issue:`3632`.) -* :cfunc:`Py_AddPendingCall` is now thread-safe, letting any +* :c:func:`Py_AddPendingCall` is now thread-safe, letting any worker thread submit notifications to the main Python thread. This is particularly useful for asynchronous IO operations. (Contributed by Kristj?n Valur J?nsson; :issue:`4293`.) -* New function: :cfunc:`PyCode_NewEmpty` creates an empty code object; +* New function: :c:func:`PyCode_NewEmpty` creates an empty code object; only the filename, function name, and first line number are required. This is useful for extension modules that are attempting to construct a more useful traceback stack. Previously such - extensions needed to call :cfunc:`PyCode_New`, which had many + extensions needed to call :c:func:`PyCode_New`, which had many more arguments. (Added by Jeffrey Yasskin.) -* New function: :cfunc:`PyErr_NewExceptionWithDoc` creates a new - exception class, just as the existing :cfunc:`PyErr_NewException` does, +* New function: :c:func:`PyErr_NewExceptionWithDoc` creates a new + exception class, just as the existing :c:func:`PyErr_NewException` does, but takes an extra ``char *`` argument containing the docstring for the new exception class. (Added by 'lekma' on the Python bug tracker; :issue:`7033`.) -* New function: :cfunc:`PyFrame_GetLineNumber` takes a frame object +* New function: :c:func:`PyFrame_GetLineNumber` takes a frame object and returns the line number that the frame is currently executing. Previously code would need to get the index of the bytecode instruction currently executing, and then look up the line number corresponding to that address. (Added by Jeffrey Yasskin.) -* New functions: :cfunc:`PyLong_AsLongAndOverflow` and - :cfunc:`PyLong_AsLongLongAndOverflow` approximates a Python long - integer as a C :ctype:`long` or :ctype:`long long`. +* New functions: :c:func:`PyLong_AsLongAndOverflow` and + :c:func:`PyLong_AsLongLongAndOverflow` approximates a Python long + integer as a C :c:type:`long` or :c:type:`long long`. If the number is too large to fit into the output type, an *overflow* flag is set and returned to the caller. (Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.) * New function: stemming from the rewrite of string-to-float conversion, - a new :cfunc:`PyOS_string_to_double` function was added. The old - :cfunc:`PyOS_ascii_strtod` and :cfunc:`PyOS_ascii_atof` functions + a new :c:func:`PyOS_string_to_double` function was added. The old + :c:func:`PyOS_ascii_strtod` and :c:func:`PyOS_ascii_atof` functions are now deprecated. -* New function: :cfunc:`PySys_SetArgvEx` sets the value of +* New function: :c:func:`PySys_SetArgvEx` sets the value of ``sys.argv`` and can optionally update ``sys.path`` to include the directory containing the script named by ``sys.argv[0]`` depending on the value of an *updatepath* parameter. This function was added to close a security hole for applications - that embed Python. The old function, :cfunc:`PySys_SetArgv`, would + that embed Python. The old function, :c:func:`PySys_SetArgv`, would always update ``sys.path``, and sometimes it would add the current directory. This meant that, if you ran an application embedding Python in a directory controlled by someone else, attackers could @@ -2100,8 +2100,8 @@ :file:`os.py`) that your application would then import and run. If you maintain a C/C++ application that embeds Python, check - whether you're calling :cfunc:`PySys_SetArgv` and carefully consider - whether the application should be using :cfunc:`PySys_SetArgvEx` + whether you're calling :c:func:`PySys_SetArgv` and carefully consider + whether the application should be using :c:func:`PySys_SetArgvEx` with *updatepath* set to false. Security issue reported as `CVE-2008-5983 @@ -2109,14 +2109,14 @@ discussed in :issue:`5753`, and fixed by Antoine Pitrou. * New macros: the Python header files now define the following macros: - :cmacro:`Py_ISALNUM`, - :cmacro:`Py_ISALPHA`, - :cmacro:`Py_ISDIGIT`, - :cmacro:`Py_ISLOWER`, - :cmacro:`Py_ISSPACE`, - :cmacro:`Py_ISUPPER`, - :cmacro:`Py_ISXDIGIT`, - :cmacro:`Py_TOLOWER`, and :cmacro:`Py_TOUPPER`. + :c:macro:`Py_ISALNUM`, + :c:macro:`Py_ISALPHA`, + :c:macro:`Py_ISDIGIT`, + :c:macro:`Py_ISLOWER`, + :c:macro:`Py_ISSPACE`, + :c:macro:`Py_ISUPPER`, + :c:macro:`Py_ISXDIGIT`, + :c:macro:`Py_TOLOWER`, and :c:macro:`Py_TOUPPER`. All of these functions are analogous to the C standard macros for classifying characters, but ignore the current locale setting, because in @@ -2126,15 +2126,15 @@ .. XXX these macros don't seem to be described in the c-api docs. -* Removed function: :cmacro:`PyEval_CallObject` is now only available +* Removed function: :c:macro:`PyEval_CallObject` is now only available as a macro. A function version was being kept around to preserve ABI linking compatibility, but that was in 1997; it can certainly be deleted by now. (Removed by Antoine Pitrou; :issue:`8276`.) -* New format codes: the :cfunc:`PyFormat_FromString`, - :cfunc:`PyFormat_FromStringV`, and :cfunc:`PyErr_Format` functions now +* New format codes: the :c:func:`PyFormat_FromString`, + :c:func:`PyFormat_FromStringV`, and :c:func:`PyErr_Format` functions now accept ``%lld`` and ``%llu`` format codes for displaying - C's :ctype:`long long` types. + C's :c:type:`long long` types. (Contributed by Mark Dickinson; :issue:`7228`.) * The complicated interaction between threads and process forking has @@ -2150,17 +2150,17 @@ Python 2.7 acquires the import lock before performing an :func:`os.fork`, and will also clean up any locks created using the :mod:`threading` module. C extension modules that have internal - locks, or that call :cfunc:`fork()` themselves, will not benefit + locks, or that call :c:func:`fork()` themselves, will not benefit from this clean-up. (Fixed by Thomas Wouters; :issue:`1590864`.) -* The :cfunc:`Py_Finalize` function now calls the internal +* The :c:func:`Py_Finalize` function now calls the internal :func:`threading._shutdown` function; this prevents some exceptions from being raised when an interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.) -* When using the :ctype:`PyMemberDef` structure to define attributes +* When using the :c:type:`PyMemberDef` structure to define attributes of a type, Python will no longer let you try to delete or set a :const:`T_STRING_INPLACE` attribute. @@ -2187,7 +2187,7 @@ :issue:`6491`.) * The :program:`configure` script now checks for floating-point rounding bugs - on certain 32-bit Intel chips and defines a :cmacro:`X87_DOUBLE_ROUNDING` + on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` preprocessor definition. No code currently uses this definition, but it's available if anyone wishes to use it. (Added by Mark Dickinson; :issue:`2937`.) @@ -2208,7 +2208,7 @@ Capsules ------------------- -Python 3.1 adds a new C datatype, :ctype:`PyCapsule`, for providing a +Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API to an extension module. A capsule is essentially the holder of a C ``void *`` pointer, and is made available as a module attribute; for example, the :mod:`socket` module's API is exposed as ``socket.CAPI``, @@ -2218,10 +2218,10 @@ to an array of pointers to the module's various API functions. There is an existing data type already used for this, -:ctype:`PyCObject`, but it doesn't provide type safety. Evil code +:c:type:`PyCObject`, but it doesn't provide type safety. Evil code written in pure Python could cause a segmentation fault by taking a -:ctype:`PyCObject` from module A and somehow substituting it for the -:ctype:`PyCObject` in module B. Capsules know their own name, +:c:type:`PyCObject` from module A and somehow substituting it for the +:c:type:`PyCObject` in module B. Capsules know their own name, and getting the pointer requires providing the name:: void *vtable; @@ -2234,15 +2234,15 @@ vtable = PyCapsule_GetPointer(capsule, "mymodule.CAPI"); You are assured that ``vtable`` points to whatever you're expecting. -If a different capsule was passed in, :cfunc:`PyCapsule_IsValid` would +If a different capsule was passed in, :c:func:`PyCapsule_IsValid` would detect the mismatched name and return false. Refer to :ref:`using-capsules` for more information on using these objects. Python 2.7 now uses capsules internally to provide various -extension-module APIs, but the :cfunc:`PyCObject_AsVoidPtr` was +extension-module APIs, but the :c:func:`PyCObject_AsVoidPtr` was modified to handle capsules, preserving compile-time compatibility -with the :ctype:`CObject` interface. Use of -:cfunc:`PyCObject_AsVoidPtr` will signal a +with the :c:type:`CObject` interface. Use of +:c:func:`PyCObject_AsVoidPtr` will signal a :exc:`PendingDeprecationWarning`, which is silent by default. Implemented in Python 3.1 and backported to 2.7 by Larry Hastings; @@ -2269,7 +2269,7 @@ were also tested and documented. (Implemented by Brian Curtin: :issue:`7347`.) -* The new :cfunc:`_beginthreadex` API is used to start threads, and +* The new :c:func:`_beginthreadex` API is used to start threads, and the native thread-local storage functions are now used. (Contributed by Kristj?n Valur J?nsson; :issue:`3582`.) @@ -2277,7 +2277,7 @@ can be the constants :const:`CTRL_C_EVENT`, :const:`CTRL_BREAK_EVENT`, or any integer. The first two constants will send Control-C and Control-Break keystroke events to - subprocesses; any other value will use the :cfunc:`TerminateProcess` + subprocesses; any other value will use the :c:func:`TerminateProcess` API. (Contributed by Miki Tebeka; :issue:`1220212`.) * The :func:`os.listdir` function now correctly fails @@ -2450,17 +2450,17 @@ family of functions will now raise a :exc:`TypeError` exception instead of triggering a :exc:`DeprecationWarning` (:issue:`5080`). -* Use the new :cfunc:`PyOS_string_to_double` function instead of the old - :cfunc:`PyOS_ascii_strtod` and :cfunc:`PyOS_ascii_atof` functions, +* Use the new :c:func:`PyOS_string_to_double` function instead of the old + :c:func:`PyOS_ascii_strtod` and :c:func:`PyOS_ascii_atof` functions, which are now deprecated. For applications that embed Python: -* The :cfunc:`PySys_SetArgvEx` function was added, letting +* The :c:func:`PySys_SetArgvEx` function was added, letting applications close a security hole when the existing - :cfunc:`PySys_SetArgv` function was used. Check whether you're - calling :cfunc:`PySys_SetArgv` and carefully consider whether the - application should be using :cfunc:`PySys_SetArgvEx` with + :c:func:`PySys_SetArgv` function was used. Check whether you're + calling :c:func:`PySys_SetArgv` and carefully consider whether the + application should be using :c:func:`PySys_SetArgvEx` with *updatepath* set to false. .. ====================================================================== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:54:12 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 16:54:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_update_part_of_?= =?utf8?q?sphinxext?= Message-ID: http://hg.python.org/cpython/rev/76aa98f69251 changeset: 74396:76aa98f69251 branch: 2.7 user: Sandro Tosi date: Sat Jan 14 16:42:21 2012 +0100 summary: update part of sphinxext files: Doc/tools/sphinxext/pyspecific.py | 141 +++++++++- Doc/tools/sphinxext/static/copybutton.js | 4 +- 2 files changed, 118 insertions(+), 27 deletions(-) diff --git a/Doc/tools/sphinxext/pyspecific.py b/Doc/tools/sphinxext/pyspecific.py --- a/Doc/tools/sphinxext/pyspecific.py +++ b/Doc/tools/sphinxext/pyspecific.py @@ -5,7 +5,7 @@ Sphinx extension with Python doc-specific markup. - :copyright: 2008-2011 by Georg Brandl. + :copyright: 2008, 2009, 2010 by Georg Brandl. :license: Python license. """ @@ -13,6 +13,7 @@ SOURCE_URI = 'http://hg.python.org/cpython/file/2.7/%s' from docutils import nodes, utils +from sphinx.util.nodes import split_explicit_title # monkey-patch reST parser to disable alphabetic and roman enumerated lists from docutils.parsers.rst.states import Body @@ -48,8 +49,10 @@ # Support for linking to Python source files easily def source_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): - path = utils.unescape(text) - refnode = nodes.reference(path, path, refuri=SOURCE_URI % path) + has_t, title, target = split_explicit_title(text) + title = utils.unescape(title) + target = utils.unescape(target) + refnode = nodes.reference(title, title, refuri=SOURCE_URI % target) return [refnode], [] @@ -81,26 +84,85 @@ return [pnode] +# Support for documenting decorators + +from sphinx import addnodes +from sphinx.domains.python import PyModulelevel, PyClassmember + +class PyDecoratorMixin(object): + def handle_signature(self, sig, signode): + ret = super(PyDecoratorMixin, self).handle_signature(sig, signode) + signode.insert(0, addnodes.desc_addname('@', '@')) + return ret + + def needs_arglist(self): + return False + +class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel): + def run(self): + # a decorator function is a function after all + self.name = 'py:function' + return PyModulelevel.run(self) + +class PyDecoratorMethod(PyDecoratorMixin, PyClassmember): + def run(self): + self.name = 'py:method' + return PyClassmember.run(self) + + +# Support for documenting version of removal in deprecations + +from sphinx.locale import versionlabels +from sphinx.util.compat import Directive + +versionlabels['deprecated-removed'] = \ + 'Deprecated since version %s, will be removed in version %s' + +class DeprecatedRemoved(Directive): + has_content = True + required_arguments = 2 + optional_arguments = 1 + final_argument_whitespace = True + option_spec = {} + + def run(self): + node = addnodes.versionmodified() + node.document = self.state.document + node['type'] = 'deprecated-removed' + version = (self.arguments[0], self.arguments[1]) + node['version'] = version + if len(self.arguments) == 3: + inodes, messages = self.state.inline_text(self.arguments[2], + self.lineno+1) + node.extend(inodes) + if self.content: + self.state.nested_parse(self.content, self.content_offset, node) + ret = [node] + messages + else: + ret = [node] + env = self.state.document.settings.env + env.note_versionchange('deprecated', version[0], node, self.lineno) + return ret + + # Support for building "topic help" for pydoc pydoc_topic_labels = [ 'assert', 'assignment', 'atom-identifiers', 'atom-literals', 'attribute-access', 'attribute-references', 'augassign', 'binary', 'bitwise', 'bltin-code-objects', 'bltin-ellipsis-object', - 'bltin-file-objects', 'bltin-null-object', 'bltin-type-objects', 'booleans', - 'break', 'callable-types', 'calls', 'class', 'coercion-rules', - 'comparisons', 'compound', 'context-managers', 'continue', 'conversions', - 'customization', 'debugger', 'del', 'dict', 'dynamic-features', 'else', - 'exceptions', 'exec', 'execmodel', 'exprlists', 'floating', 'for', - 'formatstrings', 'function', 'global', 'id-classes', 'identifiers', 'if', - 'imaginary', 'import', 'in', 'integers', 'lambda', 'lists', 'naming', - 'numbers', 'numeric-types', 'objects', 'operator-summary', 'pass', 'power', - 'print', 'raise', 'return', 'sequence-methods', 'sequence-types', - 'shifting', 'slicings', 'specialattrs', 'specialnames', - 'string-conversions', 'string-methods', 'strings', 'subscriptions', 'truth', - 'try', 'types', 'typesfunctions', 'typesmapping', 'typesmethods', - 'typesmodules', 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', - 'yield' + 'bltin-null-object', 'bltin-type-objects', 'booleans', + 'break', 'callable-types', 'calls', 'class', 'comparisons', 'compound', + 'context-managers', 'continue', 'conversions', 'customization', 'debugger', + 'del', 'dict', 'dynamic-features', 'else', 'exceptions', 'execmodel', + 'exprlists', 'floating', 'for', 'formatstrings', 'function', 'global', + 'id-classes', 'identifiers', 'if', 'imaginary', 'import', 'in', 'integers', + 'lambda', 'lists', 'naming', 'nonlocal', 'numbers', 'numeric-types', + 'objects', 'operator-summary', 'pass', 'power', 'raise', 'return', + 'sequence-types', 'shifting', 'slicings', 'specialattrs', 'specialnames', + 'string-methods', 'strings', 'subscriptions', 'truth', 'try', 'types', + 'typesfunctions', 'typesmapping', 'typesmethods', 'typesmodules', + 'typesseq', 'typesseq-mutable', 'unary', 'while', 'with', 'yield' ] from os import path @@ -130,16 +192,16 @@ for label in self.status_iterator(pydoc_topic_labels, 'building topics... ', length=len(pydoc_topic_labels)): - if label not in self.env.labels: + if label not in self.env.domaindata['std']['labels']: self.warn('label %r not in documentation' % label) continue - docname, labelid, sectname = self.env.labels[label] + docname, labelid, sectname = self.env.domaindata['std']['labels'][label] doctree = self.env.get_and_resolve_doctree(docname, self) document = new_document('
    ') document.append(doctree.ids[labelid]) destination = StringOutput(encoding='utf-8') writer.write(document, destination) - self.topics[label] = writer.output + self.topics[label] = str(writer.output) def finish(self): f = open(path.join(self.outdir, 'topics.py'), 'w') @@ -158,9 +220,8 @@ # Support for documenting Opcodes import re -from sphinx import addnodes -opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)\s*\((.*)\)') +opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)(?:\s*\((.*)\))?') def parse_opcode_signature(env, sig, signode): """Transform an opcode signature into RST nodes.""" @@ -169,18 +230,48 @@ raise ValueError opname, arglist = m.groups() signode += addnodes.desc_name(opname, opname) - paramlist = addnodes.desc_parameterlist() - signode += paramlist - paramlist += addnodes.desc_parameter(arglist, arglist) + if arglist is not None: + paramlist = addnodes.desc_parameterlist() + signode += paramlist + paramlist += addnodes.desc_parameter(arglist, arglist) return opname.strip() +# Support for documenting pdb commands + +pdbcmd_sig_re = re.compile(r'([a-z()!]+)\s*(.*)') + +# later... +#pdbargs_tokens_re = re.compile(r'''[a-zA-Z]+ | # identifiers +# [.,:]+ | # punctuation +# [\[\]()] | # parens +# \s+ # whitespace +# ''', re.X) + +def parse_pdb_command(env, sig, signode): + """Transform a pdb command signature into RST nodes.""" + m = pdbcmd_sig_re.match(sig) + if m is None: + raise ValueError + name, args = m.groups() + fullname = name.replace('(', '').replace(')', '') + signode += addnodes.desc_name(name, name) + if args: + signode += addnodes.desc_addname(' '+args, ' '+args) + return fullname + + def setup(app): app.add_role('issue', issue_role) app.add_role('source', source_role) app.add_directive('impl-detail', ImplementationDetail) + app.add_directive('deprecated-removed', DeprecatedRemoved) app.add_builder(PydocTopicsBuilder) app.add_builder(suspicious.CheckSuspiciousMarkupBuilder) app.add_description_unit('opcode', 'opcode', '%s (opcode)', parse_opcode_signature) + app.add_description_unit('pdbcommand', 'pdbcmd', '%s (pdb command)', + parse_pdb_command) app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)') + app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction) + app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod) diff --git a/Doc/tools/sphinxext/static/copybutton.js b/Doc/tools/sphinxext/static/copybutton.js --- a/Doc/tools/sphinxext/static/copybutton.js +++ b/Doc/tools/sphinxext/static/copybutton.js @@ -8,8 +8,8 @@ // get the styles from the current theme pre.parent().parent().css('position', 'relative'); - var hide_text = 'Hide the prompts and ouput'; - var show_text = 'Show the prompts and ouput'; + var hide_text = 'Hide the prompts and output'; + var show_text = 'Show the prompts and output'; var border_width = pre.css('border-top-width'); var border_style = pre.css('border-top-style'); var border_color = pre.css('border-top-color'); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:54:12 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 16:54:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_None_is_not_a_k?= =?utf8?q?eyword=2C_link_file=2Enext=28=29_to_functions=2Ehtml=23next?= Message-ID: http://hg.python.org/cpython/rev/ae6e75bd5f36 changeset: 74397:ae6e75bd5f36 branch: 2.7 user: Sandro Tosi date: Sat Jan 14 16:43:14 2012 +0100 summary: None is not a keyword, link file.next() to functions.html#next files: Doc/library/stdtypes.rst | 4 ++-- Doc/library/sys.rst | 4 ++-- Doc/reference/simple_stmts.rst | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2372,12 +2372,12 @@ A file object is its own iterator, for example ``iter(f)`` returns *f* (unless *f* is closed). When a file is used as an iterator, typically in a :keyword:`for` loop (for example, ``for line in f: print line``), the - :meth:`.next` method is called repeatedly. This method returns the next input + :meth:`next` method is called repeatedly. This method returns the next input line, or raises :exc:`StopIteration` when EOF is hit when the file is open for reading (behavior is undefined when the file is open for writing). In order to make a :keyword:`for` loop the most efficient way of looping over the lines of a file (a very common operation), the :meth:`next` method uses a hidden read-ahead - buffer. As a consequence of using a read-ahead buffer, combining :meth:`.next` + buffer. As a consequence of using a read-ahead buffer, combining :meth:`next` with other file methods (like :meth:`readline`) does not work right. However, using :meth:`seek` to reposition the file to an absolute position will flush the read-ahead buffer. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -653,7 +653,7 @@ imported. The :meth:`find_module` method is called at least with the absolute name of the module being imported. If the module to be imported is contained in package then the parent package's :attr:`__path__` attribute - is passed in as a second argument. The method returns :keyword:`None` if + is passed in as a second argument. The method returns ``None`` if the module cannot be found, else returns a :term:`loader`. :data:`sys.meta_path` is searched before any implicit default finders or @@ -712,7 +712,7 @@ A dictionary acting as a cache for :term:`finder` objects. The keys are paths that have been passed to :data:`sys.path_hooks` and the values are the finders that are found. If a path is a valid file system path but no - explicit finder is found on :data:`sys.path_hooks` then :keyword:`None` is + explicit finder is found on :data:`sys.path_hooks` then ``None`` is stored to represent the implicit default finder should be used. If the path is not an existing path then :class:`imp.NullImporter` is set. diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -706,7 +706,7 @@ second argument to :meth:`find_module` is given as the value of the :attr:`__path__` attribute from the parent package (everything up to the last dot in the name of the module being imported). If a finder can find the module -it returns a :term:`loader` (discussed later) or returns :keyword:`None`. +it returns a :term:`loader` (discussed later) or returns ``None``. .. index:: single: sys.path_hooks @@ -733,11 +733,11 @@ the list with a single argument of the path, returning a finder or raises :exc:`ImportError`. If a finder is returned then it is cached in :data:`sys.path_importer_cache` and then used for that path entry. If no finder -can be found but the path exists then a value of :keyword:`None` is +can be found but the path exists then a value of ``None`` is stored in :data:`sys.path_importer_cache` to signify that an implicit, file-based finder that handles modules stored as individual files should be used for that path. If the path does not exist then a finder which always -returns :keyword:`None` is placed in the cache for the path. +returns `None`` is placed in the cache for the path. .. index:: single: loader -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:54:13 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 16:54:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_how_could_I_hav?= =?utf8?q?e_missed_=3Acmember=3A_in_import=2Erst=3F?= Message-ID: http://hg.python.org/cpython/rev/9f664e163c9d changeset: 74398:9f664e163c9d branch: 2.7 user: Sandro Tosi date: Sat Jan 14 16:51:16 2012 +0100 summary: how could I have missed :cmember: in import.rst? files: Doc/c-api/import.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst --- a/Doc/c-api/import.rst +++ b/Doc/c-api/import.rst @@ -139,7 +139,7 @@ probably damaged with respect to the module author's intents) state. The module's :attr:`__file__` attribute will be set to the code object's - :cmember:`co_filename`. + :c:member:`co_filename`. This function will reload the module if it was already imported. See :c:func:`PyImport_ReloadModule` for the intended way to reload a module. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:57:35 2012 From: python-checkins at python.org (meador.inge) Date: Sat, 14 Jan 2012 16:57:35 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzI1?= =?utf8?q?=3A_Add_a_NEWS_entry=2E?= Message-ID: http://hg.python.org/cpython/rev/3e9b107fb5da changeset: 74399:3e9b107fb5da branch: 3.2 parent: 74392:f80f9eb5df02 user: Meador Inge date: Sat Jan 14 09:32:41 2012 -0600 summary: Issue #13725: Add a NEWS entry. files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -352,6 +352,9 @@ Tests ----- +- Issue #13725: Fix regrtest to recognize the documented -d flag. + Patch by Erno Tukia. + - Issue #13304: Skip test case if user site-packages disabled (-s or PYTHONNOUSERSITE). (Patch by Carl Meyer) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 16:57:37 2012 From: python-checkins at python.org (meador.inge) Date: Sat, 14 Jan 2012 16:57:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313725=3A_Add_a_NEWS_entry=2E?= Message-ID: http://hg.python.org/cpython/rev/7332e97587da changeset: 74400:7332e97587da parent: 74393:f2b764dd0851 parent: 74399:3e9b107fb5da user: Meador Inge date: Sat Jan 14 09:56:42 2012 -0600 summary: Issue #13725: Add a NEWS entry. files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1848,6 +1848,9 @@ Tests ----- +- Issue #13725: Fix regrtest to recognize the documented -d flag. + Patch by Erno Tukia. + - Issue #13304: Skip test case if user site-packages disabled (-s or PYTHONNOUSERSITE). (Patch by Carl Meyer) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 17:06:55 2012 From: python-checkins at python.org (georg.brandl) Date: Sat, 14 Jan 2012 17:06:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_label_names?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/f72b171c5050 changeset: 74401:f72b171c5050 branch: 2.7 parent: 74398:9f664e163c9d user: Georg Brandl date: Sat Jan 14 17:06:53 2012 +0100 summary: Fix label names. files: Doc/reference/expressions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -1048,9 +1048,9 @@ .. _comparisons: .. _is: -.. _isnot: +.. _is not: .. _in: -.. _notin: +.. _not in: Comparisons =========== -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 17:54:18 2012 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 14 Jan 2012 17:54:18 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Use_GetModuleHandleW_to_avo?= =?utf8?q?id_*A_functions_where_possible=2E?= Message-ID: http://hg.python.org/cpython/rev/c932320cba33 changeset: 74402:c932320cba33 parent: 74400:7332e97587da user: Martin v. L?wis date: Sat Jan 14 17:54:09 2012 +0100 summary: Use GetModuleHandleW to avoid *A functions where possible. files: Modules/posixmodule.c | 6 +++--- PC/frozen_dllmain.c | 2 +- PC/winreg.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1155,7 +1155,7 @@ /* only recheck */ if (!has_GetFinalPathNameByHandle) { - hKernel32 = GetModuleHandle("KERNEL32"); + hKernel32 = GetModuleHandleW(L"KERNEL32"); *(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32, "GetFinalPathNameByHandleA"); *(FARPROC*)&Py_GetFinalPathNameByHandleW = GetProcAddress(hKernel32, @@ -6526,7 +6526,7 @@ /* only recheck */ if (has_CreateSymbolicLinkW) return has_CreateSymbolicLinkW; - hKernel32 = GetModuleHandle("KERNEL32"); + hKernel32 = GetModuleHandleW(L"KERNEL32"); *(FARPROC*)&Py_CreateSymbolicLinkW = GetProcAddress(hKernel32, "CreateSymbolicLinkW"); if (Py_CreateSymbolicLinkW) @@ -9365,7 +9365,7 @@ /* Obtain handle to the DLL containing CryptoAPI This should not fail */ - hAdvAPI32 = GetModuleHandle("advapi32.dll"); + hAdvAPI32 = GetModuleHandleW(L"advapi32.dll"); if(hAdvAPI32 == NULL) return win32_error("GetModuleHandle", NULL); diff --git a/PC/frozen_dllmain.c b/PC/frozen_dllmain.c --- a/PC/frozen_dllmain.c +++ b/PC/frozen_dllmain.c @@ -118,7 +118,7 @@ BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID); char funcName[255]; - HMODULE hmod = GetModuleHandle(NULL); + HMODULE hmod = GetModuleHandleW(NULL); strcpy(funcName, "_DllMain"); strcat(funcName, modName); strcat(funcName, "@12"); // stdcall convention. diff --git a/PC/winreg.c b/PC/winreg.c --- a/PC/winreg.c +++ b/PC/winreg.c @@ -1066,7 +1066,7 @@ /* Only available on 64bit platforms, so we must load it dynamically. */ - hMod = GetModuleHandle("advapi32.dll"); + hMod = GetModuleHandleW(L"advapi32.dll"); if (hMod) pfn = (RDKEFunc)GetProcAddress(hMod, "RegDeleteKeyExW"); @@ -1590,7 +1590,7 @@ /* Only available on 64bit platforms, so we must load it dynamically.*/ - hMod = GetModuleHandle("advapi32.dll"); + hMod = GetModuleHandleW(L"advapi32.dll"); if (hMod) pfn = (RDRKFunc)GetProcAddress(hMod, "RegDisableReflectionKey"); @@ -1626,7 +1626,7 @@ /* Only available on 64bit platforms, so we must load it dynamically.*/ - hMod = GetModuleHandle("advapi32.dll"); + hMod = GetModuleHandleW(L"advapi32.dll"); if (hMod) pfn = (RERKFunc)GetProcAddress(hMod, "RegEnableReflectionKey"); @@ -1663,7 +1663,7 @@ /* Only available on 64bit platforms, so we must load it dynamically.*/ - hMod = GetModuleHandle("advapi32.dll"); + hMod = GetModuleHandleW(L"advapi32.dll"); if (hMod) pfn = (RQRKFunc)GetProcAddress(hMod, "RegQueryReflectionKey"); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 18:56:18 2012 From: python-checkins at python.org (meador.inge) Date: Sat, 14 Jan 2012 18:56:18 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzg2?= =?utf8?q?=3A_Remove_unimplemented_=27trace=27_long_option_from_regrtest?= =?utf8?q?=2Epy=2E?= Message-ID: http://hg.python.org/cpython/rev/a32bc62b8772 changeset: 74403:a32bc62b8772 branch: 3.2 parent: 74399:3e9b107fb5da user: Meador Inge date: Sat Jan 14 11:50:33 2012 -0600 summary: Issue #13786: Remove unimplemented 'trace' long option from regrtest.py. files: Lib/test/regrtest.py | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -275,7 +275,7 @@ opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FdwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', - 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', + 'use=', 'threshold=', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug', 'start=', 'nowindows', 'header', 'failfast', 'match']) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -352,6 +352,8 @@ Tests ----- +- Issue #13786: Remove unimplemented 'trace' long option from regrtest.py. + - Issue #13725: Fix regrtest to recognize the documented -d flag. Patch by Erno Tukia. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 18:56:19 2012 From: python-checkins at python.org (meador.inge) Date: Sat, 14 Jan 2012 18:56:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313786=3A_Remove_unimplemented_=27trace=27_long_opti?= =?utf8?q?on_from_regrtest=2Epy=2E?= Message-ID: http://hg.python.org/cpython/rev/9b14b04a0cdd changeset: 74404:9b14b04a0cdd parent: 74402:c932320cba33 parent: 74403:a32bc62b8772 user: Meador Inge date: Sat Jan 14 11:54:43 2012 -0600 summary: Issue #13786: Remove unimplemented 'trace' long option from regrtest.py. files: Lib/test/regrtest.py | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -301,7 +301,7 @@ opts, args = getopt.getopt(sys.argv[1:], 'hvqxsoS:rf:lu:t:TD:NLR:FdwWM:nj:Gm:', ['help', 'verbose', 'verbose2', 'verbose3', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', - 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', + 'use=', 'threshold=', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=', 'multiprocess=', 'coverage', 'slaveargs=', 'forever', 'debug', 'start=', 'nowindows', 'header', 'testdir=', 'timeout=', 'wait', diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1848,6 +1848,8 @@ Tests ----- +- Issue #13786: Remove unimplemented 'trace' long option from regrtest.py. + - Issue #13725: Fix regrtest to recognize the documented -d flag. Patch by Erno Tukia. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 19:01:09 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 19:01:09 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_move_=27Documenting_Python?= =?utf8?q?=27_doc_section_here?= Message-ID: http://hg.python.org/devguide/rev/5d4a90e568ed changeset: 479:5d4a90e568ed user: Sandro Tosi date: Sat Jan 14 18:58:47 2012 +0100 summary: move 'Documenting Python' doc section here files: docquality.rst | 4 +- documenting.rst | 1715 +++++++++++++++++++++++++++++++++++ index.rst | 1 + patch.rst | 2 +- 4 files changed, 1718 insertions(+), 4 deletions(-) diff --git a/docquality.rst b/docquality.rst --- a/docquality.rst +++ b/docquality.rst @@ -8,7 +8,7 @@ appreciated with the documentation, and it requires little programming experience (with or without Python). -`Documenting Python`_ covers the details of how Python's documentation works. +:ref:`Documenting Python ` covers the details of how Python's documentation works. It includes an explanation of the markup used (although you can figure a lot out simply by looking at pre-existing documentation) and how to build the documentation (which allows you to see how your changes will look along with @@ -32,8 +32,6 @@ `_ which discusses the documentation toolchain, projects, standards, etc. -.. _Documenting Python: http://docs.python.org/dev/documenting/ - Helping with issues filed on the issue tracker ---------------------------------------------- diff --git a/documenting.rst b/documenting.rst new file mode 100644 --- /dev/null +++ b/documenting.rst @@ -0,0 +1,1715 @@ +.. _documenting: + +Documenting Python +================== + +The Python language has a substantial body of documentation, much of it +contributed by various authors. The markup used for the Python documentation is +`reStructuredText`_, developed by the `docutils`_ project, amended by custom +directives and using a toolset named `Sphinx`_ to postprocess the HTML output. + +This document describes the style guide for our documentation as well as the +custom reStructuredText markup introduced by Sphinx to support Python +documentation and how it should be used. + +.. _reStructuredText: http://docutils.sf.net/rst.html +.. _docutils: http://docutils.sf.net/ +.. _Sphinx: http://sphinx.pocoo.org/ + +.. note:: + + If you're interested in contributing to Python's documentation, there's no + need to write reStructuredText if you're not so inclined; plain text + contributions are more than welcome as well. Send an e-mail to + docs at python.org or open an issue on the :ref:`tracker `. + + +Introduction +============ + +Python's documentation has long been considered to be good for a free +programming language. There are a number of reasons for this, the most +important being the early commitment of Python's creator, Guido van Rossum, to +providing documentation on the language and its libraries, and the continuing +involvement of the user community in providing assistance for creating and +maintaining documentation. + +The involvement of the community takes many forms, from authoring to bug reports +to just plain complaining when the documentation could be more complete or +easier to use. + +This document is aimed at authors and potential authors of documentation for +Python. More specifically, it is for people contributing to the standard +documentation and developing additional documents using the same tools as the +standard documents. This guide will be less useful for authors using the Python +documentation tools for topics other than Python, and less useful still for +authors not using the tools at all. + +If your interest is in contributing to the Python documentation, but you don't +have the time or inclination to learn reStructuredText and the markup structures +documented here, there's a welcoming place for you among the Python contributors +as well. Any time you feel that you can clarify existing documentation or +provide documentation that's missing, the existing documentation team will +gladly work with you to integrate your text, dealing with the markup for you. +Please don't let the material in this document stand between the documentation +and your desire to help out! + + +Style guide +=========== + +The Python documentation should follow the `Apple Publications Style Guide`_ +wherever possible. This particular style guide was selected mostly because it +seems reasonable and is easy to get online. + +Topics which are either not covered in Apple's style guide or treated +differently in Python documentation will be discussed in this +document. + +Use of whitespace +----------------- + +All reST files use an indentation of 3 spaces; no tabs are allowed. The +maximum line length is 80 characters for normal text, but tables, deeply +indented code samples and long links may extend beyond that. Code example +bodies should use normal Python 4-space indentation. + +Make generous use of blank lines where applicable; they help grouping things +together. + +A sentence-ending period may be followed by one or two spaces; while reST +ignores the second space, it is customarily put in by some users, for example +to aid Emacs' auto-fill mode. + +Footnotes +--------- + +Footnotes are generally discouraged, though they may be used when they are the +best way to present specific information. When a footnote reference is added at +the end of the sentence, it should follow the sentence-ending punctuation. The +reST markup should appear something like this:: + + This sentence has a footnote reference. [#]_ This is the next sentence. + +Footnotes should be gathered at the end of a file, or if the file is very long, +at the end of a section. The docutils will automatically create backlinks to +the footnote reference. + +Footnotes may appear in the middle of sentences where appropriate. + +Capitalization +-------------- + +.. sidebar:: Sentence case + + Sentence case is a set of capitalization rules used in English + sentences: the first word is always capitalized and other words are + only capitalized if there is a specific rule requiring it. + +Apple style guide recommends the use of title case in section titles. +However, rules for which words should be capitalized in title case +vary greaty between publications. + +In Python documentation, use of sentence case in section titles is +preferable, but consistency within a unit is more important than +following this rule. If you add a section to the chapter where most +sections are in title case you can either convert all titles to +sentence case or use the dominant style in the new section title. + +Sentences that start with a word for which specific rules require +starting it with a lower case letter should be avoided in titles and +elsewhere. + +.. note:: + + Sections that describe a library module often have titles in the + form of "modulename --- Short description of the module." In this + case, the description should be capitalized as a stand-alone + sentence. + +Many special names are used in the Python documentation, including the names of +operating systems, programming languages, standards bodies, and the like. Most +of these entities are not assigned any special markup, but the preferred +spellings are given here to aid authors in maintaining the consistency of +presentation in the Python documentation. + +Other terms and words deserve special mention as well; these conventions should +be used to ensure consistency throughout the documentation: + +CPU + For "central processing unit." Many style guides say this should be + spelled out on the first use (and if you must use it, do so!). For + the Python documentation, this abbreviation should be avoided since + there's no reasonable way to predict which occurrence will be the + first seen by the reader. It is better to use the word "processor" + instead. + +POSIX + The name assigned to a particular group of standards. This is always + uppercase. + +Python + The name of our favorite programming language is always capitalized. + +reST + For "reStructuredText," an easy to read, plaintext markup syntax + used to produce Python documentation. When spelled out, it is + always one word and both forms start with a lower case 'r'. + +Unicode + The name of a character coding system. This is always written + capitalized. + +Unix + The name of the operating system developed at AT&T Bell Labs in the early + 1970s. + +Affirmative Tone +---------------- + +The documentation focuses on affirmatively stating what the language does and +how to use it effectively. + +Except for certain security risks or segfault risks, the docs should avoid +wording along the lines of "feature x is dangerous" or "experts only". These +kinds of value judgments belong in external blogs and wikis, not in the core +documentation. + +Bad example (creating worry in the mind of a reader): + + Warning: failing to explicitly close a file could result in lost data or + excessive resource consumption. Never rely on reference counting to + automatically close a file. + +Good example (establishing confident knowledge in the effective use of the language): + + A best practice for using files is use a try/finally pair to explicitly + close a file after it is used. Alternatively, using a with-statement can + achieve the same effect. This assures that files are flushed and file + descriptor resources are released in a timely manner. + +Economy of Expression +--------------------- + +More documentation is not necessarily better documentation. Err on the side +of being succinct. + +It is an unfortunate fact that making documentation longer can be an impediment +to understanding and can result in even more ways to misread or misinterpret the +text. Long descriptions full of corner cases and caveats can create the +impression that a function is more complex or harder to use than it actually is. + +The documentation for :func:`super` is an example of where a good deal of +information was condensed into a few short paragraphs. Discussion of +:func:`super` could have filled a chapter in a book, but it is often easier to +grasp a terse description than a lengthy narrative. + + +Code Examples +------------- + +Short code examples can be a useful adjunct to understanding. Readers can often +grasp a simple example more quickly than they can digest a formal description in +prose. + +People learn faster with concrete, motivating examples that match the context of +a typical use case. For instance, the :func:`str.rpartition` method is better +demonstrated with an example splitting the domain from a URL than it would be +with an example of removing the last word from a line of Monty Python dialog. + +The ellipsis for the :attr:`sys.ps2` secondary interpreter prompt should only be +used sparingly, where it is necessary to clearly differentiate between input +lines and output lines. Besides contributing visual clutter, it makes it +difficult for readers to cut-and-paste examples so they can experiment with +variations. + +Code Equivalents +---------------- + +Giving pure Python code equivalents (or approximate equivalents) can be a useful +adjunct to a prose description. A documenter should carefully weigh whether the +code equivalent adds value. + +A good example is the code equivalent for :func:`all`. The short 4-line code +equivalent is easily digested; it re-emphasizes the early-out behavior; and it +clarifies the handling of the corner-case where the iterable is empty. In +addition, it serves as a model for people wanting to implement a commonly +requested alternative where :func:`all` would return the specific object +evaluating to False whenever the function terminates early. + +A more questionable example is the code for :func:`itertools.groupby`. Its code +equivalent borders on being too complex to be a quick aid to understanding. +Despite its complexity, the code equivalent was kept because it serves as a +model to alternative implementations and because the operation of the "grouper" +is more easily shown in code than in English prose. + +An example of when not to use a code equivalent is for the :func:`oct` function. +The exact steps in converting a number to octal doesn't add value for a user +trying to learn what the function does. + +Audience +-------- + +The tone of the tutorial (and all the docs) needs to be respectful of the +reader's intelligence. Don't presume that the readers are stupid. Lay out the +relevant information, show motivating use cases, provide glossary links, and do +your best to connect-the-dots, but don't talk down to them or waste their time. + +The tutorial is meant for newcomers, many of whom will be using the tutorial to +evaluate the language as a whole. The experience needs to be positive and not +leave the reader with worries that something bad will happen if they make a +misstep. The tutorial serves as guide for intelligent and curious readers, +saving details for the how-to guides and other sources. + +Be careful accepting requests for documentation changes from the rare but vocal +category of reader who is looking for vindication for one of their programming +errors ("I made a mistake, therefore the docs must be wrong ..."). Typically, +the documentation wasn't consulted until after the error was made. It is +unfortunate, but typically no documentation edit would have saved the user from +making false assumptions about the language ("I was surprised by ..."). + + +.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf + + +reStructuredText Primer +======================= + +This section is a brief introduction to reStructuredText (reST) concepts and +syntax, intended to provide authors with enough information to author documents +productively. Since reST was designed to be a simple, unobtrusive markup +language, this will not take too long. + +.. seealso:: + + The authoritative `reStructuredText User + Documentation `_. + + +Paragraphs +---------- + +The paragraph is the most basic block in a reST document. Paragraphs are simply +chunks of text separated by one or more blank lines. As in Python, indentation +is significant in reST, so all lines of the same paragraph must be left-aligned +to the same level of indentation. + + +Inline markup +------------- + +The standard reST inline markup is quite simple: use + +* one asterisk: ``*text*`` for emphasis (italics), +* two asterisks: ``**text**`` for strong emphasis (boldface), and +* backquotes: ````text```` for code samples. + +If asterisks or backquotes appear in running text and could be confused with +inline markup delimiters, they have to be escaped with a backslash. + +Be aware of some restrictions of this markup: + +* it may not be nested, +* content may not start or end with whitespace: ``* text*`` is wrong, +* it must be separated from surrounding text by non-word characters. Use a + backslash escaped space to work around that: ``thisis\ *one*\ word``. + +These restrictions may be lifted in future versions of the docutils. + +reST also allows for custom "interpreted text roles"', which signify that the +enclosed text should be interpreted in a specific way. Sphinx uses this to +provide semantic markup and cross-referencing of identifiers, as described in +the appropriate section. The general syntax is ``:rolename:`content```. + + +Lists and Quotes +---------------- + +List markup is natural: just place an asterisk at the start of a paragraph and +indent properly. The same goes for numbered lists; they can also be +autonumbered using a ``#`` sign:: + + * This is a bulleted list. + * It has two items, the second + item uses two lines. + + 1. This is a numbered list. + 2. It has two items too. + + #. This is a numbered list. + #. It has two items too. + + +Nested lists are possible, but be aware that they must be separated from the +parent list items by blank lines:: + + * this is + * a list + + * with a nested list + * and some subitems + + * and here the parent list continues + +Definition lists are created as follows:: + + term (up to a line of text) + Definition of the term, which must be indented + + and can even consist of multiple paragraphs + + next term + Description. + + +Paragraphs are quoted by just indenting them more than the surrounding +paragraphs. + + +Source Code +----------- + +Literal code blocks are introduced by ending a paragraph with the special marker +``::``. The literal block must be indented:: + + This is a normal text paragraph. The next paragraph is a code sample:: + + It is not processed in any way, except + that the indentation is removed. + + It can span multiple lines. + + This is a normal text paragraph again. + +The handling of the ``::`` marker is smart: + +* If it occurs as a paragraph of its own, that paragraph is completely left + out of the document. +* If it is preceded by whitespace, the marker is removed. +* If it is preceded by non-whitespace, the marker is replaced by a single + colon. + +That way, the second sentence in the above example's first paragraph would be +rendered as "The next paragraph is a code sample:". + + +Hyperlinks +---------- + +External links +^^^^^^^^^^^^^^ + +Use ```Link text `_`` for inline web links. If the link text +should be the web address, you don't need special markup at all, the parser +finds links and mail addresses in ordinary text. + +Internal links +^^^^^^^^^^^^^^ + +Internal linking is done via a special reST role, see the section on specific +markup, :ref:`doc-ref-role`. + + +Sections +-------- + +Section headers are created by underlining (and optionally overlining) the +section title with a punctuation character, at least as long as the text:: + + ================= + This is a heading + ================= + +Normally, there are no heading levels assigned to certain characters as the +structure is determined from the succession of headings. However, for the +Python documentation, we use this convention: + +* ``#`` with overline, for parts +* ``*`` with overline, for chapters +* ``=``, for sections +* ``-``, for subsections +* ``^``, for subsubsections +* ``"``, for paragraphs + + +Explicit Markup +--------------- + +"Explicit markup" is used in reST for most constructs that need special +handling, such as footnotes, specially-highlighted paragraphs, comments, and +generic directives. + +An explicit markup block begins with a line starting with ``..`` followed by +whitespace and is terminated by the next paragraph at the same level of +indentation. (There needs to be a blank line between explicit markup and normal +paragraphs. This may all sound a bit complicated, but it is intuitive enough +when you write it.) + + +Directives +---------- + +A directive is a generic block of explicit markup. Besides roles, it is one of +the extension mechanisms of reST, and Sphinx makes heavy use of it. + +Basically, a directive consists of a name, arguments, options and content. (Keep +this terminology in mind, it is used in the next chapter describing custom +directives.) Looking at this example, :: + + .. function:: foo(x) + foo(y, z) + :bar: no + + Return a line of text input from the user. + +``function`` is the directive name. It is given two arguments here, the +remainder of the first line and the second line, as well as one option ``bar`` +(as you can see, options are given in the lines immediately following the +arguments and indicated by the colons). + +The directive content follows after a blank line and is indented relative to the +directive start. + + +Footnotes +--------- + +For footnotes, use ``[#]_`` to mark the footnote location, and add the footnote +body at the bottom of the document after a "Footnotes" rubric heading, like so:: + + Lorem ipsum [#]_ dolor sit amet ... [#]_ + + .. rubric:: Footnotes + + .. [#] Text of the first footnote. + .. [#] Text of the second footnote. + +You can also explicitly number the footnotes for better context. + + +Comments +-------- + +Every explicit markup block which isn't a valid markup construct (like the +footnotes above) is regarded as a comment. + + +Source encoding +--------------- + +Since the easiest way to include special characters like em dashes or copyright +signs in reST is to directly write them as Unicode characters, one has to +specify an encoding: + +All Python documentation source files must be in UTF-8 encoding, and the HTML +documents written from them will be in that encoding as well. + + +Gotchas +------- + +There are some problems one commonly runs into while authoring reST documents: + +* **Separation of inline markup:** As said above, inline markup spans must be + separated from the surrounding text by non-word characters, you have to use + an escaped space to get around that. + + +Additional Markup Constructs +============================ + +Sphinx adds a lot of new directives and interpreted text roles to standard reST +markup. This section contains the reference material for these facilities. +Documentation for "standard" reST constructs is not included here, though +they are used in the Python documentation. + +.. note:: + + This is just an overview of Sphinx' extended markup capabilities; full + coverage can be found in `its own documentation + `_. + + +Meta-information markup +----------------------- + +.. describe:: sectionauthor + + Identifies the author of the current section. The argument should include + the author's name such that it can be used for presentation (though it isn't) + and email address. The domain name portion of the address should be lower + case. Example:: + + .. sectionauthor:: Guido van Rossum + + Currently, this markup isn't reflected in the output in any way, but it helps + keep track of contributions. + + +Module-specific markup +---------------------- + +The markup described in this section is used to provide information about a +module being documented. Each module should be documented in its own file. +Normally this markup appears after the title heading of that file; a typical +file might start like this:: + + :mod:`parrot` -- Dead parrot access + =================================== + + .. module:: parrot + :platform: Unix, Windows + :synopsis: Analyze and reanimate dead parrots. + .. moduleauthor:: Eric Cleese + .. moduleauthor:: John Idle + +As you can see, the module-specific markup consists of two directives, the +``module`` directive and the ``moduleauthor`` directive. + +.. describe:: module + + This directive marks the beginning of the description of a module, package, + or submodule. The name should be fully qualified (i.e. including the + package name for submodules). + + The ``platform`` option, if present, is a comma-separated list of the + platforms on which the module is available (if it is available on all + platforms, the option should be omitted). The keys are short identifiers; + examples that are in use include "IRIX", "Mac", "Windows", and "Unix". It is + important to use a key which has already been used when applicable. + + The ``synopsis`` option should consist of one sentence describing the + module's purpose -- it is currently only used in the Global Module Index. + + The ``deprecated`` option can be given (with no value) to mark a module as + deprecated; it will be designated as such in various locations then. + +.. describe:: moduleauthor + + The ``moduleauthor`` directive, which can appear multiple times, names the + authors of the module code, just like ``sectionauthor`` names the author(s) + of a piece of documentation. It too does not result in any output currently. + +.. note:: + + It is important to make the section title of a module-describing file + meaningful since that value will be inserted in the table-of-contents trees + in overview files. + + +Information units +----------------- + +There are a number of directives used to describe specific features provided by +modules. Each directive requires one or more signatures to provide basic +information about what is being described, and the content should be the +description. The basic version makes entries in the general index; if no index +entry is desired, you can give the directive option flag ``:noindex:``. The +following example shows all of the features of this directive type:: + + .. function:: spam(eggs) + ham(eggs) + :noindex: + + Spam or ham the foo. + +The signatures of object methods or data attributes should not include the +class name, but be nested in a class directive. The generated files will +reflect this nesting, and the target identifiers (for HTML output) will use +both the class and method name, to enable consistent cross-references. If you +describe methods belonging to an abstract protocol such as context managers, +use a class directive with a (pseudo-)type name too to make the +index entries more informative. + +The directives are: + +.. describe:: c:function + + Describes a C function. The signature should be given as in C, e.g.:: + + .. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) + + This is also used to describe function-like preprocessor macros. The names + of the arguments should be given so they may be used in the description. + + Note that you don't have to backslash-escape asterisks in the signature, + as it is not parsed by the reST inliner. + +.. describe:: c:member + + Describes a C struct member. Example signature:: + + .. c:member:: PyObject* PyTypeObject.tp_bases + + The text of the description should include the range of values allowed, how + the value should be interpreted, and whether the value can be changed. + References to structure members in text should use the ``member`` role. + +.. describe:: c:macro + + Describes a "simple" C macro. Simple macros are macros which are used + for code expansion, but which do not take arguments so cannot be described as + functions. This is not to be used for simple constant definitions. Examples + of its use in the Python documentation include :c:macro:`PyObject_HEAD` and + :c:macro:`Py_BEGIN_ALLOW_THREADS`. + +.. describe:: c:type + + Describes a C type. The signature should just be the type name. + +.. describe:: c:var + + Describes a global C variable. The signature should include the type, such + as:: + + .. cvar:: PyObject* PyClass_Type + +.. describe:: data + + Describes global data in a module, including both variables and values used + as "defined constants." Class and object attributes are not documented + using this directive. + +.. describe:: exception + + Describes an exception class. The signature can, but need not include + parentheses with constructor arguments. + +.. describe:: function + + Describes a module-level function. The signature should include the + parameters, enclosing optional parameters in brackets. Default values can be + given if it enhances clarity. For example:: + + .. function:: repeat([repeat=3[, number=1000000]]) + + Object methods are not documented using this directive. Bound object methods + placed in the module namespace as part of the public interface of the module + are documented using this, as they are equivalent to normal functions for + most purposes. + + The description should include information about the parameters required and + how they are used (especially whether mutable objects passed as parameters + are modified), side effects, and possible exceptions. A small example may be + provided. + +.. describe:: decorator + + Describes a decorator function. The signature should *not* represent the + signature of the actual function, but the usage as a decorator. For example, + given the functions + + .. code-block:: python + + def removename(func): + func.__name__ = '' + return func + + def setnewname(name): + def decorator(func): + func.__name__ = name + return func + return decorator + + the descriptions should look like this:: + + .. decorator:: removename + + Remove name of the decorated function. + + .. decorator:: setnewname(name) + + Set name of the decorated function to *name*. + + There is no ``deco`` role to link to a decorator that is marked up with + this directive; rather, use the ``:func:`` role. + +.. describe:: class + + Describes a class. The signature can include parentheses with parameters + which will be shown as the constructor arguments. + +.. describe:: attribute + + Describes an object data attribute. The description should include + information about the type of the data to be expected and whether it may be + changed directly. This directive should be nested in a class directive, + like in this example:: + + .. class:: Spam + + Description of the class. + + .. data:: ham + + Description of the attribute. + + If is also possible to document an attribute outside of a class directive, + for example if the documentation for different attributes and methods is + split in multiple sections. The class name should then be included + explicitly:: + + .. data:: Spam.eggs + +.. describe:: method + + Describes an object method. The parameters should not include the ``self`` + parameter. The description should include similar information to that + described for ``function``. This directive should be nested in a class + directive, like in the example above. + +.. describe:: decoratormethod + + Same as ``decorator``, but for decorators that are methods. + + Refer to a decorator method using the ``:meth:`` role. + +.. describe:: opcode + + Describes a Python :term:`bytecode` instruction. + +.. describe:: cmdoption + + Describes a Python command line option or switch. Option argument names + should be enclosed in angle brackets. Example:: + + .. cmdoption:: -m + + Run a module as a script. + +.. describe:: envvar + + Describes an environment variable that Python uses or defines. + + +There is also a generic version of these directives: + +.. describe:: describe + + This directive produces the same formatting as the specific ones explained + above but does not create index entries or cross-referencing targets. It is + used, for example, to describe the directives in this document. Example:: + + .. describe:: opcode + + Describes a Python bytecode instruction. + + +Showing code examples +--------------------- + +Examples of Python source code or interactive sessions are represented using +standard reST literal blocks. They are started by a ``::`` at the end of the +preceding paragraph and delimited by indentation. + +Representing an interactive session requires including the prompts and output +along with the Python code. No special markup is required for interactive +sessions. After the last line of input or output presented, there should not be +an "unused" primary prompt; this is an example of what *not* to do:: + + >>> 1 + 1 + 2 + >>> + +Syntax highlighting is handled in a smart way: + +* There is a "highlighting language" for each source file. Per default, + this is ``'python'`` as the majority of files will have to highlight Python + snippets. + +* Within Python highlighting mode, interactive sessions are recognized + automatically and highlighted appropriately. + +* The highlighting language can be changed using the ``highlightlang`` + directive, used as follows:: + + .. highlightlang:: c + + This language is used until the next ``highlightlang`` directive is + encountered. + +* The values normally used for the highlighting language are: + + * ``python`` (the default) + * ``c`` + * ``rest`` + * ``none`` (no highlighting) + +* If highlighting with the current language fails, the block is not highlighted + in any way. + +Longer displays of verbatim text may be included by storing the example text in +an external file containing only plain text. The file may be included using the +``literalinclude`` directive. [1]_ For example, to include the Python source file +:file:`example.py`, use:: + + .. literalinclude:: example.py + +The file name is relative to the current file's path. Documentation-specific +include files should be placed in the ``Doc/includes`` subdirectory. + + +Inline markup +------------- + +As said before, Sphinx uses interpreted text roles to insert semantic markup in +documents. + +Names of local variables, such as function/method arguments, are an exception, +they should be marked simply with ``*var*``. + +For all other roles, you have to write ``:rolename:`content```. + +There are some additional facilities that make cross-referencing roles more +versatile: + +* You may supply an explicit title and reference target, like in reST direct + hyperlinks: ``:role:`title ``` will refer to *target*, but the link + text will be *title*. + +* If you prefix the content with ``!``, no reference/hyperlink will be created. + +* For the Python object roles, if you prefix the content with ``~``, the link + text will only be the last component of the target. For example, + ``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only + display ``get`` as the link text. + + In HTML output, the link's ``title`` attribute (that is e.g. shown as a + tool-tip on mouse-hover) will always be the full target name. + +The following roles refer to objects in modules and are possibly hyperlinked if +a matching identifier is found: + +.. describe:: mod + + The name of a module; a dotted name may be used. This should also be used for + package names. + +.. describe:: func + + The name of a Python function; dotted names may be used. The role text + should not include trailing parentheses to enhance readability. The + parentheses are stripped when searching for identifiers. + +.. describe:: data + + The name of a module-level variable or constant. + +.. describe:: const + + The name of a "defined" constant. This may be a C-language ``#define`` + or a Python variable that is not intended to be changed. + +.. describe:: class + + A class name; a dotted name may be used. + +.. describe:: meth + + The name of a method of an object. The role text should include the type + name and the method name. A dotted name may be used. + +.. describe:: attr + + The name of a data attribute of an object. + +.. describe:: exc + + The name of an exception. A dotted name may be used. + +The name enclosed in this markup can include a module name and/or a class name. +For example, ``:func:`filter``` could refer to a function named ``filter`` in +the current module, or the built-in function of that name. In contrast, +``:func:`foo.filter``` clearly refers to the ``filter`` function in the ``foo`` +module. + +Normally, names in these roles are searched first without any further +qualification, then with the current module name prepended, then with the +current module and class name (if any) prepended. If you prefix the name with a +dot, this order is reversed. For example, in the documentation of the +:mod:`codecs` module, ``:func:`open``` always refers to the built-in function, +while ``:func:`.open``` refers to :func:`codecs.open`. + +A similar heuristic is used to determine whether the name is an attribute of +the currently documented class. + +The following roles create cross-references to C-language constructs if they +are defined in the API documentation: + +.. describe:: c:data + + The name of a C-language variable. + +.. describe:: c:func + + The name of a C-language function. Should include trailing parentheses. + +.. describe:: c:macro + + The name of a "simple" C macro, as defined above. + +.. describe:: c:type + + The name of a C-language type. + +.. describe:: c:member + + The name of a C type member, as defined above. + + +The following role does possibly create a cross-reference, but does not refer +to objects: + +.. describe:: token + + The name of a grammar token (used in the reference manual to create links + between production displays). + + +The following role creates a cross-reference to the term in the glossary: + +.. describe:: term + + Reference to a term in the glossary. The glossary is created using the + ``glossary`` directive containing a definition list with terms and + definitions. It does not have to be in the same file as the ``term`` + markup, in fact, by default the Python docs have one global glossary + in the ``glossary.rst`` file. + + If you use a term that's not explained in a glossary, you'll get a warning + during build. + +--------- + +The following roles don't do anything special except formatting the text +in a different style: + +.. describe:: command + + The name of an OS-level command, such as ``rm``. + +.. describe:: dfn + + Mark the defining instance of a term in the text. (No index entries are + generated.) + +.. describe:: envvar + + An environment variable. Index entries are generated. + +.. describe:: file + + The name of a file or directory. Within the contents, you can use curly + braces to indicate a "variable" part, for example:: + + ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... + + In the built documentation, the ``x`` will be displayed differently to + indicate that it is to be replaced by the Python minor version. + +.. describe:: guilabel + + Labels presented as part of an interactive user interface should be marked + using ``guilabel``. This includes labels from text-based interfaces such as + those created using :mod:`curses` or other text-based libraries. Any label + used in the interface should be marked with this role, including button + labels, window titles, field names, menu and menu selection names, and even + values in selection lists. + +.. describe:: kbd + + Mark a sequence of keystrokes. What form the key sequence takes may depend + on platform- or application-specific conventions. When there are no relevant + conventions, the names of modifier keys should be spelled out, to improve + accessibility for new users and non-native speakers. For example, an + *xemacs* key sequence may be marked like ``:kbd:`C-x C-f```, but without + reference to a specific application or platform, the same sequence should be + marked as ``:kbd:`Control-x Control-f```. + +.. describe:: keyword + + The name of a Python keyword. Using this role will generate a link to the + documentation of the keyword. ``True``, ``False`` and ``None`` do not use + this role, but simple code markup (````True````), given that they're + fundamental to the language and should be known to any programmer. + +.. describe:: mailheader + + The name of an RFC 822-style mail header. This markup does not imply that + the header is being used in an email message, but can be used to refer to any + header of the same "style." This is also used for headers defined by the + various MIME specifications. The header name should be entered in the same + way it would normally be found in practice, with the camel-casing conventions + being preferred where there is more than one common usage. For example: + ``:mailheader:`Content-Type```. + +.. describe:: makevar + + The name of a :command:`make` variable. + +.. describe:: manpage + + A reference to a Unix manual page including the section, + e.g. ``:manpage:`ls(1)```. + +.. describe:: menuselection + + Menu selections should be marked using the ``menuselection`` role. This is + used to mark a complete sequence of menu selections, including selecting + submenus and choosing a specific operation, or any subsequence of such a + sequence. The names of individual selections should be separated by + ``-->``. + + For example, to mark the selection "Start > Programs", use this markup:: + + :menuselection:`Start --> Programs` + + When including a selection that includes some trailing indicator, such as the + ellipsis some operating systems use to indicate that the command opens a + dialog, the indicator should be omitted from the selection name. + +.. describe:: mimetype + + The name of a MIME type, or a component of a MIME type (the major or minor + portion, taken alone). + +.. describe:: newsgroup + + The name of a Usenet newsgroup. + +.. describe:: option + + A command-line option of Python. The leading hyphen(s) must be included. + If a matching ``cmdoption`` directive exists, it is linked to. For options + of other programs or scripts, use simple ````code```` markup. + +.. describe:: program + + The name of an executable program. This may differ from the file name for + the executable for some platforms. In particular, the ``.exe`` (or other) + extension should be omitted for Windows programs. + +.. describe:: regexp + + A regular expression. Quotes should not be included. + +.. describe:: samp + + A piece of literal text, such as code. Within the contents, you can use + curly braces to indicate a "variable" part, as in ``:file:``. + + If you don't need the "variable part" indication, use the standard + ````code```` instead. + + +The following roles generate external links: + +.. describe:: pep + + A reference to a Python Enhancement Proposal. This generates appropriate + index entries. The text "PEP *number*\ " is generated; in the HTML output, + this text is a hyperlink to an online copy of the specified PEP. + +.. describe:: rfc + + A reference to an Internet Request for Comments. This generates appropriate + index entries. The text "RFC *number*\ " is generated; in the HTML output, + this text is a hyperlink to an online copy of the specified RFC. + + +Note that there are no special roles for including hyperlinks as you can use +the standard reST markup for that purpose. + + +.. _doc-ref-role: + +Cross-linking markup +-------------------- + +To support cross-referencing to arbitrary sections in the documentation, the +standard reST labels are "abused" a bit: Every label must precede a section +title; and every label name must be unique throughout the entire documentation +source. + +You can then reference to these sections using the ``:ref:`label-name``` role. + +Example:: + + .. _my-reference-label: + + Section to cross-reference + -------------------------- + + This is the text of the section. + + It refers to the section itself, see :ref:`my-reference-label`. + +The ``:ref:`` invocation is replaced with the section title. + +Alternatively, you can reference any label (not just section titles) +if you provide the link text ``:ref:`link text ```. + +Paragraph-level markup +---------------------- + +These directives create short paragraphs and can be used inside information +units as well as normal text: + +.. describe:: note + + An especially important bit of information about an API that a user should be + aware of when using whatever bit of API the note pertains to. The content of + the directive should be written in complete sentences and include all + appropriate punctuation. + + Example:: + + .. note:: + + This function is not suitable for sending spam e-mails. + +.. describe:: warning + + An important bit of information about an API that a user should be aware of + when using whatever bit of API the warning pertains to. The content of the + directive should be written in complete sentences and include all appropriate + punctuation. In the interest of not scaring users away from pages filled + with warnings, this directive should only be chosen over ``note`` for + information regarding the possibility of crashes, data loss, or security + implications. + +.. describe:: versionadded + + This directive documents the version of Python which added the described + feature to the library or C API. When this applies to an entire module, it + should be placed at the top of the module section before any prose. + + The first argument must be given and is the version in question; you can add + a second argument consisting of a *brief* explanation of the change. + + Example:: + + .. versionadded:: 3.1 + The *spam* parameter. + + Note that there must be no blank line between the directive head and the + explanation; this is to make these blocks visually continuous in the markup. + +.. describe:: versionchanged + + Similar to ``versionadded``, but describes when and what changed in the named + feature in some way (new parameters, changed side effects, etc.). + +-------------- + +.. describe:: impl-detail + + This directive is used to mark CPython-specific information. Use either with + a block content or a single sentence as an argument, i.e. either :: + + .. impl-detail:: + + This describes some implementation detail. + + More explanation. + + or :: + + .. impl-detail:: This shortly mentions an implementation detail. + + "\ **CPython implementation detail:**\ " is automatically prepended to the + content. + +.. describe:: seealso + + Many sections include a list of references to module documentation or + external documents. These lists are created using the ``seealso`` directive. + + The ``seealso`` directive is typically placed in a section just before any + sub-sections. For the HTML output, it is shown boxed off from the main flow + of the text. + + The content of the ``seealso`` directive should be a reST definition list. + Example:: + + .. seealso:: + + Module :mod:`zipfile` + Documentation of the :mod:`zipfile` standard module. + + `GNU tar manual, Basic Tar Format `_ + Documentation for tar archive files, including GNU tar extensions. + +.. describe:: rubric + + This directive creates a paragraph heading that is not used to create a + table of contents node. It is currently used for the "Footnotes" caption. + +.. describe:: centered + + This directive creates a centered boldfaced paragraph. Use it as follows:: + + .. centered:: + + Paragraph contents. + + +Table-of-contents markup +------------------------ + +Since reST does not have facilities to interconnect several documents, or split +documents into multiple output files, Sphinx uses a custom directive to add +relations between the single files the documentation is made of, as well as +tables of contents. The ``toctree`` directive is the central element. + +.. describe:: toctree + + This directive inserts a "TOC tree" at the current location, using the + individual TOCs (including "sub-TOC trees") of the files given in the + directive body. A numeric ``maxdepth`` option may be given to indicate the + depth of the tree; by default, all levels are included. + + Consider this example (taken from the library reference index):: + + .. toctree:: + :maxdepth: 2 + + intro + strings + datatypes + numeric + (many more files listed here) + + This accomplishes two things: + + * Tables of contents from all those files are inserted, with a maximum depth + of two, that means one nested heading. ``toctree`` directives in those + files are also taken into account. + * Sphinx knows that the relative order of the files ``intro``, + ``strings`` and so forth, and it knows that they are children of the + shown file, the library index. From this information it generates "next + chapter", "previous chapter" and "parent chapter" links. + + In the end, all files included in the build process must occur in one + ``toctree`` directive; Sphinx will emit a warning if it finds a file that is + not included, because that means that this file will not be reachable through + standard navigation. + + The special file ``contents.rst`` at the root of the source directory is the + "root" of the TOC tree hierarchy; from it the "Contents" page is generated. + + +Index-generating markup +----------------------- + +Sphinx automatically creates index entries from all information units (like +functions, classes or attributes) like discussed before. + +However, there is also an explicit directive available, to make the index more +comprehensive and enable index entries in documents where information is not +mainly contained in information units, such as the language reference. + +The directive is ``index`` and contains one or more index entries. Each entry +consists of a type and a value, separated by a colon. + +For example:: + + .. index:: + single: execution; context + module: __main__ + module: sys + triple: module; search; path + +This directive contains five entries, which will be converted to entries in the +generated index which link to the exact location of the index statement (or, in +case of offline media, the corresponding page number). + +The possible entry types are: + +single + Creates a single index entry. Can be made a subentry by separating the + subentry text with a semicolon (this notation is also used below to describe + what entries are created). +pair + ``pair: loop; statement`` is a shortcut that creates two index entries, + namely ``loop; statement`` and ``statement; loop``. +triple + Likewise, ``triple: module; search; path`` is a shortcut that creates three + index entries, which are ``module; search path``, ``search; path, module`` and + ``path; module search``. +module, keyword, operator, object, exception, statement, builtin + These all create two index entries. For example, ``module: hashlib`` creates + the entries ``module; hashlib`` and ``hashlib; module``. + +For index directives containing only "single" entries, there is a shorthand +notation:: + + .. index:: BNF, grammar, syntax, notation + +This creates four index entries. + + +Grammar production displays +--------------------------- + +Special markup is available for displaying the productions of a formal grammar. +The markup is simple and does not attempt to model all aspects of BNF (or any +derived forms), but provides enough to allow context-free grammars to be +displayed in a way that causes uses of a symbol to be rendered as hyperlinks to +the definition of the symbol. There is this directive: + +.. describe:: productionlist + + This directive is used to enclose a group of productions. Each production is + given on a single line and consists of a name, separated by a colon from the + following definition. If the definition spans multiple lines, each + continuation line must begin with a colon placed at the same column as in the + first line. + + Blank lines are not allowed within ``productionlist`` directive arguments. + + The definition can contain token names which are marked as interpreted text + (e.g. ``unaryneg ::= "-" `integer```) -- this generates cross-references + to the productions of these tokens. + + Note that no further reST parsing is done in the production, so that you + don't have to escape ``*`` or ``|`` characters. + + +.. XXX describe optional first parameter + +The following is an example taken from the Python Reference Manual:: + + .. productionlist:: + try_stmt: try1_stmt | try2_stmt + try1_stmt: "try" ":" `suite` + : ("except" [`expression` ["," `target`]] ":" `suite`)+ + : ["else" ":" `suite`] + : ["finally" ":" `suite`] + try2_stmt: "try" ":" `suite` + : "finally" ":" `suite` + + +Substitutions +------------- + +The documentation system provides three substitutions that are defined by default. +They are set in the build configuration file :file:`conf.py`. + +.. describe:: |release| + + Replaced by the Python release the documentation refers to. This is the full + version string including alpha/beta/release candidate tags, e.g. ``2.5.2b3``. + +.. describe:: |version| + + Replaced by the Python version the documentation refers to. This consists + only of the major and minor version parts, e.g. ``2.5``, even for version + 2.5.1. + +.. describe:: |today| + + Replaced by either today's date, or the date set in the build configuration + file. Normally has the format ``April 14, 2007``. + + +.. rubric:: Footnotes + +.. [1] There is a standard ``.. include`` directive, but it raises errors if the + file is not found. This one only emits a warning. + + +Differences to the LaTeX markup +=============================== + +Though the markup language is different, most of the concepts and markup types +of the old LaTeX docs have been kept -- environments as reST directives, inline +commands as reST roles and so forth. + +However, there are some differences in the way these work, partly due to the +differences in the markup languages, partly due to improvements in Sphinx. This +section lists these differences, in order to give those familiar with the old +format a quick overview of what they might run into. + +Inline markup +------------- + +These changes have been made to inline markup: + +* **Cross-reference roles** + + Most of the following semantic roles existed previously as inline commands, + but didn't do anything except formatting the content as code. Now, they + cross-reference to known targets (some names have also been shortened): + + | *mod* (previously *refmodule* or *module*) + | *func* (previously *function*) + | *data* (new) + | *const* + | *class* + | *meth* (previously *method*) + | *attr* (previously *member*) + | *exc* (previously *exception*) + | *cdata* + | *cfunc* (previously *cfunction*) + | *cmacro* (previously *csimplemacro*) + | *ctype* + + Also different is the handling of *func* and *meth*: while previously + parentheses were added to the callable name (like ``\func{str()}``), they are + now appended by the build system -- appending them in the source will result + in double parentheses. This also means that ``:func:`str(object)``` will not + work as expected -- use ````str(object)```` instead! + +* **Inline commands implemented as directives** + + These were inline commands in LaTeX, but are now directives in reST: + + | *deprecated* + | *versionadded* + | *versionchanged* + + These are used like so:: + + .. deprecated:: 2.5 + Reason of deprecation. + + Also, no period is appended to the text for *versionadded* and + *versionchanged*. + + | *note* + | *warning* + + These are used like so:: + + .. note:: + + Content of note. + +* **Otherwise changed commands** + + The *samp* command previously formatted code and added quotation marks around + it. The *samp* role, however, features a new highlighting system just like + *file* does: + + ``:samp:`open({filename}, {mode})``` results in :samp:`open({filename}, {mode})` + +* **Dropped commands** + + These were commands in LaTeX, but are not available as roles: + + | *bfcode* + | *character* (use :samp:`\`\`'c'\`\``) + | *citetitle* (use ```Title `_``) + | *code* (use ````code````) + | *email* (just write the address in body text) + | *filenq* + | *filevar* (use the ``{...}`` highlighting feature of *file*) + | *programopt*, *longprogramopt* (use *option*) + | *ulink* (use ```Title `_``) + | *url* (just write the URL in body text) + | *var* (use ``*var*``) + | *infinity*, *plusminus* (use the Unicode character) + | *shortversion*, *version* (use the ``|version|`` and ``|release|`` substitutions) + | *emph*, *strong* (use the reST markup) + +* **Backslash escaping** + + In reST, a backslash must be escaped in normal text, and in the content of + roles. However, in code literals and literal blocks, it must not be escaped. + Example: ``:file:`C:\\Temp\\my.tmp``` vs. ````open("C:\Temp\my.tmp")````. + + +Information units +----------------- + +Information units (*...desc* environments) have been made reST directives. +These changes to information units should be noted: + +* **New names** + + "desc" has been removed from every name. Additionally, these directives have + new names: + + | *cfunction* (previously *cfuncdesc*) + | *cmacro* (previously *csimplemacrodesc*) + | *exception* (previously *excdesc*) + | *function* (previously *funcdesc*) + | *attribute* (previously *memberdesc*) + + The *classdesc\** and *excclassdesc* environments have been dropped, the + *class* and *exception* directives support classes documented with and without + constructor arguments. + +* **Multiple objects** + + The equivalent of the *...line* commands is:: + + .. function:: do_foo(bar) + do_bar(baz) + + Description of the functions. + + IOW, just give one signatures per line, at the same indentation level. + +* **Arguments** + + There is no *optional* command. Just give function signatures like they + should appear in the output:: + + .. function:: open(filename[, mode[, buffering]]) + + Description. + + Note: markup in the signature is not supported. + +* **Indexing** + + The *...descni* environments have been dropped. To mark an information unit + as unsuitable for index entry generation, use the *noindex* option like so:: + + .. function:: foo_* + :noindex: + + Description. + +* **New information units** + + There are new generic information units: One is called "describe" and can be + used to document things that are not covered by the other units:: + + .. describe:: a == b + + The equals operator. + + The others are:: + + .. cmdoption:: -O + + Describes a command-line option. + + .. envvar:: PYTHONINSPECT + + Describes an environment variable. + + +Structure +--------- + +The LaTeX docs were split in several toplevel manuals. Now, all files are part +of the same documentation tree, as indicated by the *toctree* directives in the +sources (though individual output formats may choose to split them up into parts +again). Every *toctree* directive embeds other files as subdocuments of the +current file (this structure is not necessarily mirrored in the filesystem +layout). The toplevel file is :file:`contents.rst`. + +However, most of the old directory structure has been kept, with the +directories renamed as follows: + +* :file:`api` -> :file:`c-api` +* :file:`dist` -> :file:`distutils`, with the single TeX file split up +* :file:`doc` -> :file:`documenting` +* :file:`ext` -> :file:`extending` +* :file:`inst` -> :file:`installing` +* :file:`lib` -> :file:`library` +* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex` + moved to :file:`using/mac.rst` +* :file:`ref` -> :file:`reference` +* :file:`tut` -> :file:`tutorial`, with the single TeX file split up + + +.. XXX more (index-generating, production lists, ...) + + +Building the documentation +========================== + +You need to have Python 2.4 or higher installed; the toolset used to build the +docs is written in Python. It is called *Sphinx*, it is not included in this +tree, but maintained separately. Also needed are the docutils, supplying the +base markup that Sphinx uses, Jinja, a templating engine, and optionally +Pygments, a code highlighter. + + +Using make +---------- + +Luckily, a Makefile has been prepared so that on Unix, provided you have +installed Python and Subversion, you can just run :: + + cd Doc + make html + +to check out the necessary toolset in the :file:`tools/` subdirectory and build +the HTML output files. To view the generated HTML, point your favorite browser +at the top-level index :file:`build/html/index.html` after running "make". + +Available make targets are: + + * "html", which builds standalone HTML files for offline viewing. + + * "htmlhelp", which builds HTML files and a HTML Help project file usable to + convert them into a single Compiled HTML (.chm) file -- these are popular + under Microsoft Windows, but very handy on every platform. + + To create the CHM file, you need to run the Microsoft HTML Help Workshop + over the generated project (.hhp) file. + + * "latex", which builds LaTeX source files as input to "pdflatex" to produce + PDF documents. + + * "text", which builds a plain text file for each source file. + + * "linkcheck", which checks all external references to see whether they are + broken, redirected or malformed, and outputs this information to stdout + as well as a plain-text (.txt) file. + + * "changes", which builds an overview over all versionadded/versionchanged/ + deprecated items in the current version. This is meant as a help for the + writer of the "What's New" document. + + * "coverage", which builds a coverage overview for standard library modules + and C API. + + * "pydoc-topics", which builds a Python module containing a dictionary with + plain text documentation for the labels defined in + :file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and + keyword help. + +A "make update" updates the Subversion checkouts in :file:`tools/`. + + +Without make +------------ + +You'll need to install the Sphinx package, either by checking it out via :: + + svn co http://svn.python.org/projects/external/Sphinx-0.6.5/sphinx tools/sphinx + +or by installing it from PyPI. + +Then, you need to install Docutils, either by checking it out via :: + + svn co http://svn.python.org/projects/external/docutils-0.6/docutils tools/docutils + +or by installing it from http://docutils.sf.net/. + +You also need Jinja2, either by checking it out via :: + + svn co http://svn.python.org/projects/external/Jinja-2.3.1/jinja2 tools/jinja2 + +or by installing it from PyPI. + +You can optionally also install Pygments, either as a checkout via :: + + svn co http://svn.python.org/projects/external/Pygments-1.3.1/pygments tools/pygments + +or from PyPI at http://pypi.python.org/pypi/Pygments. + + +Then, make an output directory, e.g. under `build/`, and run :: + + python tools/sphinx-build.py -b . build/ + +where `` is one of html, text, latex, or htmlhelp (for explanations see +the make targets above). diff --git a/index.rst b/index.rst --- a/index.rst +++ b/index.rst @@ -10,6 +10,7 @@ runtests coverage docquality + documenting silencewarnings fixingissues helptriage diff --git a/patch.rst b/patch.rst --- a/patch.rst +++ b/patch.rst @@ -92,7 +92,7 @@ test seems impacted by your changes, because there might be interferences unknown to you between your changes and some other part of the interpreter. -Fifth, proper `documentation `_ +Fifth, proper :ref:`documentation ` additions/changes should be included. Sixth, if you are not already in the ``Misc/ACKS`` file then add your name. If -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sat Jan 14 19:23:39 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 14 Jan 2012 19:23:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_add_str=2Ecasefold=28=29_?= =?utf8?b?KGNsb3NlcyAjMTM3NTIp?= Message-ID: http://hg.python.org/cpython/rev/d4669f43d05f changeset: 74405:d4669f43d05f user: Benjamin Peterson date: Sat Jan 14 13:23:30 2012 -0500 summary: add str.casefold() (closes #13752) files: Doc/library/stdtypes.rst | 8 + Include/unicodeobject.h | 5 + Lib/test/test_unicode.py | 8 + Misc/NEWS | 2 + Objects/unicodectype.c | 25 +- Objects/unicodeobject.c | 35 + Objects/unicodetype_db.h | 497 ++++++++++++++---- Tools/unicode/makeunicodedata.py | 50 +- 8 files changed, 493 insertions(+), 137 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1002,6 +1002,14 @@ rest lowercased. +.. method:: str.casefold() + + Return a casefolded copy of the string. Casefolded strings may be used for + caseless matching. For example, ``"MASSE".casefold() == "ma?e".casefold()``. + + .. versionadded:: 3.3 + + .. method:: str.center(width[, fillchar]) Return centered in a string of length *width*. Padding is done using the diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2023,6 +2023,11 @@ Py_UCS4 *res ); +PyAPI_FUNC(int) _PyUnicode_ToFoldedFull( + Py_UCS4 ch, /* Unicode character */ + Py_UCS4 *res + ); + PyAPI_FUNC(int) _PyUnicode_IsCaseIgnorable( Py_UCS4 ch /* Unicode character */ ); diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -565,6 +565,14 @@ self.assertEqual('\U0008fffe'.lower(), '\U0008fffe') self.assertEqual('\u2177'.lower(), '\u2177') + def test_casefold(self): + self.assertEqual('hello'.casefold(), 'hello') + self.assertEqual('hELlo'.casefold(), 'hello') + self.assertEqual('?'.casefold(), 'ss') + self.assertEqual('?'.casefold(), 'fi') + self.assertEqual('\u03a3'.casefold(), '\u03c3') + self.assertEqual('A\u0345\u03a3'.casefold(), 'a\u03b9\u03c3') + def test_upper(self): string_tests.CommonTest.test_upper(self) self.assertEqual('\U0001044F'.upper(), '\U00010427') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #13752: Add a casefold() method to str. + - Issue #13761: Add a "flush" keyword argument to the print() function, used to ensure flushing the output stream. diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -185,7 +185,7 @@ const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); if (ctype->flags & EXTENDED_CASE_MASK) - return _PyUnicode_ExtendedCase[ctype->upper & 0xFFFFFF]; + return _PyUnicode_ExtendedCase[ctype->upper & 0xFFFF]; return ctype->upper ? ctype->upper : ch; } @@ -197,7 +197,7 @@ const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); if (ctype->flags & EXTENDED_CASE_MASK) - return _PyUnicode_ExtendedCase[ctype->lower & 0xFFFFFF]; + return _PyUnicode_ExtendedCase[ctype->lower & 0xFFFF]; return ctype->lower ? ctype->lower : ch; } @@ -206,7 +206,7 @@ const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); if (ctype->flags & EXTENDED_CASE_MASK) { - int index = ctype->lower & 0xFFFFFF; + int index = ctype->lower & 0xFFFF; int n = ctype->lower >> 24; int i; for (i = 0; i < n; i++) @@ -222,7 +222,7 @@ const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); if (ctype->flags & EXTENDED_CASE_MASK) { - int index = ctype->title & 0xFFFFFF; + int index = ctype->title & 0xFFFF; int n = ctype->title >> 24; int i; for (i = 0; i < n; i++) @@ -238,7 +238,7 @@ const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); if (ctype->flags & EXTENDED_CASE_MASK) { - int index = ctype->upper & 0xFFFFFF; + int index = ctype->upper & 0xFFFF; int n = ctype->upper >> 24; int i; for (i = 0; i < n; i++) @@ -249,6 +249,21 @@ return 1; } +int _PyUnicode_ToFoldedFull(Py_UCS4 ch, Py_UCS4 *res) +{ + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + if (ctype->flags & EXTENDED_CASE_MASK && (ctype->lower >> 20) & 7) { + int index = (ctype->lower & 0xFFFF) + (ctype->lower >> 24); + int n = (ctype->lower >> 20) & 7; + int i; + for (i = 0; i < n; i++) + res[i] = _PyUnicode_ExtendedCase[index + i]; + return n; + } + return _PyUnicode_ToLowerFull(ch, res); +} + int _PyUnicode_IsCased(Py_UCS4 ch) { const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9577,6 +9577,24 @@ } static Py_ssize_t +do_casefold(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) +{ + Py_ssize_t i, k = 0; + + for (i = 0; i < length; i++) { + Py_UCS4 c = PyUnicode_READ(kind, data, i); + Py_UCS4 mapped[3]; + int j, n_res = _PyUnicode_ToFoldedFull(c, mapped); + for (j = 0; j < n_res; j++) { + if (mapped[j] > *maxchar) + *maxchar = mapped[j]; + res[k++] = mapped[j]; + } + } + return k; +} + +static Py_ssize_t do_title(int kind, void *data, Py_ssize_t length, Py_UCS4 *res, Py_UCS4 *maxchar) { Py_ssize_t i, k = 0; @@ -10501,6 +10519,22 @@ return case_operation(self, do_capitalize); } +PyDoc_STRVAR(casefold__doc__, + "S.casefold() -> str\n\ +\n\ +Return a version of S suitable for caseless comparisons."); + +static PyObject * +unicode_casefold(PyObject *self) +{ + if (PyUnicode_READY(self) == -1) + return NULL; + if (PyUnicode_IS_ASCII(self)) + return ascii_upper_or_lower(self, 1); + return case_operation(self, do_casefold); +} + + /* Argument converter. Coerces to a single unicode character */ static int @@ -12998,6 +13032,7 @@ {"rsplit", (PyCFunction) unicode_rsplit, METH_VARARGS, rsplit__doc__}, {"join", (PyCFunction) unicode_join, METH_O, join__doc__}, {"capitalize", (PyCFunction) unicode_capitalize, METH_NOARGS, capitalize__doc__}, + {"casefold", (PyCFunction) unicode_casefold, METH_NOARGS, casefold__doc__}, {"title", (PyCFunction) unicode_title, METH_NOARGS, title__doc__}, {"center", (PyCFunction) unicode_center, METH_VARARGS, center__doc__}, {"count", (PyCFunction) unicode_count, METH_VARARGS, count__doc__}, diff --git a/Objects/unicodetype_db.h b/Objects/unicodetype_db.h --- a/Objects/unicodetype_db.h +++ b/Objects/unicodetype_db.h @@ -76,7 +76,7 @@ {0, 0, 0, 0, 0, 4096}, {0, 0, 0, 0, 2, 3076}, {0, 0, 0, 0, 3, 3076}, - {924, 181, 924, 0, 0, 9993}, + {16777218, 17825792, 16777218, 0, 0, 26377}, {0, 0, 0, 0, 0, 5632}, {0, 0, 0, 0, 1, 3076}, {0, 0, 0, 0, 0, 3072}, @@ -110,7 +110,7 @@ {220, 252, 220, 0, 0, 10113}, {221, 253, 221, 0, 0, 10113}, {222, 254, 222, 0, 0, 10113}, - {33554433, 16777216, 33554435, 0, 0, 26377}, + {33554438, 18874371, 33554440, 0, 0, 26377}, {192, 224, 192, 0, 0, 9993}, {193, 225, 193, 0, 0, 9993}, {194, 226, 194, 0, 0, 9993}, @@ -190,7 +190,7 @@ {300, 301, 300, 0, 0, 9993}, {302, 303, 302, 0, 0, 10113}, {302, 303, 302, 0, 0, 9993}, - {16777223, 33554437, 16777223, 0, 0, 26497}, + {16777228, 33554442, 16777228, 0, 0, 26497}, {73, 305, 73, 0, 0, 9993}, {306, 307, 306, 0, 0, 10113}, {306, 307, 306, 0, 0, 9993}, @@ -214,7 +214,7 @@ {325, 326, 325, 0, 0, 9993}, {327, 328, 327, 0, 0, 10113}, {327, 328, 327, 0, 0, 9993}, - {33554441, 16777224, 33554441, 0, 0, 26377}, + {33554448, 18874381, 33554448, 0, 0, 26377}, {330, 331, 330, 0, 0, 10113}, {330, 331, 330, 0, 0, 9993}, {332, 333, 332, 0, 0, 10113}, @@ -268,7 +268,7 @@ {379, 380, 379, 0, 0, 9993}, {381, 382, 381, 0, 0, 10113}, {381, 382, 381, 0, 0, 9993}, - {83, 383, 83, 0, 0, 9993}, + {16777236, 17825810, 16777236, 0, 0, 26377}, {579, 384, 579, 0, 0, 9993}, {385, 595, 385, 0, 0, 10113}, {386, 387, 386, 0, 0, 10113}, @@ -371,7 +371,7 @@ {492, 493, 492, 0, 0, 9993}, {494, 495, 494, 0, 0, 10113}, {494, 495, 494, 0, 0, 9993}, - {33554444, 16777227, 33554444, 0, 0, 26377}, + {33554456, 18874389, 33554456, 0, 0, 26377}, {497, 499, 498, 0, 0, 10113}, {497, 499, 498, 0, 0, 10049}, {497, 499, 498, 0, 0, 9993}, @@ -490,7 +490,7 @@ {439, 658, 439, 0, 0, 9993}, {0, 0, 0, 0, 0, 14089}, {0, 0, 0, 0, 0, 5889}, - {921, 837, 921, 0, 0, 13832}, + {16777244, 17825818, 16777244, 0, 0, 30216}, {880, 881, 880, 0, 0, 10113}, {880, 881, 880, 0, 0, 9993}, {882, 883, 882, 0, 0, 10113}, @@ -508,7 +508,7 @@ {908, 972, 908, 0, 0, 10113}, {910, 973, 910, 0, 0, 10113}, {911, 974, 911, 0, 0, 10113}, - {50331663, 16777230, 50331663, 0, 0, 26377}, + {50331681, 19922973, 50331681, 0, 0, 26377}, {913, 945, 913, 0, 0, 10113}, {914, 946, 914, 0, 0, 10113}, {915, 947, 915, 0, 0, 10113}, @@ -539,7 +539,7 @@ {904, 941, 904, 0, 0, 9993}, {905, 942, 905, 0, 0, 9993}, {906, 943, 906, 0, 0, 9993}, - {50331667, 16777234, 50331667, 0, 0, 26377}, + {50331688, 19922980, 50331688, 0, 0, 26377}, {913, 945, 913, 0, 0, 9993}, {914, 946, 914, 0, 0, 9993}, {915, 947, 915, 0, 0, 9993}, @@ -557,7 +557,7 @@ {927, 959, 927, 0, 0, 9993}, {928, 960, 928, 0, 0, 9993}, {929, 961, 929, 0, 0, 9993}, - {931, 962, 931, 0, 0, 9993}, + {16777261, 17825835, 16777261, 0, 0, 26377}, {931, 963, 931, 0, 0, 9993}, {932, 964, 932, 0, 0, 9993}, {933, 965, 933, 0, 0, 9993}, @@ -571,11 +571,11 @@ {910, 973, 910, 0, 0, 9993}, {911, 974, 911, 0, 0, 9993}, {975, 983, 975, 0, 0, 10113}, - {914, 976, 914, 0, 0, 9993}, - {920, 977, 920, 0, 0, 9993}, + {16777264, 17825838, 16777264, 0, 0, 26377}, + {16777267, 17825841, 16777267, 0, 0, 26377}, {0, 0, 0, 0, 0, 10113}, - {934, 981, 934, 0, 0, 9993}, - {928, 982, 928, 0, 0, 9993}, + {16777270, 17825844, 16777270, 0, 0, 26377}, + {16777273, 17825847, 16777273, 0, 0, 26377}, {975, 983, 975, 0, 0, 9993}, {984, 985, 984, 0, 0, 10113}, {984, 985, 984, 0, 0, 9993}, @@ -601,11 +601,11 @@ {1004, 1005, 1004, 0, 0, 9993}, {1006, 1007, 1006, 0, 0, 10113}, {1006, 1007, 1006, 0, 0, 9993}, - {922, 1008, 922, 0, 0, 9993}, - {929, 1009, 929, 0, 0, 9993}, + {16777276, 17825850, 16777276, 0, 0, 26377}, + {16777279, 17825853, 16777279, 0, 0, 26377}, {1017, 1010, 1017, 0, 0, 9993}, {1012, 952, 1012, 0, 0, 10113}, - {917, 1013, 917, 0, 0, 9993}, + {16777282, 17825856, 16777282, 0, 0, 26377}, {1015, 1016, 1015, 0, 0, 10113}, {1015, 1016, 1015, 0, 0, 9993}, {1017, 1010, 1017, 0, 0, 10113}, @@ -978,7 +978,7 @@ {1364, 1412, 1364, 0, 0, 9993}, {1365, 1413, 1365, 0, 0, 9993}, {1366, 1414, 1366, 0, 0, 9993}, - {33554455, 16777238, 33554457, 0, 0, 26377}, + {33554502, 18874435, 33554504, 0, 0, 26377}, {0, 0, 0, 0, 0, 1537}, {4256, 11520, 4256, 0, 0, 10113}, {4257, 11521, 4257, 0, 0, 10113}, @@ -1180,13 +1180,13 @@ {7826, 7827, 7826, 0, 0, 9993}, {7828, 7829, 7828, 0, 0, 10113}, {7828, 7829, 7828, 0, 0, 9993}, - {33554460, 16777243, 33554460, 0, 0, 26377}, - {33554463, 16777246, 33554463, 0, 0, 26377}, - {33554466, 16777249, 33554466, 0, 0, 26377}, - {33554469, 16777252, 33554469, 0, 0, 26377}, - {33554472, 16777255, 33554472, 0, 0, 26377}, - {7776, 7835, 7776, 0, 0, 9993}, - {7838, 223, 7838, 0, 0, 10113}, + {33554509, 18874442, 33554509, 0, 0, 26377}, + {33554514, 18874447, 33554514, 0, 0, 26377}, + {33554519, 18874452, 33554519, 0, 0, 26377}, + {33554524, 18874457, 33554524, 0, 0, 26377}, + {33554529, 18874462, 33554529, 0, 0, 26377}, + {16777317, 17825891, 16777317, 0, 0, 26377}, + {16777321, 18874470, 16777321, 0, 0, 26497}, {7840, 7841, 7840, 0, 0, 10113}, {7840, 7841, 7840, 0, 0, 9993}, {7842, 7843, 7842, 0, 0, 10113}, @@ -1355,13 +1355,13 @@ {8011, 8003, 8011, 0, 0, 10113}, {8012, 8004, 8012, 0, 0, 10113}, {8013, 8005, 8013, 0, 0, 10113}, - {33554475, 16777258, 33554475, 0, 0, 26377}, + {33554541, 18874474, 33554541, 0, 0, 26377}, {8025, 8017, 8025, 0, 0, 9993}, - {50331694, 16777261, 50331694, 0, 0, 26377}, + {50331763, 19923055, 50331763, 0, 0, 26377}, {8027, 8019, 8027, 0, 0, 9993}, - {50331698, 16777265, 50331698, 0, 0, 26377}, + {50331770, 19923062, 50331770, 0, 0, 26377}, {8029, 8021, 8029, 0, 0, 9993}, - {50331702, 16777269, 50331702, 0, 0, 26377}, + {50331777, 19923069, 50331777, 0, 0, 26377}, {8031, 8023, 8031, 0, 0, 9993}, {8025, 8017, 8025, 0, 0, 10113}, {8027, 8019, 8027, 0, 0, 10113}, @@ -1397,110 +1397,110 @@ {8171, 8059, 8171, 0, 0, 9993}, {8186, 8060, 8186, 0, 0, 9993}, {8187, 8061, 8187, 0, 0, 9993}, - {33554490, 16777273, 16777276, 0, 0, 26377}, - {33554494, 16777277, 16777280, 0, 0, 26377}, - {33554498, 16777281, 16777284, 0, 0, 26377}, - {33554502, 16777285, 16777288, 0, 0, 26377}, - {33554506, 16777289, 16777292, 0, 0, 26377}, - {33554510, 16777293, 16777296, 0, 0, 26377}, - {33554514, 16777297, 16777300, 0, 0, 26377}, - {33554518, 16777301, 16777304, 0, 0, 26377}, - {33554522, 16777305, 16777308, 0, 0, 26433}, - {33554526, 16777309, 16777312, 0, 0, 26433}, - {33554530, 16777313, 16777316, 0, 0, 26433}, - {33554534, 16777317, 16777320, 0, 0, 26433}, - {33554538, 16777321, 16777324, 0, 0, 26433}, - {33554542, 16777325, 16777328, 0, 0, 26433}, - {33554546, 16777329, 16777332, 0, 0, 26433}, - {33554550, 16777333, 16777336, 0, 0, 26433}, - {33554554, 16777337, 16777340, 0, 0, 26377}, - {33554558, 16777341, 16777344, 0, 0, 26377}, - {33554562, 16777345, 16777348, 0, 0, 26377}, - {33554566, 16777349, 16777352, 0, 0, 26377}, - {33554570, 16777353, 16777356, 0, 0, 26377}, - {33554574, 16777357, 16777360, 0, 0, 26377}, - {33554578, 16777361, 16777364, 0, 0, 26377}, - {33554582, 16777365, 16777368, 0, 0, 26377}, - {33554586, 16777369, 16777372, 0, 0, 26433}, - {33554590, 16777373, 16777376, 0, 0, 26433}, - {33554594, 16777377, 16777380, 0, 0, 26433}, - {33554598, 16777381, 16777384, 0, 0, 26433}, - {33554602, 16777385, 16777388, 0, 0, 26433}, - {33554606, 16777389, 16777392, 0, 0, 26433}, - {33554610, 16777393, 16777396, 0, 0, 26433}, - {33554614, 16777397, 16777400, 0, 0, 26433}, - {33554618, 16777401, 16777404, 0, 0, 26377}, - {33554622, 16777405, 16777408, 0, 0, 26377}, - {33554626, 16777409, 16777412, 0, 0, 26377}, - {33554630, 16777413, 16777416, 0, 0, 26377}, - {33554634, 16777417, 16777420, 0, 0, 26377}, - {33554638, 16777421, 16777424, 0, 0, 26377}, - {33554642, 16777425, 16777428, 0, 0, 26377}, - {33554646, 16777429, 16777432, 0, 0, 26377}, - {33554650, 16777433, 16777436, 0, 0, 26433}, - {33554654, 16777437, 16777440, 0, 0, 26433}, - {33554658, 16777441, 16777444, 0, 0, 26433}, - {33554662, 16777445, 16777448, 0, 0, 26433}, - {33554666, 16777449, 16777452, 0, 0, 26433}, - {33554670, 16777453, 16777456, 0, 0, 26433}, - {33554674, 16777457, 16777460, 0, 0, 26433}, - {33554678, 16777461, 16777464, 0, 0, 26433}, + {33554567, 18874500, 16777353, 0, 0, 26377}, + {33554573, 18874506, 16777359, 0, 0, 26377}, + {33554579, 18874512, 16777365, 0, 0, 26377}, + {33554585, 18874518, 16777371, 0, 0, 26377}, + {33554591, 18874524, 16777377, 0, 0, 26377}, + {33554597, 18874530, 16777383, 0, 0, 26377}, + {33554603, 18874536, 16777389, 0, 0, 26377}, + {33554609, 18874542, 16777395, 0, 0, 26377}, + {33554615, 18874548, 16777401, 0, 0, 26433}, + {33554621, 18874554, 16777407, 0, 0, 26433}, + {33554627, 18874560, 16777413, 0, 0, 26433}, + {33554633, 18874566, 16777419, 0, 0, 26433}, + {33554639, 18874572, 16777425, 0, 0, 26433}, + {33554645, 18874578, 16777431, 0, 0, 26433}, + {33554651, 18874584, 16777437, 0, 0, 26433}, + {33554657, 18874590, 16777443, 0, 0, 26433}, + {33554663, 18874596, 16777449, 0, 0, 26377}, + {33554669, 18874602, 16777455, 0, 0, 26377}, + {33554675, 18874608, 16777461, 0, 0, 26377}, + {33554681, 18874614, 16777467, 0, 0, 26377}, + {33554687, 18874620, 16777473, 0, 0, 26377}, + {33554693, 18874626, 16777479, 0, 0, 26377}, + {33554699, 18874632, 16777485, 0, 0, 26377}, + {33554705, 18874638, 16777491, 0, 0, 26377}, + {33554711, 18874644, 16777497, 0, 0, 26433}, + {33554717, 18874650, 16777503, 0, 0, 26433}, + {33554723, 18874656, 16777509, 0, 0, 26433}, + {33554729, 18874662, 16777515, 0, 0, 26433}, + {33554735, 18874668, 16777521, 0, 0, 26433}, + {33554741, 18874674, 16777527, 0, 0, 26433}, + {33554747, 18874680, 16777533, 0, 0, 26433}, + {33554753, 18874686, 16777539, 0, 0, 26433}, + {33554759, 18874692, 16777545, 0, 0, 26377}, + {33554765, 18874698, 16777551, 0, 0, 26377}, + {33554771, 18874704, 16777557, 0, 0, 26377}, + {33554777, 18874710, 16777563, 0, 0, 26377}, + {33554783, 18874716, 16777569, 0, 0, 26377}, + {33554789, 18874722, 16777575, 0, 0, 26377}, + {33554795, 18874728, 16777581, 0, 0, 26377}, + {33554801, 18874734, 16777587, 0, 0, 26377}, + {33554807, 18874740, 16777593, 0, 0, 26433}, + {33554813, 18874746, 16777599, 0, 0, 26433}, + {33554819, 18874752, 16777605, 0, 0, 26433}, + {33554825, 18874758, 16777611, 0, 0, 26433}, + {33554831, 18874764, 16777617, 0, 0, 26433}, + {33554837, 18874770, 16777623, 0, 0, 26433}, + {33554843, 18874776, 16777629, 0, 0, 26433}, + {33554849, 18874782, 16777635, 0, 0, 26433}, {8120, 8112, 8120, 0, 0, 9993}, {8121, 8113, 8121, 0, 0, 9993}, - {33554682, 16777465, 33554684, 0, 0, 26377}, - {33554687, 16777470, 16777473, 0, 0, 26377}, - {33554691, 16777474, 33554693, 0, 0, 26377}, - {33554696, 16777479, 33554696, 0, 0, 26377}, - {50331915, 16777482, 50331918, 0, 0, 26377}, + {33554855, 18874788, 33554857, 0, 0, 26377}, + {33554862, 18874795, 16777648, 0, 0, 26377}, + {33554868, 18874801, 33554870, 0, 0, 26377}, + {33554875, 18874808, 33554875, 0, 0, 26377}, + {50332097, 19923389, 50332100, 0, 0, 26377}, {8120, 8112, 8120, 0, 0, 10113}, {8121, 8113, 8121, 0, 0, 10113}, {8122, 8048, 8122, 0, 0, 10113}, {8123, 8049, 8123, 0, 0, 10113}, - {33554706, 16777489, 16777492, 0, 0, 26433}, - {921, 8126, 921, 0, 0, 9993}, - {33554710, 16777493, 33554712, 0, 0, 26377}, - {33554715, 16777498, 16777501, 0, 0, 26377}, - {33554719, 16777502, 33554721, 0, 0, 26377}, - {33554724, 16777507, 33554724, 0, 0, 26377}, - {50331943, 16777510, 50331946, 0, 0, 26377}, + {33554890, 18874823, 16777676, 0, 0, 26433}, + {16777679, 17826253, 16777679, 0, 0, 26377}, + {33554899, 18874832, 33554901, 0, 0, 26377}, + {33554906, 18874839, 16777692, 0, 0, 26377}, + {33554912, 18874845, 33554914, 0, 0, 26377}, + {33554919, 18874852, 33554919, 0, 0, 26377}, + {50332141, 19923433, 50332144, 0, 0, 26377}, {8136, 8050, 8136, 0, 0, 10113}, {8137, 8051, 8137, 0, 0, 10113}, {8138, 8052, 8138, 0, 0, 10113}, {8139, 8053, 8139, 0, 0, 10113}, - {33554734, 16777517, 16777520, 0, 0, 26433}, + {33554934, 18874867, 16777720, 0, 0, 26433}, {8152, 8144, 8152, 0, 0, 9993}, {8153, 8145, 8153, 0, 0, 9993}, - {50331954, 16777521, 50331954, 0, 0, 26377}, - {50331958, 16777525, 50331958, 0, 0, 26377}, - {33554746, 16777529, 33554746, 0, 0, 26377}, - {50331965, 16777532, 50331965, 0, 0, 26377}, + {50332157, 19923449, 50332157, 0, 0, 26377}, + {50332164, 19923456, 50332164, 0, 0, 26377}, + {33554954, 18874887, 33554954, 0, 0, 26377}, + {50332176, 19923468, 50332176, 0, 0, 26377}, {8152, 8144, 8152, 0, 0, 10113}, {8153, 8145, 8153, 0, 0, 10113}, {8154, 8054, 8154, 0, 0, 10113}, {8155, 8055, 8155, 0, 0, 10113}, {8168, 8160, 8168, 0, 0, 9993}, {8169, 8161, 8169, 0, 0, 9993}, - {50331969, 16777536, 50331969, 0, 0, 26377}, - {50331973, 16777540, 50331973, 0, 0, 26377}, - {33554761, 16777544, 33554761, 0, 0, 26377}, + {50332183, 19923475, 50332183, 0, 0, 26377}, + {50332190, 19923482, 50332190, 0, 0, 26377}, + {33554980, 18874913, 33554980, 0, 0, 26377}, {8172, 8165, 8172, 0, 0, 9993}, - {33554764, 16777547, 33554764, 0, 0, 26377}, - {50331983, 16777550, 50331983, 0, 0, 26377}, + {33554985, 18874918, 33554985, 0, 0, 26377}, + {50332207, 19923499, 50332207, 0, 0, 26377}, {8168, 8160, 8168, 0, 0, 10113}, {8169, 8161, 8169, 0, 0, 10113}, {8170, 8058, 8170, 0, 0, 10113}, {8171, 8059, 8171, 0, 0, 10113}, {8172, 8165, 8172, 0, 0, 10113}, - {33554771, 16777554, 33554773, 0, 0, 26377}, - {33554776, 16777559, 16777562, 0, 0, 26377}, - {33554780, 16777563, 33554782, 0, 0, 26377}, - {33554785, 16777568, 33554785, 0, 0, 26377}, - {50332004, 16777571, 50332007, 0, 0, 26377}, + {33554997, 18874930, 33554999, 0, 0, 26377}, + {33555004, 18874937, 16777790, 0, 0, 26377}, + {33555010, 18874943, 33555012, 0, 0, 26377}, + {33555017, 18874950, 33555017, 0, 0, 26377}, + {50332239, 19923531, 50332242, 0, 0, 26377}, {8184, 8056, 8184, 0, 0, 10113}, {8185, 8057, 8185, 0, 0, 10113}, {8186, 8060, 8186, 0, 0, 10113}, {8187, 8061, 8187, 0, 0, 10113}, - {33554795, 16777578, 16777581, 0, 0, 26433}, + {33555032, 18874965, 16777818, 0, 0, 26433}, {0, 0, 0, 0, 0, 3076}, {0, 0, 0, 0, 4, 3076}, {0, 0, 0, 0, 5, 3076}, @@ -2037,18 +2037,18 @@ {42918, 42919, 42918, 0, 0, 9993}, {42920, 42921, 42920, 0, 0, 10113}, {42920, 42921, 42920, 0, 0, 9993}, - {33554799, 16777582, 33554801, 0, 0, 26377}, - {33554804, 16777587, 33554806, 0, 0, 26377}, - {33554809, 16777592, 33554811, 0, 0, 26377}, - {50332030, 16777597, 50332033, 0, 0, 26377}, - {50332037, 16777604, 50332040, 0, 0, 26377}, - {33554828, 16777611, 33554830, 0, 0, 26377}, - {33554833, 16777616, 33554835, 0, 0, 26377}, - {33554838, 16777621, 33554840, 0, 0, 26377}, - {33554843, 16777626, 33554845, 0, 0, 26377}, - {33554848, 16777631, 33554850, 0, 0, 26377}, - {33554853, 16777636, 33554855, 0, 0, 26377}, - {33554858, 16777641, 33554860, 0, 0, 26377}, + {33555038, 18874971, 33555040, 0, 0, 26377}, + {33555045, 18874978, 33555047, 0, 0, 26377}, + {33555052, 18874985, 33555054, 0, 0, 26377}, + {50332276, 19923568, 50332279, 0, 0, 26377}, + {50332286, 19923578, 50332289, 0, 0, 26377}, + {33555079, 18875012, 33555081, 0, 0, 26377}, + {33555086, 18875019, 33555088, 0, 0, 26377}, + {33555093, 18875026, 33555095, 0, 0, 26377}, + {33555100, 18875033, 33555102, 0, 0, 26377}, + {33555107, 18875040, 33555109, 0, 0, 26377}, + {33555114, 18875047, 33555116, 0, 0, 26377}, + {33555121, 18875054, 33555123, 0, 0, 26377}, {0, 0, 0, 0, 0, 1025}, {65313, 65345, 65313, 0, 0, 10113}, {65314, 65346, 65314, 0, 0, 10113}, @@ -2188,7 +2188,12 @@ /* extended case mappings */ const Py_UCS4 _PyUnicode_ExtendedCase[] = { + 181, + 956, + 924, 223, + 115, + 115, 83, 83, 83, @@ -2198,263 +2203,440 @@ 304, 329, 700, + 110, + 700, 78, + 383, + 115, + 83, 496, + 106, + 780, 74, 780, + 837, + 953, + 921, 912, + 953, + 776, + 769, 921, 776, 769, 944, + 965, + 776, + 769, 933, 776, 769, + 962, + 963, + 931, + 976, + 946, + 914, + 977, + 952, + 920, + 981, + 966, + 934, + 982, + 960, + 928, + 1008, + 954, + 922, + 1009, + 961, + 929, + 1013, + 949, + 917, 1415, + 1381, + 1410, 1333, 1362, 1333, 1410, 7830, + 104, + 817, 72, 817, 7831, + 116, + 776, 84, 776, 7832, + 119, + 778, 87, 778, 7833, + 121, + 778, 89, 778, 7834, + 97, + 702, 65, 702, + 7835, + 7777, + 7776, + 223, + 115, + 115, + 7838, 8016, + 965, + 787, 933, 787, 8018, + 965, + 787, + 768, 933, 787, 768, 8020, + 965, + 787, + 769, 933, 787, 769, 8022, + 965, + 787, + 834, 933, 787, 834, 8064, + 7936, + 953, 7944, 921, 8072, 8065, + 7937, + 953, 7945, 921, 8073, 8066, + 7938, + 953, 7946, 921, 8074, 8067, + 7939, + 953, 7947, 921, 8075, 8068, + 7940, + 953, 7948, 921, 8076, 8069, + 7941, + 953, 7949, 921, 8077, 8070, + 7942, + 953, 7950, 921, 8078, 8071, + 7943, + 953, 7951, 921, 8079, 8064, + 7936, + 953, 7944, 921, 8072, 8065, + 7937, + 953, 7945, 921, 8073, 8066, + 7938, + 953, 7946, 921, 8074, 8067, + 7939, + 953, 7947, 921, 8075, 8068, + 7940, + 953, 7948, 921, 8076, 8069, + 7941, + 953, 7949, 921, 8077, 8070, + 7942, + 953, 7950, 921, 8078, 8071, + 7943, + 953, 7951, 921, 8079, 8080, + 7968, + 953, 7976, 921, 8088, 8081, + 7969, + 953, 7977, 921, 8089, 8082, + 7970, + 953, 7978, 921, 8090, 8083, + 7971, + 953, 7979, 921, 8091, 8084, + 7972, + 953, 7980, 921, 8092, 8085, + 7973, + 953, 7981, 921, 8093, 8086, + 7974, + 953, 7982, 921, 8094, 8087, + 7975, + 953, 7983, 921, 8095, 8080, + 7968, + 953, 7976, 921, 8088, 8081, + 7969, + 953, 7977, 921, 8089, 8082, + 7970, + 953, 7978, 921, 8090, 8083, + 7971, + 953, 7979, 921, 8091, 8084, + 7972, + 953, 7980, 921, 8092, 8085, + 7973, + 953, 7981, 921, 8093, 8086, + 7974, + 953, 7982, 921, 8094, 8087, + 7975, + 953, 7983, 921, 8095, 8096, + 8032, + 953, 8040, 921, 8104, 8097, + 8033, + 953, 8041, 921, 8105, 8098, + 8034, + 953, 8042, 921, 8106, 8099, + 8035, + 953, 8043, 921, 8107, 8100, + 8036, + 953, 8044, 921, 8108, 8101, + 8037, + 953, 8045, 921, 8109, 8102, + 8038, + 953, 8046, 921, 8110, 8103, + 8039, + 953, 8047, 921, 8111, 8096, + 8032, + 953, 8040, 921, 8104, 8097, + 8033, + 953, 8041, 921, 8105, 8098, + 8034, + 953, 8042, 921, 8106, 8099, + 8035, + 953, 8043, 921, 8107, 8100, + 8036, + 953, 8044, 921, 8108, 8101, + 8037, + 953, 8045, 921, 8109, 8102, + 8038, + 953, 8046, 921, 8110, 8103, + 8039, + 953, 8047, 921, 8111, 8114, + 8048, + 953, 8122, 921, 8122, 837, 8115, + 945, + 953, 913, 921, 8124, 8116, + 940, + 953, 902, 921, 902, 837, 8118, + 945, + 834, 913, 834, 8119, + 945, + 834, + 953, 913, 834, 921, @@ -2462,27 +2644,43 @@ 834, 837, 8115, + 945, + 953, 913, 921, 8124, + 8126, + 953, + 921, 8130, + 8052, + 953, 8138, 921, 8138, 837, 8131, + 951, + 953, 919, 921, 8140, 8132, + 942, + 953, 905, 921, 905, 837, 8134, + 951, + 834, 919, 834, 8135, + 951, + 834, + 953, 919, 834, 921, @@ -2490,60 +2688,97 @@ 834, 837, 8131, + 951, + 953, 919, 921, 8140, 8146, + 953, + 776, + 768, 921, 776, 768, 8147, + 953, + 776, + 769, 921, 776, 769, 8150, + 953, + 834, 921, 834, 8151, + 953, + 776, + 834, 921, 776, 834, 8162, + 965, + 776, + 768, 933, 776, 768, 8163, + 965, + 776, + 769, 933, 776, 769, 8164, + 961, + 787, 929, 787, 8166, + 965, + 834, 933, 834, 8167, + 965, + 776, + 834, 933, 776, 834, 8178, + 8060, + 953, 8186, 921, 8186, 837, 8179, + 969, + 953, 937, 921, 8188, 8180, + 974, + 953, 911, 921, 911, 837, 8182, + 969, + 834, 937, 834, 8183, + 969, + 834, + 953, 937, 834, 921, @@ -2551,25 +2786,36 @@ 834, 837, 8179, + 969, + 953, 937, 921, 8188, 64256, + 102, + 102, 70, 70, 70, 102, 64257, + 102, + 105, 70, 73, 70, 105, 64258, + 102, + 108, 70, 76, 70, 108, 64259, + 102, + 102, + 105, 70, 70, 73, @@ -2577,6 +2823,9 @@ 102, 105, 64260, + 102, + 102, + 108, 70, 70, 76, @@ -2584,36 +2833,50 @@ 102, 108, 64261, + 115, + 116, 83, 84, 83, 116, 64262, + 115, + 116, 83, 84, 83, 116, 64275, + 1396, + 1398, 1348, 1350, 1348, 1398, 64276, + 1396, + 1381, 1348, 1333, 1348, 1381, 64277, + 1396, + 1387, 1348, 1339, 1348, 1387, 64278, + 1406, + 1398, 1358, 1350, 1358, 1398, 64279, + 1396, + 1389, 1348, 1341, 1348, diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -49,6 +49,7 @@ NAME_ALIASES = "NameAliases%s.txt" NAMED_SEQUENCES = "NamedSequences%s.txt" SPECIAL_CASING = "SpecialCasing%s.txt" +CASE_FOLDING = "CaseFolding%s.txt" # Private Use Areas -- in planes 1, 15, 16 PUA_1 = range(0xE000, 0xF900) @@ -424,28 +425,36 @@ if "Case_Ignorable" in properties: flags |= CASE_IGNORABLE_MASK sc = unicode.special_casing.get(char) + cf = unicode.case_folding.get(char, [char]) + if record[12]: + upper = int(record[12], 16) + else: + upper = char + if record[13]: + lower = int(record[13], 16) + else: + lower = char + if record[14]: + title = int(record[14], 16) + else: + title = upper + if sc is None and cf != [lower]: + sc = ([lower], [title], [upper]) if sc is None: - if record[12]: - upper = int(record[12], 16) - else: - upper = char - if record[13]: - lower = int(record[13], 16) - else: - lower = char - if record[14]: - title = int(record[14], 16) - else: - title = upper if upper == lower == title: upper = lower = title = 0 else: - # This happens when some character maps to more than one - # character in uppercase, lowercase, or titlecase. The extra - # characters are stored in a different array. + # This happens either when some character maps to more than one + # character in uppercase, lowercase, or titlecase or the + # casefolded version of the character is different from the + # lowercase. The extra characters are stored in a different + # array. flags |= EXTENDED_CASE_MASK lower = len(extra_casing) | (len(sc[0]) << 24) extra_casing.extend(sc[0]) + if cf != sc[0]: + lower |= len(cf) << 20 + extra_casing.extend(cf) upper = len(extra_casing) | (len(sc[2]) << 24) extra_casing.extend(sc[2]) # Title is probably equal to upper. @@ -1107,6 +1116,17 @@ title = [int(char, 16) for char in data[2].split()] upper = [int(char, 16) for char in data[3].split()] sc[c] = (lower, title, upper) + cf = self.case_folding = {} + if version != '3.2.0': + with open_data(CASE_FOLDING, version) as file: + for s in file: + s = s[:-1].split('#', 1)[0] + if not s: + continue + data = s.split("; ") + if data[1] in "CF": + c = int(data[0], 16) + cf[c] = [int(char, 16) for char in data[2].split()] def uselatin1(self): # restrict character range to ISO Latin 1 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 19:37:37 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 14 Jan 2012 19:37:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_always_explicitly_check_for?= =?utf8?q?_-1_from_PyUnicode=5FREADY?= Message-ID: http://hg.python.org/cpython/rev/c39bada2a60f changeset: 74406:c39bada2a60f user: Benjamin Peterson date: Sat Jan 14 13:34:47 2012 -0500 summary: always explicitly check for -1 from PyUnicode_READY files: Objects/unicodeobject.c | 70 ++++++++++++++-------------- 1 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -491,7 +491,7 @@ unicode_result_unchanged(PyObject *unicode) { if (PyUnicode_CheckExact(unicode)) { - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; Py_INCREF(unicode); return unicode; @@ -764,7 +764,7 @@ if (_PyUnicode_KIND(unicode) != PyUnicode_WCHAR_KIND) { PyObject *copy; - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; copy = PyUnicode_New(length, PyUnicode_MAX_CHAR_VALUE(unicode)); @@ -1263,9 +1263,9 @@ return -1; } - if (PyUnicode_READY(from)) + if (PyUnicode_READY(from) == -1) return -1; - if (PyUnicode_READY(to)) + if (PyUnicode_READY(to) == -1) return -1; how_many = Py_MIN(PyUnicode_GET_LENGTH(from), how_many); @@ -1959,7 +1959,7 @@ PyErr_BadInternalCall(); return NULL; } - if (PyUnicode_READY(unicode)) + if (PyUnicode_READY(unicode) == -1) return NULL; length = PyUnicode_GET_LENGTH(unicode); @@ -1985,7 +1985,7 @@ void *result; unsigned int skind; - if (PyUnicode_READY(s)) + if (PyUnicode_READY(s) == -1) return NULL; len = PyUnicode_GET_LENGTH(s); @@ -2471,7 +2471,7 @@ str_obj = PyUnicode_DecodeUTF8Stateful(str, strlen(str), "replace", NULL); if (!str_obj) goto fail; - if (PyUnicode_READY(str_obj)) { + if (PyUnicode_READY(str_obj) == -1) { Py_DECREF(str_obj); goto fail; } @@ -2813,7 +2813,7 @@ /* XXX Perhaps we should make this API an alias of PyObject_Str() instead ?! */ if (PyUnicode_CheckExact(obj)) { - if (PyUnicode_READY(obj)) + if (PyUnicode_READY(obj) == -1) return NULL; Py_INCREF(obj); return obj; @@ -3611,7 +3611,7 @@ return 1; } if (PyUnicode_Check(arg)) { - if (PyUnicode_READY(arg)) + if (PyUnicode_READY(arg) == -1) return 0; output = arg; Py_INCREF(output); @@ -3631,7 +3631,7 @@ return 0; } } - if (PyUnicode_READY(output) < 0) { + if (PyUnicode_READY(output) == -1) { Py_DECREF(output); return 0; } @@ -3957,7 +3957,7 @@ } if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos)) goto onError; - if (PyUnicode_READY(repunicode) < 0) + if (PyUnicode_READY(repunicode) == -1) goto onError; /* Copy back the bytes variables, which might have been modified by the @@ -4330,7 +4330,7 @@ char * out; char * start; - if (PyUnicode_READY(str) < 0) + if (PyUnicode_READY(str) == -1) return NULL; kind = PyUnicode_KIND(str); data = PyUnicode_DATA(str); @@ -5224,7 +5224,7 @@ PyErr_BadArgument(); return NULL; } - if (PyUnicode_READY(str) < 0) + if (PyUnicode_READY(str) == -1) return NULL; kind = PyUnicode_KIND(str); data = PyUnicode_DATA(str); @@ -5590,7 +5590,7 @@ PyErr_BadArgument(); return NULL; } - if (PyUnicode_READY(str) < 0) + if (PyUnicode_READY(str) == -1) return NULL; kind = PyUnicode_KIND(str); data = PyUnicode_DATA(str); @@ -6021,7 +6021,7 @@ PyErr_BadArgument(); return NULL; } - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; len = PyUnicode_GET_LENGTH(unicode); kind = PyUnicode_KIND(unicode); @@ -6254,7 +6254,7 @@ PyErr_BadArgument(); return NULL; } - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; kind = PyUnicode_KIND(unicode); data = PyUnicode_DATA(unicode); @@ -6500,7 +6500,7 @@ return NULL; } - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; len = PyUnicode_GET_LENGTH(unicode); @@ -6563,7 +6563,7 @@ * -1=not initialized, 0=unknown, 1=strict, 2=replace, 3=ignore, 4=xmlcharrefreplace */ int known_errorHandler = -1; - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; size = PyUnicode_GET_LENGTH(unicode); kind = PyUnicode_KIND(unicode); @@ -6662,7 +6662,7 @@ encoding, reason, unicode, &exc, collstart, collend, &newpos); if (repunicode == NULL || (PyUnicode_Check(repunicode) && - PyUnicode_READY(repunicode) < 0)) + PyUnicode_READY(repunicode) == -1)) goto onError; if (PyBytes_Check(repunicode)) { /* Directly copy bytes result to output. */ @@ -7525,7 +7525,7 @@ enum PyUnicode_Kind kind; void *data; - if (PyUnicode_READY(rep) < 0) { + if (PyUnicode_READY(rep) == -1) { Py_DECREF(rep); goto error; } @@ -7583,7 +7583,7 @@ Py_ssize_t offset; int chunk_len, ret, done; - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; len = PyUnicode_GET_LENGTH(unicode); @@ -7702,7 +7702,7 @@ void *data; Py_UCS4 x; - if (PyUnicode_READY(mapping) < 0) + if (PyUnicode_READY(mapping) == -1) return NULL; maplen = PyUnicode_GET_LENGTH(mapping); @@ -7787,7 +7787,7 @@ else if (PyUnicode_Check(x)) { Py_ssize_t targetsize; - if (PyUnicode_READY(x) < 0) + if (PyUnicode_READY(x) == -1) goto onError; targetsize = PyUnicode_GET_LENGTH(x); @@ -8203,7 +8203,7 @@ Py_UCS4 ch; int val; - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return -1; size = PyUnicode_GET_LENGTH(unicode); /* find all unencodable characters */ @@ -8306,7 +8306,7 @@ break; } /* generate replacement */ - if (PyUnicode_READY(repunicode) < 0) { + if (PyUnicode_READY(repunicode) == -1) { Py_DECREF(repunicode); return -1; } @@ -8351,7 +8351,7 @@ * 3=ignore, 4=xmlcharrefreplace */ int known_errorHandler = -1; - if (PyUnicode_READY(unicode) < 0) + if (PyUnicode_READY(unicode) == -1) return NULL; size = PyUnicode_GET_LENGTH(unicode); @@ -8953,7 +8953,7 @@ if (unicode == NULL) return -1; - if (PyUnicode_READY(unicode) < 0) { + if (PyUnicode_READY(unicode) == -1) { Py_DECREF(unicode); return -1; } @@ -10576,7 +10576,7 @@ if (!PyArg_ParseTuple(args, "n|O&:center", &width, convert_uc, &fillchar)) return NULL; - if (PyUnicode_READY(self) < 0) + if (PyUnicode_READY(self) == -1) return NULL; if (PyUnicode_GET_LENGTH(self) >= width) @@ -10870,9 +10870,9 @@ goto error; } - if (PyUnicode_READY(left)) + if (PyUnicode_READY(left) == -1) goto error; - if (PyUnicode_READY(right)) + if (PyUnicode_READY(right) == -1) goto error; /* Shortcuts */ @@ -11735,7 +11735,7 @@ if (!PyArg_ParseTuple(args, "n|O&:ljust", &width, convert_uc, &fillchar)) return NULL; - if (PyUnicode_READY(self) < 0) + if (PyUnicode_READY(self) == -1) return NULL; if (PyUnicode_GET_LENGTH(self) >= width) @@ -11965,7 +11965,7 @@ if (len == 1) return unicode_result_unchanged(str); - if (PyUnicode_READY(str) < 0) + if (PyUnicode_READY(str) == -1) return NULL; if (PyUnicode_GET_LENGTH(str) > PY_SSIZE_T_MAX / len) { @@ -12329,7 +12329,7 @@ if (!PyArg_ParseTuple(args, "n|O&:rjust", &width, convert_uc, &fillchar)) return NULL; - if (PyUnicode_READY(self) < 0) + if (PyUnicode_READY(self) == -1) return NULL; if (PyUnicode_GET_LENGTH(self) >= width) @@ -12817,7 +12817,7 @@ if (!PyArg_ParseTuple(args, "n:zfill", &width)) return NULL; - if (PyUnicode_READY(self) < 0) + if (PyUnicode_READY(self) == -1) return NULL; if (PyUnicode_GET_LENGTH(self) >= width) @@ -13836,7 +13836,7 @@ if (unicode == NULL) return NULL; assert(_PyUnicode_CHECK(unicode)); - if (PyUnicode_READY(unicode)) { + if (PyUnicode_READY(unicode) == -1) { Py_DECREF(unicode); return NULL; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 19:37:37 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 14 Jan 2012 19:37:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_possible_refleaks_if_Py?= =?utf8?q?Unicode=5FREADY_fails?= Message-ID: http://hg.python.org/cpython/rev/9cd5e8ee1d02 changeset: 74407:9cd5e8ee1d02 user: Benjamin Peterson date: Sat Jan 14 13:37:31 2012 -0500 summary: fix possible refleaks if PyUnicode_READY fails files: Objects/unicodeobject.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2488,8 +2488,12 @@ PyObject *str; assert(obj); str = PyObject_Str(obj); - if (!str || PyUnicode_READY(str) == -1) + if (!str) goto fail; + if (PyUnicode_READY(str) == -1) { + Py_DECREF(str); + goto fail; + } argmaxchar = PyUnicode_MAX_CHAR_VALUE(str); maxchar = Py_MAX(maxchar, argmaxchar); n += PyUnicode_GET_LENGTH(str); @@ -2503,8 +2507,12 @@ PyObject *repr; assert(obj); repr = PyObject_Repr(obj); - if (!repr || PyUnicode_READY(repr) == -1) + if (!repr) goto fail; + if (PyUnicode_READY(repr) == -1) { + Py_DECREF(repr); + goto fail; + } argmaxchar = PyUnicode_MAX_CHAR_VALUE(repr); maxchar = Py_MAX(maxchar, argmaxchar); n += PyUnicode_GET_LENGTH(repr); @@ -2518,8 +2526,12 @@ PyObject *ascii; assert(obj); ascii = PyObject_ASCII(obj); - if (!ascii || PyUnicode_READY(ascii) == -1) + if (!ascii) goto fail; + if (PyUnicode_READY(ascii) == -1) { + Py_DECREF(ascii); + goto fail; + } argmaxchar = PyUnicode_MAX_CHAR_VALUE(ascii); maxchar = Py_MAX(maxchar, argmaxchar); n += PyUnicode_GET_LENGTH(ascii); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 22:19:38 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 14 Jan 2012 22:19:38 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Mention_the_add?= =?utf8?q?itional_way_to_use_the_lvl_parameter_and_when_it_changed=2E?= Message-ID: http://hg.python.org/cpython/rev/d97f5311c9ad changeset: 74408:d97f5311c9ad branch: 3.2 parent: 74403:a32bc62b8772 user: Gregory P. Smith date: Sat Jan 14 12:46:17 2012 -0800 summary: Mention the additional way to use the lvl parameter and when it changed. files: Doc/library/logging.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -87,6 +87,11 @@ If the root is reached, and it has a level of NOTSET, then all messages will be processed. Otherwise, the root's level will be used as the effective level. + .. versionchanged:: 3.2 + The *lvl* parameter now accepts a string representation of the + level such as 'INFO' as an alternative to the integer constants + such as :const:`INFO`. + .. method:: Logger.isEnabledFor(lvl) @@ -319,6 +324,11 @@ severe than *lvl* will be ignored. When a handler is created, the level is set to :const:`NOTSET` (which causes all messages to be processed). + .. versionchanged:: 3.2 + The *lvl* parameter now accepts a string representation of the + level such as 'INFO' as an alternative to the integer constants + such as :const:`INFO`. + .. method:: Handler.setFormatter(form) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 22:19:39 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 14 Jan 2012 22:19:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Mention_the_additional_way_to_use_the_lvl_parameter_and_when?= =?utf8?q?_it_changed=2E?= Message-ID: http://hg.python.org/cpython/rev/06d96a5bb41e changeset: 74409:06d96a5bb41e parent: 74407:9cd5e8ee1d02 parent: 74408:d97f5311c9ad user: Gregory P. Smith date: Sat Jan 14 13:19:20 2012 -0800 summary: Mention the additional way to use the lvl parameter and when it changed. files: Doc/library/logging.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -87,6 +87,11 @@ If the root is reached, and it has a level of NOTSET, then all messages will be processed. Otherwise, the root's level will be used as the effective level. + .. versionchanged:: 3.2 + The *lvl* parameter now accepts a string representation of the + level such as 'INFO' as an alternative to the integer constants + such as :const:`INFO`. + .. method:: Logger.isEnabledFor(lvl) @@ -322,6 +327,11 @@ severe than *lvl* will be ignored. When a handler is created, the level is set to :const:`NOTSET` (which causes all messages to be processed). + .. versionchanged:: 3.2 + The *lvl* parameter now accepts a string representation of the + level such as 'INFO' as an alternative to the integer constants + such as :const:`INFO`. + .. method:: Handler.setFormatter(form) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 22:30:31 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 22:30:31 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_remove_=27Docum?= =?utf8?q?enting_Python=27_and_its_references=2C_it=27s_now_on_devguide?= Message-ID: http://hg.python.org/cpython/rev/8975f7d0fbf7 changeset: 74410:8975f7d0fbf7 branch: 2.7 parent: 74401:f72b171c5050 user: Sandro Tosi date: Sat Jan 14 22:22:54 2012 +0100 summary: remove 'Documenting Python' and its references, it's now on devguide files: Doc/contents.rst | 1 - Doc/documenting/building.rst | 90 - Doc/documenting/fromlatex.rst | 199 --- Doc/documenting/index.rst | 38 - Doc/documenting/intro.rst | 29 - Doc/documenting/markup.rst | 848 -------------- Doc/documenting/rest.rst | 231 --- Doc/documenting/style.rst | 169 -- Doc/tools/sphinxext/indexcontent.html | 2 - Doc/whatsnew/2.6.rst | 2 +- 10 files changed, 1 insertions(+), 1608 deletions(-) diff --git a/Doc/contents.rst b/Doc/contents.rst --- a/Doc/contents.rst +++ b/Doc/contents.rst @@ -13,7 +13,6 @@ c-api/index.rst distutils/index.rst install/index.rst - documenting/index.rst howto/index.rst faq/index.rst glossary.rst diff --git a/Doc/documenting/building.rst b/Doc/documenting/building.rst deleted file mode 100644 --- a/Doc/documenting/building.rst +++ /dev/null @@ -1,92 +0,0 @@ -Building the documentation -========================== - -You need to have Python 2.4 or higher installed; the toolset used to build the -docs is written in Python. It is called *Sphinx*, it is not included in this -tree, but maintained separately. Also needed are the docutils, supplying the -base markup that Sphinx uses, Jinja, a templating engine, and optionally -Pygments, a code highlighter. - - -Using make ----------- - -Luckily, a Makefile has been prepared so that on Unix, provided you have -installed Python and Subversion, you can just run :: - - cd Doc - make html - -to check out the necessary toolset in the :file:`tools/` subdirectory and build -the HTML output files. To view the generated HTML, point your favorite browser -at the top-level index :file:`build/html/index.html` after running "make". - -Available make targets are: - - * "html", which builds standalone HTML files for offline viewing. - - * "htmlhelp", which builds HTML files and a HTML Help project file usable to - convert them into a single Compiled HTML (.chm) file -- these are popular - under Microsoft Windows, but very handy on every platform. - - To create the CHM file, you need to run the Microsoft HTML Help Workshop - over the generated project (.hhp) file. - - * "latex", which builds LaTeX source files as input to "pdflatex" to produce - PDF documents. - - * "text", which builds a plain text file for each source file. - - * "linkcheck", which checks all external references to see whether they are - broken, redirected or malformed, and outputs this information to stdout - as well as a plain-text (.txt) file. - - * "changes", which builds an overview over all versionadded/versionchanged/ - deprecated items in the current version. This is meant as a help for the - writer of the "What's New" document. - - * "coverage", which builds a coverage overview for standard library modules - and C API. - - * "pydoc-topics", which builds a Python module containing a dictionary with - plain text documentation for the labels defined in - :file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and - keyword help. - -A "make update" updates the Subversion checkouts in :file:`tools/`. - - -Without make ------------- - -You'll need to install the Sphinx package, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Sphinx-0.6.5/sphinx tools/sphinx - -or by installing it from PyPI. - -Then, you need to install Docutils, either by checking it out via :: - - svn co http://svn.python.org/projects/external/docutils-0.6/docutils tools/docutils - -or by installing it from http://docutils.sf.net/. - -You also need Jinja2, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Jinja-2.3.1/jinja2 tools/jinja2 - -or by installing it from PyPI. - -You can optionally also install Pygments, either as a checkout via :: - - svn co http://svn.python.org/projects/external/Pygments-1.3.1/pygments tools/pygments - -or from PyPI at http://pypi.python.org/pypi/Pygments. - - -Then, make an output directory, e.g. under `build/`, and run :: - - python tools/sphinx-build.py -b . build/ - -where `` is one of html, text, latex, or htmlhelp (for explanations see -the make targets above). diff --git a/Doc/documenting/fromlatex.rst b/Doc/documenting/fromlatex.rst deleted file mode 100644 --- a/Doc/documenting/fromlatex.rst +++ /dev/null @@ -1,202 +0,0 @@ -.. highlightlang:: rest - -Differences to the LaTeX markup -=============================== - -Though the markup language is different, most of the concepts and markup types -of the old LaTeX docs have been kept -- environments as reST directives, inline -commands as reST roles and so forth. - -However, there are some differences in the way these work, partly due to the -differences in the markup languages, partly due to improvements in Sphinx. This -section lists these differences, in order to give those familiar with the old -format a quick overview of what they might run into. - -Inline markup -------------- - -These changes have been made to inline markup: - -* **Cross-reference roles** - - Most of the following semantic roles existed previously as inline commands, - but didn't do anything except formatting the content as code. Now, they - cross-reference to known targets (some names have also been shortened): - - | *mod* (previously *refmodule* or *module*) - | *func* (previously *function*) - | *data* (new) - | *const* - | *class* - | *meth* (previously *method*) - | *attr* (previously *member*) - | *exc* (previously *exception*) - | *cdata* - | *cfunc* (previously *cfunction*) - | *cmacro* (previously *csimplemacro*) - | *ctype* - - Also different is the handling of *func* and *meth*: while previously - parentheses were added to the callable name (like ``\func{str()}``), they are - now appended by the build system -- appending them in the source will result - in double parentheses. This also means that ``:func:`str(object)``` will not - work as expected -- use ````str(object)```` instead! - -* **Inline commands implemented as directives** - - These were inline commands in LaTeX, but are now directives in reST: - - | *deprecated* - | *versionadded* - | *versionchanged* - - These are used like so:: - - .. deprecated:: 2.5 - Reason of deprecation. - - Also, no period is appended to the text for *versionadded* and - *versionchanged*. - - | *note* - | *warning* - - These are used like so:: - - .. note:: - - Content of note. - -* **Otherwise changed commands** - - The *samp* command previously formatted code and added quotation marks around - it. The *samp* role, however, features a new highlighting system just like - *file* does: - - ``:samp:`open({filename}, {mode})``` results in :samp:`open({filename}, {mode})` - -* **Dropped commands** - - These were commands in LaTeX, but are not available as roles: - - | *bfcode* - | *character* (use :samp:`\`\`'c'\`\``) - | *citetitle* (use ```Title `_``) - | *code* (use ````code````) - | *email* (just write the address in body text) - | *filenq* - | *filevar* (use the ``{...}`` highlighting feature of *file*) - | *programopt*, *longprogramopt* (use *option*) - | *ulink* (use ```Title `_``) - | *url* (just write the URL in body text) - | *var* (use ``*var*``) - | *infinity*, *plusminus* (use the Unicode character) - | *shortversion*, *version* (use the ``|version|`` and ``|release|`` substitutions) - | *emph*, *strong* (use the reST markup) - -* **Backslash escaping** - - In reST, a backslash must be escaped in normal text, and in the content of - roles. However, in code literals and literal blocks, it must not be escaped. - Example: ``:file:`C:\\Temp\\my.tmp``` vs. ````open("C:\Temp\my.tmp")````. - - -Information units ------------------ - -Information units (*...desc* environments) have been made reST directives. -These changes to information units should be noted: - -* **New names** - - "desc" has been removed from every name. Additionally, these directives have - new names: - - | *cfunction* (previously *cfuncdesc*) - | *cmacro* (previously *csimplemacrodesc*) - | *exception* (previously *excdesc*) - | *function* (previously *funcdesc*) - | *attribute* (previously *memberdesc*) - - The *classdesc\** and *excclassdesc* environments have been dropped, the - *class* and *exception* directives support classes documented with and without - constructor arguments. - -* **Multiple objects** - - The equivalent of the *...line* commands is:: - - .. function:: do_foo(bar) - do_bar(baz) - - Description of the functions. - - IOW, just give one signatures per line, at the same indentation level. - -* **Arguments** - - There is no *optional* command. Just give function signatures like they - should appear in the output:: - - .. function:: open(filename[, mode[, buffering]]) - - Description. - - Note: markup in the signature is not supported. - -* **Indexing** - - The *...descni* environments have been dropped. To mark an information unit - as unsuitable for index entry generation, use the *noindex* option like so:: - - .. function:: foo_* - :noindex: - - Description. - -* **New information units** - - There are new generic information units: One is called "describe" and can be - used to document things that are not covered by the other units:: - - .. describe:: a == b - - The equals operator. - - The others are:: - - .. cmdoption:: -O - - Describes a command-line option. - - .. envvar:: PYTHONINSPECT - - Describes an environment variable. - - -Structure ---------- - -The LaTeX docs were split in several toplevel manuals. Now, all files are part -of the same documentation tree, as indicated by the *toctree* directives in the -sources (though individual output formats may choose to split them up into parts -again). Every *toctree* directive embeds other files as subdocuments of the -current file (this structure is not necessarily mirrored in the filesystem -layout). The toplevel file is :file:`contents.rst`. - -However, most of the old directory structure has been kept, with the -directories renamed as follows: - -* :file:`api` -> :file:`c-api` -* :file:`dist` -> :file:`distutils`, with the single TeX file split up -* :file:`doc` -> :file:`documenting` -* :file:`ext` -> :file:`extending` -* :file:`inst` -> :file:`installing` -* :file:`lib` -> :file:`library` -* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex` - moved to :file:`using/mac.rst` -* :file:`ref` -> :file:`reference` -* :file:`tut` -> :file:`tutorial`, with the single TeX file split up - - -.. XXX more (index-generating, production lists, ...) diff --git a/Doc/documenting/index.rst b/Doc/documenting/index.rst deleted file mode 100644 --- a/Doc/documenting/index.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _documenting-index: - -###################### - Documenting Python -###################### - - -The Python language has a substantial body of documentation, much of it -contributed by various authors. The markup used for the Python documentation is -`reStructuredText`_, developed by the `docutils`_ project, amended by custom -directives and using a toolset named `Sphinx`_ to postprocess the HTML output. - -This document describes the style guide for our documentation as well as the -custom reStructuredText markup introduced by Sphinx to support Python -documentation and how it should be used. - -.. _reStructuredText: http://docutils.sf.net/rst.html -.. _docutils: http://docutils.sf.net/ -.. _Sphinx: http://sphinx.pocoo.org/ - -.. note:: - - If you're interested in contributing to Python's documentation, there's no - need to write reStructuredText if you're not so inclined; plain text - contributions are more than welcome as well. Send an e-mail to - docs at python.org or open an issue on the :ref:`tracker `. - - -.. toctree:: - :numbered: - :maxdepth: 1 - - intro.rst - style.rst - rest.rst - markup.rst - fromlatex.rst - building.rst diff --git a/Doc/documenting/intro.rst b/Doc/documenting/intro.rst deleted file mode 100644 --- a/Doc/documenting/intro.rst +++ /dev/null @@ -1,29 +0,0 @@ -Introduction -============ - -Python's documentation has long been considered to be good for a free -programming language. There are a number of reasons for this, the most -important being the early commitment of Python's creator, Guido van Rossum, to -providing documentation on the language and its libraries, and the continuing -involvement of the user community in providing assistance for creating and -maintaining documentation. - -The involvement of the community takes many forms, from authoring to bug reports -to just plain complaining when the documentation could be more complete or -easier to use. - -This document is aimed at authors and potential authors of documentation for -Python. More specifically, it is for people contributing to the standard -documentation and developing additional documents using the same tools as the -standard documents. This guide will be less useful for authors using the Python -documentation tools for topics other than Python, and less useful still for -authors not using the tools at all. - -If your interest is in contributing to the Python documentation, but you don't -have the time or inclination to learn reStructuredText and the markup structures -documented here, there's a welcoming place for you among the Python contributors -as well. Any time you feel that you can clarify existing documentation or -provide documentation that's missing, the existing documentation team will -gladly work with you to integrate your text, dealing with the markup for you. -Please don't let the material in this document stand between the documentation -and your desire to help out! \ No newline at end of file diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst deleted file mode 100644 --- a/Doc/documenting/markup.rst +++ /dev/null @@ -1,861 +0,0 @@ -.. highlightlang:: rest - -Additional Markup Constructs -============================ - -Sphinx adds a lot of new directives and interpreted text roles to standard reST -markup. This section contains the reference material for these facilities. -Documentation for "standard" reST constructs is not included here, though -they are used in the Python documentation. - -.. note:: - - This is just an overview of Sphinx' extended markup capabilities; full - coverage can be found in `its own documentation - `_. - - -Meta-information markup ------------------------ - -.. describe:: sectionauthor - - Identifies the author of the current section. The argument should include - the author's name such that it can be used for presentation (though it isn't) - and email address. The domain name portion of the address should be lower - case. Example:: - - .. sectionauthor:: Guido van Rossum - - Currently, this markup isn't reflected in the output in any way, but it helps - keep track of contributions. - - -Module-specific markup ----------------------- - -The markup described in this section is used to provide information about a -module being documented. Each module should be documented in its own file. -Normally this markup appears after the title heading of that file; a typical -file might start like this:: - - :mod:`parrot` -- Dead parrot access - =================================== - - .. module:: parrot - :platform: Unix, Windows - :synopsis: Analyze and reanimate dead parrots. - .. moduleauthor:: Eric Cleese - .. moduleauthor:: John Idle - -As you can see, the module-specific markup consists of two directives, the -``module`` directive and the ``moduleauthor`` directive. - -.. describe:: module - - This directive marks the beginning of the description of a module (or package - submodule, in which case the name should be fully qualified, including the - package name). - - The ``platform`` option, if present, is a comma-separated list of the - platforms on which the module is available (if it is available on all - platforms, the option should be omitted). The keys are short identifiers; - examples that are in use include "IRIX", "Mac", "Windows", and "Unix". It is - important to use a key which has already been used when applicable. - - The ``synopsis`` option should consist of one sentence describing the - module's purpose -- it is currently only used in the Global Module Index. - - The ``deprecated`` option can be given (with no value) to mark a module as - deprecated; it will be designated as such in various locations then. - -.. describe:: moduleauthor - - The ``moduleauthor`` directive, which can appear multiple times, names the - authors of the module code, just like ``sectionauthor`` names the author(s) - of a piece of documentation. It too does not result in any output currently. - -.. note:: - - It is important to make the section title of a module-describing file - meaningful since that value will be inserted in the table-of-contents trees - in overview files. - - -Information units ------------------ - -There are a number of directives used to describe specific features provided by -modules. Each directive requires one or more signatures to provide basic -information about what is being described, and the content should be the -description. The basic version makes entries in the general index; if no index -entry is desired, you can give the directive option flag ``:noindex:``. The -following example shows all of the features of this directive type:: - - .. function:: spam(eggs) - ham(eggs) - :noindex: - - Spam or ham the foo. - -The signatures of object methods or data attributes should not include the -class name, but be nested in a class directive. The generated files will -reflect this nesting, and the target identifiers (for HTML output) will use -both the class and method name, to enable consistent cross-references. If you -describe methods belonging to an abstract protocol such as context managers, -use a class directive with a (pseudo-)type name too to make the -index entries more informative. - -The directives are: - -.. describe:: cfunction - - Describes a C function. The signature should be given as in C, e.g.:: - - .. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) - - This is also used to describe function-like preprocessor macros. The names - of the arguments should be given so they may be used in the description. - - Note that you don't have to backslash-escape asterisks in the signature, - as it is not parsed by the reST inliner. - -.. describe:: cmember - - Describes a C struct member. Example signature:: - - .. c:member:: PyObject* PyTypeObject.tp_bases - - The text of the description should include the range of values allowed, how - the value should be interpreted, and whether the value can be changed. - References to structure members in text should use the ``member`` role. - -.. describe:: cmacro - - Describes a "simple" C macro. Simple macros are macros which are used - for code expansion, but which do not take arguments so cannot be described as - functions. This is not to be used for simple constant definitions. Examples - of its use in the Python documentation include :c:macro:`PyObject_HEAD` and - :c:macro:`Py_BEGIN_ALLOW_THREADS`. - -.. describe:: ctype - - Describes a C type. The signature should just be the type name. - -.. describe:: cvar - - Describes a global C variable. The signature should include the type, such - as:: - - .. c:var:: PyObject* PyClass_Type - -.. describe:: data - - Describes global data in a module, including both variables and values used - as "defined constants." Class and object attributes are not documented - using this directive. - -.. describe:: exception - - Describes an exception class. The signature can, but need not include - parentheses with constructor arguments. - -.. describe:: function - - Describes a module-level function. The signature should include the - parameters, enclosing optional parameters in brackets. Default values can be - given if it enhances clarity. For example:: - - .. function:: repeat([repeat=3[, number=1000000]]) - - Object methods are not documented using this directive. Bound object methods - placed in the module namespace as part of the public interface of the module - are documented using this, as they are equivalent to normal functions for - most purposes. - - The description should include information about the parameters required and - how they are used (especially whether mutable objects passed as parameters - are modified), side effects, and possible exceptions. A small example may be - provided. - -.. describe:: class - - Describes a class. The signature can include parentheses with parameters - which will be shown as the constructor arguments. - -.. describe:: attribute - - Describes an object data attribute. The description should include - information about the type of the data to be expected and whether it may be - changed directly. This directive should be nested in a class directive, - like in this example:: - - .. class:: Spam - - Description of the class. - - .. data:: ham - - Description of the attribute. - - If is also possible to document an attribute outside of a class directive, - for example if the documentation for different attributes and methods is - split in multiple sections. The class name should then be included - explicitly:: - - .. data:: Spam.eggs - -.. describe:: method - - Describes an object method. The parameters should not include the ``self`` - parameter. The description should include similar information to that - described for ``function``. This directive should be nested in a class - directive, like in the example above. - -.. describe:: opcode - - Describes a Python :term:`bytecode` instruction. - -.. describe:: cmdoption - - Describes a Python command line option or switch. Option argument names - should be enclosed in angle brackets. Example:: - - .. cmdoption:: -m - - Run a module as a script. - -.. describe:: envvar - - Describes an environment variable that Python uses or defines. - - -There is also a generic version of these directives: - -.. describe:: describe - - This directive produces the same formatting as the specific ones explained - above but does not create index entries or cross-referencing targets. It is - used, for example, to describe the directives in this document. Example:: - - .. describe:: opcode - - Describes a Python bytecode instruction. - - -Showing code examples ---------------------- - -Examples of Python source code or interactive sessions are represented using -standard reST literal blocks. They are started by a ``::`` at the end of the -preceding paragraph and delimited by indentation. - -Representing an interactive session requires including the prompts and output -along with the Python code. No special markup is required for interactive -sessions. After the last line of input or output presented, there should not be -an "unused" primary prompt; this is an example of what *not* to do:: - - >>> 1 + 1 - 2 - >>> - -Syntax highlighting is handled in a smart way: - -* There is a "highlighting language" for each source file. Per default, - this is ``'python'`` as the majority of files will have to highlight Python - snippets. - -* Within Python highlighting mode, interactive sessions are recognized - automatically and highlighted appropriately. - -* The highlighting language can be changed using the ``highlightlang`` - directive, used as follows:: - - .. highlightlang:: c - - This language is used until the next ``highlightlang`` directive is - encountered. - -* The values normally used for the highlighting language are: - - * ``python`` (the default) - * ``c`` - * ``rest`` - * ``none`` (no highlighting) - -* If highlighting with the current language fails, the block is not highlighted - in any way. - -Longer displays of verbatim text may be included by storing the example text in -an external file containing only plain text. The file may be included using the -``literalinclude`` directive. [1]_ For example, to include the Python source file -:file:`example.py`, use:: - - .. literalinclude:: example.py - -The file name is relative to the current file's path. Documentation-specific -include files should be placed in the ``Doc/includes`` subdirectory. - - -Inline markup -------------- - -As said before, Sphinx uses interpreted text roles to insert semantic markup in -documents. - -Names of local variables, such as function/method arguments, are an exception, -they should be marked simply with ``*var*``. - -For all other roles, you have to write ``:rolename:`content```. - -There are some additional facilities that make cross-referencing roles more -versatile: - -* You may supply an explicit title and reference target, like in reST direct - hyperlinks: ``:role:`title ``` will refer to *target*, but the link - text will be *title*. - -* If you prefix the content with ``!``, no reference/hyperlink will be created. - -* For the Python object roles, if you prefix the content with ``~``, the link - text will only be the last component of the target. For example, - ``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only - display ``get`` as the link text. - - In HTML output, the link's ``title`` attribute (that is e.g. shown as a - tool-tip on mouse-hover) will always be the full target name. - -The following roles refer to objects in modules and are possibly hyperlinked if -a matching identifier is found: - -.. describe:: mod - - The name of a module; a dotted name may be used. This should also be used for - package names. - -.. describe:: func - - The name of a Python function; dotted names may be used. The role text - should not include trailing parentheses to enhance readability. The - parentheses are stripped when searching for identifiers. - -.. describe:: data - - The name of a module-level variable or constant. - -.. describe:: const - - The name of a "defined" constant. This may be a C-language ``#define`` - or a Python variable that is not intended to be changed. - -.. describe:: class - - A class name; a dotted name may be used. - -.. describe:: meth - - The name of a method of an object. The role text should include the type - name and the method name. A dotted name may be used. - -.. describe:: attr - - The name of a data attribute of an object. - -.. describe:: exc - - The name of an exception. A dotted name may be used. - -The name enclosed in this markup can include a module name and/or a class name. -For example, ``:func:`filter``` could refer to a function named ``filter`` in -the current module, or the built-in function of that name. In contrast, -``:func:`foo.filter``` clearly refers to the ``filter`` function in the ``foo`` -module. - -Normally, names in these roles are searched first without any further -qualification, then with the current module name prepended, then with the -current module and class name (if any) prepended. If you prefix the name with a -dot, this order is reversed. For example, in the documentation of the -:mod:`codecs` module, ``:func:`open``` always refers to the built-in function, -while ``:func:`.open``` refers to :func:`codecs.open`. - -A similar heuristic is used to determine whether the name is an attribute of -the currently documented class. - -The following roles create cross-references to C-language constructs if they -are defined in the API documentation: - -.. describe:: cdata - - The name of a C-language variable. - -.. describe:: cfunc - - The name of a C-language function. Should include trailing parentheses. - -.. describe:: cmacro - - The name of a "simple" C macro, as defined above. - -.. describe:: ctype - - The name of a C-language type. - - -The following role does possibly create a cross-reference, but does not refer -to objects: - -.. describe:: token - - The name of a grammar token (used in the reference manual to create links - between production displays). - - -The following role creates a cross-reference to the term in the glossary: - -.. describe:: term - - Reference to a term in the glossary. The glossary is created using the - ``glossary`` directive containing a definition list with terms and - definitions. It does not have to be in the same file as the ``term`` - markup, in fact, by default the Python docs have one global glossary - in the ``glossary.rst`` file. - - If you use a term that's not explained in a glossary, you'll get a warning - during build. - ---------- - -The following roles don't do anything special except formatting the text -in a different style: - -.. describe:: command - - The name of an OS-level command, such as ``rm``. - -.. describe:: dfn - - Mark the defining instance of a term in the text. (No index entries are - generated.) - -.. describe:: envvar - - An environment variable. Index entries are generated. - -.. describe:: file - - The name of a file or directory. Within the contents, you can use curly - braces to indicate a "variable" part, for example:: - - ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... - - In the built documentation, the ``x`` will be displayed differently to - indicate that it is to be replaced by the Python minor version. - -.. describe:: guilabel - - Labels presented as part of an interactive user interface should be marked - using ``guilabel``. This includes labels from text-based interfaces such as - those created using :mod:`curses` or other text-based libraries. Any label - used in the interface should be marked with this role, including button - labels, window titles, field names, menu and menu selection names, and even - values in selection lists. - -.. describe:: kbd - - Mark a sequence of keystrokes. What form the key sequence takes may depend - on platform- or application-specific conventions. When there are no relevant - conventions, the names of modifier keys should be spelled out, to improve - accessibility for new users and non-native speakers. For example, an - *xemacs* key sequence may be marked like ``:kbd:`C-x C-f```, but without - reference to a specific application or platform, the same sequence should be - marked as ``:kbd:`Control-x Control-f```. - -.. describe:: keyword - - The name of a Python keyword. Using this role will generate a link to the - documentation of the keyword. ``True``, ``False`` and ``None`` do not use - this role, but simple code markup (````True````), given that they're - fundamental to the language and should be known to any programmer. - -.. describe:: mailheader - - The name of an RFC 822-style mail header. This markup does not imply that - the header is being used in an email message, but can be used to refer to any - header of the same "style." This is also used for headers defined by the - various MIME specifications. The header name should be entered in the same - way it would normally be found in practice, with the camel-casing conventions - being preferred where there is more than one common usage. For example: - ``:mailheader:`Content-Type```. - -.. describe:: makevar - - The name of a :command:`make` variable. - -.. describe:: manpage - - A reference to a Unix manual page including the section, - e.g. ``:manpage:`ls(1)```. - -.. describe:: menuselection - - Menu selections should be marked using the ``menuselection`` role. This is - used to mark a complete sequence of menu selections, including selecting - submenus and choosing a specific operation, or any subsequence of such a - sequence. The names of individual selections should be separated by - ``-->``. - - For example, to mark the selection "Start > Programs", use this markup:: - - :menuselection:`Start --> Programs` - - When including a selection that includes some trailing indicator, such as the - ellipsis some operating systems use to indicate that the command opens a - dialog, the indicator should be omitted from the selection name. - -.. describe:: mimetype - - The name of a MIME type, or a component of a MIME type (the major or minor - portion, taken alone). - -.. describe:: newsgroup - - The name of a Usenet newsgroup. - -.. describe:: option - - A command-line option of Python. The leading hyphen(s) must be included. - If a matching ``cmdoption`` directive exists, it is linked to. For options - of other programs or scripts, use simple ````code```` markup. - -.. describe:: program - - The name of an executable program. This may differ from the file name for - the executable for some platforms. In particular, the ``.exe`` (or other) - extension should be omitted for Windows programs. - -.. describe:: regexp - - A regular expression. Quotes should not be included. - -.. describe:: samp - - A piece of literal text, such as code. Within the contents, you can use - curly braces to indicate a "variable" part, as in ``:file:``. - - If you don't need the "variable part" indication, use the standard - ````code```` instead. - - -The following roles generate external links: - -.. describe:: pep - - A reference to a Python Enhancement Proposal. This generates appropriate - index entries. The text "PEP *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified PEP. - -.. describe:: rfc - - A reference to an Internet Request for Comments. This generates appropriate - index entries. The text "RFC *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified RFC. - - -Note that there are no special roles for including hyperlinks as you can use -the standard reST markup for that purpose. - - -.. _doc-ref-role: - -Cross-linking markup --------------------- - -To support cross-referencing to arbitrary sections in the documentation, the -standard reST labels are "abused" a bit: Every label must precede a section -title; and every label name must be unique throughout the entire documentation -source. - -You can then reference to these sections using the ``:ref:`label-name``` role. - -Example:: - - .. _my-reference-label: - - Section to cross-reference - -------------------------- - - This is the text of the section. - - It refers to the section itself, see :ref:`my-reference-label`. - -The ``:ref:`` invocation is replaced with the section title. - - -Paragraph-level markup ----------------------- - -These directives create short paragraphs and can be used inside information -units as well as normal text: - -.. describe:: note - - An especially important bit of information about an API that a user should be - aware of when using whatever bit of API the note pertains to. The content of - the directive should be written in complete sentences and include all - appropriate punctuation. - - Example:: - - .. note:: - - This function is not suitable for sending spam e-mails. - -.. describe:: warning - - An important bit of information about an API that a user should be aware of - when using whatever bit of API the warning pertains to. The content of the - directive should be written in complete sentences and include all appropriate - punctuation. In the interest of not scaring users away from pages filled - with warnings, this directive should only be chosen over ``note`` for - information regarding the possibility of crashes, data loss, or security - implications. - -.. describe:: versionadded - - This directive documents the version of Python which added the described - feature to the library or C API. When this applies to an entire module, it - should be placed at the top of the module section before any prose. - - The first argument must be given and is the version in question; you can add - a second argument consisting of a *brief* explanation of the change. - - Example:: - - .. versionadded:: 2.5 - The *spam* parameter. - - Note that there must be no blank line between the directive head and the - explanation; this is to make these blocks visually continuous in the markup. - -.. describe:: versionchanged - - Similar to ``versionadded``, but describes when and what changed in the named - feature in some way (new parameters, changed side effects, etc.). - --------------- - -.. describe:: impl-detail - - This directive is used to mark CPython-specific information. Use either with - a block content or a single sentence as an argument, i.e. either :: - - .. impl-detail:: - - This describes some implementation detail. - - More explanation. - - or :: - - .. impl-detail:: This shortly mentions an implementation detail. - - "\ **CPython implementation detail:**\ " is automatically prepended to the - content. - -.. describe:: seealso - - Many sections include a list of references to module documentation or - external documents. These lists are created using the ``seealso`` directive. - - The ``seealso`` directive is typically placed in a section just before any - sub-sections. For the HTML output, it is shown boxed off from the main flow - of the text. - - The content of the ``seealso`` directive should be a reST definition list. - Example:: - - .. seealso:: - - Module :mod:`zipfile` - Documentation of the :mod:`zipfile` standard module. - - `GNU tar manual, Basic Tar Format `_ - Documentation for tar archive files, including GNU tar extensions. - -.. describe:: rubric - - This directive creates a paragraph heading that is not used to create a - table of contents node. It is currently used for the "Footnotes" caption. - -.. describe:: centered - - This directive creates a centered boldfaced paragraph. Use it as follows:: - - .. centered:: - - Paragraph contents. - - -Table-of-contents markup ------------------------- - -Since reST does not have facilities to interconnect several documents, or split -documents into multiple output files, Sphinx uses a custom directive to add -relations between the single files the documentation is made of, as well as -tables of contents. The ``toctree`` directive is the central element. - -.. describe:: toctree - - This directive inserts a "TOC tree" at the current location, using the - individual TOCs (including "sub-TOC trees") of the files given in the - directive body. A numeric ``maxdepth`` option may be given to indicate the - depth of the tree; by default, all levels are included. - - Consider this example (taken from the library reference index):: - - .. toctree:: - :maxdepth: 2 - - intro - strings - datatypes - numeric - (many more files listed here) - - This accomplishes two things: - - * Tables of contents from all those files are inserted, with a maximum depth - of two, that means one nested heading. ``toctree`` directives in those - files are also taken into account. - * Sphinx knows that the relative order of the files ``intro``, - ``strings`` and so forth, and it knows that they are children of the - shown file, the library index. From this information it generates "next - chapter", "previous chapter" and "parent chapter" links. - - In the end, all files included in the build process must occur in one - ``toctree`` directive; Sphinx will emit a warning if it finds a file that is - not included, because that means that this file will not be reachable through - standard navigation. - - The special file ``contents.rst`` at the root of the source directory is the - "root" of the TOC tree hierarchy; from it the "Contents" page is generated. - - -Index-generating markup ------------------------ - -Sphinx automatically creates index entries from all information units (like -functions, classes or attributes) like discussed before. - -However, there is also an explicit directive available, to make the index more -comprehensive and enable index entries in documents where information is not -mainly contained in information units, such as the language reference. - -The directive is ``index`` and contains one or more index entries. Each entry -consists of a type and a value, separated by a colon. - -For example:: - - .. index:: - single: execution; context - module: __main__ - module: sys - triple: module; search; path - -This directive contains five entries, which will be converted to entries in the -generated index which link to the exact location of the index statement (or, in -case of offline media, the corresponding page number). - -The possible entry types are: - -single - Creates a single index entry. Can be made a subentry by separating the - subentry text with a semicolon (this notation is also used below to describe - what entries are created). -pair - ``pair: loop; statement`` is a shortcut that creates two index entries, - namely ``loop; statement`` and ``statement; loop``. -triple - Likewise, ``triple: module; search; path`` is a shortcut that creates three - index entries, which are ``module; search path``, ``search; path, module`` and - ``path; module search``. -module, keyword, operator, object, exception, statement, builtin - These all create two index entries. For example, ``module: hashlib`` creates - the entries ``module; hashlib`` and ``hashlib; module``. - -For index directives containing only "single" entries, there is a shorthand -notation:: - - .. index:: BNF, grammar, syntax, notation - -This creates four index entries. - - -Grammar production displays ---------------------------- - -Special markup is available for displaying the productions of a formal grammar. -The markup is simple and does not attempt to model all aspects of BNF (or any -derived forms), but provides enough to allow context-free grammars to be -displayed in a way that causes uses of a symbol to be rendered as hyperlinks to -the definition of the symbol. There is this directive: - -.. describe:: productionlist - - This directive is used to enclose a group of productions. Each production is - given on a single line and consists of a name, separated by a colon from the - following definition. If the definition spans multiple lines, each - continuation line must begin with a colon placed at the same column as in the - first line. - - Blank lines are not allowed within ``productionlist`` directive arguments. - - The definition can contain token names which are marked as interpreted text - (e.g. ``unaryneg ::= "-" `integer```) -- this generates cross-references - to the productions of these tokens. - - Note that no further reST parsing is done in the production, so that you - don't have to escape ``*`` or ``|`` characters. - - -.. XXX describe optional first parameter - -The following is an example taken from the Python Reference Manual:: - - .. productionlist:: - try_stmt: try1_stmt | try2_stmt - try1_stmt: "try" ":" `suite` - : ("except" [`expression` ["," `target`]] ":" `suite`)+ - : ["else" ":" `suite`] - : ["finally" ":" `suite`] - try2_stmt: "try" ":" `suite` - : "finally" ":" `suite` - - -Substitutions -------------- - -The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file :file:`conf.py`. - -.. describe:: |release| - - Replaced by the Python release the documentation refers to. This is the full - version string including alpha/beta/release candidate tags, e.g. ``2.5.2b3``. - -.. describe:: |version| - - Replaced by the Python version the documentation refers to. This consists - only of the major and minor version parts, e.g. ``2.5``, even for version - 2.5.1. - -.. describe:: |today| - - Replaced by either today's date, or the date set in the build configuration - file. Normally has the format ``April 14, 2007``. - - -.. rubric:: Footnotes - -.. [1] There is a standard ``.. include`` directive, but it raises errors if the - file is not found. This one only emits a warning. diff --git a/Doc/documenting/rest.rst b/Doc/documenting/rest.rst deleted file mode 100644 --- a/Doc/documenting/rest.rst +++ /dev/null @@ -1,243 +0,0 @@ -.. highlightlang:: rest - -reStructuredText Primer -======================= - -This section is a brief introduction to reStructuredText (reST) concepts and -syntax, intended to provide authors with enough information to author documents -productively. Since reST was designed to be a simple, unobtrusive markup -language, this will not take too long. - -.. seealso:: - - The authoritative `reStructuredText User - Documentation `_. - - -Paragraphs ----------- - -The paragraph is the most basic block in a reST document. Paragraphs are simply -chunks of text separated by one or more blank lines. As in Python, indentation -is significant in reST, so all lines of the same paragraph must be left-aligned -to the same level of indentation. - - -Inline markup -------------- - -The standard reST inline markup is quite simple: use - -* one asterisk: ``*text*`` for emphasis (italics), -* two asterisks: ``**text**`` for strong emphasis (boldface), and -* backquotes: ````text```` for code samples. - -If asterisks or backquotes appear in running text and could be confused with -inline markup delimiters, they have to be escaped with a backslash. - -Be aware of some restrictions of this markup: - -* it may not be nested, -* content may not start or end with whitespace: ``* text*`` is wrong, -* it must be separated from surrounding text by non-word characters. Use a - backslash escaped space to work around that: ``thisis\ *one*\ word``. - -These restrictions may be lifted in future versions of the docutils. - -reST also allows for custom "interpreted text roles"', which signify that the -enclosed text should be interpreted in a specific way. Sphinx uses this to -provide semantic markup and cross-referencing of identifiers, as described in -the appropriate section. The general syntax is ``:rolename:`content```. - - -Lists and Quotes ----------------- - -List markup is natural: just place an asterisk at the start of a paragraph and -indent properly. The same goes for numbered lists; they can also be -autonumbered using a ``#`` sign:: - - * This is a bulleted list. - * It has two items, the second - item uses two lines. - - 1. This is a numbered list. - 2. It has two items too. - - #. This is a numbered list. - #. It has two items too. - - -Nested lists are possible, but be aware that they must be separated from the -parent list items by blank lines:: - - * this is - * a list - - * with a nested list - * and some subitems - - * and here the parent list continues - -Definition lists are created as follows:: - - term (up to a line of text) - Definition of the term, which must be indented - - and can even consist of multiple paragraphs - - next term - Description. - - -Paragraphs are quoted by just indenting them more than the surrounding -paragraphs. - - -Source Code ------------ - -Literal code blocks are introduced by ending a paragraph with the special marker -``::``. The literal block must be indented:: - - This is a normal text paragraph. The next paragraph is a code sample:: - - It is not processed in any way, except - that the indentation is removed. - - It can span multiple lines. - - This is a normal text paragraph again. - -The handling of the ``::`` marker is smart: - -* If it occurs as a paragraph of its own, that paragraph is completely left - out of the document. -* If it is preceded by whitespace, the marker is removed. -* If it is preceded by non-whitespace, the marker is replaced by a single - colon. - -That way, the second sentence in the above example's first paragraph would be -rendered as "The next paragraph is a code sample:". - - -Hyperlinks ----------- - -External links -^^^^^^^^^^^^^^ - -Use ```Link text `_`` for inline web links. If the link text -should be the web address, you don't need special markup at all, the parser -finds links and mail addresses in ordinary text. - -Internal links -^^^^^^^^^^^^^^ - -Internal linking is done via a special reST role, see the section on specific -markup, :ref:`doc-ref-role`. - - -Sections --------- - -Section headers are created by underlining (and optionally overlining) the -section title with a punctuation character, at least as long as the text:: - - ================= - This is a heading - ================= - -Normally, there are no heading levels assigned to certain characters as the -structure is determined from the succession of headings. However, for the -Python documentation, we use this convention: - -* ``#`` with overline, for parts -* ``*`` with overline, for chapters -* ``=``, for sections -* ``-``, for subsections -* ``^``, for subsubsections -* ``"``, for paragraphs - - -Explicit Markup ---------------- - -"Explicit markup" is used in reST for most constructs that need special -handling, such as footnotes, specially-highlighted paragraphs, comments, and -generic directives. - -An explicit markup block begins with a line starting with ``..`` followed by -whitespace and is terminated by the next paragraph at the same level of -indentation. (There needs to be a blank line between explicit markup and normal -paragraphs. This may all sound a bit complicated, but it is intuitive enough -when you write it.) - - -Directives ----------- - -A directive is a generic block of explicit markup. Besides roles, it is one of -the extension mechanisms of reST, and Sphinx makes heavy use of it. - -Basically, a directive consists of a name, arguments, options and content. (Keep -this terminology in mind, it is used in the next chapter describing custom -directives.) Looking at this example, :: - - .. function:: foo(x) - foo(y, z) - :bar: no - - Return a line of text input from the user. - -``function`` is the directive name. It is given two arguments here, the -remainder of the first line and the second line, as well as one option ``bar`` -(as you can see, options are given in the lines immediately following the -arguments and indicated by the colons). - -The directive content follows after a blank line and is indented relative to the -directive start. - - -Footnotes ---------- - -For footnotes, use ``[#]_`` to mark the footnote location, and add the footnote -body at the bottom of the document after a "Footnotes" rubric heading, like so:: - - Lorem ipsum [#]_ dolor sit amet ... [#]_ - - .. rubric:: Footnotes - - .. [#] Text of the first footnote. - .. [#] Text of the second footnote. - -You can also explicitly number the footnotes for better context. - - -Comments --------- - -Every explicit markup block which isn't a valid markup construct (like the -footnotes above) is regarded as a comment. - - -Source encoding ---------------- - -Since the easiest way to include special characters like em dashes or copyright -signs in reST is to directly write them as Unicode characters, one has to -specify an encoding: - -All Python documentation source files must be in UTF-8 encoding, and the HTML -documents written from them will be in that encoding as well. - - -Gotchas -------- - -There are some problems one commonly runs into while authoring reST documents: - -* **Separation of inline markup:** As said above, inline markup spans must be - separated from the surrounding text by non-word characters, you have to use - an escaped space to get around that. diff --git a/Doc/documenting/style.rst b/Doc/documenting/style.rst deleted file mode 100644 --- a/Doc/documenting/style.rst +++ /dev/null @@ -1,174 +0,0 @@ -.. highlightlang:: rest - -Style Guide -=========== - -The Python documentation should follow the `Apple Publications Style Guide`_ -wherever possible. This particular style guide was selected mostly because it -seems reasonable and is easy to get online. - -Topics which are not covered in Apple's style guide will be discussed in -this document. - -All reST files use an indentation of 3 spaces. The maximum line length is 80 -characters for normal text, but tables, deeply indented code samples and long -links may extend beyond that. - -Make generous use of blank lines where applicable; they help grouping things -together. - -A sentence-ending period may be followed by one or two spaces; while reST -ignores the second space, it is customarily put in by some users, for example -to aid Emacs' auto-fill mode. - -Footnotes are generally discouraged, though they may be used when they are the -best way to present specific information. When a footnote reference is added at -the end of the sentence, it should follow the sentence-ending punctuation. The -reST markup should appear something like this:: - - This sentence has a footnote reference. [#]_ This is the next sentence. - -Footnotes should be gathered at the end of a file, or if the file is very long, -at the end of a section. The docutils will automatically create backlinks to -the footnote reference. - -Footnotes may appear in the middle of sentences where appropriate. - -Many special names are used in the Python documentation, including the names of -operating systems, programming languages, standards bodies, and the like. Most -of these entities are not assigned any special markup, but the preferred -spellings are given here to aid authors in maintaining the consistency of -presentation in the Python documentation. - -Other terms and words deserve special mention as well; these conventions should -be used to ensure consistency throughout the documentation: - -CPU - For "central processing unit." Many style guides say this should be spelled - out on the first use (and if you must use it, do so!). For the Python - documentation, this abbreviation should be avoided since there's no - reasonable way to predict which occurrence will be the first seen by the - reader. It is better to use the word "processor" instead. - -POSIX - The name assigned to a particular group of standards. This is always - uppercase. - -Python - The name of our favorite programming language is always capitalized. - -Unicode - The name of a character set and matching encoding. This is always written - capitalized. - -Unix - The name of the operating system developed at AT&T Bell Labs in the early - 1970s. - -Affirmative Tone ----------------- - -The documentation focuses on affirmatively stating what the language does and -how to use it effectively. - -Except for certain security risks or segfault risks, the docs should avoid -wording along the lines of "feature x is dangerous" or "experts only". These -kinds of value judgments belong in external blogs and wikis, not in the core -documentation. - -Bad example (creating worry in the mind of a reader): - - Warning: failing to explicitly close a file could result in lost data or - excessive resource consumption. Never rely on reference counting to - automatically close a file. - -Good example (establishing confident knowledge in the effective use of the language): - - A best practice for using files is use a try/finally pair to explicitly - close a file after it is used. Alternatively, using a with-statement can - achieve the same effect. This assures that files are flushed and file - descriptor resources are released in a timely manner. - -Economy of Expression ---------------------- - -More documentation is not necessarily better documentation. Err on the side -of being succinct. - -It is an unfortunate fact that making documentation longer can be an impediment -to understanding and can result in even more ways to misread or misinterpret the -text. Long descriptions full of corner cases and caveats can create the -impression that a function is more complex or harder to use than it actually is. - -The documentation for :func:`super` is an example of where a good deal of -information was condensed into a few short paragraphs. Discussion of -:func:`super` could have filled a chapter in a book, but it is often easier to -grasp a terse description than a lengthy narrative. - - -Code Examples -------------- - -Short code examples can be a useful adjunct to understanding. Readers can often -grasp a simple example more quickly than they can digest a formal description in -prose. - -People learn faster with concrete, motivating examples that match the context of -a typical use case. For instance, the :func:`str.rpartition` method is better -demonstrated with an example splitting the domain from a URL than it would be -with an example of removing the last word from a line of Monty Python dialog. - -The ellipsis for the :attr:`sys.ps2` secondary interpreter prompt should only be -used sparingly, where it is necessary to clearly differentiate between input -lines and output lines. Besides contributing visual clutter, it makes it -difficult for readers to cut-and-paste examples so they can experiment with -variations. - -Code Equivalents ----------------- - -Giving pure Python code equivalents (or approximate equivalents) can be a useful -adjunct to a prose description. A documenter should carefully weigh whether the -code equivalent adds value. - -A good example is the code equivalent for :func:`all`. The short 4-line code -equivalent is easily digested; it re-emphasizes the early-out behavior; and it -clarifies the handling of the corner-case where the iterable is empty. In -addition, it serves as a model for people wanting to implement a commonly -requested alternative where :func:`all` would return the specific object -evaluating to False whenever the function terminates early. - -A more questionable example is the code for :func:`itertools.groupby`. Its code -equivalent borders on being too complex to be a quick aid to understanding. -Despite its complexity, the code equivalent was kept because it serves as a -model to alternative implementations and because the operation of the "grouper" -is more easily shown in code than in English prose. - -An example of when not to use a code equivalent is for the :func:`oct` function. -The exact steps in converting a number to octal doesn't add value for a user -trying to learn what the function does. - -Audience --------- - -The tone of the tutorial (and all the docs) needs to be respectful of the -reader's intelligence. Don't presume that the readers are stupid. Lay out the -relevant information, show motivating use cases, provide glossary links, and do -your best to connect the dots, but don't talk down to them or waste their time. - -The tutorial is meant for newcomers, many of whom will be using the tutorial to -evaluate the language as a whole. The experience needs to be positive and not -leave the reader with worries that something bad will happen if they make a -misstep. The tutorial serves as guide for intelligent and curious readers, -saving details for the how-to guides and other sources. - -Be careful accepting requests for documentation changes from the rare but vocal -category of reader who is looking for vindication for one of their programming -errors ("I made a mistake, therefore the docs must be wrong ..."). Typically, -the documentation wasn't consulted until after the error was made. It is -unfortunate, but typically no documentation edit would have saved the user from -making false assumptions about the language ("I was surprised by ..."). - - -.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf - diff --git a/Doc/tools/sphinxext/indexcontent.html b/Doc/tools/sphinxext/indexcontent.html --- a/Doc/tools/sphinxext/indexcontent.html +++ b/Doc/tools/sphinxext/indexcontent.html @@ -24,8 +24,6 @@ information for installers & sys-admins

    - diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -232,7 +232,7 @@ .. seealso:: - :ref:`documenting-index` + `Documenting Python `__ Describes how to write for Python's documentation. `Sphinx `__ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 22:30:31 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 22:30:31 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_remove_=27Docum?= =?utf8?q?enting_Python=27_and_its_references=2C_it=27s_now_on_devguide?= Message-ID: http://hg.python.org/cpython/rev/70c46599fb0e changeset: 74411:70c46599fb0e branch: 3.2 parent: 74408:d97f5311c9ad user: Sandro Tosi date: Sat Jan 14 22:23:27 2012 +0100 summary: remove 'Documenting Python' and its references, it's now on devguide files: Doc/contents.rst | 1 - Doc/documenting/building.rst | 90 - Doc/documenting/fromlatex.rst | 199 --- Doc/documenting/index.rst | 38 - Doc/documenting/intro.rst | 29 - Doc/documenting/markup.rst | 891 -------------- Doc/documenting/rest.rst | 231 --- Doc/documenting/style.rst | 209 --- Doc/tools/sphinxext/indexcontent.html | 2 - Doc/whatsnew/2.6.rst | 2 +- 10 files changed, 1 insertions(+), 1691 deletions(-) diff --git a/Doc/contents.rst b/Doc/contents.rst --- a/Doc/contents.rst +++ b/Doc/contents.rst @@ -13,7 +13,6 @@ c-api/index.rst distutils/index.rst install/index.rst - documenting/index.rst howto/index.rst faq/index.rst glossary.rst diff --git a/Doc/documenting/building.rst b/Doc/documenting/building.rst deleted file mode 100644 --- a/Doc/documenting/building.rst +++ /dev/null @@ -1,92 +0,0 @@ -Building the documentation -========================== - -You need to have Python 2.4 or higher installed; the toolset used to build the -docs is written in Python. It is called *Sphinx*, it is not included in this -tree, but maintained separately. Also needed are the docutils, supplying the -base markup that Sphinx uses, Jinja, a templating engine, and optionally -Pygments, a code highlighter. - - -Using make ----------- - -Luckily, a Makefile has been prepared so that on Unix, provided you have -installed Python and Subversion, you can just run :: - - cd Doc - make html - -to check out the necessary toolset in the :file:`tools/` subdirectory and build -the HTML output files. To view the generated HTML, point your favorite browser -at the top-level index :file:`build/html/index.html` after running "make". - -Available make targets are: - - * "html", which builds standalone HTML files for offline viewing. - - * "htmlhelp", which builds HTML files and a HTML Help project file usable to - convert them into a single Compiled HTML (.chm) file -- these are popular - under Microsoft Windows, but very handy on every platform. - - To create the CHM file, you need to run the Microsoft HTML Help Workshop - over the generated project (.hhp) file. - - * "latex", which builds LaTeX source files as input to "pdflatex" to produce - PDF documents. - - * "text", which builds a plain text file for each source file. - - * "linkcheck", which checks all external references to see whether they are - broken, redirected or malformed, and outputs this information to stdout - as well as a plain-text (.txt) file. - - * "changes", which builds an overview over all versionadded/versionchanged/ - deprecated items in the current version. This is meant as a help for the - writer of the "What's New" document. - - * "coverage", which builds a coverage overview for standard library modules - and C API. - - * "pydoc-topics", which builds a Python module containing a dictionary with - plain text documentation for the labels defined in - :file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and - keyword help. - -A "make update" updates the Subversion checkouts in :file:`tools/`. - - -Without make ------------- - -You'll need to install the Sphinx package, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Sphinx-0.6.5/sphinx tools/sphinx - -or by installing it from PyPI. - -Then, you need to install Docutils, either by checking it out via :: - - svn co http://svn.python.org/projects/external/docutils-0.6/docutils tools/docutils - -or by installing it from http://docutils.sf.net/. - -You also need Jinja2, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Jinja-2.3.1/jinja2 tools/jinja2 - -or by installing it from PyPI. - -You can optionally also install Pygments, either as a checkout via :: - - svn co http://svn.python.org/projects/external/Pygments-1.3.1/pygments tools/pygments - -or from PyPI at http://pypi.python.org/pypi/Pygments. - - -Then, make an output directory, e.g. under `build/`, and run :: - - python tools/sphinx-build.py -b . build/ - -where `` is one of html, text, latex, or htmlhelp (for explanations see -the make targets above). diff --git a/Doc/documenting/fromlatex.rst b/Doc/documenting/fromlatex.rst deleted file mode 100644 --- a/Doc/documenting/fromlatex.rst +++ /dev/null @@ -1,202 +0,0 @@ -.. highlightlang:: rest - -Differences to the LaTeX markup -=============================== - -Though the markup language is different, most of the concepts and markup types -of the old LaTeX docs have been kept -- environments as reST directives, inline -commands as reST roles and so forth. - -However, there are some differences in the way these work, partly due to the -differences in the markup languages, partly due to improvements in Sphinx. This -section lists these differences, in order to give those familiar with the old -format a quick overview of what they might run into. - -Inline markup -------------- - -These changes have been made to inline markup: - -* **Cross-reference roles** - - Most of the following semantic roles existed previously as inline commands, - but didn't do anything except formatting the content as code. Now, they - cross-reference to known targets (some names have also been shortened): - - | *mod* (previously *refmodule* or *module*) - | *func* (previously *function*) - | *data* (new) - | *const* - | *class* - | *meth* (previously *method*) - | *attr* (previously *member*) - | *exc* (previously *exception*) - | *cdata* - | *cfunc* (previously *cfunction*) - | *cmacro* (previously *csimplemacro*) - | *ctype* - - Also different is the handling of *func* and *meth*: while previously - parentheses were added to the callable name (like ``\func{str()}``), they are - now appended by the build system -- appending them in the source will result - in double parentheses. This also means that ``:func:`str(object)``` will not - work as expected -- use ````str(object)```` instead! - -* **Inline commands implemented as directives** - - These were inline commands in LaTeX, but are now directives in reST: - - | *deprecated* - | *versionadded* - | *versionchanged* - - These are used like so:: - - .. deprecated:: 2.5 - Reason of deprecation. - - Also, no period is appended to the text for *versionadded* and - *versionchanged*. - - | *note* - | *warning* - - These are used like so:: - - .. note:: - - Content of note. - -* **Otherwise changed commands** - - The *samp* command previously formatted code and added quotation marks around - it. The *samp* role, however, features a new highlighting system just like - *file* does: - - ``:samp:`open({filename}, {mode})``` results in :samp:`open({filename}, {mode})` - -* **Dropped commands** - - These were commands in LaTeX, but are not available as roles: - - | *bfcode* - | *character* (use :samp:`\`\`'c'\`\``) - | *citetitle* (use ```Title `_``) - | *code* (use ````code````) - | *email* (just write the address in body text) - | *filenq* - | *filevar* (use the ``{...}`` highlighting feature of *file*) - | *programopt*, *longprogramopt* (use *option*) - | *ulink* (use ```Title `_``) - | *url* (just write the URL in body text) - | *var* (use ``*var*``) - | *infinity*, *plusminus* (use the Unicode character) - | *shortversion*, *version* (use the ``|version|`` and ``|release|`` substitutions) - | *emph*, *strong* (use the reST markup) - -* **Backslash escaping** - - In reST, a backslash must be escaped in normal text, and in the content of - roles. However, in code literals and literal blocks, it must not be escaped. - Example: ``:file:`C:\\Temp\\my.tmp``` vs. ````open("C:\Temp\my.tmp")````. - - -Information units ------------------ - -Information units (*...desc* environments) have been made reST directives. -These changes to information units should be noted: - -* **New names** - - "desc" has been removed from every name. Additionally, these directives have - new names: - - | *cfunction* (previously *cfuncdesc*) - | *cmacro* (previously *csimplemacrodesc*) - | *exception* (previously *excdesc*) - | *function* (previously *funcdesc*) - | *attribute* (previously *memberdesc*) - - The *classdesc\** and *excclassdesc* environments have been dropped, the - *class* and *exception* directives support classes documented with and without - constructor arguments. - -* **Multiple objects** - - The equivalent of the *...line* commands is:: - - .. function:: do_foo(bar) - do_bar(baz) - - Description of the functions. - - IOW, just give one signatures per line, at the same indentation level. - -* **Arguments** - - There is no *optional* command. Just give function signatures like they - should appear in the output:: - - .. function:: open(filename[, mode[, buffering]]) - - Description. - - Note: markup in the signature is not supported. - -* **Indexing** - - The *...descni* environments have been dropped. To mark an information unit - as unsuitable for index entry generation, use the *noindex* option like so:: - - .. function:: foo_* - :noindex: - - Description. - -* **New information units** - - There are new generic information units: One is called "describe" and can be - used to document things that are not covered by the other units:: - - .. describe:: a == b - - The equals operator. - - The others are:: - - .. cmdoption:: -O - - Describes a command-line option. - - .. envvar:: PYTHONINSPECT - - Describes an environment variable. - - -Structure ---------- - -The LaTeX docs were split in several toplevel manuals. Now, all files are part -of the same documentation tree, as indicated by the *toctree* directives in the -sources (though individual output formats may choose to split them up into parts -again). Every *toctree* directive embeds other files as subdocuments of the -current file (this structure is not necessarily mirrored in the filesystem -layout). The toplevel file is :file:`contents.rst`. - -However, most of the old directory structure has been kept, with the -directories renamed as follows: - -* :file:`api` -> :file:`c-api` -* :file:`dist` -> :file:`distutils`, with the single TeX file split up -* :file:`doc` -> :file:`documenting` -* :file:`ext` -> :file:`extending` -* :file:`inst` -> :file:`installing` -* :file:`lib` -> :file:`library` -* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex` - moved to :file:`using/mac.rst` -* :file:`ref` -> :file:`reference` -* :file:`tut` -> :file:`tutorial`, with the single TeX file split up - - -.. XXX more (index-generating, production lists, ...) diff --git a/Doc/documenting/index.rst b/Doc/documenting/index.rst deleted file mode 100644 --- a/Doc/documenting/index.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _documenting-index: - -###################### - Documenting Python -###################### - - -The Python language has a substantial body of documentation, much of it -contributed by various authors. The markup used for the Python documentation is -`reStructuredText`_, developed by the `docutils`_ project, amended by custom -directives and using a toolset named `Sphinx`_ to postprocess the HTML output. - -This document describes the style guide for our documentation as well as the -custom reStructuredText markup introduced by Sphinx to support Python -documentation and how it should be used. - -.. _reStructuredText: http://docutils.sf.net/rst.html -.. _docutils: http://docutils.sf.net/ -.. _Sphinx: http://sphinx.pocoo.org/ - -.. note:: - - If you're interested in contributing to Python's documentation, there's no - need to write reStructuredText if you're not so inclined; plain text - contributions are more than welcome as well. Send an e-mail to - docs at python.org or open an issue on the :ref:`tracker `. - - -.. toctree:: - :numbered: - :maxdepth: 1 - - intro.rst - style.rst - rest.rst - markup.rst - fromlatex.rst - building.rst diff --git a/Doc/documenting/intro.rst b/Doc/documenting/intro.rst deleted file mode 100644 --- a/Doc/documenting/intro.rst +++ /dev/null @@ -1,29 +0,0 @@ -Introduction -============ - -Python's documentation has long been considered to be good for a free -programming language. There are a number of reasons for this, the most -important being the early commitment of Python's creator, Guido van Rossum, to -providing documentation on the language and its libraries, and the continuing -involvement of the user community in providing assistance for creating and -maintaining documentation. - -The involvement of the community takes many forms, from authoring to bug reports -to just plain complaining when the documentation could be more complete or -easier to use. - -This document is aimed at authors and potential authors of documentation for -Python. More specifically, it is for people contributing to the standard -documentation and developing additional documents using the same tools as the -standard documents. This guide will be less useful for authors using the Python -documentation tools for topics other than Python, and less useful still for -authors not using the tools at all. - -If your interest is in contributing to the Python documentation, but you don't -have the time or inclination to learn reStructuredText and the markup structures -documented here, there's a welcoming place for you among the Python contributors -as well. Any time you feel that you can clarify existing documentation or -provide documentation that's missing, the existing documentation team will -gladly work with you to integrate your text, dealing with the markup for you. -Please don't let the material in this document stand between the documentation -and your desire to help out! \ No newline at end of file diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst deleted file mode 100644 --- a/Doc/documenting/markup.rst +++ /dev/null @@ -1,904 +0,0 @@ -.. highlightlang:: rest - -Additional Markup Constructs -============================ - -Sphinx adds a lot of new directives and interpreted text roles to standard reST -markup. This section contains the reference material for these facilities. -Documentation for "standard" reST constructs is not included here, though -they are used in the Python documentation. - -.. note:: - - This is just an overview of Sphinx' extended markup capabilities; full - coverage can be found in `its own documentation - `_. - - -Meta-information markup ------------------------ - -.. describe:: sectionauthor - - Identifies the author of the current section. The argument should include - the author's name such that it can be used for presentation (though it isn't) - and email address. The domain name portion of the address should be lower - case. Example:: - - .. sectionauthor:: Guido van Rossum - - Currently, this markup isn't reflected in the output in any way, but it helps - keep track of contributions. - - -Module-specific markup ----------------------- - -The markup described in this section is used to provide information about a -module being documented. Each module should be documented in its own file. -Normally this markup appears after the title heading of that file; a typical -file might start like this:: - - :mod:`parrot` -- Dead parrot access - =================================== - - .. module:: parrot - :platform: Unix, Windows - :synopsis: Analyze and reanimate dead parrots. - .. moduleauthor:: Eric Cleese - .. moduleauthor:: John Idle - -As you can see, the module-specific markup consists of two directives, the -``module`` directive and the ``moduleauthor`` directive. - -.. describe:: module - - This directive marks the beginning of the description of a module, package, - or submodule. The name should be fully qualified (i.e. including the - package name for submodules). - - The ``platform`` option, if present, is a comma-separated list of the - platforms on which the module is available (if it is available on all - platforms, the option should be omitted). The keys are short identifiers; - examples that are in use include "IRIX", "Mac", "Windows", and "Unix". It is - important to use a key which has already been used when applicable. - - The ``synopsis`` option should consist of one sentence describing the - module's purpose -- it is currently only used in the Global Module Index. - - The ``deprecated`` option can be given (with no value) to mark a module as - deprecated; it will be designated as such in various locations then. - -.. describe:: moduleauthor - - The ``moduleauthor`` directive, which can appear multiple times, names the - authors of the module code, just like ``sectionauthor`` names the author(s) - of a piece of documentation. It too does not result in any output currently. - -.. note:: - - It is important to make the section title of a module-describing file - meaningful since that value will be inserted in the table-of-contents trees - in overview files. - - -Information units ------------------ - -There are a number of directives used to describe specific features provided by -modules. Each directive requires one or more signatures to provide basic -information about what is being described, and the content should be the -description. The basic version makes entries in the general index; if no index -entry is desired, you can give the directive option flag ``:noindex:``. The -following example shows all of the features of this directive type:: - - .. function:: spam(eggs) - ham(eggs) - :noindex: - - Spam or ham the foo. - -The signatures of object methods or data attributes should not include the -class name, but be nested in a class directive. The generated files will -reflect this nesting, and the target identifiers (for HTML output) will use -both the class and method name, to enable consistent cross-references. If you -describe methods belonging to an abstract protocol such as context managers, -use a class directive with a (pseudo-)type name too to make the -index entries more informative. - -The directives are: - -.. describe:: c:function - - Describes a C function. The signature should be given as in C, e.g.:: - - .. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) - - This is also used to describe function-like preprocessor macros. The names - of the arguments should be given so they may be used in the description. - - Note that you don't have to backslash-escape asterisks in the signature, - as it is not parsed by the reST inliner. - -.. describe:: c:member - - Describes a C struct member. Example signature:: - - .. c:member:: PyObject* PyTypeObject.tp_bases - - The text of the description should include the range of values allowed, how - the value should be interpreted, and whether the value can be changed. - References to structure members in text should use the ``member`` role. - -.. describe:: c:macro - - Describes a "simple" C macro. Simple macros are macros which are used - for code expansion, but which do not take arguments so cannot be described as - functions. This is not to be used for simple constant definitions. Examples - of its use in the Python documentation include :c:macro:`PyObject_HEAD` and - :c:macro:`Py_BEGIN_ALLOW_THREADS`. - -.. describe:: c:type - - Describes a C type. The signature should just be the type name. - -.. describe:: c:var - - Describes a global C variable. The signature should include the type, such - as:: - - .. cvar:: PyObject* PyClass_Type - -.. describe:: data - - Describes global data in a module, including both variables and values used - as "defined constants." Class and object attributes are not documented - using this directive. - -.. describe:: exception - - Describes an exception class. The signature can, but need not include - parentheses with constructor arguments. - -.. describe:: function - - Describes a module-level function. The signature should include the - parameters, enclosing optional parameters in brackets. Default values can be - given if it enhances clarity. For example:: - - .. function:: repeat([repeat=3[, number=1000000]]) - - Object methods are not documented using this directive. Bound object methods - placed in the module namespace as part of the public interface of the module - are documented using this, as they are equivalent to normal functions for - most purposes. - - The description should include information about the parameters required and - how they are used (especially whether mutable objects passed as parameters - are modified), side effects, and possible exceptions. A small example may be - provided. - -.. describe:: decorator - - Describes a decorator function. The signature should *not* represent the - signature of the actual function, but the usage as a decorator. For example, - given the functions - - .. code-block:: python - - def removename(func): - func.__name__ = '' - return func - - def setnewname(name): - def decorator(func): - func.__name__ = name - return func - return decorator - - the descriptions should look like this:: - - .. decorator:: removename - - Remove name of the decorated function. - - .. decorator:: setnewname(name) - - Set name of the decorated function to *name*. - - There is no ``deco`` role to link to a decorator that is marked up with - this directive; rather, use the ``:func:`` role. - -.. describe:: class - - Describes a class. The signature can include parentheses with parameters - which will be shown as the constructor arguments. - -.. describe:: attribute - - Describes an object data attribute. The description should include - information about the type of the data to be expected and whether it may be - changed directly. This directive should be nested in a class directive, - like in this example:: - - .. class:: Spam - - Description of the class. - - .. data:: ham - - Description of the attribute. - - If is also possible to document an attribute outside of a class directive, - for example if the documentation for different attributes and methods is - split in multiple sections. The class name should then be included - explicitly:: - - .. data:: Spam.eggs - -.. describe:: method - - Describes an object method. The parameters should not include the ``self`` - parameter. The description should include similar information to that - described for ``function``. This directive should be nested in a class - directive, like in the example above. - -.. describe:: decoratormethod - - Same as ``decorator``, but for decorators that are methods. - - Refer to a decorator method using the ``:meth:`` role. - -.. describe:: opcode - - Describes a Python :term:`bytecode` instruction. - -.. describe:: cmdoption - - Describes a Python command line option or switch. Option argument names - should be enclosed in angle brackets. Example:: - - .. cmdoption:: -m - - Run a module as a script. - -.. describe:: envvar - - Describes an environment variable that Python uses or defines. - - -There is also a generic version of these directives: - -.. describe:: describe - - This directive produces the same formatting as the specific ones explained - above but does not create index entries or cross-referencing targets. It is - used, for example, to describe the directives in this document. Example:: - - .. describe:: opcode - - Describes a Python bytecode instruction. - - -Showing code examples ---------------------- - -Examples of Python source code or interactive sessions are represented using -standard reST literal blocks. They are started by a ``::`` at the end of the -preceding paragraph and delimited by indentation. - -Representing an interactive session requires including the prompts and output -along with the Python code. No special markup is required for interactive -sessions. After the last line of input or output presented, there should not be -an "unused" primary prompt; this is an example of what *not* to do:: - - >>> 1 + 1 - 2 - >>> - -Syntax highlighting is handled in a smart way: - -* There is a "highlighting language" for each source file. Per default, - this is ``'python'`` as the majority of files will have to highlight Python - snippets. - -* Within Python highlighting mode, interactive sessions are recognized - automatically and highlighted appropriately. - -* The highlighting language can be changed using the ``highlightlang`` - directive, used as follows:: - - .. highlightlang:: c - - This language is used until the next ``highlightlang`` directive is - encountered. - -* The values normally used for the highlighting language are: - - * ``python`` (the default) - * ``c`` - * ``rest`` - * ``none`` (no highlighting) - -* If highlighting with the current language fails, the block is not highlighted - in any way. - -Longer displays of verbatim text may be included by storing the example text in -an external file containing only plain text. The file may be included using the -``literalinclude`` directive. [1]_ For example, to include the Python source file -:file:`example.py`, use:: - - .. literalinclude:: example.py - -The file name is relative to the current file's path. Documentation-specific -include files should be placed in the ``Doc/includes`` subdirectory. - - -Inline markup -------------- - -As said before, Sphinx uses interpreted text roles to insert semantic markup in -documents. - -Names of local variables, such as function/method arguments, are an exception, -they should be marked simply with ``*var*``. - -For all other roles, you have to write ``:rolename:`content```. - -There are some additional facilities that make cross-referencing roles more -versatile: - -* You may supply an explicit title and reference target, like in reST direct - hyperlinks: ``:role:`title ``` will refer to *target*, but the link - text will be *title*. - -* If you prefix the content with ``!``, no reference/hyperlink will be created. - -* For the Python object roles, if you prefix the content with ``~``, the link - text will only be the last component of the target. For example, - ``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only - display ``get`` as the link text. - - In HTML output, the link's ``title`` attribute (that is e.g. shown as a - tool-tip on mouse-hover) will always be the full target name. - -The following roles refer to objects in modules and are possibly hyperlinked if -a matching identifier is found: - -.. describe:: mod - - The name of a module; a dotted name may be used. This should also be used for - package names. - -.. describe:: func - - The name of a Python function; dotted names may be used. The role text - should not include trailing parentheses to enhance readability. The - parentheses are stripped when searching for identifiers. - -.. describe:: data - - The name of a module-level variable or constant. - -.. describe:: const - - The name of a "defined" constant. This may be a C-language ``#define`` - or a Python variable that is not intended to be changed. - -.. describe:: class - - A class name; a dotted name may be used. - -.. describe:: meth - - The name of a method of an object. The role text should include the type - name and the method name. A dotted name may be used. - -.. describe:: attr - - The name of a data attribute of an object. - -.. describe:: exc - - The name of an exception. A dotted name may be used. - -The name enclosed in this markup can include a module name and/or a class name. -For example, ``:func:`filter``` could refer to a function named ``filter`` in -the current module, or the built-in function of that name. In contrast, -``:func:`foo.filter``` clearly refers to the ``filter`` function in the ``foo`` -module. - -Normally, names in these roles are searched first without any further -qualification, then with the current module name prepended, then with the -current module and class name (if any) prepended. If you prefix the name with a -dot, this order is reversed. For example, in the documentation of the -:mod:`codecs` module, ``:func:`open``` always refers to the built-in function, -while ``:func:`.open``` refers to :func:`codecs.open`. - -A similar heuristic is used to determine whether the name is an attribute of -the currently documented class. - -The following roles create cross-references to C-language constructs if they -are defined in the API documentation: - -.. describe:: c:data - - The name of a C-language variable. - -.. describe:: c:func - - The name of a C-language function. Should include trailing parentheses. - -.. describe:: c:macro - - The name of a "simple" C macro, as defined above. - -.. describe:: c:type - - The name of a C-language type. - -.. describe:: c:member - - The name of a C type member, as defined above. - - -The following role does possibly create a cross-reference, but does not refer -to objects: - -.. describe:: token - - The name of a grammar token (used in the reference manual to create links - between production displays). - - -The following role creates a cross-reference to the term in the glossary: - -.. describe:: term - - Reference to a term in the glossary. The glossary is created using the - ``glossary`` directive containing a definition list with terms and - definitions. It does not have to be in the same file as the ``term`` - markup, in fact, by default the Python docs have one global glossary - in the ``glossary.rst`` file. - - If you use a term that's not explained in a glossary, you'll get a warning - during build. - ---------- - -The following roles don't do anything special except formatting the text -in a different style: - -.. describe:: command - - The name of an OS-level command, such as ``rm``. - -.. describe:: dfn - - Mark the defining instance of a term in the text. (No index entries are - generated.) - -.. describe:: envvar - - An environment variable. Index entries are generated. - -.. describe:: file - - The name of a file or directory. Within the contents, you can use curly - braces to indicate a "variable" part, for example:: - - ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... - - In the built documentation, the ``x`` will be displayed differently to - indicate that it is to be replaced by the Python minor version. - -.. describe:: guilabel - - Labels presented as part of an interactive user interface should be marked - using ``guilabel``. This includes labels from text-based interfaces such as - those created using :mod:`curses` or other text-based libraries. Any label - used in the interface should be marked with this role, including button - labels, window titles, field names, menu and menu selection names, and even - values in selection lists. - -.. describe:: kbd - - Mark a sequence of keystrokes. What form the key sequence takes may depend - on platform- or application-specific conventions. When there are no relevant - conventions, the names of modifier keys should be spelled out, to improve - accessibility for new users and non-native speakers. For example, an - *xemacs* key sequence may be marked like ``:kbd:`C-x C-f```, but without - reference to a specific application or platform, the same sequence should be - marked as ``:kbd:`Control-x Control-f```. - -.. describe:: keyword - - The name of a Python keyword. Using this role will generate a link to the - documentation of the keyword. ``True``, ``False`` and ``None`` do not use - this role, but simple code markup (````True````), given that they're - fundamental to the language and should be known to any programmer. - -.. describe:: mailheader - - The name of an RFC 822-style mail header. This markup does not imply that - the header is being used in an email message, but can be used to refer to any - header of the same "style." This is also used for headers defined by the - various MIME specifications. The header name should be entered in the same - way it would normally be found in practice, with the camel-casing conventions - being preferred where there is more than one common usage. For example: - ``:mailheader:`Content-Type```. - -.. describe:: makevar - - The name of a :command:`make` variable. - -.. describe:: manpage - - A reference to a Unix manual page including the section, - e.g. ``:manpage:`ls(1)```. - -.. describe:: menuselection - - Menu selections should be marked using the ``menuselection`` role. This is - used to mark a complete sequence of menu selections, including selecting - submenus and choosing a specific operation, or any subsequence of such a - sequence. The names of individual selections should be separated by - ``-->``. - - For example, to mark the selection "Start > Programs", use this markup:: - - :menuselection:`Start --> Programs` - - When including a selection that includes some trailing indicator, such as the - ellipsis some operating systems use to indicate that the command opens a - dialog, the indicator should be omitted from the selection name. - -.. describe:: mimetype - - The name of a MIME type, or a component of a MIME type (the major or minor - portion, taken alone). - -.. describe:: newsgroup - - The name of a Usenet newsgroup. - -.. describe:: option - - A command-line option of Python. The leading hyphen(s) must be included. - If a matching ``cmdoption`` directive exists, it is linked to. For options - of other programs or scripts, use simple ````code```` markup. - -.. describe:: program - - The name of an executable program. This may differ from the file name for - the executable for some platforms. In particular, the ``.exe`` (or other) - extension should be omitted for Windows programs. - -.. describe:: regexp - - A regular expression. Quotes should not be included. - -.. describe:: samp - - A piece of literal text, such as code. Within the contents, you can use - curly braces to indicate a "variable" part, as in ``:file:``. - - If you don't need the "variable part" indication, use the standard - ````code```` instead. - - -The following roles generate external links: - -.. describe:: pep - - A reference to a Python Enhancement Proposal. This generates appropriate - index entries. The text "PEP *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified PEP. - -.. describe:: rfc - - A reference to an Internet Request for Comments. This generates appropriate - index entries. The text "RFC *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified RFC. - - -Note that there are no special roles for including hyperlinks as you can use -the standard reST markup for that purpose. - - -.. _doc-ref-role: - -Cross-linking markup --------------------- - -To support cross-referencing to arbitrary sections in the documentation, the -standard reST labels are "abused" a bit: Every label must precede a section -title; and every label name must be unique throughout the entire documentation -source. - -You can then reference to these sections using the ``:ref:`label-name``` role. - -Example:: - - .. _my-reference-label: - - Section to cross-reference - -------------------------- - - This is the text of the section. - - It refers to the section itself, see :ref:`my-reference-label`. - -The ``:ref:`` invocation is replaced with the section title. - -Alternatively, you can reference any label (not just section titles) -if you provide the link text ``:ref:`link text ```. - -Paragraph-level markup ----------------------- - -These directives create short paragraphs and can be used inside information -units as well as normal text: - -.. describe:: note - - An especially important bit of information about an API that a user should be - aware of when using whatever bit of API the note pertains to. The content of - the directive should be written in complete sentences and include all - appropriate punctuation. - - Example:: - - .. note:: - - This function is not suitable for sending spam e-mails. - -.. describe:: warning - - An important bit of information about an API that a user should be aware of - when using whatever bit of API the warning pertains to. The content of the - directive should be written in complete sentences and include all appropriate - punctuation. In the interest of not scaring users away from pages filled - with warnings, this directive should only be chosen over ``note`` for - information regarding the possibility of crashes, data loss, or security - implications. - -.. describe:: versionadded - - This directive documents the version of Python which added the described - feature to the library or C API. When this applies to an entire module, it - should be placed at the top of the module section before any prose. - - The first argument must be given and is the version in question; you can add - a second argument consisting of a *brief* explanation of the change. - - Example:: - - .. versionadded:: 3.1 - The *spam* parameter. - - Note that there must be no blank line between the directive head and the - explanation; this is to make these blocks visually continuous in the markup. - -.. describe:: versionchanged - - Similar to ``versionadded``, but describes when and what changed in the named - feature in some way (new parameters, changed side effects, etc.). - --------------- - -.. describe:: impl-detail - - This directive is used to mark CPython-specific information. Use either with - a block content or a single sentence as an argument, i.e. either :: - - .. impl-detail:: - - This describes some implementation detail. - - More explanation. - - or :: - - .. impl-detail:: This shortly mentions an implementation detail. - - "\ **CPython implementation detail:**\ " is automatically prepended to the - content. - -.. describe:: seealso - - Many sections include a list of references to module documentation or - external documents. These lists are created using the ``seealso`` directive. - - The ``seealso`` directive is typically placed in a section just before any - sub-sections. For the HTML output, it is shown boxed off from the main flow - of the text. - - The content of the ``seealso`` directive should be a reST definition list. - Example:: - - .. seealso:: - - Module :mod:`zipfile` - Documentation of the :mod:`zipfile` standard module. - - `GNU tar manual, Basic Tar Format `_ - Documentation for tar archive files, including GNU tar extensions. - -.. describe:: rubric - - This directive creates a paragraph heading that is not used to create a - table of contents node. It is currently used for the "Footnotes" caption. - -.. describe:: centered - - This directive creates a centered boldfaced paragraph. Use it as follows:: - - .. centered:: - - Paragraph contents. - - -Table-of-contents markup ------------------------- - -Since reST does not have facilities to interconnect several documents, or split -documents into multiple output files, Sphinx uses a custom directive to add -relations between the single files the documentation is made of, as well as -tables of contents. The ``toctree`` directive is the central element. - -.. describe:: toctree - - This directive inserts a "TOC tree" at the current location, using the - individual TOCs (including "sub-TOC trees") of the files given in the - directive body. A numeric ``maxdepth`` option may be given to indicate the - depth of the tree; by default, all levels are included. - - Consider this example (taken from the library reference index):: - - .. toctree:: - :maxdepth: 2 - - intro - strings - datatypes - numeric - (many more files listed here) - - This accomplishes two things: - - * Tables of contents from all those files are inserted, with a maximum depth - of two, that means one nested heading. ``toctree`` directives in those - files are also taken into account. - * Sphinx knows that the relative order of the files ``intro``, - ``strings`` and so forth, and it knows that they are children of the - shown file, the library index. From this information it generates "next - chapter", "previous chapter" and "parent chapter" links. - - In the end, all files included in the build process must occur in one - ``toctree`` directive; Sphinx will emit a warning if it finds a file that is - not included, because that means that this file will not be reachable through - standard navigation. - - The special file ``contents.rst`` at the root of the source directory is the - "root" of the TOC tree hierarchy; from it the "Contents" page is generated. - - -Index-generating markup ------------------------ - -Sphinx automatically creates index entries from all information units (like -functions, classes or attributes) like discussed before. - -However, there is also an explicit directive available, to make the index more -comprehensive and enable index entries in documents where information is not -mainly contained in information units, such as the language reference. - -The directive is ``index`` and contains one or more index entries. Each entry -consists of a type and a value, separated by a colon. - -For example:: - - .. index:: - single: execution; context - module: __main__ - module: sys - triple: module; search; path - -This directive contains five entries, which will be converted to entries in the -generated index which link to the exact location of the index statement (or, in -case of offline media, the corresponding page number). - -The possible entry types are: - -single - Creates a single index entry. Can be made a subentry by separating the - subentry text with a semicolon (this notation is also used below to describe - what entries are created). -pair - ``pair: loop; statement`` is a shortcut that creates two index entries, - namely ``loop; statement`` and ``statement; loop``. -triple - Likewise, ``triple: module; search; path`` is a shortcut that creates three - index entries, which are ``module; search path``, ``search; path, module`` and - ``path; module search``. -module, keyword, operator, object, exception, statement, builtin - These all create two index entries. For example, ``module: hashlib`` creates - the entries ``module; hashlib`` and ``hashlib; module``. - -For index directives containing only "single" entries, there is a shorthand -notation:: - - .. index:: BNF, grammar, syntax, notation - -This creates four index entries. - - -Grammar production displays ---------------------------- - -Special markup is available for displaying the productions of a formal grammar. -The markup is simple and does not attempt to model all aspects of BNF (or any -derived forms), but provides enough to allow context-free grammars to be -displayed in a way that causes uses of a symbol to be rendered as hyperlinks to -the definition of the symbol. There is this directive: - -.. describe:: productionlist - - This directive is used to enclose a group of productions. Each production is - given on a single line and consists of a name, separated by a colon from the - following definition. If the definition spans multiple lines, each - continuation line must begin with a colon placed at the same column as in the - first line. - - Blank lines are not allowed within ``productionlist`` directive arguments. - - The definition can contain token names which are marked as interpreted text - (e.g. ``unaryneg ::= "-" `integer```) -- this generates cross-references - to the productions of these tokens. - - Note that no further reST parsing is done in the production, so that you - don't have to escape ``*`` or ``|`` characters. - - -.. XXX describe optional first parameter - -The following is an example taken from the Python Reference Manual:: - - .. productionlist:: - try_stmt: try1_stmt | try2_stmt - try1_stmt: "try" ":" `suite` - : ("except" [`expression` ["," `target`]] ":" `suite`)+ - : ["else" ":" `suite`] - : ["finally" ":" `suite`] - try2_stmt: "try" ":" `suite` - : "finally" ":" `suite` - - -Substitutions -------------- - -The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file :file:`conf.py`. - -.. describe:: |release| - - Replaced by the Python release the documentation refers to. This is the full - version string including alpha/beta/release candidate tags, e.g. ``2.5.2b3``. - -.. describe:: |version| - - Replaced by the Python version the documentation refers to. This consists - only of the major and minor version parts, e.g. ``2.5``, even for version - 2.5.1. - -.. describe:: |today| - - Replaced by either today's date, or the date set in the build configuration - file. Normally has the format ``April 14, 2007``. - - -.. rubric:: Footnotes - -.. [1] There is a standard ``.. include`` directive, but it raises errors if the - file is not found. This one only emits a warning. diff --git a/Doc/documenting/rest.rst b/Doc/documenting/rest.rst deleted file mode 100644 --- a/Doc/documenting/rest.rst +++ /dev/null @@ -1,243 +0,0 @@ -.. highlightlang:: rest - -reStructuredText Primer -======================= - -This section is a brief introduction to reStructuredText (reST) concepts and -syntax, intended to provide authors with enough information to author documents -productively. Since reST was designed to be a simple, unobtrusive markup -language, this will not take too long. - -.. seealso:: - - The authoritative `reStructuredText User - Documentation `_. - - -Paragraphs ----------- - -The paragraph is the most basic block in a reST document. Paragraphs are simply -chunks of text separated by one or more blank lines. As in Python, indentation -is significant in reST, so all lines of the same paragraph must be left-aligned -to the same level of indentation. - - -Inline markup -------------- - -The standard reST inline markup is quite simple: use - -* one asterisk: ``*text*`` for emphasis (italics), -* two asterisks: ``**text**`` for strong emphasis (boldface), and -* backquotes: ````text```` for code samples. - -If asterisks or backquotes appear in running text and could be confused with -inline markup delimiters, they have to be escaped with a backslash. - -Be aware of some restrictions of this markup: - -* it may not be nested, -* content may not start or end with whitespace: ``* text*`` is wrong, -* it must be separated from surrounding text by non-word characters. Use a - backslash escaped space to work around that: ``thisis\ *one*\ word``. - -These restrictions may be lifted in future versions of the docutils. - -reST also allows for custom "interpreted text roles"', which signify that the -enclosed text should be interpreted in a specific way. Sphinx uses this to -provide semantic markup and cross-referencing of identifiers, as described in -the appropriate section. The general syntax is ``:rolename:`content```. - - -Lists and Quotes ----------------- - -List markup is natural: just place an asterisk at the start of a paragraph and -indent properly. The same goes for numbered lists; they can also be -autonumbered using a ``#`` sign:: - - * This is a bulleted list. - * It has two items, the second - item uses two lines. - - 1. This is a numbered list. - 2. It has two items too. - - #. This is a numbered list. - #. It has two items too. - - -Nested lists are possible, but be aware that they must be separated from the -parent list items by blank lines:: - - * this is - * a list - - * with a nested list - * and some subitems - - * and here the parent list continues - -Definition lists are created as follows:: - - term (up to a line of text) - Definition of the term, which must be indented - - and can even consist of multiple paragraphs - - next term - Description. - - -Paragraphs are quoted by just indenting them more than the surrounding -paragraphs. - - -Source Code ------------ - -Literal code blocks are introduced by ending a paragraph with the special marker -``::``. The literal block must be indented:: - - This is a normal text paragraph. The next paragraph is a code sample:: - - It is not processed in any way, except - that the indentation is removed. - - It can span multiple lines. - - This is a normal text paragraph again. - -The handling of the ``::`` marker is smart: - -* If it occurs as a paragraph of its own, that paragraph is completely left - out of the document. -* If it is preceded by whitespace, the marker is removed. -* If it is preceded by non-whitespace, the marker is replaced by a single - colon. - -That way, the second sentence in the above example's first paragraph would be -rendered as "The next paragraph is a code sample:". - - -Hyperlinks ----------- - -External links -^^^^^^^^^^^^^^ - -Use ```Link text `_`` for inline web links. If the link text -should be the web address, you don't need special markup at all, the parser -finds links and mail addresses in ordinary text. - -Internal links -^^^^^^^^^^^^^^ - -Internal linking is done via a special reST role, see the section on specific -markup, :ref:`doc-ref-role`. - - -Sections --------- - -Section headers are created by underlining (and optionally overlining) the -section title with a punctuation character, at least as long as the text:: - - ================= - This is a heading - ================= - -Normally, there are no heading levels assigned to certain characters as the -structure is determined from the succession of headings. However, for the -Python documentation, we use this convention: - -* ``#`` with overline, for parts -* ``*`` with overline, for chapters -* ``=``, for sections -* ``-``, for subsections -* ``^``, for subsubsections -* ``"``, for paragraphs - - -Explicit Markup ---------------- - -"Explicit markup" is used in reST for most constructs that need special -handling, such as footnotes, specially-highlighted paragraphs, comments, and -generic directives. - -An explicit markup block begins with a line starting with ``..`` followed by -whitespace and is terminated by the next paragraph at the same level of -indentation. (There needs to be a blank line between explicit markup and normal -paragraphs. This may all sound a bit complicated, but it is intuitive enough -when you write it.) - - -Directives ----------- - -A directive is a generic block of explicit markup. Besides roles, it is one of -the extension mechanisms of reST, and Sphinx makes heavy use of it. - -Basically, a directive consists of a name, arguments, options and content. (Keep -this terminology in mind, it is used in the next chapter describing custom -directives.) Looking at this example, :: - - .. function:: foo(x) - foo(y, z) - :bar: no - - Return a line of text input from the user. - -``function`` is the directive name. It is given two arguments here, the -remainder of the first line and the second line, as well as one option ``bar`` -(as you can see, options are given in the lines immediately following the -arguments and indicated by the colons). - -The directive content follows after a blank line and is indented relative to the -directive start. - - -Footnotes ---------- - -For footnotes, use ``[#]_`` to mark the footnote location, and add the footnote -body at the bottom of the document after a "Footnotes" rubric heading, like so:: - - Lorem ipsum [#]_ dolor sit amet ... [#]_ - - .. rubric:: Footnotes - - .. [#] Text of the first footnote. - .. [#] Text of the second footnote. - -You can also explicitly number the footnotes for better context. - - -Comments --------- - -Every explicit markup block which isn't a valid markup construct (like the -footnotes above) is regarded as a comment. - - -Source encoding ---------------- - -Since the easiest way to include special characters like em dashes or copyright -signs in reST is to directly write them as Unicode characters, one has to -specify an encoding: - -All Python documentation source files must be in UTF-8 encoding, and the HTML -documents written from them will be in that encoding as well. - - -Gotchas -------- - -There are some problems one commonly runs into while authoring reST documents: - -* **Separation of inline markup:** As said above, inline markup spans must be - separated from the surrounding text by non-word characters, you have to use - an escaped space to get around that. diff --git a/Doc/documenting/style.rst b/Doc/documenting/style.rst deleted file mode 100644 --- a/Doc/documenting/style.rst +++ /dev/null @@ -1,217 +0,0 @@ -.. highlightlang:: rest - -Style guide -=========== - -The Python documentation should follow the `Apple Publications Style Guide`_ -wherever possible. This particular style guide was selected mostly because it -seems reasonable and is easy to get online. - -Topics which are either not covered in Apple's style guide or treated -differently in Python documentation will be discussed in this -document. - -Use of whitespace ------------------ - -All reST files use an indentation of 3 spaces. The maximum line length is 80 -characters for normal text, but tables, deeply indented code samples and long -links may extend beyond that. - -Make generous use of blank lines where applicable; they help grouping things -together. - -A sentence-ending period may be followed by one or two spaces; while reST -ignores the second space, it is customarily put in by some users, for example -to aid Emacs' auto-fill mode. - -Footnotes ---------- - -Footnotes are generally discouraged, though they may be used when they are the -best way to present specific information. When a footnote reference is added at -the end of the sentence, it should follow the sentence-ending punctuation. The -reST markup should appear something like this:: - - This sentence has a footnote reference. [#]_ This is the next sentence. - -Footnotes should be gathered at the end of a file, or if the file is very long, -at the end of a section. The docutils will automatically create backlinks to -the footnote reference. - -Footnotes may appear in the middle of sentences where appropriate. - -Capitalization --------------- - -.. sidebar:: Sentence case - - Sentence case is a set of capitalization rules used in English - sentences: the first word is always capitalized and other words are - only capitalized if there is a specific rule requiring it. - -Apple style guide recommends the use of title case in section titles. -However, rules for which words should be capitalized in title case -vary greaty between publications. - -In Python documentation, use of sentence case in section titles is -preferable, but consistency within a unit is more important than -following this rule. If you add a section to the chapter where most -sections are in title case you can either convert all titles to -sentence case or use the dominant style in the new section title. - -Sentences that start with a word for which specific rules require -starting it with a lower case letter should be avoided in titles and -elsewhere. - -.. note:: - - Sections that describe a library module often have titles in the - form of "modulename --- Short description of the module." In this - case, the description should be capitalized as a stand-alone - sentence. - -Many special names are used in the Python documentation, including the names of -operating systems, programming languages, standards bodies, and the like. Most -of these entities are not assigned any special markup, but the preferred -spellings are given here to aid authors in maintaining the consistency of -presentation in the Python documentation. - -Other terms and words deserve special mention as well; these conventions should -be used to ensure consistency throughout the documentation: - -CPU - For "central processing unit." Many style guides say this should be - spelled out on the first use (and if you must use it, do so!). For - the Python documentation, this abbreviation should be avoided since - there's no reasonable way to predict which occurrence will be the - first seen by the reader. It is better to use the word "processor" - instead. - -POSIX - The name assigned to a particular group of standards. This is always - uppercase. - -Python - The name of our favorite programming language is always capitalized. - -reST - For "reStructuredText," an easy to read, plaintext markup syntax - used to produce Python documentation. When spelled out, it is - always one word and both forms start with a lower case 'r'. - -Unicode - The name of a character coding system. This is always written - capitalized. - -Unix - The name of the operating system developed at AT&T Bell Labs in the early - 1970s. - -Affirmative Tone ----------------- - -The documentation focuses on affirmatively stating what the language does and -how to use it effectively. - -Except for certain security risks or segfault risks, the docs should avoid -wording along the lines of "feature x is dangerous" or "experts only". These -kinds of value judgments belong in external blogs and wikis, not in the core -documentation. - -Bad example (creating worry in the mind of a reader): - - Warning: failing to explicitly close a file could result in lost data or - excessive resource consumption. Never rely on reference counting to - automatically close a file. - -Good example (establishing confident knowledge in the effective use of the language): - - A best practice for using files is use a try/finally pair to explicitly - close a file after it is used. Alternatively, using a with-statement can - achieve the same effect. This assures that files are flushed and file - descriptor resources are released in a timely manner. - -Economy of Expression ---------------------- - -More documentation is not necessarily better documentation. Err on the side -of being succinct. - -It is an unfortunate fact that making documentation longer can be an impediment -to understanding and can result in even more ways to misread or misinterpret the -text. Long descriptions full of corner cases and caveats can create the -impression that a function is more complex or harder to use than it actually is. - -The documentation for :func:`super` is an example of where a good deal of -information was condensed into a few short paragraphs. Discussion of -:func:`super` could have filled a chapter in a book, but it is often easier to -grasp a terse description than a lengthy narrative. - - -Code Examples -------------- - -Short code examples can be a useful adjunct to understanding. Readers can often -grasp a simple example more quickly than they can digest a formal description in -prose. - -People learn faster with concrete, motivating examples that match the context of -a typical use case. For instance, the :func:`str.rpartition` method is better -demonstrated with an example splitting the domain from a URL than it would be -with an example of removing the last word from a line of Monty Python dialog. - -The ellipsis for the :attr:`sys.ps2` secondary interpreter prompt should only be -used sparingly, where it is necessary to clearly differentiate between input -lines and output lines. Besides contributing visual clutter, it makes it -difficult for readers to cut-and-paste examples so they can experiment with -variations. - -Code Equivalents ----------------- - -Giving pure Python code equivalents (or approximate equivalents) can be a useful -adjunct to a prose description. A documenter should carefully weigh whether the -code equivalent adds value. - -A good example is the code equivalent for :func:`all`. The short 4-line code -equivalent is easily digested; it re-emphasizes the early-out behavior; and it -clarifies the handling of the corner-case where the iterable is empty. In -addition, it serves as a model for people wanting to implement a commonly -requested alternative where :func:`all` would return the specific object -evaluating to False whenever the function terminates early. - -A more questionable example is the code for :func:`itertools.groupby`. Its code -equivalent borders on being too complex to be a quick aid to understanding. -Despite its complexity, the code equivalent was kept because it serves as a -model to alternative implementations and because the operation of the "grouper" -is more easily shown in code than in English prose. - -An example of when not to use a code equivalent is for the :func:`oct` function. -The exact steps in converting a number to octal doesn't add value for a user -trying to learn what the function does. - -Audience --------- - -The tone of the tutorial (and all the docs) needs to be respectful of the -reader's intelligence. Don't presume that the readers are stupid. Lay out the -relevant information, show motivating use cases, provide glossary links, and do -your best to connect-the-dots, but don't talk down to them or waste their time. - -The tutorial is meant for newcomers, many of whom will be using the tutorial to -evaluate the language as a whole. The experience needs to be positive and not -leave the reader with worries that something bad will happen if they make a -misstep. The tutorial serves as guide for intelligent and curious readers, -saving details for the how-to guides and other sources. - -Be careful accepting requests for documentation changes from the rare but vocal -category of reader who is looking for vindication for one of their programming -errors ("I made a mistake, therefore the docs must be wrong ..."). Typically, -the documentation wasn't consulted until after the error was made. It is -unfortunate, but typically no documentation edit would have saved the user from -making false assumptions about the language ("I was surprised by ..."). - - -.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf - diff --git a/Doc/tools/sphinxext/indexcontent.html b/Doc/tools/sphinxext/indexcontent.html --- a/Doc/tools/sphinxext/indexcontent.html +++ b/Doc/tools/sphinxext/indexcontent.html @@ -24,8 +24,6 @@ information for installers & sys-admins

    - diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -234,7 +234,7 @@ .. seealso:: - :ref:`documenting-index` + `Documenting Python `__ Describes how to write for Python's documentation. `Sphinx `__ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 14 22:30:32 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 14 Jan 2012 22:30:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/900c01e643a7 changeset: 74412:900c01e643a7 parent: 74409:06d96a5bb41e parent: 74411:70c46599fb0e user: Sandro Tosi date: Sat Jan 14 22:27:56 2012 +0100 summary: merge with 3.2 files: Doc/contents.rst | 1 - Doc/documenting/building.rst | 90 - Doc/documenting/fromlatex.rst | 199 --- Doc/documenting/index.rst | 38 - Doc/documenting/intro.rst | 29 - Doc/documenting/markup.rst | 891 -------------- Doc/documenting/rest.rst | 231 --- Doc/documenting/style.rst | 210 --- Doc/tools/sphinxext/indexcontent.html | 2 - Doc/whatsnew/2.6.rst | 2 +- 10 files changed, 1 insertions(+), 1692 deletions(-) diff --git a/Doc/contents.rst b/Doc/contents.rst --- a/Doc/contents.rst +++ b/Doc/contents.rst @@ -13,7 +13,6 @@ c-api/index.rst packaging/index.rst install/index.rst - documenting/index.rst howto/index.rst faq/index.rst glossary.rst diff --git a/Doc/documenting/building.rst b/Doc/documenting/building.rst deleted file mode 100644 --- a/Doc/documenting/building.rst +++ /dev/null @@ -1,92 +0,0 @@ -Building the documentation -========================== - -You need to have Python 2.4 or higher installed; the toolset used to build the -docs is written in Python. It is called *Sphinx*, it is not included in this -tree, but maintained separately. Also needed are the docutils, supplying the -base markup that Sphinx uses, Jinja, a templating engine, and optionally -Pygments, a code highlighter. - - -Using make ----------- - -Luckily, a Makefile has been prepared so that on Unix, provided you have -installed Python and Subversion, you can just run :: - - cd Doc - make html - -to check out the necessary toolset in the :file:`tools/` subdirectory and build -the HTML output files. To view the generated HTML, point your favorite browser -at the top-level index :file:`build/html/index.html` after running "make". - -Available make targets are: - - * "html", which builds standalone HTML files for offline viewing. - - * "htmlhelp", which builds HTML files and a HTML Help project file usable to - convert them into a single Compiled HTML (.chm) file -- these are popular - under Microsoft Windows, but very handy on every platform. - - To create the CHM file, you need to run the Microsoft HTML Help Workshop - over the generated project (.hhp) file. - - * "latex", which builds LaTeX source files as input to "pdflatex" to produce - PDF documents. - - * "text", which builds a plain text file for each source file. - - * "linkcheck", which checks all external references to see whether they are - broken, redirected or malformed, and outputs this information to stdout - as well as a plain-text (.txt) file. - - * "changes", which builds an overview over all versionadded/versionchanged/ - deprecated items in the current version. This is meant as a help for the - writer of the "What's New" document. - - * "coverage", which builds a coverage overview for standard library modules - and C API. - - * "pydoc-topics", which builds a Python module containing a dictionary with - plain text documentation for the labels defined in - :file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and - keyword help. - -A "make update" updates the Subversion checkouts in :file:`tools/`. - - -Without make ------------- - -You'll need to install the Sphinx package, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Sphinx-0.6.5/sphinx tools/sphinx - -or by installing it from PyPI. - -Then, you need to install Docutils, either by checking it out via :: - - svn co http://svn.python.org/projects/external/docutils-0.6/docutils tools/docutils - -or by installing it from http://docutils.sf.net/. - -You also need Jinja2, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Jinja-2.3.1/jinja2 tools/jinja2 - -or by installing it from PyPI. - -You can optionally also install Pygments, either as a checkout via :: - - svn co http://svn.python.org/projects/external/Pygments-1.3.1/pygments tools/pygments - -or from PyPI at http://pypi.python.org/pypi/Pygments. - - -Then, make an output directory, e.g. under `build/`, and run :: - - python tools/sphinx-build.py -b . build/ - -where `` is one of html, text, latex, or htmlhelp (for explanations see -the make targets above). diff --git a/Doc/documenting/fromlatex.rst b/Doc/documenting/fromlatex.rst deleted file mode 100644 --- a/Doc/documenting/fromlatex.rst +++ /dev/null @@ -1,202 +0,0 @@ -.. highlightlang:: rest - -Differences to the LaTeX markup -=============================== - -Though the markup language is different, most of the concepts and markup types -of the old LaTeX docs have been kept -- environments as reST directives, inline -commands as reST roles and so forth. - -However, there are some differences in the way these work, partly due to the -differences in the markup languages, partly due to improvements in Sphinx. This -section lists these differences, in order to give those familiar with the old -format a quick overview of what they might run into. - -Inline markup -------------- - -These changes have been made to inline markup: - -* **Cross-reference roles** - - Most of the following semantic roles existed previously as inline commands, - but didn't do anything except formatting the content as code. Now, they - cross-reference to known targets (some names have also been shortened): - - | *mod* (previously *refmodule* or *module*) - | *func* (previously *function*) - | *data* (new) - | *const* - | *class* - | *meth* (previously *method*) - | *attr* (previously *member*) - | *exc* (previously *exception*) - | *cdata* - | *cfunc* (previously *cfunction*) - | *cmacro* (previously *csimplemacro*) - | *ctype* - - Also different is the handling of *func* and *meth*: while previously - parentheses were added to the callable name (like ``\func{str()}``), they are - now appended by the build system -- appending them in the source will result - in double parentheses. This also means that ``:func:`str(object)``` will not - work as expected -- use ````str(object)```` instead! - -* **Inline commands implemented as directives** - - These were inline commands in LaTeX, but are now directives in reST: - - | *deprecated* - | *versionadded* - | *versionchanged* - - These are used like so:: - - .. deprecated:: 2.5 - Reason of deprecation. - - Also, no period is appended to the text for *versionadded* and - *versionchanged*. - - | *note* - | *warning* - - These are used like so:: - - .. note:: - - Content of note. - -* **Otherwise changed commands** - - The *samp* command previously formatted code and added quotation marks around - it. The *samp* role, however, features a new highlighting system just like - *file* does: - - ``:samp:`open({filename}, {mode})``` results in :samp:`open({filename}, {mode})` - -* **Dropped commands** - - These were commands in LaTeX, but are not available as roles: - - | *bfcode* - | *character* (use :samp:`\`\`'c'\`\``) - | *citetitle* (use ```Title `_``) - | *code* (use ````code````) - | *email* (just write the address in body text) - | *filenq* - | *filevar* (use the ``{...}`` highlighting feature of *file*) - | *programopt*, *longprogramopt* (use *option*) - | *ulink* (use ```Title `_``) - | *url* (just write the URL in body text) - | *var* (use ``*var*``) - | *infinity*, *plusminus* (use the Unicode character) - | *shortversion*, *version* (use the ``|version|`` and ``|release|`` substitutions) - | *emph*, *strong* (use the reST markup) - -* **Backslash escaping** - - In reST, a backslash must be escaped in normal text, and in the content of - roles. However, in code literals and literal blocks, it must not be escaped. - Example: ``:file:`C:\\Temp\\my.tmp``` vs. ````open("C:\Temp\my.tmp")````. - - -Information units ------------------ - -Information units (*...desc* environments) have been made reST directives. -These changes to information units should be noted: - -* **New names** - - "desc" has been removed from every name. Additionally, these directives have - new names: - - | *cfunction* (previously *cfuncdesc*) - | *cmacro* (previously *csimplemacrodesc*) - | *exception* (previously *excdesc*) - | *function* (previously *funcdesc*) - | *attribute* (previously *memberdesc*) - - The *classdesc\** and *excclassdesc* environments have been dropped, the - *class* and *exception* directives support classes documented with and without - constructor arguments. - -* **Multiple objects** - - The equivalent of the *...line* commands is:: - - .. function:: do_foo(bar) - do_bar(baz) - - Description of the functions. - - IOW, just give one signatures per line, at the same indentation level. - -* **Arguments** - - There is no *optional* command. Just give function signatures like they - should appear in the output:: - - .. function:: open(filename[, mode[, buffering]]) - - Description. - - Note: markup in the signature is not supported. - -* **Indexing** - - The *...descni* environments have been dropped. To mark an information unit - as unsuitable for index entry generation, use the *noindex* option like so:: - - .. function:: foo_* - :noindex: - - Description. - -* **New information units** - - There are new generic information units: One is called "describe" and can be - used to document things that are not covered by the other units:: - - .. describe:: a == b - - The equals operator. - - The others are:: - - .. cmdoption:: -O - - Describes a command-line option. - - .. envvar:: PYTHONINSPECT - - Describes an environment variable. - - -Structure ---------- - -The LaTeX docs were split in several toplevel manuals. Now, all files are part -of the same documentation tree, as indicated by the *toctree* directives in the -sources (though individual output formats may choose to split them up into parts -again). Every *toctree* directive embeds other files as subdocuments of the -current file (this structure is not necessarily mirrored in the filesystem -layout). The toplevel file is :file:`contents.rst`. - -However, most of the old directory structure has been kept, with the -directories renamed as follows: - -* :file:`api` -> :file:`c-api` -* :file:`dist` -> :file:`distutils`, with the single TeX file split up -* :file:`doc` -> :file:`documenting` -* :file:`ext` -> :file:`extending` -* :file:`inst` -> :file:`installing` -* :file:`lib` -> :file:`library` -* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex` - moved to :file:`using/mac.rst` -* :file:`ref` -> :file:`reference` -* :file:`tut` -> :file:`tutorial`, with the single TeX file split up - - -.. XXX more (index-generating, production lists, ...) diff --git a/Doc/documenting/index.rst b/Doc/documenting/index.rst deleted file mode 100644 --- a/Doc/documenting/index.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _documenting-index: - -###################### - Documenting Python -###################### - - -The Python language has a substantial body of documentation, much of it -contributed by various authors. The markup used for the Python documentation is -`reStructuredText`_, developed by the `docutils`_ project, amended by custom -directives and using a toolset named `Sphinx`_ to postprocess the HTML output. - -This document describes the style guide for our documentation as well as the -custom reStructuredText markup introduced by Sphinx to support Python -documentation and how it should be used. - -.. _reStructuredText: http://docutils.sf.net/rst.html -.. _docutils: http://docutils.sf.net/ -.. _Sphinx: http://sphinx.pocoo.org/ - -.. note:: - - If you're interested in contributing to Python's documentation, there's no - need to write reStructuredText if you're not so inclined; plain text - contributions are more than welcome as well. Send an e-mail to - docs at python.org or open an issue on the :ref:`tracker `. - - -.. toctree:: - :numbered: - :maxdepth: 1 - - intro.rst - style.rst - rest.rst - markup.rst - fromlatex.rst - building.rst diff --git a/Doc/documenting/intro.rst b/Doc/documenting/intro.rst deleted file mode 100644 --- a/Doc/documenting/intro.rst +++ /dev/null @@ -1,29 +0,0 @@ -Introduction -============ - -Python's documentation has long been considered to be good for a free -programming language. There are a number of reasons for this, the most -important being the early commitment of Python's creator, Guido van Rossum, to -providing documentation on the language and its libraries, and the continuing -involvement of the user community in providing assistance for creating and -maintaining documentation. - -The involvement of the community takes many forms, from authoring to bug reports -to just plain complaining when the documentation could be more complete or -easier to use. - -This document is aimed at authors and potential authors of documentation for -Python. More specifically, it is for people contributing to the standard -documentation and developing additional documents using the same tools as the -standard documents. This guide will be less useful for authors using the Python -documentation tools for topics other than Python, and less useful still for -authors not using the tools at all. - -If your interest is in contributing to the Python documentation, but you don't -have the time or inclination to learn reStructuredText and the markup structures -documented here, there's a welcoming place for you among the Python contributors -as well. Any time you feel that you can clarify existing documentation or -provide documentation that's missing, the existing documentation team will -gladly work with you to integrate your text, dealing with the markup for you. -Please don't let the material in this document stand between the documentation -and your desire to help out! \ No newline at end of file diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst deleted file mode 100644 --- a/Doc/documenting/markup.rst +++ /dev/null @@ -1,904 +0,0 @@ -.. highlightlang:: rest - -Additional Markup Constructs -============================ - -Sphinx adds a lot of new directives and interpreted text roles to standard reST -markup. This section contains the reference material for these facilities. -Documentation for "standard" reST constructs is not included here, though -they are used in the Python documentation. - -.. note:: - - This is just an overview of Sphinx' extended markup capabilities; full - coverage can be found in `its own documentation - `_. - - -Meta-information markup ------------------------ - -.. describe:: sectionauthor - - Identifies the author of the current section. The argument should include - the author's name such that it can be used for presentation (though it isn't) - and email address. The domain name portion of the address should be lower - case. Example:: - - .. sectionauthor:: Guido van Rossum - - Currently, this markup isn't reflected in the output in any way, but it helps - keep track of contributions. - - -Module-specific markup ----------------------- - -The markup described in this section is used to provide information about a -module being documented. Each module should be documented in its own file. -Normally this markup appears after the title heading of that file; a typical -file might start like this:: - - :mod:`parrot` -- Dead parrot access - =================================== - - .. module:: parrot - :platform: Unix, Windows - :synopsis: Analyze and reanimate dead parrots. - .. moduleauthor:: Eric Cleese - .. moduleauthor:: John Idle - -As you can see, the module-specific markup consists of two directives, the -``module`` directive and the ``moduleauthor`` directive. - -.. describe:: module - - This directive marks the beginning of the description of a module, package, - or submodule. The name should be fully qualified (i.e. including the - package name for submodules). - - The ``platform`` option, if present, is a comma-separated list of the - platforms on which the module is available (if it is available on all - platforms, the option should be omitted). The keys are short identifiers; - examples that are in use include "IRIX", "Mac", "Windows", and "Unix". It is - important to use a key which has already been used when applicable. - - The ``synopsis`` option should consist of one sentence describing the - module's purpose -- it is currently only used in the Global Module Index. - - The ``deprecated`` option can be given (with no value) to mark a module as - deprecated; it will be designated as such in various locations then. - -.. describe:: moduleauthor - - The ``moduleauthor`` directive, which can appear multiple times, names the - authors of the module code, just like ``sectionauthor`` names the author(s) - of a piece of documentation. It too does not result in any output currently. - -.. note:: - - It is important to make the section title of a module-describing file - meaningful since that value will be inserted in the table-of-contents trees - in overview files. - - -Information units ------------------ - -There are a number of directives used to describe specific features provided by -modules. Each directive requires one or more signatures to provide basic -information about what is being described, and the content should be the -description. The basic version makes entries in the general index; if no index -entry is desired, you can give the directive option flag ``:noindex:``. The -following example shows all of the features of this directive type:: - - .. function:: spam(eggs) - ham(eggs) - :noindex: - - Spam or ham the foo. - -The signatures of object methods or data attributes should not include the -class name, but be nested in a class directive. The generated files will -reflect this nesting, and the target identifiers (for HTML output) will use -both the class and method name, to enable consistent cross-references. If you -describe methods belonging to an abstract protocol such as context managers, -use a class directive with a (pseudo-)type name too to make the -index entries more informative. - -The directives are: - -.. describe:: c:function - - Describes a C function. The signature should be given as in C, e.g.:: - - .. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) - - This is also used to describe function-like preprocessor macros. The names - of the arguments should be given so they may be used in the description. - - Note that you don't have to backslash-escape asterisks in the signature, - as it is not parsed by the reST inliner. - -.. describe:: c:member - - Describes a C struct member. Example signature:: - - .. c:member:: PyObject* PyTypeObject.tp_bases - - The text of the description should include the range of values allowed, how - the value should be interpreted, and whether the value can be changed. - References to structure members in text should use the ``member`` role. - -.. describe:: c:macro - - Describes a "simple" C macro. Simple macros are macros which are used - for code expansion, but which do not take arguments so cannot be described as - functions. This is not to be used for simple constant definitions. Examples - of its use in the Python documentation include :c:macro:`PyObject_HEAD` and - :c:macro:`Py_BEGIN_ALLOW_THREADS`. - -.. describe:: c:type - - Describes a C type. The signature should just be the type name. - -.. describe:: c:var - - Describes a global C variable. The signature should include the type, such - as:: - - .. cvar:: PyObject* PyClass_Type - -.. describe:: data - - Describes global data in a module, including both variables and values used - as "defined constants." Class and object attributes are not documented - using this directive. - -.. describe:: exception - - Describes an exception class. The signature can, but need not include - parentheses with constructor arguments. - -.. describe:: function - - Describes a module-level function. The signature should include the - parameters, enclosing optional parameters in brackets. Default values can be - given if it enhances clarity. For example:: - - .. function:: repeat([repeat=3[, number=1000000]]) - - Object methods are not documented using this directive. Bound object methods - placed in the module namespace as part of the public interface of the module - are documented using this, as they are equivalent to normal functions for - most purposes. - - The description should include information about the parameters required and - how they are used (especially whether mutable objects passed as parameters - are modified), side effects, and possible exceptions. A small example may be - provided. - -.. describe:: decorator - - Describes a decorator function. The signature should *not* represent the - signature of the actual function, but the usage as a decorator. For example, - given the functions - - .. code-block:: python - - def removename(func): - func.__name__ = '' - return func - - def setnewname(name): - def decorator(func): - func.__name__ = name - return func - return decorator - - the descriptions should look like this:: - - .. decorator:: removename - - Remove name of the decorated function. - - .. decorator:: setnewname(name) - - Set name of the decorated function to *name*. - - There is no ``deco`` role to link to a decorator that is marked up with - this directive; rather, use the ``:func:`` role. - -.. describe:: class - - Describes a class. The signature can include parentheses with parameters - which will be shown as the constructor arguments. - -.. describe:: attribute - - Describes an object data attribute. The description should include - information about the type of the data to be expected and whether it may be - changed directly. This directive should be nested in a class directive, - like in this example:: - - .. class:: Spam - - Description of the class. - - .. data:: ham - - Description of the attribute. - - If is also possible to document an attribute outside of a class directive, - for example if the documentation for different attributes and methods is - split in multiple sections. The class name should then be included - explicitly:: - - .. data:: Spam.eggs - -.. describe:: method - - Describes an object method. The parameters should not include the ``self`` - parameter. The description should include similar information to that - described for ``function``. This directive should be nested in a class - directive, like in the example above. - -.. describe:: decoratormethod - - Same as ``decorator``, but for decorators that are methods. - - Refer to a decorator method using the ``:meth:`` role. - -.. describe:: opcode - - Describes a Python :term:`bytecode` instruction. - -.. describe:: cmdoption - - Describes a Python command line option or switch. Option argument names - should be enclosed in angle brackets. Example:: - - .. cmdoption:: -m - - Run a module as a script. - -.. describe:: envvar - - Describes an environment variable that Python uses or defines. - - -There is also a generic version of these directives: - -.. describe:: describe - - This directive produces the same formatting as the specific ones explained - above but does not create index entries or cross-referencing targets. It is - used, for example, to describe the directives in this document. Example:: - - .. describe:: opcode - - Describes a Python bytecode instruction. - - -Showing code examples ---------------------- - -Examples of Python source code or interactive sessions are represented using -standard reST literal blocks. They are started by a ``::`` at the end of the -preceding paragraph and delimited by indentation. - -Representing an interactive session requires including the prompts and output -along with the Python code. No special markup is required for interactive -sessions. After the last line of input or output presented, there should not be -an "unused" primary prompt; this is an example of what *not* to do:: - - >>> 1 + 1 - 2 - >>> - -Syntax highlighting is handled in a smart way: - -* There is a "highlighting language" for each source file. Per default, - this is ``'python'`` as the majority of files will have to highlight Python - snippets. - -* Within Python highlighting mode, interactive sessions are recognized - automatically and highlighted appropriately. - -* The highlighting language can be changed using the ``highlightlang`` - directive, used as follows:: - - .. highlightlang:: c - - This language is used until the next ``highlightlang`` directive is - encountered. - -* The values normally used for the highlighting language are: - - * ``python`` (the default) - * ``c`` - * ``rest`` - * ``none`` (no highlighting) - -* If highlighting with the current language fails, the block is not highlighted - in any way. - -Longer displays of verbatim text may be included by storing the example text in -an external file containing only plain text. The file may be included using the -``literalinclude`` directive. [1]_ For example, to include the Python source file -:file:`example.py`, use:: - - .. literalinclude:: example.py - -The file name is relative to the current file's path. Documentation-specific -include files should be placed in the ``Doc/includes`` subdirectory. - - -Inline markup -------------- - -As said before, Sphinx uses interpreted text roles to insert semantic markup in -documents. - -Names of local variables, such as function/method arguments, are an exception, -they should be marked simply with ``*var*``. - -For all other roles, you have to write ``:rolename:`content```. - -There are some additional facilities that make cross-referencing roles more -versatile: - -* You may supply an explicit title and reference target, like in reST direct - hyperlinks: ``:role:`title ``` will refer to *target*, but the link - text will be *title*. - -* If you prefix the content with ``!``, no reference/hyperlink will be created. - -* For the Python object roles, if you prefix the content with ``~``, the link - text will only be the last component of the target. For example, - ``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only - display ``get`` as the link text. - - In HTML output, the link's ``title`` attribute (that is e.g. shown as a - tool-tip on mouse-hover) will always be the full target name. - -The following roles refer to objects in modules and are possibly hyperlinked if -a matching identifier is found: - -.. describe:: mod - - The name of a module; a dotted name may be used. This should also be used for - package names. - -.. describe:: func - - The name of a Python function; dotted names may be used. The role text - should not include trailing parentheses to enhance readability. The - parentheses are stripped when searching for identifiers. - -.. describe:: data - - The name of a module-level variable or constant. - -.. describe:: const - - The name of a "defined" constant. This may be a C-language ``#define`` - or a Python variable that is not intended to be changed. - -.. describe:: class - - A class name; a dotted name may be used. - -.. describe:: meth - - The name of a method of an object. The role text should include the type - name and the method name. A dotted name may be used. - -.. describe:: attr - - The name of a data attribute of an object. - -.. describe:: exc - - The name of an exception. A dotted name may be used. - -The name enclosed in this markup can include a module name and/or a class name. -For example, ``:func:`filter``` could refer to a function named ``filter`` in -the current module, or the built-in function of that name. In contrast, -``:func:`foo.filter``` clearly refers to the ``filter`` function in the ``foo`` -module. - -Normally, names in these roles are searched first without any further -qualification, then with the current module name prepended, then with the -current module and class name (if any) prepended. If you prefix the name with a -dot, this order is reversed. For example, in the documentation of the -:mod:`codecs` module, ``:func:`open``` always refers to the built-in function, -while ``:func:`.open``` refers to :func:`codecs.open`. - -A similar heuristic is used to determine whether the name is an attribute of -the currently documented class. - -The following roles create cross-references to C-language constructs if they -are defined in the API documentation: - -.. describe:: c:data - - The name of a C-language variable. - -.. describe:: c:func - - The name of a C-language function. Should include trailing parentheses. - -.. describe:: c:macro - - The name of a "simple" C macro, as defined above. - -.. describe:: c:type - - The name of a C-language type. - -.. describe:: c:member - - The name of a C type member, as defined above. - - -The following role does possibly create a cross-reference, but does not refer -to objects: - -.. describe:: token - - The name of a grammar token (used in the reference manual to create links - between production displays). - - -The following role creates a cross-reference to the term in the glossary: - -.. describe:: term - - Reference to a term in the glossary. The glossary is created using the - ``glossary`` directive containing a definition list with terms and - definitions. It does not have to be in the same file as the ``term`` - markup, in fact, by default the Python docs have one global glossary - in the ``glossary.rst`` file. - - If you use a term that's not explained in a glossary, you'll get a warning - during build. - ---------- - -The following roles don't do anything special except formatting the text -in a different style: - -.. describe:: command - - The name of an OS-level command, such as ``rm``. - -.. describe:: dfn - - Mark the defining instance of a term in the text. (No index entries are - generated.) - -.. describe:: envvar - - An environment variable. Index entries are generated. - -.. describe:: file - - The name of a file or directory. Within the contents, you can use curly - braces to indicate a "variable" part, for example:: - - ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... - - In the built documentation, the ``x`` will be displayed differently to - indicate that it is to be replaced by the Python minor version. - -.. describe:: guilabel - - Labels presented as part of an interactive user interface should be marked - using ``guilabel``. This includes labels from text-based interfaces such as - those created using :mod:`curses` or other text-based libraries. Any label - used in the interface should be marked with this role, including button - labels, window titles, field names, menu and menu selection names, and even - values in selection lists. - -.. describe:: kbd - - Mark a sequence of keystrokes. What form the key sequence takes may depend - on platform- or application-specific conventions. When there are no relevant - conventions, the names of modifier keys should be spelled out, to improve - accessibility for new users and non-native speakers. For example, an - *xemacs* key sequence may be marked like ``:kbd:`C-x C-f```, but without - reference to a specific application or platform, the same sequence should be - marked as ``:kbd:`Control-x Control-f```. - -.. describe:: keyword - - The name of a Python keyword. Using this role will generate a link to the - documentation of the keyword. ``True``, ``False`` and ``None`` do not use - this role, but simple code markup (````True````), given that they're - fundamental to the language and should be known to any programmer. - -.. describe:: mailheader - - The name of an RFC 822-style mail header. This markup does not imply that - the header is being used in an email message, but can be used to refer to any - header of the same "style." This is also used for headers defined by the - various MIME specifications. The header name should be entered in the same - way it would normally be found in practice, with the camel-casing conventions - being preferred where there is more than one common usage. For example: - ``:mailheader:`Content-Type```. - -.. describe:: makevar - - The name of a :command:`make` variable. - -.. describe:: manpage - - A reference to a Unix manual page including the section, - e.g. ``:manpage:`ls(1)```. - -.. describe:: menuselection - - Menu selections should be marked using the ``menuselection`` role. This is - used to mark a complete sequence of menu selections, including selecting - submenus and choosing a specific operation, or any subsequence of such a - sequence. The names of individual selections should be separated by - ``-->``. - - For example, to mark the selection "Start > Programs", use this markup:: - - :menuselection:`Start --> Programs` - - When including a selection that includes some trailing indicator, such as the - ellipsis some operating systems use to indicate that the command opens a - dialog, the indicator should be omitted from the selection name. - -.. describe:: mimetype - - The name of a MIME type, or a component of a MIME type (the major or minor - portion, taken alone). - -.. describe:: newsgroup - - The name of a Usenet newsgroup. - -.. describe:: option - - A command-line option of Python. The leading hyphen(s) must be included. - If a matching ``cmdoption`` directive exists, it is linked to. For options - of other programs or scripts, use simple ````code```` markup. - -.. describe:: program - - The name of an executable program. This may differ from the file name for - the executable for some platforms. In particular, the ``.exe`` (or other) - extension should be omitted for Windows programs. - -.. describe:: regexp - - A regular expression. Quotes should not be included. - -.. describe:: samp - - A piece of literal text, such as code. Within the contents, you can use - curly braces to indicate a "variable" part, as in ``:file:``. - - If you don't need the "variable part" indication, use the standard - ````code```` instead. - - -The following roles generate external links: - -.. describe:: pep - - A reference to a Python Enhancement Proposal. This generates appropriate - index entries. The text "PEP *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified PEP. - -.. describe:: rfc - - A reference to an Internet Request for Comments. This generates appropriate - index entries. The text "RFC *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified RFC. - - -Note that there are no special roles for including hyperlinks as you can use -the standard reST markup for that purpose. - - -.. _doc-ref-role: - -Cross-linking markup --------------------- - -To support cross-referencing to arbitrary sections in the documentation, the -standard reST labels are "abused" a bit: Every label must precede a section -title; and every label name must be unique throughout the entire documentation -source. - -You can then reference to these sections using the ``:ref:`label-name``` role. - -Example:: - - .. _my-reference-label: - - Section to cross-reference - -------------------------- - - This is the text of the section. - - It refers to the section itself, see :ref:`my-reference-label`. - -The ``:ref:`` invocation is replaced with the section title. - -Alternatively, you can reference any label (not just section titles) -if you provide the link text ``:ref:`link text ```. - -Paragraph-level markup ----------------------- - -These directives create short paragraphs and can be used inside information -units as well as normal text: - -.. describe:: note - - An especially important bit of information about an API that a user should be - aware of when using whatever bit of API the note pertains to. The content of - the directive should be written in complete sentences and include all - appropriate punctuation. - - Example:: - - .. note:: - - This function is not suitable for sending spam e-mails. - -.. describe:: warning - - An important bit of information about an API that a user should be aware of - when using whatever bit of API the warning pertains to. The content of the - directive should be written in complete sentences and include all appropriate - punctuation. In the interest of not scaring users away from pages filled - with warnings, this directive should only be chosen over ``note`` for - information regarding the possibility of crashes, data loss, or security - implications. - -.. describe:: versionadded - - This directive documents the version of Python which added the described - feature to the library or C API. When this applies to an entire module, it - should be placed at the top of the module section before any prose. - - The first argument must be given and is the version in question; you can add - a second argument consisting of a *brief* explanation of the change. - - Example:: - - .. versionadded:: 3.1 - The *spam* parameter. - - Note that there must be no blank line between the directive head and the - explanation; this is to make these blocks visually continuous in the markup. - -.. describe:: versionchanged - - Similar to ``versionadded``, but describes when and what changed in the named - feature in some way (new parameters, changed side effects, etc.). - --------------- - -.. describe:: impl-detail - - This directive is used to mark CPython-specific information. Use either with - a block content or a single sentence as an argument, i.e. either :: - - .. impl-detail:: - - This describes some implementation detail. - - More explanation. - - or :: - - .. impl-detail:: This shortly mentions an implementation detail. - - "\ **CPython implementation detail:**\ " is automatically prepended to the - content. - -.. describe:: seealso - - Many sections include a list of references to module documentation or - external documents. These lists are created using the ``seealso`` directive. - - The ``seealso`` directive is typically placed in a section just before any - sub-sections. For the HTML output, it is shown boxed off from the main flow - of the text. - - The content of the ``seealso`` directive should be a reST definition list. - Example:: - - .. seealso:: - - Module :mod:`zipfile` - Documentation of the :mod:`zipfile` standard module. - - `GNU tar manual, Basic Tar Format `_ - Documentation for tar archive files, including GNU tar extensions. - -.. describe:: rubric - - This directive creates a paragraph heading that is not used to create a - table of contents node. It is currently used for the "Footnotes" caption. - -.. describe:: centered - - This directive creates a centered boldfaced paragraph. Use it as follows:: - - .. centered:: - - Paragraph contents. - - -Table-of-contents markup ------------------------- - -Since reST does not have facilities to interconnect several documents, or split -documents into multiple output files, Sphinx uses a custom directive to add -relations between the single files the documentation is made of, as well as -tables of contents. The ``toctree`` directive is the central element. - -.. describe:: toctree - - This directive inserts a "TOC tree" at the current location, using the - individual TOCs (including "sub-TOC trees") of the files given in the - directive body. A numeric ``maxdepth`` option may be given to indicate the - depth of the tree; by default, all levels are included. - - Consider this example (taken from the library reference index):: - - .. toctree:: - :maxdepth: 2 - - intro - strings - datatypes - numeric - (many more files listed here) - - This accomplishes two things: - - * Tables of contents from all those files are inserted, with a maximum depth - of two, that means one nested heading. ``toctree`` directives in those - files are also taken into account. - * Sphinx knows that the relative order of the files ``intro``, - ``strings`` and so forth, and it knows that they are children of the - shown file, the library index. From this information it generates "next - chapter", "previous chapter" and "parent chapter" links. - - In the end, all files included in the build process must occur in one - ``toctree`` directive; Sphinx will emit a warning if it finds a file that is - not included, because that means that this file will not be reachable through - standard navigation. - - The special file ``contents.rst`` at the root of the source directory is the - "root" of the TOC tree hierarchy; from it the "Contents" page is generated. - - -Index-generating markup ------------------------ - -Sphinx automatically creates index entries from all information units (like -functions, classes or attributes) like discussed before. - -However, there is also an explicit directive available, to make the index more -comprehensive and enable index entries in documents where information is not -mainly contained in information units, such as the language reference. - -The directive is ``index`` and contains one or more index entries. Each entry -consists of a type and a value, separated by a colon. - -For example:: - - .. index:: - single: execution; context - module: __main__ - module: sys - triple: module; search; path - -This directive contains five entries, which will be converted to entries in the -generated index which link to the exact location of the index statement (or, in -case of offline media, the corresponding page number). - -The possible entry types are: - -single - Creates a single index entry. Can be made a subentry by separating the - subentry text with a semicolon (this notation is also used below to describe - what entries are created). -pair - ``pair: loop; statement`` is a shortcut that creates two index entries, - namely ``loop; statement`` and ``statement; loop``. -triple - Likewise, ``triple: module; search; path`` is a shortcut that creates three - index entries, which are ``module; search path``, ``search; path, module`` and - ``path; module search``. -module, keyword, operator, object, exception, statement, builtin - These all create two index entries. For example, ``module: hashlib`` creates - the entries ``module; hashlib`` and ``hashlib; module``. - -For index directives containing only "single" entries, there is a shorthand -notation:: - - .. index:: BNF, grammar, syntax, notation - -This creates four index entries. - - -Grammar production displays ---------------------------- - -Special markup is available for displaying the productions of a formal grammar. -The markup is simple and does not attempt to model all aspects of BNF (or any -derived forms), but provides enough to allow context-free grammars to be -displayed in a way that causes uses of a symbol to be rendered as hyperlinks to -the definition of the symbol. There is this directive: - -.. describe:: productionlist - - This directive is used to enclose a group of productions. Each production is - given on a single line and consists of a name, separated by a colon from the - following definition. If the definition spans multiple lines, each - continuation line must begin with a colon placed at the same column as in the - first line. - - Blank lines are not allowed within ``productionlist`` directive arguments. - - The definition can contain token names which are marked as interpreted text - (e.g. ``unaryneg ::= "-" `integer```) -- this generates cross-references - to the productions of these tokens. - - Note that no further reST parsing is done in the production, so that you - don't have to escape ``*`` or ``|`` characters. - - -.. XXX describe optional first parameter - -The following is an example taken from the Python Reference Manual:: - - .. productionlist:: - try_stmt: try1_stmt | try2_stmt - try1_stmt: "try" ":" `suite` - : ("except" [`expression` ["," `target`]] ":" `suite`)+ - : ["else" ":" `suite`] - : ["finally" ":" `suite`] - try2_stmt: "try" ":" `suite` - : "finally" ":" `suite` - - -Substitutions -------------- - -The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file :file:`conf.py`. - -.. describe:: |release| - - Replaced by the Python release the documentation refers to. This is the full - version string including alpha/beta/release candidate tags, e.g. ``2.5.2b3``. - -.. describe:: |version| - - Replaced by the Python version the documentation refers to. This consists - only of the major and minor version parts, e.g. ``2.5``, even for version - 2.5.1. - -.. describe:: |today| - - Replaced by either today's date, or the date set in the build configuration - file. Normally has the format ``April 14, 2007``. - - -.. rubric:: Footnotes - -.. [1] There is a standard ``.. include`` directive, but it raises errors if the - file is not found. This one only emits a warning. diff --git a/Doc/documenting/rest.rst b/Doc/documenting/rest.rst deleted file mode 100644 --- a/Doc/documenting/rest.rst +++ /dev/null @@ -1,243 +0,0 @@ -.. highlightlang:: rest - -reStructuredText Primer -======================= - -This section is a brief introduction to reStructuredText (reST) concepts and -syntax, intended to provide authors with enough information to author documents -productively. Since reST was designed to be a simple, unobtrusive markup -language, this will not take too long. - -.. seealso:: - - The authoritative `reStructuredText User - Documentation `_. - - -Paragraphs ----------- - -The paragraph is the most basic block in a reST document. Paragraphs are simply -chunks of text separated by one or more blank lines. As in Python, indentation -is significant in reST, so all lines of the same paragraph must be left-aligned -to the same level of indentation. - - -Inline markup -------------- - -The standard reST inline markup is quite simple: use - -* one asterisk: ``*text*`` for emphasis (italics), -* two asterisks: ``**text**`` for strong emphasis (boldface), and -* backquotes: ````text```` for code samples. - -If asterisks or backquotes appear in running text and could be confused with -inline markup delimiters, they have to be escaped with a backslash. - -Be aware of some restrictions of this markup: - -* it may not be nested, -* content may not start or end with whitespace: ``* text*`` is wrong, -* it must be separated from surrounding text by non-word characters. Use a - backslash escaped space to work around that: ``thisis\ *one*\ word``. - -These restrictions may be lifted in future versions of the docutils. - -reST also allows for custom "interpreted text roles"', which signify that the -enclosed text should be interpreted in a specific way. Sphinx uses this to -provide semantic markup and cross-referencing of identifiers, as described in -the appropriate section. The general syntax is ``:rolename:`content```. - - -Lists and Quotes ----------------- - -List markup is natural: just place an asterisk at the start of a paragraph and -indent properly. The same goes for numbered lists; they can also be -autonumbered using a ``#`` sign:: - - * This is a bulleted list. - * It has two items, the second - item uses two lines. - - 1. This is a numbered list. - 2. It has two items too. - - #. This is a numbered list. - #. It has two items too. - - -Nested lists are possible, but be aware that they must be separated from the -parent list items by blank lines:: - - * this is - * a list - - * with a nested list - * and some subitems - - * and here the parent list continues - -Definition lists are created as follows:: - - term (up to a line of text) - Definition of the term, which must be indented - - and can even consist of multiple paragraphs - - next term - Description. - - -Paragraphs are quoted by just indenting them more than the surrounding -paragraphs. - - -Source Code ------------ - -Literal code blocks are introduced by ending a paragraph with the special marker -``::``. The literal block must be indented:: - - This is a normal text paragraph. The next paragraph is a code sample:: - - It is not processed in any way, except - that the indentation is removed. - - It can span multiple lines. - - This is a normal text paragraph again. - -The handling of the ``::`` marker is smart: - -* If it occurs as a paragraph of its own, that paragraph is completely left - out of the document. -* If it is preceded by whitespace, the marker is removed. -* If it is preceded by non-whitespace, the marker is replaced by a single - colon. - -That way, the second sentence in the above example's first paragraph would be -rendered as "The next paragraph is a code sample:". - - -Hyperlinks ----------- - -External links -^^^^^^^^^^^^^^ - -Use ```Link text `_`` for inline web links. If the link text -should be the web address, you don't need special markup at all, the parser -finds links and mail addresses in ordinary text. - -Internal links -^^^^^^^^^^^^^^ - -Internal linking is done via a special reST role, see the section on specific -markup, :ref:`doc-ref-role`. - - -Sections --------- - -Section headers are created by underlining (and optionally overlining) the -section title with a punctuation character, at least as long as the text:: - - ================= - This is a heading - ================= - -Normally, there are no heading levels assigned to certain characters as the -structure is determined from the succession of headings. However, for the -Python documentation, we use this convention: - -* ``#`` with overline, for parts -* ``*`` with overline, for chapters -* ``=``, for sections -* ``-``, for subsections -* ``^``, for subsubsections -* ``"``, for paragraphs - - -Explicit Markup ---------------- - -"Explicit markup" is used in reST for most constructs that need special -handling, such as footnotes, specially-highlighted paragraphs, comments, and -generic directives. - -An explicit markup block begins with a line starting with ``..`` followed by -whitespace and is terminated by the next paragraph at the same level of -indentation. (There needs to be a blank line between explicit markup and normal -paragraphs. This may all sound a bit complicated, but it is intuitive enough -when you write it.) - - -Directives ----------- - -A directive is a generic block of explicit markup. Besides roles, it is one of -the extension mechanisms of reST, and Sphinx makes heavy use of it. - -Basically, a directive consists of a name, arguments, options and content. (Keep -this terminology in mind, it is used in the next chapter describing custom -directives.) Looking at this example, :: - - .. function:: foo(x) - foo(y, z) - :bar: no - - Return a line of text input from the user. - -``function`` is the directive name. It is given two arguments here, the -remainder of the first line and the second line, as well as one option ``bar`` -(as you can see, options are given in the lines immediately following the -arguments and indicated by the colons). - -The directive content follows after a blank line and is indented relative to the -directive start. - - -Footnotes ---------- - -For footnotes, use ``[#]_`` to mark the footnote location, and add the footnote -body at the bottom of the document after a "Footnotes" rubric heading, like so:: - - Lorem ipsum [#]_ dolor sit amet ... [#]_ - - .. rubric:: Footnotes - - .. [#] Text of the first footnote. - .. [#] Text of the second footnote. - -You can also explicitly number the footnotes for better context. - - -Comments --------- - -Every explicit markup block which isn't a valid markup construct (like the -footnotes above) is regarded as a comment. - - -Source encoding ---------------- - -Since the easiest way to include special characters like em dashes or copyright -signs in reST is to directly write them as Unicode characters, one has to -specify an encoding: - -All Python documentation source files must be in UTF-8 encoding, and the HTML -documents written from them will be in that encoding as well. - - -Gotchas -------- - -There are some problems one commonly runs into while authoring reST documents: - -* **Separation of inline markup:** As said above, inline markup spans must be - separated from the surrounding text by non-word characters, you have to use - an escaped space to get around that. diff --git a/Doc/documenting/style.rst b/Doc/documenting/style.rst deleted file mode 100644 --- a/Doc/documenting/style.rst +++ /dev/null @@ -1,218 +0,0 @@ -.. highlightlang:: rest - -Style guide -=========== - -The Python documentation should follow the `Apple Publications Style Guide`_ -wherever possible. This particular style guide was selected mostly because it -seems reasonable and is easy to get online. - -Topics which are either not covered in Apple's style guide or treated -differently in Python documentation will be discussed in this -document. - -Use of whitespace ------------------ - -All reST files use an indentation of 3 spaces; no tabs are allowed. The -maximum line length is 80 characters for normal text, but tables, deeply -indented code samples and long links may extend beyond that. Code example -bodies should use normal Python 4-space indentation. - -Make generous use of blank lines where applicable; they help grouping things -together. - -A sentence-ending period may be followed by one or two spaces; while reST -ignores the second space, it is customarily put in by some users, for example -to aid Emacs' auto-fill mode. - -Footnotes ---------- - -Footnotes are generally discouraged, though they may be used when they are the -best way to present specific information. When a footnote reference is added at -the end of the sentence, it should follow the sentence-ending punctuation. The -reST markup should appear something like this:: - - This sentence has a footnote reference. [#]_ This is the next sentence. - -Footnotes should be gathered at the end of a file, or if the file is very long, -at the end of a section. The docutils will automatically create backlinks to -the footnote reference. - -Footnotes may appear in the middle of sentences where appropriate. - -Capitalization --------------- - -.. sidebar:: Sentence case - - Sentence case is a set of capitalization rules used in English - sentences: the first word is always capitalized and other words are - only capitalized if there is a specific rule requiring it. - -Apple style guide recommends the use of title case in section titles. -However, rules for which words should be capitalized in title case -vary greaty between publications. - -In Python documentation, use of sentence case in section titles is -preferable, but consistency within a unit is more important than -following this rule. If you add a section to the chapter where most -sections are in title case you can either convert all titles to -sentence case or use the dominant style in the new section title. - -Sentences that start with a word for which specific rules require -starting it with a lower case letter should be avoided in titles and -elsewhere. - -.. note:: - - Sections that describe a library module often have titles in the - form of "modulename --- Short description of the module." In this - case, the description should be capitalized as a stand-alone - sentence. - -Many special names are used in the Python documentation, including the names of -operating systems, programming languages, standards bodies, and the like. Most -of these entities are not assigned any special markup, but the preferred -spellings are given here to aid authors in maintaining the consistency of -presentation in the Python documentation. - -Other terms and words deserve special mention as well; these conventions should -be used to ensure consistency throughout the documentation: - -CPU - For "central processing unit." Many style guides say this should be - spelled out on the first use (and if you must use it, do so!). For - the Python documentation, this abbreviation should be avoided since - there's no reasonable way to predict which occurrence will be the - first seen by the reader. It is better to use the word "processor" - instead. - -POSIX - The name assigned to a particular group of standards. This is always - uppercase. - -Python - The name of our favorite programming language is always capitalized. - -reST - For "reStructuredText," an easy to read, plaintext markup syntax - used to produce Python documentation. When spelled out, it is - always one word and both forms start with a lower case 'r'. - -Unicode - The name of a character coding system. This is always written - capitalized. - -Unix - The name of the operating system developed at AT&T Bell Labs in the early - 1970s. - -Affirmative Tone ----------------- - -The documentation focuses on affirmatively stating what the language does and -how to use it effectively. - -Except for certain security risks or segfault risks, the docs should avoid -wording along the lines of "feature x is dangerous" or "experts only". These -kinds of value judgments belong in external blogs and wikis, not in the core -documentation. - -Bad example (creating worry in the mind of a reader): - - Warning: failing to explicitly close a file could result in lost data or - excessive resource consumption. Never rely on reference counting to - automatically close a file. - -Good example (establishing confident knowledge in the effective use of the language): - - A best practice for using files is use a try/finally pair to explicitly - close a file after it is used. Alternatively, using a with-statement can - achieve the same effect. This assures that files are flushed and file - descriptor resources are released in a timely manner. - -Economy of Expression ---------------------- - -More documentation is not necessarily better documentation. Err on the side -of being succinct. - -It is an unfortunate fact that making documentation longer can be an impediment -to understanding and can result in even more ways to misread or misinterpret the -text. Long descriptions full of corner cases and caveats can create the -impression that a function is more complex or harder to use than it actually is. - -The documentation for :func:`super` is an example of where a good deal of -information was condensed into a few short paragraphs. Discussion of -:func:`super` could have filled a chapter in a book, but it is often easier to -grasp a terse description than a lengthy narrative. - - -Code Examples -------------- - -Short code examples can be a useful adjunct to understanding. Readers can often -grasp a simple example more quickly than they can digest a formal description in -prose. - -People learn faster with concrete, motivating examples that match the context of -a typical use case. For instance, the :func:`str.rpartition` method is better -demonstrated with an example splitting the domain from a URL than it would be -with an example of removing the last word from a line of Monty Python dialog. - -The ellipsis for the :attr:`sys.ps2` secondary interpreter prompt should only be -used sparingly, where it is necessary to clearly differentiate between input -lines and output lines. Besides contributing visual clutter, it makes it -difficult for readers to cut-and-paste examples so they can experiment with -variations. - -Code Equivalents ----------------- - -Giving pure Python code equivalents (or approximate equivalents) can be a useful -adjunct to a prose description. A documenter should carefully weigh whether the -code equivalent adds value. - -A good example is the code equivalent for :func:`all`. The short 4-line code -equivalent is easily digested; it re-emphasizes the early-out behavior; and it -clarifies the handling of the corner-case where the iterable is empty. In -addition, it serves as a model for people wanting to implement a commonly -requested alternative where :func:`all` would return the specific object -evaluating to False whenever the function terminates early. - -A more questionable example is the code for :func:`itertools.groupby`. Its code -equivalent borders on being too complex to be a quick aid to understanding. -Despite its complexity, the code equivalent was kept because it serves as a -model to alternative implementations and because the operation of the "grouper" -is more easily shown in code than in English prose. - -An example of when not to use a code equivalent is for the :func:`oct` function. -The exact steps in converting a number to octal doesn't add value for a user -trying to learn what the function does. - -Audience --------- - -The tone of the tutorial (and all the docs) needs to be respectful of the -reader's intelligence. Don't presume that the readers are stupid. Lay out the -relevant information, show motivating use cases, provide glossary links, and do -your best to connect-the-dots, but don't talk down to them or waste their time. - -The tutorial is meant for newcomers, many of whom will be using the tutorial to -evaluate the language as a whole. The experience needs to be positive and not -leave the reader with worries that something bad will happen if they make a -misstep. The tutorial serves as guide for intelligent and curious readers, -saving details for the how-to guides and other sources. - -Be careful accepting requests for documentation changes from the rare but vocal -category of reader who is looking for vindication for one of their programming -errors ("I made a mistake, therefore the docs must be wrong ..."). Typically, -the documentation wasn't consulted until after the error was made. It is -unfortunate, but typically no documentation edit would have saved the user from -making false assumptions about the language ("I was surprised by ..."). - - -.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf - diff --git a/Doc/tools/sphinxext/indexcontent.html b/Doc/tools/sphinxext/indexcontent.html --- a/Doc/tools/sphinxext/indexcontent.html +++ b/Doc/tools/sphinxext/indexcontent.html @@ -24,8 +24,6 @@ finding and installing modules and applications

    - diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -234,7 +234,7 @@ .. seealso:: - :ref:`documenting-index` + `Documenting Python `__ Describes how to write for Python's documentation. `Sphinx `__ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 15 00:09:39 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 15 Jan 2012 00:09:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_an_unnecessary_extra?= =?utf8?q?_copy_of_the_bytes_hash_function=2E?= Message-ID: http://hg.python.org/cpython/rev/4ac9ff649f5b changeset: 74413:4ac9ff649f5b parent: 74409:06d96a5bb41e user: Gregory P. Smith date: Sat Jan 14 14:31:13 2012 -0800 summary: Remove an unnecessary extra copy of the bytes hash function. This copy also had a bug in it, it fails to incorporate the length into the hash by using it as the loop variable so it'll always be -1 by the time it is XORed in. As such: I'm doing this only in Python 3.3 and not backporting as it would change the existing hash behavior of datetime objects. files: Modules/_datetimemodule.c | 16 +--------------- 1 files changed, 1 insertions(+), 15 deletions(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -2755,24 +2755,10 @@ return clone; } -/* - Borrowed from stringobject.c, originally it was string_hash() -*/ static Py_hash_t generic_hash(unsigned char *data, int len) { - register unsigned char *p; - register Py_uhash_t x; - - p = (unsigned char *) data; - x = (Py_uhash_t)*p << 7; - while (--len >= 0) - x = (1000003U*x) ^ (Py_uhash_t)*p++; - x ^= (Py_uhash_t)len; - if (x == -1) - x = -2; - - return x; + return _Py_HashBytes(data, len); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 15 00:09:42 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 15 Jan 2012 00:09:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/83e56004c12b changeset: 74414:83e56004c12b parent: 74413:4ac9ff649f5b parent: 74412:900c01e643a7 user: Gregory P. Smith date: Sat Jan 14 15:09:07 2012 -0800 summary: merge heads files: Doc/contents.rst | 1 - Doc/documenting/building.rst | 90 - Doc/documenting/fromlatex.rst | 199 --- Doc/documenting/index.rst | 38 - Doc/documenting/intro.rst | 29 - Doc/documenting/markup.rst | 891 -------------- Doc/documenting/rest.rst | 231 --- Doc/documenting/style.rst | 210 --- Doc/tools/sphinxext/indexcontent.html | 2 - Doc/whatsnew/2.6.rst | 2 +- 10 files changed, 1 insertions(+), 1692 deletions(-) diff --git a/Doc/contents.rst b/Doc/contents.rst --- a/Doc/contents.rst +++ b/Doc/contents.rst @@ -13,7 +13,6 @@ c-api/index.rst packaging/index.rst install/index.rst - documenting/index.rst howto/index.rst faq/index.rst glossary.rst diff --git a/Doc/documenting/building.rst b/Doc/documenting/building.rst deleted file mode 100644 --- a/Doc/documenting/building.rst +++ /dev/null @@ -1,92 +0,0 @@ -Building the documentation -========================== - -You need to have Python 2.4 or higher installed; the toolset used to build the -docs is written in Python. It is called *Sphinx*, it is not included in this -tree, but maintained separately. Also needed are the docutils, supplying the -base markup that Sphinx uses, Jinja, a templating engine, and optionally -Pygments, a code highlighter. - - -Using make ----------- - -Luckily, a Makefile has been prepared so that on Unix, provided you have -installed Python and Subversion, you can just run :: - - cd Doc - make html - -to check out the necessary toolset in the :file:`tools/` subdirectory and build -the HTML output files. To view the generated HTML, point your favorite browser -at the top-level index :file:`build/html/index.html` after running "make". - -Available make targets are: - - * "html", which builds standalone HTML files for offline viewing. - - * "htmlhelp", which builds HTML files and a HTML Help project file usable to - convert them into a single Compiled HTML (.chm) file -- these are popular - under Microsoft Windows, but very handy on every platform. - - To create the CHM file, you need to run the Microsoft HTML Help Workshop - over the generated project (.hhp) file. - - * "latex", which builds LaTeX source files as input to "pdflatex" to produce - PDF documents. - - * "text", which builds a plain text file for each source file. - - * "linkcheck", which checks all external references to see whether they are - broken, redirected or malformed, and outputs this information to stdout - as well as a plain-text (.txt) file. - - * "changes", which builds an overview over all versionadded/versionchanged/ - deprecated items in the current version. This is meant as a help for the - writer of the "What's New" document. - - * "coverage", which builds a coverage overview for standard library modules - and C API. - - * "pydoc-topics", which builds a Python module containing a dictionary with - plain text documentation for the labels defined in - :file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and - keyword help. - -A "make update" updates the Subversion checkouts in :file:`tools/`. - - -Without make ------------- - -You'll need to install the Sphinx package, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Sphinx-0.6.5/sphinx tools/sphinx - -or by installing it from PyPI. - -Then, you need to install Docutils, either by checking it out via :: - - svn co http://svn.python.org/projects/external/docutils-0.6/docutils tools/docutils - -or by installing it from http://docutils.sf.net/. - -You also need Jinja2, either by checking it out via :: - - svn co http://svn.python.org/projects/external/Jinja-2.3.1/jinja2 tools/jinja2 - -or by installing it from PyPI. - -You can optionally also install Pygments, either as a checkout via :: - - svn co http://svn.python.org/projects/external/Pygments-1.3.1/pygments tools/pygments - -or from PyPI at http://pypi.python.org/pypi/Pygments. - - -Then, make an output directory, e.g. under `build/`, and run :: - - python tools/sphinx-build.py -b . build/ - -where `` is one of html, text, latex, or htmlhelp (for explanations see -the make targets above). diff --git a/Doc/documenting/fromlatex.rst b/Doc/documenting/fromlatex.rst deleted file mode 100644 --- a/Doc/documenting/fromlatex.rst +++ /dev/null @@ -1,202 +0,0 @@ -.. highlightlang:: rest - -Differences to the LaTeX markup -=============================== - -Though the markup language is different, most of the concepts and markup types -of the old LaTeX docs have been kept -- environments as reST directives, inline -commands as reST roles and so forth. - -However, there are some differences in the way these work, partly due to the -differences in the markup languages, partly due to improvements in Sphinx. This -section lists these differences, in order to give those familiar with the old -format a quick overview of what they might run into. - -Inline markup -------------- - -These changes have been made to inline markup: - -* **Cross-reference roles** - - Most of the following semantic roles existed previously as inline commands, - but didn't do anything except formatting the content as code. Now, they - cross-reference to known targets (some names have also been shortened): - - | *mod* (previously *refmodule* or *module*) - | *func* (previously *function*) - | *data* (new) - | *const* - | *class* - | *meth* (previously *method*) - | *attr* (previously *member*) - | *exc* (previously *exception*) - | *cdata* - | *cfunc* (previously *cfunction*) - | *cmacro* (previously *csimplemacro*) - | *ctype* - - Also different is the handling of *func* and *meth*: while previously - parentheses were added to the callable name (like ``\func{str()}``), they are - now appended by the build system -- appending them in the source will result - in double parentheses. This also means that ``:func:`str(object)``` will not - work as expected -- use ````str(object)```` instead! - -* **Inline commands implemented as directives** - - These were inline commands in LaTeX, but are now directives in reST: - - | *deprecated* - | *versionadded* - | *versionchanged* - - These are used like so:: - - .. deprecated:: 2.5 - Reason of deprecation. - - Also, no period is appended to the text for *versionadded* and - *versionchanged*. - - | *note* - | *warning* - - These are used like so:: - - .. note:: - - Content of note. - -* **Otherwise changed commands** - - The *samp* command previously formatted code and added quotation marks around - it. The *samp* role, however, features a new highlighting system just like - *file* does: - - ``:samp:`open({filename}, {mode})``` results in :samp:`open({filename}, {mode})` - -* **Dropped commands** - - These were commands in LaTeX, but are not available as roles: - - | *bfcode* - | *character* (use :samp:`\`\`'c'\`\``) - | *citetitle* (use ```Title `_``) - | *code* (use ````code````) - | *email* (just write the address in body text) - | *filenq* - | *filevar* (use the ``{...}`` highlighting feature of *file*) - | *programopt*, *longprogramopt* (use *option*) - | *ulink* (use ```Title `_``) - | *url* (just write the URL in body text) - | *var* (use ``*var*``) - | *infinity*, *plusminus* (use the Unicode character) - | *shortversion*, *version* (use the ``|version|`` and ``|release|`` substitutions) - | *emph*, *strong* (use the reST markup) - -* **Backslash escaping** - - In reST, a backslash must be escaped in normal text, and in the content of - roles. However, in code literals and literal blocks, it must not be escaped. - Example: ``:file:`C:\\Temp\\my.tmp``` vs. ````open("C:\Temp\my.tmp")````. - - -Information units ------------------ - -Information units (*...desc* environments) have been made reST directives. -These changes to information units should be noted: - -* **New names** - - "desc" has been removed from every name. Additionally, these directives have - new names: - - | *cfunction* (previously *cfuncdesc*) - | *cmacro* (previously *csimplemacrodesc*) - | *exception* (previously *excdesc*) - | *function* (previously *funcdesc*) - | *attribute* (previously *memberdesc*) - - The *classdesc\** and *excclassdesc* environments have been dropped, the - *class* and *exception* directives support classes documented with and without - constructor arguments. - -* **Multiple objects** - - The equivalent of the *...line* commands is:: - - .. function:: do_foo(bar) - do_bar(baz) - - Description of the functions. - - IOW, just give one signatures per line, at the same indentation level. - -* **Arguments** - - There is no *optional* command. Just give function signatures like they - should appear in the output:: - - .. function:: open(filename[, mode[, buffering]]) - - Description. - - Note: markup in the signature is not supported. - -* **Indexing** - - The *...descni* environments have been dropped. To mark an information unit - as unsuitable for index entry generation, use the *noindex* option like so:: - - .. function:: foo_* - :noindex: - - Description. - -* **New information units** - - There are new generic information units: One is called "describe" and can be - used to document things that are not covered by the other units:: - - .. describe:: a == b - - The equals operator. - - The others are:: - - .. cmdoption:: -O - - Describes a command-line option. - - .. envvar:: PYTHONINSPECT - - Describes an environment variable. - - -Structure ---------- - -The LaTeX docs were split in several toplevel manuals. Now, all files are part -of the same documentation tree, as indicated by the *toctree* directives in the -sources (though individual output formats may choose to split them up into parts -again). Every *toctree* directive embeds other files as subdocuments of the -current file (this structure is not necessarily mirrored in the filesystem -layout). The toplevel file is :file:`contents.rst`. - -However, most of the old directory structure has been kept, with the -directories renamed as follows: - -* :file:`api` -> :file:`c-api` -* :file:`dist` -> :file:`distutils`, with the single TeX file split up -* :file:`doc` -> :file:`documenting` -* :file:`ext` -> :file:`extending` -* :file:`inst` -> :file:`installing` -* :file:`lib` -> :file:`library` -* :file:`mac` -> merged into :file:`library`, with :file:`mac/using.tex` - moved to :file:`using/mac.rst` -* :file:`ref` -> :file:`reference` -* :file:`tut` -> :file:`tutorial`, with the single TeX file split up - - -.. XXX more (index-generating, production lists, ...) diff --git a/Doc/documenting/index.rst b/Doc/documenting/index.rst deleted file mode 100644 --- a/Doc/documenting/index.rst +++ /dev/null @@ -1,38 +0,0 @@ -.. _documenting-index: - -###################### - Documenting Python -###################### - - -The Python language has a substantial body of documentation, much of it -contributed by various authors. The markup used for the Python documentation is -`reStructuredText`_, developed by the `docutils`_ project, amended by custom -directives and using a toolset named `Sphinx`_ to postprocess the HTML output. - -This document describes the style guide for our documentation as well as the -custom reStructuredText markup introduced by Sphinx to support Python -documentation and how it should be used. - -.. _reStructuredText: http://docutils.sf.net/rst.html -.. _docutils: http://docutils.sf.net/ -.. _Sphinx: http://sphinx.pocoo.org/ - -.. note:: - - If you're interested in contributing to Python's documentation, there's no - need to write reStructuredText if you're not so inclined; plain text - contributions are more than welcome as well. Send an e-mail to - docs at python.org or open an issue on the :ref:`tracker `. - - -.. toctree:: - :numbered: - :maxdepth: 1 - - intro.rst - style.rst - rest.rst - markup.rst - fromlatex.rst - building.rst diff --git a/Doc/documenting/intro.rst b/Doc/documenting/intro.rst deleted file mode 100644 --- a/Doc/documenting/intro.rst +++ /dev/null @@ -1,29 +0,0 @@ -Introduction -============ - -Python's documentation has long been considered to be good for a free -programming language. There are a number of reasons for this, the most -important being the early commitment of Python's creator, Guido van Rossum, to -providing documentation on the language and its libraries, and the continuing -involvement of the user community in providing assistance for creating and -maintaining documentation. - -The involvement of the community takes many forms, from authoring to bug reports -to just plain complaining when the documentation could be more complete or -easier to use. - -This document is aimed at authors and potential authors of documentation for -Python. More specifically, it is for people contributing to the standard -documentation and developing additional documents using the same tools as the -standard documents. This guide will be less useful for authors using the Python -documentation tools for topics other than Python, and less useful still for -authors not using the tools at all. - -If your interest is in contributing to the Python documentation, but you don't -have the time or inclination to learn reStructuredText and the markup structures -documented here, there's a welcoming place for you among the Python contributors -as well. Any time you feel that you can clarify existing documentation or -provide documentation that's missing, the existing documentation team will -gladly work with you to integrate your text, dealing with the markup for you. -Please don't let the material in this document stand between the documentation -and your desire to help out! \ No newline at end of file diff --git a/Doc/documenting/markup.rst b/Doc/documenting/markup.rst deleted file mode 100644 --- a/Doc/documenting/markup.rst +++ /dev/null @@ -1,904 +0,0 @@ -.. highlightlang:: rest - -Additional Markup Constructs -============================ - -Sphinx adds a lot of new directives and interpreted text roles to standard reST -markup. This section contains the reference material for these facilities. -Documentation for "standard" reST constructs is not included here, though -they are used in the Python documentation. - -.. note:: - - This is just an overview of Sphinx' extended markup capabilities; full - coverage can be found in `its own documentation - `_. - - -Meta-information markup ------------------------ - -.. describe:: sectionauthor - - Identifies the author of the current section. The argument should include - the author's name such that it can be used for presentation (though it isn't) - and email address. The domain name portion of the address should be lower - case. Example:: - - .. sectionauthor:: Guido van Rossum - - Currently, this markup isn't reflected in the output in any way, but it helps - keep track of contributions. - - -Module-specific markup ----------------------- - -The markup described in this section is used to provide information about a -module being documented. Each module should be documented in its own file. -Normally this markup appears after the title heading of that file; a typical -file might start like this:: - - :mod:`parrot` -- Dead parrot access - =================================== - - .. module:: parrot - :platform: Unix, Windows - :synopsis: Analyze and reanimate dead parrots. - .. moduleauthor:: Eric Cleese - .. moduleauthor:: John Idle - -As you can see, the module-specific markup consists of two directives, the -``module`` directive and the ``moduleauthor`` directive. - -.. describe:: module - - This directive marks the beginning of the description of a module, package, - or submodule. The name should be fully qualified (i.e. including the - package name for submodules). - - The ``platform`` option, if present, is a comma-separated list of the - platforms on which the module is available (if it is available on all - platforms, the option should be omitted). The keys are short identifiers; - examples that are in use include "IRIX", "Mac", "Windows", and "Unix". It is - important to use a key which has already been used when applicable. - - The ``synopsis`` option should consist of one sentence describing the - module's purpose -- it is currently only used in the Global Module Index. - - The ``deprecated`` option can be given (with no value) to mark a module as - deprecated; it will be designated as such in various locations then. - -.. describe:: moduleauthor - - The ``moduleauthor`` directive, which can appear multiple times, names the - authors of the module code, just like ``sectionauthor`` names the author(s) - of a piece of documentation. It too does not result in any output currently. - -.. note:: - - It is important to make the section title of a module-describing file - meaningful since that value will be inserted in the table-of-contents trees - in overview files. - - -Information units ------------------ - -There are a number of directives used to describe specific features provided by -modules. Each directive requires one or more signatures to provide basic -information about what is being described, and the content should be the -description. The basic version makes entries in the general index; if no index -entry is desired, you can give the directive option flag ``:noindex:``. The -following example shows all of the features of this directive type:: - - .. function:: spam(eggs) - ham(eggs) - :noindex: - - Spam or ham the foo. - -The signatures of object methods or data attributes should not include the -class name, but be nested in a class directive. The generated files will -reflect this nesting, and the target identifiers (for HTML output) will use -both the class and method name, to enable consistent cross-references. If you -describe methods belonging to an abstract protocol such as context managers, -use a class directive with a (pseudo-)type name too to make the -index entries more informative. - -The directives are: - -.. describe:: c:function - - Describes a C function. The signature should be given as in C, e.g.:: - - .. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) - - This is also used to describe function-like preprocessor macros. The names - of the arguments should be given so they may be used in the description. - - Note that you don't have to backslash-escape asterisks in the signature, - as it is not parsed by the reST inliner. - -.. describe:: c:member - - Describes a C struct member. Example signature:: - - .. c:member:: PyObject* PyTypeObject.tp_bases - - The text of the description should include the range of values allowed, how - the value should be interpreted, and whether the value can be changed. - References to structure members in text should use the ``member`` role. - -.. describe:: c:macro - - Describes a "simple" C macro. Simple macros are macros which are used - for code expansion, but which do not take arguments so cannot be described as - functions. This is not to be used for simple constant definitions. Examples - of its use in the Python documentation include :c:macro:`PyObject_HEAD` and - :c:macro:`Py_BEGIN_ALLOW_THREADS`. - -.. describe:: c:type - - Describes a C type. The signature should just be the type name. - -.. describe:: c:var - - Describes a global C variable. The signature should include the type, such - as:: - - .. cvar:: PyObject* PyClass_Type - -.. describe:: data - - Describes global data in a module, including both variables and values used - as "defined constants." Class and object attributes are not documented - using this directive. - -.. describe:: exception - - Describes an exception class. The signature can, but need not include - parentheses with constructor arguments. - -.. describe:: function - - Describes a module-level function. The signature should include the - parameters, enclosing optional parameters in brackets. Default values can be - given if it enhances clarity. For example:: - - .. function:: repeat([repeat=3[, number=1000000]]) - - Object methods are not documented using this directive. Bound object methods - placed in the module namespace as part of the public interface of the module - are documented using this, as they are equivalent to normal functions for - most purposes. - - The description should include information about the parameters required and - how they are used (especially whether mutable objects passed as parameters - are modified), side effects, and possible exceptions. A small example may be - provided. - -.. describe:: decorator - - Describes a decorator function. The signature should *not* represent the - signature of the actual function, but the usage as a decorator. For example, - given the functions - - .. code-block:: python - - def removename(func): - func.__name__ = '' - return func - - def setnewname(name): - def decorator(func): - func.__name__ = name - return func - return decorator - - the descriptions should look like this:: - - .. decorator:: removename - - Remove name of the decorated function. - - .. decorator:: setnewname(name) - - Set name of the decorated function to *name*. - - There is no ``deco`` role to link to a decorator that is marked up with - this directive; rather, use the ``:func:`` role. - -.. describe:: class - - Describes a class. The signature can include parentheses with parameters - which will be shown as the constructor arguments. - -.. describe:: attribute - - Describes an object data attribute. The description should include - information about the type of the data to be expected and whether it may be - changed directly. This directive should be nested in a class directive, - like in this example:: - - .. class:: Spam - - Description of the class. - - .. data:: ham - - Description of the attribute. - - If is also possible to document an attribute outside of a class directive, - for example if the documentation for different attributes and methods is - split in multiple sections. The class name should then be included - explicitly:: - - .. data:: Spam.eggs - -.. describe:: method - - Describes an object method. The parameters should not include the ``self`` - parameter. The description should include similar information to that - described for ``function``. This directive should be nested in a class - directive, like in the example above. - -.. describe:: decoratormethod - - Same as ``decorator``, but for decorators that are methods. - - Refer to a decorator method using the ``:meth:`` role. - -.. describe:: opcode - - Describes a Python :term:`bytecode` instruction. - -.. describe:: cmdoption - - Describes a Python command line option or switch. Option argument names - should be enclosed in angle brackets. Example:: - - .. cmdoption:: -m - - Run a module as a script. - -.. describe:: envvar - - Describes an environment variable that Python uses or defines. - - -There is also a generic version of these directives: - -.. describe:: describe - - This directive produces the same formatting as the specific ones explained - above but does not create index entries or cross-referencing targets. It is - used, for example, to describe the directives in this document. Example:: - - .. describe:: opcode - - Describes a Python bytecode instruction. - - -Showing code examples ---------------------- - -Examples of Python source code or interactive sessions are represented using -standard reST literal blocks. They are started by a ``::`` at the end of the -preceding paragraph and delimited by indentation. - -Representing an interactive session requires including the prompts and output -along with the Python code. No special markup is required for interactive -sessions. After the last line of input or output presented, there should not be -an "unused" primary prompt; this is an example of what *not* to do:: - - >>> 1 + 1 - 2 - >>> - -Syntax highlighting is handled in a smart way: - -* There is a "highlighting language" for each source file. Per default, - this is ``'python'`` as the majority of files will have to highlight Python - snippets. - -* Within Python highlighting mode, interactive sessions are recognized - automatically and highlighted appropriately. - -* The highlighting language can be changed using the ``highlightlang`` - directive, used as follows:: - - .. highlightlang:: c - - This language is used until the next ``highlightlang`` directive is - encountered. - -* The values normally used for the highlighting language are: - - * ``python`` (the default) - * ``c`` - * ``rest`` - * ``none`` (no highlighting) - -* If highlighting with the current language fails, the block is not highlighted - in any way. - -Longer displays of verbatim text may be included by storing the example text in -an external file containing only plain text. The file may be included using the -``literalinclude`` directive. [1]_ For example, to include the Python source file -:file:`example.py`, use:: - - .. literalinclude:: example.py - -The file name is relative to the current file's path. Documentation-specific -include files should be placed in the ``Doc/includes`` subdirectory. - - -Inline markup -------------- - -As said before, Sphinx uses interpreted text roles to insert semantic markup in -documents. - -Names of local variables, such as function/method arguments, are an exception, -they should be marked simply with ``*var*``. - -For all other roles, you have to write ``:rolename:`content```. - -There are some additional facilities that make cross-referencing roles more -versatile: - -* You may supply an explicit title and reference target, like in reST direct - hyperlinks: ``:role:`title ``` will refer to *target*, but the link - text will be *title*. - -* If you prefix the content with ``!``, no reference/hyperlink will be created. - -* For the Python object roles, if you prefix the content with ``~``, the link - text will only be the last component of the target. For example, - ``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only - display ``get`` as the link text. - - In HTML output, the link's ``title`` attribute (that is e.g. shown as a - tool-tip on mouse-hover) will always be the full target name. - -The following roles refer to objects in modules and are possibly hyperlinked if -a matching identifier is found: - -.. describe:: mod - - The name of a module; a dotted name may be used. This should also be used for - package names. - -.. describe:: func - - The name of a Python function; dotted names may be used. The role text - should not include trailing parentheses to enhance readability. The - parentheses are stripped when searching for identifiers. - -.. describe:: data - - The name of a module-level variable or constant. - -.. describe:: const - - The name of a "defined" constant. This may be a C-language ``#define`` - or a Python variable that is not intended to be changed. - -.. describe:: class - - A class name; a dotted name may be used. - -.. describe:: meth - - The name of a method of an object. The role text should include the type - name and the method name. A dotted name may be used. - -.. describe:: attr - - The name of a data attribute of an object. - -.. describe:: exc - - The name of an exception. A dotted name may be used. - -The name enclosed in this markup can include a module name and/or a class name. -For example, ``:func:`filter``` could refer to a function named ``filter`` in -the current module, or the built-in function of that name. In contrast, -``:func:`foo.filter``` clearly refers to the ``filter`` function in the ``foo`` -module. - -Normally, names in these roles are searched first without any further -qualification, then with the current module name prepended, then with the -current module and class name (if any) prepended. If you prefix the name with a -dot, this order is reversed. For example, in the documentation of the -:mod:`codecs` module, ``:func:`open``` always refers to the built-in function, -while ``:func:`.open``` refers to :func:`codecs.open`. - -A similar heuristic is used to determine whether the name is an attribute of -the currently documented class. - -The following roles create cross-references to C-language constructs if they -are defined in the API documentation: - -.. describe:: c:data - - The name of a C-language variable. - -.. describe:: c:func - - The name of a C-language function. Should include trailing parentheses. - -.. describe:: c:macro - - The name of a "simple" C macro, as defined above. - -.. describe:: c:type - - The name of a C-language type. - -.. describe:: c:member - - The name of a C type member, as defined above. - - -The following role does possibly create a cross-reference, but does not refer -to objects: - -.. describe:: token - - The name of a grammar token (used in the reference manual to create links - between production displays). - - -The following role creates a cross-reference to the term in the glossary: - -.. describe:: term - - Reference to a term in the glossary. The glossary is created using the - ``glossary`` directive containing a definition list with terms and - definitions. It does not have to be in the same file as the ``term`` - markup, in fact, by default the Python docs have one global glossary - in the ``glossary.rst`` file. - - If you use a term that's not explained in a glossary, you'll get a warning - during build. - ---------- - -The following roles don't do anything special except formatting the text -in a different style: - -.. describe:: command - - The name of an OS-level command, such as ``rm``. - -.. describe:: dfn - - Mark the defining instance of a term in the text. (No index entries are - generated.) - -.. describe:: envvar - - An environment variable. Index entries are generated. - -.. describe:: file - - The name of a file or directory. Within the contents, you can use curly - braces to indicate a "variable" part, for example:: - - ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... - - In the built documentation, the ``x`` will be displayed differently to - indicate that it is to be replaced by the Python minor version. - -.. describe:: guilabel - - Labels presented as part of an interactive user interface should be marked - using ``guilabel``. This includes labels from text-based interfaces such as - those created using :mod:`curses` or other text-based libraries. Any label - used in the interface should be marked with this role, including button - labels, window titles, field names, menu and menu selection names, and even - values in selection lists. - -.. describe:: kbd - - Mark a sequence of keystrokes. What form the key sequence takes may depend - on platform- or application-specific conventions. When there are no relevant - conventions, the names of modifier keys should be spelled out, to improve - accessibility for new users and non-native speakers. For example, an - *xemacs* key sequence may be marked like ``:kbd:`C-x C-f```, but without - reference to a specific application or platform, the same sequence should be - marked as ``:kbd:`Control-x Control-f```. - -.. describe:: keyword - - The name of a Python keyword. Using this role will generate a link to the - documentation of the keyword. ``True``, ``False`` and ``None`` do not use - this role, but simple code markup (````True````), given that they're - fundamental to the language and should be known to any programmer. - -.. describe:: mailheader - - The name of an RFC 822-style mail header. This markup does not imply that - the header is being used in an email message, but can be used to refer to any - header of the same "style." This is also used for headers defined by the - various MIME specifications. The header name should be entered in the same - way it would normally be found in practice, with the camel-casing conventions - being preferred where there is more than one common usage. For example: - ``:mailheader:`Content-Type```. - -.. describe:: makevar - - The name of a :command:`make` variable. - -.. describe:: manpage - - A reference to a Unix manual page including the section, - e.g. ``:manpage:`ls(1)```. - -.. describe:: menuselection - - Menu selections should be marked using the ``menuselection`` role. This is - used to mark a complete sequence of menu selections, including selecting - submenus and choosing a specific operation, or any subsequence of such a - sequence. The names of individual selections should be separated by - ``-->``. - - For example, to mark the selection "Start > Programs", use this markup:: - - :menuselection:`Start --> Programs` - - When including a selection that includes some trailing indicator, such as the - ellipsis some operating systems use to indicate that the command opens a - dialog, the indicator should be omitted from the selection name. - -.. describe:: mimetype - - The name of a MIME type, or a component of a MIME type (the major or minor - portion, taken alone). - -.. describe:: newsgroup - - The name of a Usenet newsgroup. - -.. describe:: option - - A command-line option of Python. The leading hyphen(s) must be included. - If a matching ``cmdoption`` directive exists, it is linked to. For options - of other programs or scripts, use simple ````code```` markup. - -.. describe:: program - - The name of an executable program. This may differ from the file name for - the executable for some platforms. In particular, the ``.exe`` (or other) - extension should be omitted for Windows programs. - -.. describe:: regexp - - A regular expression. Quotes should not be included. - -.. describe:: samp - - A piece of literal text, such as code. Within the contents, you can use - curly braces to indicate a "variable" part, as in ``:file:``. - - If you don't need the "variable part" indication, use the standard - ````code```` instead. - - -The following roles generate external links: - -.. describe:: pep - - A reference to a Python Enhancement Proposal. This generates appropriate - index entries. The text "PEP *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified PEP. - -.. describe:: rfc - - A reference to an Internet Request for Comments. This generates appropriate - index entries. The text "RFC *number*\ " is generated; in the HTML output, - this text is a hyperlink to an online copy of the specified RFC. - - -Note that there are no special roles for including hyperlinks as you can use -the standard reST markup for that purpose. - - -.. _doc-ref-role: - -Cross-linking markup --------------------- - -To support cross-referencing to arbitrary sections in the documentation, the -standard reST labels are "abused" a bit: Every label must precede a section -title; and every label name must be unique throughout the entire documentation -source. - -You can then reference to these sections using the ``:ref:`label-name``` role. - -Example:: - - .. _my-reference-label: - - Section to cross-reference - -------------------------- - - This is the text of the section. - - It refers to the section itself, see :ref:`my-reference-label`. - -The ``:ref:`` invocation is replaced with the section title. - -Alternatively, you can reference any label (not just section titles) -if you provide the link text ``:ref:`link text ```. - -Paragraph-level markup ----------------------- - -These directives create short paragraphs and can be used inside information -units as well as normal text: - -.. describe:: note - - An especially important bit of information about an API that a user should be - aware of when using whatever bit of API the note pertains to. The content of - the directive should be written in complete sentences and include all - appropriate punctuation. - - Example:: - - .. note:: - - This function is not suitable for sending spam e-mails. - -.. describe:: warning - - An important bit of information about an API that a user should be aware of - when using whatever bit of API the warning pertains to. The content of the - directive should be written in complete sentences and include all appropriate - punctuation. In the interest of not scaring users away from pages filled - with warnings, this directive should only be chosen over ``note`` for - information regarding the possibility of crashes, data loss, or security - implications. - -.. describe:: versionadded - - This directive documents the version of Python which added the described - feature to the library or C API. When this applies to an entire module, it - should be placed at the top of the module section before any prose. - - The first argument must be given and is the version in question; you can add - a second argument consisting of a *brief* explanation of the change. - - Example:: - - .. versionadded:: 3.1 - The *spam* parameter. - - Note that there must be no blank line between the directive head and the - explanation; this is to make these blocks visually continuous in the markup. - -.. describe:: versionchanged - - Similar to ``versionadded``, but describes when and what changed in the named - feature in some way (new parameters, changed side effects, etc.). - --------------- - -.. describe:: impl-detail - - This directive is used to mark CPython-specific information. Use either with - a block content or a single sentence as an argument, i.e. either :: - - .. impl-detail:: - - This describes some implementation detail. - - More explanation. - - or :: - - .. impl-detail:: This shortly mentions an implementation detail. - - "\ **CPython implementation detail:**\ " is automatically prepended to the - content. - -.. describe:: seealso - - Many sections include a list of references to module documentation or - external documents. These lists are created using the ``seealso`` directive. - - The ``seealso`` directive is typically placed in a section just before any - sub-sections. For the HTML output, it is shown boxed off from the main flow - of the text. - - The content of the ``seealso`` directive should be a reST definition list. - Example:: - - .. seealso:: - - Module :mod:`zipfile` - Documentation of the :mod:`zipfile` standard module. - - `GNU tar manual, Basic Tar Format `_ - Documentation for tar archive files, including GNU tar extensions. - -.. describe:: rubric - - This directive creates a paragraph heading that is not used to create a - table of contents node. It is currently used for the "Footnotes" caption. - -.. describe:: centered - - This directive creates a centered boldfaced paragraph. Use it as follows:: - - .. centered:: - - Paragraph contents. - - -Table-of-contents markup ------------------------- - -Since reST does not have facilities to interconnect several documents, or split -documents into multiple output files, Sphinx uses a custom directive to add -relations between the single files the documentation is made of, as well as -tables of contents. The ``toctree`` directive is the central element. - -.. describe:: toctree - - This directive inserts a "TOC tree" at the current location, using the - individual TOCs (including "sub-TOC trees") of the files given in the - directive body. A numeric ``maxdepth`` option may be given to indicate the - depth of the tree; by default, all levels are included. - - Consider this example (taken from the library reference index):: - - .. toctree:: - :maxdepth: 2 - - intro - strings - datatypes - numeric - (many more files listed here) - - This accomplishes two things: - - * Tables of contents from all those files are inserted, with a maximum depth - of two, that means one nested heading. ``toctree`` directives in those - files are also taken into account. - * Sphinx knows that the relative order of the files ``intro``, - ``strings`` and so forth, and it knows that they are children of the - shown file, the library index. From this information it generates "next - chapter", "previous chapter" and "parent chapter" links. - - In the end, all files included in the build process must occur in one - ``toctree`` directive; Sphinx will emit a warning if it finds a file that is - not included, because that means that this file will not be reachable through - standard navigation. - - The special file ``contents.rst`` at the root of the source directory is the - "root" of the TOC tree hierarchy; from it the "Contents" page is generated. - - -Index-generating markup ------------------------ - -Sphinx automatically creates index entries from all information units (like -functions, classes or attributes) like discussed before. - -However, there is also an explicit directive available, to make the index more -comprehensive and enable index entries in documents where information is not -mainly contained in information units, such as the language reference. - -The directive is ``index`` and contains one or more index entries. Each entry -consists of a type and a value, separated by a colon. - -For example:: - - .. index:: - single: execution; context - module: __main__ - module: sys - triple: module; search; path - -This directive contains five entries, which will be converted to entries in the -generated index which link to the exact location of the index statement (or, in -case of offline media, the corresponding page number). - -The possible entry types are: - -single - Creates a single index entry. Can be made a subentry by separating the - subentry text with a semicolon (this notation is also used below to describe - what entries are created). -pair - ``pair: loop; statement`` is a shortcut that creates two index entries, - namely ``loop; statement`` and ``statement; loop``. -triple - Likewise, ``triple: module; search; path`` is a shortcut that creates three - index entries, which are ``module; search path``, ``search; path, module`` and - ``path; module search``. -module, keyword, operator, object, exception, statement, builtin - These all create two index entries. For example, ``module: hashlib`` creates - the entries ``module; hashlib`` and ``hashlib; module``. - -For index directives containing only "single" entries, there is a shorthand -notation:: - - .. index:: BNF, grammar, syntax, notation - -This creates four index entries. - - -Grammar production displays ---------------------------- - -Special markup is available for displaying the productions of a formal grammar. -The markup is simple and does not attempt to model all aspects of BNF (or any -derived forms), but provides enough to allow context-free grammars to be -displayed in a way that causes uses of a symbol to be rendered as hyperlinks to -the definition of the symbol. There is this directive: - -.. describe:: productionlist - - This directive is used to enclose a group of productions. Each production is - given on a single line and consists of a name, separated by a colon from the - following definition. If the definition spans multiple lines, each - continuation line must begin with a colon placed at the same column as in the - first line. - - Blank lines are not allowed within ``productionlist`` directive arguments. - - The definition can contain token names which are marked as interpreted text - (e.g. ``unaryneg ::= "-" `integer```) -- this generates cross-references - to the productions of these tokens. - - Note that no further reST parsing is done in the production, so that you - don't have to escape ``*`` or ``|`` characters. - - -.. XXX describe optional first parameter - -The following is an example taken from the Python Reference Manual:: - - .. productionlist:: - try_stmt: try1_stmt | try2_stmt - try1_stmt: "try" ":" `suite` - : ("except" [`expression` ["," `target`]] ":" `suite`)+ - : ["else" ":" `suite`] - : ["finally" ":" `suite`] - try2_stmt: "try" ":" `suite` - : "finally" ":" `suite` - - -Substitutions -------------- - -The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file :file:`conf.py`. - -.. describe:: |release| - - Replaced by the Python release the documentation refers to. This is the full - version string including alpha/beta/release candidate tags, e.g. ``2.5.2b3``. - -.. describe:: |version| - - Replaced by the Python version the documentation refers to. This consists - only of the major and minor version parts, e.g. ``2.5``, even for version - 2.5.1. - -.. describe:: |today| - - Replaced by either today's date, or the date set in the build configuration - file. Normally has the format ``April 14, 2007``. - - -.. rubric:: Footnotes - -.. [1] There is a standard ``.. include`` directive, but it raises errors if the - file is not found. This one only emits a warning. diff --git a/Doc/documenting/rest.rst b/Doc/documenting/rest.rst deleted file mode 100644 --- a/Doc/documenting/rest.rst +++ /dev/null @@ -1,243 +0,0 @@ -.. highlightlang:: rest - -reStructuredText Primer -======================= - -This section is a brief introduction to reStructuredText (reST) concepts and -syntax, intended to provide authors with enough information to author documents -productively. Since reST was designed to be a simple, unobtrusive markup -language, this will not take too long. - -.. seealso:: - - The authoritative `reStructuredText User - Documentation `_. - - -Paragraphs ----------- - -The paragraph is the most basic block in a reST document. Paragraphs are simply -chunks of text separated by one or more blank lines. As in Python, indentation -is significant in reST, so all lines of the same paragraph must be left-aligned -to the same level of indentation. - - -Inline markup -------------- - -The standard reST inline markup is quite simple: use - -* one asterisk: ``*text*`` for emphasis (italics), -* two asterisks: ``**text**`` for strong emphasis (boldface), and -* backquotes: ````text```` for code samples. - -If asterisks or backquotes appear in running text and could be confused with -inline markup delimiters, they have to be escaped with a backslash. - -Be aware of some restrictions of this markup: - -* it may not be nested, -* content may not start or end with whitespace: ``* text*`` is wrong, -* it must be separated from surrounding text by non-word characters. Use a - backslash escaped space to work around that: ``thisis\ *one*\ word``. - -These restrictions may be lifted in future versions of the docutils. - -reST also allows for custom "interpreted text roles"', which signify that the -enclosed text should be interpreted in a specific way. Sphinx uses this to -provide semantic markup and cross-referencing of identifiers, as described in -the appropriate section. The general syntax is ``:rolename:`content```. - - -Lists and Quotes ----------------- - -List markup is natural: just place an asterisk at the start of a paragraph and -indent properly. The same goes for numbered lists; they can also be -autonumbered using a ``#`` sign:: - - * This is a bulleted list. - * It has two items, the second - item uses two lines. - - 1. This is a numbered list. - 2. It has two items too. - - #. This is a numbered list. - #. It has two items too. - - -Nested lists are possible, but be aware that they must be separated from the -parent list items by blank lines:: - - * this is - * a list - - * with a nested list - * and some subitems - - * and here the parent list continues - -Definition lists are created as follows:: - - term (up to a line of text) - Definition of the term, which must be indented - - and can even consist of multiple paragraphs - - next term - Description. - - -Paragraphs are quoted by just indenting them more than the surrounding -paragraphs. - - -Source Code ------------ - -Literal code blocks are introduced by ending a paragraph with the special marker -``::``. The literal block must be indented:: - - This is a normal text paragraph. The next paragraph is a code sample:: - - It is not processed in any way, except - that the indentation is removed. - - It can span multiple lines. - - This is a normal text paragraph again. - -The handling of the ``::`` marker is smart: - -* If it occurs as a paragraph of its own, that paragraph is completely left - out of the document. -* If it is preceded by whitespace, the marker is removed. -* If it is preceded by non-whitespace, the marker is replaced by a single - colon. - -That way, the second sentence in the above example's first paragraph would be -rendered as "The next paragraph is a code sample:". - - -Hyperlinks ----------- - -External links -^^^^^^^^^^^^^^ - -Use ```Link text `_`` for inline web links. If the link text -should be the web address, you don't need special markup at all, the parser -finds links and mail addresses in ordinary text. - -Internal links -^^^^^^^^^^^^^^ - -Internal linking is done via a special reST role, see the section on specific -markup, :ref:`doc-ref-role`. - - -Sections --------- - -Section headers are created by underlining (and optionally overlining) the -section title with a punctuation character, at least as long as the text:: - - ================= - This is a heading - ================= - -Normally, there are no heading levels assigned to certain characters as the -structure is determined from the succession of headings. However, for the -Python documentation, we use this convention: - -* ``#`` with overline, for parts -* ``*`` with overline, for chapters -* ``=``, for sections -* ``-``, for subsections -* ``^``, for subsubsections -* ``"``, for paragraphs - - -Explicit Markup ---------------- - -"Explicit markup" is used in reST for most constructs that need special -handling, such as footnotes, specially-highlighted paragraphs, comments, and -generic directives. - -An explicit markup block begins with a line starting with ``..`` followed by -whitespace and is terminated by the next paragraph at the same level of -indentation. (There needs to be a blank line between explicit markup and normal -paragraphs. This may all sound a bit complicated, but it is intuitive enough -when you write it.) - - -Directives ----------- - -A directive is a generic block of explicit markup. Besides roles, it is one of -the extension mechanisms of reST, and Sphinx makes heavy use of it. - -Basically, a directive consists of a name, arguments, options and content. (Keep -this terminology in mind, it is used in the next chapter describing custom -directives.) Looking at this example, :: - - .. function:: foo(x) - foo(y, z) - :bar: no - - Return a line of text input from the user. - -``function`` is the directive name. It is given two arguments here, the -remainder of the first line and the second line, as well as one option ``bar`` -(as you can see, options are given in the lines immediately following the -arguments and indicated by the colons). - -The directive content follows after a blank line and is indented relative to the -directive start. - - -Footnotes ---------- - -For footnotes, use ``[#]_`` to mark the footnote location, and add the footnote -body at the bottom of the document after a "Footnotes" rubric heading, like so:: - - Lorem ipsum [#]_ dolor sit amet ... [#]_ - - .. rubric:: Footnotes - - .. [#] Text of the first footnote. - .. [#] Text of the second footnote. - -You can also explicitly number the footnotes for better context. - - -Comments --------- - -Every explicit markup block which isn't a valid markup construct (like the -footnotes above) is regarded as a comment. - - -Source encoding ---------------- - -Since the easiest way to include special characters like em dashes or copyright -signs in reST is to directly write them as Unicode characters, one has to -specify an encoding: - -All Python documentation source files must be in UTF-8 encoding, and the HTML -documents written from them will be in that encoding as well. - - -Gotchas -------- - -There are some problems one commonly runs into while authoring reST documents: - -* **Separation of inline markup:** As said above, inline markup spans must be - separated from the surrounding text by non-word characters, you have to use - an escaped space to get around that. diff --git a/Doc/documenting/style.rst b/Doc/documenting/style.rst deleted file mode 100644 --- a/Doc/documenting/style.rst +++ /dev/null @@ -1,218 +0,0 @@ -.. highlightlang:: rest - -Style guide -=========== - -The Python documentation should follow the `Apple Publications Style Guide`_ -wherever possible. This particular style guide was selected mostly because it -seems reasonable and is easy to get online. - -Topics which are either not covered in Apple's style guide or treated -differently in Python documentation will be discussed in this -document. - -Use of whitespace ------------------ - -All reST files use an indentation of 3 spaces; no tabs are allowed. The -maximum line length is 80 characters for normal text, but tables, deeply -indented code samples and long links may extend beyond that. Code example -bodies should use normal Python 4-space indentation. - -Make generous use of blank lines where applicable; they help grouping things -together. - -A sentence-ending period may be followed by one or two spaces; while reST -ignores the second space, it is customarily put in by some users, for example -to aid Emacs' auto-fill mode. - -Footnotes ---------- - -Footnotes are generally discouraged, though they may be used when they are the -best way to present specific information. When a footnote reference is added at -the end of the sentence, it should follow the sentence-ending punctuation. The -reST markup should appear something like this:: - - This sentence has a footnote reference. [#]_ This is the next sentence. - -Footnotes should be gathered at the end of a file, or if the file is very long, -at the end of a section. The docutils will automatically create backlinks to -the footnote reference. - -Footnotes may appear in the middle of sentences where appropriate. - -Capitalization --------------- - -.. sidebar:: Sentence case - - Sentence case is a set of capitalization rules used in English - sentences: the first word is always capitalized and other words are - only capitalized if there is a specific rule requiring it. - -Apple style guide recommends the use of title case in section titles. -However, rules for which words should be capitalized in title case -vary greaty between publications. - -In Python documentation, use of sentence case in section titles is -preferable, but consistency within a unit is more important than -following this rule. If you add a section to the chapter where most -sections are in title case you can either convert all titles to -sentence case or use the dominant style in the new section title. - -Sentences that start with a word for which specific rules require -starting it with a lower case letter should be avoided in titles and -elsewhere. - -.. note:: - - Sections that describe a library module often have titles in the - form of "modulename --- Short description of the module." In this - case, the description should be capitalized as a stand-alone - sentence. - -Many special names are used in the Python documentation, including the names of -operating systems, programming languages, standards bodies, and the like. Most -of these entities are not assigned any special markup, but the preferred -spellings are given here to aid authors in maintaining the consistency of -presentation in the Python documentation. - -Other terms and words deserve special mention as well; these conventions should -be used to ensure consistency throughout the documentation: - -CPU - For "central processing unit." Many style guides say this should be - spelled out on the first use (and if you must use it, do so!). For - the Python documentation, this abbreviation should be avoided since - there's no reasonable way to predict which occurrence will be the - first seen by the reader. It is better to use the word "processor" - instead. - -POSIX - The name assigned to a particular group of standards. This is always - uppercase. - -Python - The name of our favorite programming language is always capitalized. - -reST - For "reStructuredText," an easy to read, plaintext markup syntax - used to produce Python documentation. When spelled out, it is - always one word and both forms start with a lower case 'r'. - -Unicode - The name of a character coding system. This is always written - capitalized. - -Unix - The name of the operating system developed at AT&T Bell Labs in the early - 1970s. - -Affirmative Tone ----------------- - -The documentation focuses on affirmatively stating what the language does and -how to use it effectively. - -Except for certain security risks or segfault risks, the docs should avoid -wording along the lines of "feature x is dangerous" or "experts only". These -kinds of value judgments belong in external blogs and wikis, not in the core -documentation. - -Bad example (creating worry in the mind of a reader): - - Warning: failing to explicitly close a file could result in lost data or - excessive resource consumption. Never rely on reference counting to - automatically close a file. - -Good example (establishing confident knowledge in the effective use of the language): - - A best practice for using files is use a try/finally pair to explicitly - close a file after it is used. Alternatively, using a with-statement can - achieve the same effect. This assures that files are flushed and file - descriptor resources are released in a timely manner. - -Economy of Expression ---------------------- - -More documentation is not necessarily better documentation. Err on the side -of being succinct. - -It is an unfortunate fact that making documentation longer can be an impediment -to understanding and can result in even more ways to misread or misinterpret the -text. Long descriptions full of corner cases and caveats can create the -impression that a function is more complex or harder to use than it actually is. - -The documentation for :func:`super` is an example of where a good deal of -information was condensed into a few short paragraphs. Discussion of -:func:`super` could have filled a chapter in a book, but it is often easier to -grasp a terse description than a lengthy narrative. - - -Code Examples -------------- - -Short code examples can be a useful adjunct to understanding. Readers can often -grasp a simple example more quickly than they can digest a formal description in -prose. - -People learn faster with concrete, motivating examples that match the context of -a typical use case. For instance, the :func:`str.rpartition` method is better -demonstrated with an example splitting the domain from a URL than it would be -with an example of removing the last word from a line of Monty Python dialog. - -The ellipsis for the :attr:`sys.ps2` secondary interpreter prompt should only be -used sparingly, where it is necessary to clearly differentiate between input -lines and output lines. Besides contributing visual clutter, it makes it -difficult for readers to cut-and-paste examples so they can experiment with -variations. - -Code Equivalents ----------------- - -Giving pure Python code equivalents (or approximate equivalents) can be a useful -adjunct to a prose description. A documenter should carefully weigh whether the -code equivalent adds value. - -A good example is the code equivalent for :func:`all`. The short 4-line code -equivalent is easily digested; it re-emphasizes the early-out behavior; and it -clarifies the handling of the corner-case where the iterable is empty. In -addition, it serves as a model for people wanting to implement a commonly -requested alternative where :func:`all` would return the specific object -evaluating to False whenever the function terminates early. - -A more questionable example is the code for :func:`itertools.groupby`. Its code -equivalent borders on being too complex to be a quick aid to understanding. -Despite its complexity, the code equivalent was kept because it serves as a -model to alternative implementations and because the operation of the "grouper" -is more easily shown in code than in English prose. - -An example of when not to use a code equivalent is for the :func:`oct` function. -The exact steps in converting a number to octal doesn't add value for a user -trying to learn what the function does. - -Audience --------- - -The tone of the tutorial (and all the docs) needs to be respectful of the -reader's intelligence. Don't presume that the readers are stupid. Lay out the -relevant information, show motivating use cases, provide glossary links, and do -your best to connect-the-dots, but don't talk down to them or waste their time. - -The tutorial is meant for newcomers, many of whom will be using the tutorial to -evaluate the language as a whole. The experience needs to be positive and not -leave the reader with worries that something bad will happen if they make a -misstep. The tutorial serves as guide for intelligent and curious readers, -saving details for the how-to guides and other sources. - -Be careful accepting requests for documentation changes from the rare but vocal -category of reader who is looking for vindication for one of their programming -errors ("I made a mistake, therefore the docs must be wrong ..."). Typically, -the documentation wasn't consulted until after the error was made. It is -unfortunate, but typically no documentation edit would have saved the user from -making false assumptions about the language ("I was surprised by ..."). - - -.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf - diff --git a/Doc/tools/sphinxext/indexcontent.html b/Doc/tools/sphinxext/indexcontent.html --- a/Doc/tools/sphinxext/indexcontent.html +++ b/Doc/tools/sphinxext/indexcontent.html @@ -24,8 +24,6 @@ finding and installing modules and applications

    - diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -234,7 +234,7 @@ .. seealso:: - :ref:`documenting-index` + `Documenting Python `__ Describes how to write for Python's documentation. `Sphinx `__ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 15 00:45:31 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 15 Jan 2012 00:45:31 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Consolidate_the?= =?utf8?q?_occurrances_of_the_prime_used_as_the_multiplier_when_hashing?= Message-ID: http://hg.python.org/cpython/rev/050c07b31192 changeset: 74415:050c07b31192 branch: 3.2 parent: 74411:70c46599fb0e user: Gregory P. Smith date: Sat Jan 14 15:31:34 2012 -0800 summary: Consolidate the occurrances of the prime used as the multiplier when hashing to a single #define instead of having several copies in several files. This excludes the Modules/ tree (datetime and expat both have a copy for their own purposes with no need for it to be the same). files: Include/pyport.h | 5 ++++- Objects/bytesobject.c | 2 +- Objects/tupleobject.c | 2 +- Objects/unicodeobject.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h --- a/Include/pyport.h +++ b/Include/pyport.h @@ -131,6 +131,9 @@ #endif #endif +/* Prime multiplier used in string and various other hashes. */ +#define _PyHASH_MULTIPLIER 1000003 /* 0xf4243 */ + /* Parameters used for the numeric hash implementation. See notes for _PyHash_Double in Objects/object.c. Numeric hashes are based on reduction modulo the prime 2**_PyHASH_BITS - 1. */ @@ -143,7 +146,7 @@ #define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) #define _PyHASH_INF 314159 #define _PyHASH_NAN 0 -#define _PyHASH_IMAG 1000003UL +#define _PyHASH_IMAG _PyHASH_MULTIPLIER /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -881,7 +881,7 @@ p = (unsigned char *) a->ob_sval; x = *p << 7; while (--len >= 0) - x = (1000003*x) ^ *p++; + x = (_PyHASH_MULTIPLIER*x) ^ *p++; x ^= Py_SIZE(a); if (x == -1) x = -2; diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -315,7 +315,7 @@ register Py_hash_t x, y; register Py_ssize_t len = Py_SIZE(v); register PyObject **p; - Py_hash_t mult = 1000003L; + Py_hash_t mult = _PyHASH_MULTIPLIER; x = 0x345678L; p = v->ob_item; while (--len >= 0) { diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7666,7 +7666,7 @@ p = self->str; x = *p << 7; while (--len >= 0) - x = (1000003*x) ^ *p++; + x = (_PyHASH_MULTIPLIER*x) ^ *p++; x ^= Py_SIZE(self); if (x == -1) x = -2; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 15 00:45:32 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 15 Jan 2012 00:45:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Consolidate_the_occurrances_of_the_prime_used_as_the_multipl?= =?utf8?q?ier_when_hashing=2E?= Message-ID: http://hg.python.org/cpython/rev/40e1be1e0707 changeset: 74416:40e1be1e0707 parent: 74414:83e56004c12b parent: 74415:050c07b31192 user: Gregory P. Smith date: Sat Jan 14 15:45:13 2012 -0800 summary: Consolidate the occurrances of the prime used as the multiplier when hashing. files: Include/pyport.h | 5 ++++- Objects/object.c | 2 +- Objects/tupleobject.c | 2 +- Objects/unicodeobject.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h --- a/Include/pyport.h +++ b/Include/pyport.h @@ -131,6 +131,9 @@ #endif #endif +/* Prime multiplier used in string and various other hashes. */ +#define _PyHASH_MULTIPLIER 1000003 /* 0xf4243 */ + /* Parameters used for the numeric hash implementation. See notes for _Py_HashDouble in Objects/object.c. Numeric hashes are based on reduction modulo the prime 2**_PyHASH_BITS - 1. */ @@ -143,7 +146,7 @@ #define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1) #define _PyHASH_INF 314159 #define _PyHASH_NAN 0 -#define _PyHASH_IMAG 1000003UL +#define _PyHASH_IMAG _PyHASH_MULTIPLIER /* uintptr_t is the C9X name for an unsigned integral type such that a * legitimate void* can be cast to uintptr_t and then back to void* again diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -761,7 +761,7 @@ x = (Py_uhash_t) *p << 7; for (i = 0; i < len; i++) - x = (1000003U * x) ^ (Py_uhash_t) *p++; + x = (_PyHASH_MULTIPLIER * x) ^ (Py_uhash_t) *p++; x ^= (Py_uhash_t) len; if (x == -1) x = -2; diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -316,7 +316,7 @@ register Py_hash_t y; register Py_ssize_t len = Py_SIZE(v); register PyObject **p; - Py_uhash_t mult = 1000003; + Py_uhash_t mult = _PyHASH_MULTIPLIER; x = 0x345678; p = v->ob_item; while (--len >= 0) { diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11210,7 +11210,7 @@ #define HASH(P) \ x = (Py_uhash_t)*P << 7; \ while (--len >= 0) \ - x = (1000003*x) ^ (Py_uhash_t)*P++; + x = (_PyHASH_MULTIPLIER*x) ^ (Py_uhash_t)*P++; switch (PyUnicode_KIND(self)) { case PyUnicode_1BYTE_KIND: { -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Jan 15 05:34:25 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 15 Jan 2012 05:34:25 +0100 Subject: [Python-checkins] Daily reference leaks (40e1be1e0707): sum=0 Message-ID: results for 40e1be1e0707 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogRPZKBj', '-x'] From python-checkins at python.org Sun Jan 15 16:37:11 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 15 Jan 2012 16:37:11 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_fix_typo=3B_tha?= =?utf8?q?nks_to_Jan_Heidbrink_from_docs=40?= Message-ID: http://hg.python.org/cpython/rev/19356498cdb7 changeset: 74417:19356498cdb7 branch: 2.7 parent: 74410:8975f7d0fbf7 user: Sandro Tosi date: Sun Jan 15 16:34:29 2012 +0100 summary: fix typo; thanks to Jan Heidbrink from docs@ files: Doc/faq/library.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -410,7 +410,7 @@ Since then, the idea of getting rid of the GIL has occasionally come up but nobody has found a way to deal with the expected slowdown, and users who don't -use threads would not be happy if their code ran at half at the speed. Greg's +use threads would not be happy if their code ran at half the speed. Greg's free threading patch set has not been kept up-to-date for later Python versions. This doesn't mean that you can't make good use of Python on multi-CPU machines! -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 01:09:03 2012 From: python-checkins at python.org (terry.reedy) Date: Mon, 16 Jan 2012 01:09:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_=2313039_allow_?= =?utf8?q?proper_deletion_of_=27=3E=3E=3E_=27_in_IDLE_editor_windows=2E?= Message-ID: http://hg.python.org/cpython/rev/95b704cb7f7c changeset: 74418:95b704cb7f7c branch: 2.7 user: Terry Jan Reedy date: Sun Jan 15 19:02:50 2012 -0500 summary: #13039 allow proper deletion of '>>> ' in IDLE editor windows. Patch by Roger Serwy. files: Lib/idlelib/EditorWindow.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1135,7 +1135,10 @@ assert have > 0 want = ((have - 1) // self.indentwidth) * self.indentwidth # Debug prompt is multilined.... - last_line_of_prompt = sys.ps1.split('\n')[-1] + if self.context_use_ps1: + last_line_of_prompt = sys.ps1.split('\n')[-1] + else: + last_line_of_prompt = '' ncharsdeleted = 0 while 1: if chars == last_line_of_prompt: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 01:09:04 2012 From: python-checkins at python.org (terry.reedy) Date: Mon, 16 Jan 2012 01:09:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_=2313039_allow_?= =?utf8?q?proper_deletion_of_=27=3E=3E=3E_=27_in_IDLE_editor_windows=2E?= Message-ID: http://hg.python.org/cpython/rev/c6e7473b1fb5 changeset: 74419:c6e7473b1fb5 branch: 3.2 parent: 74415:050c07b31192 user: Terry Jan Reedy date: Sun Jan 15 19:03:23 2012 -0500 summary: #13039 allow proper deletion of '>>> ' in IDLE editor windows. Patch by Roger Serwy. files: Lib/idlelib/EditorWindow.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1134,7 +1134,10 @@ assert have > 0 want = ((have - 1) // self.indentwidth) * self.indentwidth # Debug prompt is multilined.... - last_line_of_prompt = sys.ps1.split('\n')[-1] + if self.context_use_ps1: + last_line_of_prompt = sys.ps1.split('\n')[-1] + else: + last_line_of_prompt = '' ncharsdeleted = 0 while 1: if chars == last_line_of_prompt: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 01:09:04 2012 From: python-checkins at python.org (terry.reedy) Date: Mon, 16 Jan 2012 01:09:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2_=2313039_allow_proper_deletion_of_=27=3E=3E?= =?utf8?q?=3E_=27_in_IDLE_editor_windows=2E?= Message-ID: http://hg.python.org/cpython/rev/6099d9dd0c26 changeset: 74420:6099d9dd0c26 parent: 74416:40e1be1e0707 parent: 74419:c6e7473b1fb5 user: Terry Jan Reedy date: Sun Jan 15 19:08:28 2012 -0500 summary: Merge with 3.2 #13039 allow proper deletion of '>>> ' in IDLE editor windows. Patch by Roger Serwy. files: Lib/idlelib/EditorWindow.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -1134,7 +1134,10 @@ assert have > 0 want = ((have - 1) // self.indentwidth) * self.indentwidth # Debug prompt is multilined.... - last_line_of_prompt = sys.ps1.split('\n')[-1] + if self.context_use_ps1: + last_line_of_prompt = sys.ps1.split('\n')[-1] + else: + last_line_of_prompt = '' ncharsdeleted = 0 while 1: if chars == last_line_of_prompt: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 02:34:24 2012 From: python-checkins at python.org (meador.inge) Date: Mon, 16 Jan 2012 02:34:24 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjI5?= =?utf8?q?=3A_Renumber_the_tokens_in_token=2Eh_to_match_the_=5FPyParser=5F?= =?utf8?q?TokenNames?= Message-ID: http://hg.python.org/cpython/rev/1c0c6fa7341c changeset: 74421:1c0c6fa7341c branch: 3.2 parent: 74419:c6e7473b1fb5 user: Meador Inge date: Sun Jan 15 19:15:36 2012 -0600 summary: Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes. files: Include/token.h | 61 +++++++++++++++++----------------- Lib/token.py | 60 +++++++++++++++++----------------- Misc/NEWS | 3 + Python/graminit.c | 30 ++++++++-------- 4 files changed, 78 insertions(+), 76 deletions(-) diff --git a/Include/token.h b/Include/token.h --- a/Include/token.h +++ b/Include/token.h @@ -34,38 +34,37 @@ #define EQUAL 22 #define DOT 23 #define PERCENT 24 -/* #define BACKQUOTE 25 */ -#define LBRACE 26 -#define RBRACE 27 -#define EQEQUAL 28 -#define NOTEQUAL 29 -#define LESSEQUAL 30 -#define GREATEREQUAL 31 -#define TILDE 32 -#define CIRCUMFLEX 33 -#define LEFTSHIFT 34 -#define RIGHTSHIFT 35 -#define DOUBLESTAR 36 -#define PLUSEQUAL 37 -#define MINEQUAL 38 -#define STAREQUAL 39 -#define SLASHEQUAL 40 -#define PERCENTEQUAL 41 -#define AMPEREQUAL 42 -#define VBAREQUAL 43 -#define CIRCUMFLEXEQUAL 44 -#define LEFTSHIFTEQUAL 45 -#define RIGHTSHIFTEQUAL 46 -#define DOUBLESTAREQUAL 47 -#define DOUBLESLASH 48 -#define DOUBLESLASHEQUAL 49 -#define AT 50 -#define RARROW 51 -#define ELLIPSIS 52 +#define LBRACE 25 +#define RBRACE 26 +#define EQEQUAL 27 +#define NOTEQUAL 28 +#define LESSEQUAL 29 +#define GREATEREQUAL 30 +#define TILDE 31 +#define CIRCUMFLEX 32 +#define LEFTSHIFT 33 +#define RIGHTSHIFT 34 +#define DOUBLESTAR 35 +#define PLUSEQUAL 36 +#define MINEQUAL 37 +#define STAREQUAL 38 +#define SLASHEQUAL 39 +#define PERCENTEQUAL 40 +#define AMPEREQUAL 41 +#define VBAREQUAL 42 +#define CIRCUMFLEXEQUAL 43 +#define LEFTSHIFTEQUAL 44 +#define RIGHTSHIFTEQUAL 45 +#define DOUBLESTAREQUAL 46 +#define DOUBLESLASH 47 +#define DOUBLESLASHEQUAL 48 +#define AT 49 +#define RARROW 50 +#define ELLIPSIS 51 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ -#define OP 53 -#define ERRORTOKEN 54 -#define N_TOKENS 55 +#define OP 52 +#define ERRORTOKEN 53 +#define N_TOKENS 54 /* Special definitions for cooperation with parser */ diff --git a/Lib/token.py b/Lib/token.py --- a/Lib/token.py +++ b/Lib/token.py @@ -35,36 +35,36 @@ EQUAL = 22 DOT = 23 PERCENT = 24 -LBRACE = 26 -RBRACE = 27 -EQEQUAL = 28 -NOTEQUAL = 29 -LESSEQUAL = 30 -GREATEREQUAL = 31 -TILDE = 32 -CIRCUMFLEX = 33 -LEFTSHIFT = 34 -RIGHTSHIFT = 35 -DOUBLESTAR = 36 -PLUSEQUAL = 37 -MINEQUAL = 38 -STAREQUAL = 39 -SLASHEQUAL = 40 -PERCENTEQUAL = 41 -AMPEREQUAL = 42 -VBAREQUAL = 43 -CIRCUMFLEXEQUAL = 44 -LEFTSHIFTEQUAL = 45 -RIGHTSHIFTEQUAL = 46 -DOUBLESTAREQUAL = 47 -DOUBLESLASH = 48 -DOUBLESLASHEQUAL = 49 -AT = 50 -RARROW = 51 -ELLIPSIS = 52 -OP = 53 -ERRORTOKEN = 54 -N_TOKENS = 55 +LBRACE = 25 +RBRACE = 26 +EQEQUAL = 27 +NOTEQUAL = 28 +LESSEQUAL = 29 +GREATEREQUAL = 30 +TILDE = 31 +CIRCUMFLEX = 32 +LEFTSHIFT = 33 +RIGHTSHIFT = 34 +DOUBLESTAR = 35 +PLUSEQUAL = 36 +MINEQUAL = 37 +STAREQUAL = 38 +SLASHEQUAL = 39 +PERCENTEQUAL = 40 +AMPEREQUAL = 41 +VBAREQUAL = 42 +CIRCUMFLEXEQUAL = 43 +LEFTSHIFTEQUAL = 44 +RIGHTSHIFTEQUAL = 45 +DOUBLESTAREQUAL = 46 +DOUBLESLASH = 47 +DOUBLESLASHEQUAL = 48 +AT = 49 +RARROW = 50 +ELLIPSIS = 51 +OP = 52 +ERRORTOKEN = 53 +N_TOKENS = 54 NT_OFFSET = 256 #--end constants-- diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #13629: Renumber the tokens in token.h so that they match the indexes + into _PyParser_TokenNames. + - Fix the fix for issue #12149: it was incorrect, although it had the side effect of appearing to resolve the issue. Thanks to Mark Shannon for noticing. diff --git a/Python/graminit.c b/Python/graminit.c --- a/Python/graminit.c +++ b/Python/graminit.c @@ -1978,7 +1978,7 @@ {258, 0}, {327, 0}, {259, 0}, - {50, 0}, + {49, 0}, {289, 0}, {7, 0}, {330, 0}, @@ -1990,7 +1990,7 @@ {1, "def"}, {1, 0}, {263, 0}, - {51, 0}, + {50, 0}, {302, 0}, {11, 0}, {301, 0}, @@ -1999,7 +1999,7 @@ {22, 0}, {12, 0}, {16, 0}, - {36, 0}, + {35, 0}, {266, 0}, {267, 0}, {270, 0}, @@ -2016,6 +2016,7 @@ {273, 0}, {336, 0}, {311, 0}, + {36, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -2026,8 +2027,7 @@ {44, 0}, {45, 0}, {46, 0}, - {47, 0}, - {49, 0}, + {48, 0}, {1, "del"}, {326, 0}, {1, "pass"}, @@ -2046,7 +2046,7 @@ {1, "import"}, {288, 0}, {23, 0}, - {52, 0}, + {51, 0}, {287, 0}, {285, 0}, {1, "as"}, @@ -2088,38 +2088,38 @@ {310, 0}, {20, 0}, {21, 0}, - {28, 0}, - {31, 0}, + {27, 0}, {30, 0}, {29, 0}, - {29, 0}, + {28, 0}, + {28, 0}, {1, "is"}, {313, 0}, {18, 0}, {314, 0}, - {33, 0}, + {32, 0}, {315, 0}, {19, 0}, {316, 0}, + {33, 0}, {34, 0}, - {35, 0}, {317, 0}, {14, 0}, {15, 0}, {318, 0}, {17, 0}, {24, 0}, - {48, 0}, - {32, 0}, + {47, 0}, + {31, 0}, {319, 0}, {320, 0}, {322, 0}, {321, 0}, {9, 0}, {10, 0}, + {25, 0}, + {328, 0}, {26, 0}, - {328, 0}, - {27, 0}, {2, 0}, {3, 0}, {1, "None"}, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 02:34:25 2012 From: python-checkins at python.org (meador.inge) Date: Mon, 16 Jan 2012 02:34:25 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313629=3A_Renumber_the_tokens_in_token=2Eh_to_match_?= =?utf8?q?the_=5FPyParser=5FTokenNames?= Message-ID: http://hg.python.org/cpython/rev/c0660d7cc1fe changeset: 74422:c0660d7cc1fe parent: 74420:6099d9dd0c26 parent: 74421:1c0c6fa7341c user: Meador Inge date: Sun Jan 15 19:31:57 2012 -0600 summary: Issue #13629: Renumber the tokens in token.h to match the _PyParser_TokenNames indexes. files: Include/token.h | 61 +++++++++++++++++----------------- Lib/token.py | 60 +++++++++++++++++----------------- Misc/NEWS | 3 + Python/graminit.c | 30 ++++++++-------- 4 files changed, 78 insertions(+), 76 deletions(-) diff --git a/Include/token.h b/Include/token.h --- a/Include/token.h +++ b/Include/token.h @@ -34,38 +34,37 @@ #define EQUAL 22 #define DOT 23 #define PERCENT 24 -/* #define BACKQUOTE 25 */ -#define LBRACE 26 -#define RBRACE 27 -#define EQEQUAL 28 -#define NOTEQUAL 29 -#define LESSEQUAL 30 -#define GREATEREQUAL 31 -#define TILDE 32 -#define CIRCUMFLEX 33 -#define LEFTSHIFT 34 -#define RIGHTSHIFT 35 -#define DOUBLESTAR 36 -#define PLUSEQUAL 37 -#define MINEQUAL 38 -#define STAREQUAL 39 -#define SLASHEQUAL 40 -#define PERCENTEQUAL 41 -#define AMPEREQUAL 42 -#define VBAREQUAL 43 -#define CIRCUMFLEXEQUAL 44 -#define LEFTSHIFTEQUAL 45 -#define RIGHTSHIFTEQUAL 46 -#define DOUBLESTAREQUAL 47 -#define DOUBLESLASH 48 -#define DOUBLESLASHEQUAL 49 -#define AT 50 -#define RARROW 51 -#define ELLIPSIS 52 +#define LBRACE 25 +#define RBRACE 26 +#define EQEQUAL 27 +#define NOTEQUAL 28 +#define LESSEQUAL 29 +#define GREATEREQUAL 30 +#define TILDE 31 +#define CIRCUMFLEX 32 +#define LEFTSHIFT 33 +#define RIGHTSHIFT 34 +#define DOUBLESTAR 35 +#define PLUSEQUAL 36 +#define MINEQUAL 37 +#define STAREQUAL 38 +#define SLASHEQUAL 39 +#define PERCENTEQUAL 40 +#define AMPEREQUAL 41 +#define VBAREQUAL 42 +#define CIRCUMFLEXEQUAL 43 +#define LEFTSHIFTEQUAL 44 +#define RIGHTSHIFTEQUAL 45 +#define DOUBLESTAREQUAL 46 +#define DOUBLESLASH 47 +#define DOUBLESLASHEQUAL 48 +#define AT 49 +#define RARROW 50 +#define ELLIPSIS 51 /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ -#define OP 53 -#define ERRORTOKEN 54 -#define N_TOKENS 55 +#define OP 52 +#define ERRORTOKEN 53 +#define N_TOKENS 54 /* Special definitions for cooperation with parser */ diff --git a/Lib/token.py b/Lib/token.py --- a/Lib/token.py +++ b/Lib/token.py @@ -35,36 +35,36 @@ EQUAL = 22 DOT = 23 PERCENT = 24 -LBRACE = 26 -RBRACE = 27 -EQEQUAL = 28 -NOTEQUAL = 29 -LESSEQUAL = 30 -GREATEREQUAL = 31 -TILDE = 32 -CIRCUMFLEX = 33 -LEFTSHIFT = 34 -RIGHTSHIFT = 35 -DOUBLESTAR = 36 -PLUSEQUAL = 37 -MINEQUAL = 38 -STAREQUAL = 39 -SLASHEQUAL = 40 -PERCENTEQUAL = 41 -AMPEREQUAL = 42 -VBAREQUAL = 43 -CIRCUMFLEXEQUAL = 44 -LEFTSHIFTEQUAL = 45 -RIGHTSHIFTEQUAL = 46 -DOUBLESTAREQUAL = 47 -DOUBLESLASH = 48 -DOUBLESLASHEQUAL = 49 -AT = 50 -RARROW = 51 -ELLIPSIS = 52 -OP = 53 -ERRORTOKEN = 54 -N_TOKENS = 55 +LBRACE = 25 +RBRACE = 26 +EQEQUAL = 27 +NOTEQUAL = 28 +LESSEQUAL = 29 +GREATEREQUAL = 30 +TILDE = 31 +CIRCUMFLEX = 32 +LEFTSHIFT = 33 +RIGHTSHIFT = 34 +DOUBLESTAR = 35 +PLUSEQUAL = 36 +MINEQUAL = 37 +STAREQUAL = 38 +SLASHEQUAL = 39 +PERCENTEQUAL = 40 +AMPEREQUAL = 41 +VBAREQUAL = 42 +CIRCUMFLEXEQUAL = 43 +LEFTSHIFTEQUAL = 44 +RIGHTSHIFTEQUAL = 45 +DOUBLESTAREQUAL = 46 +DOUBLESLASH = 47 +DOUBLESLASHEQUAL = 48 +AT = 49 +RARROW = 50 +ELLIPSIS = 51 +OP = 52 +ERRORTOKEN = 53 +N_TOKENS = 54 NT_OFFSET = 256 #--end constants-- diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #13629: Renumber the tokens in token.h so that they match the indexes + into _PyParser_TokenNames. + - Issue #13752: Add a casefold() method to str. - Issue #13761: Add a "flush" keyword argument to the print() function, diff --git a/Python/graminit.c b/Python/graminit.c --- a/Python/graminit.c +++ b/Python/graminit.c @@ -1995,7 +1995,7 @@ {258, 0}, {327, 0}, {259, 0}, - {50, 0}, + {49, 0}, {289, 0}, {7, 0}, {330, 0}, @@ -2007,7 +2007,7 @@ {1, "def"}, {1, 0}, {263, 0}, - {51, 0}, + {50, 0}, {302, 0}, {11, 0}, {301, 0}, @@ -2016,7 +2016,7 @@ {22, 0}, {12, 0}, {16, 0}, - {36, 0}, + {35, 0}, {266, 0}, {267, 0}, {270, 0}, @@ -2033,6 +2033,7 @@ {273, 0}, {336, 0}, {311, 0}, + {36, 0}, {37, 0}, {38, 0}, {39, 0}, @@ -2043,8 +2044,7 @@ {44, 0}, {45, 0}, {46, 0}, - {47, 0}, - {49, 0}, + {48, 0}, {1, "del"}, {326, 0}, {1, "pass"}, @@ -2063,7 +2063,7 @@ {1, "import"}, {288, 0}, {23, 0}, - {52, 0}, + {51, 0}, {287, 0}, {285, 0}, {1, "as"}, @@ -2105,38 +2105,38 @@ {310, 0}, {20, 0}, {21, 0}, - {28, 0}, - {31, 0}, + {27, 0}, {30, 0}, {29, 0}, - {29, 0}, + {28, 0}, + {28, 0}, {1, "is"}, {313, 0}, {18, 0}, {314, 0}, - {33, 0}, + {32, 0}, {315, 0}, {19, 0}, {316, 0}, + {33, 0}, {34, 0}, - {35, 0}, {317, 0}, {14, 0}, {15, 0}, {318, 0}, {17, 0}, {24, 0}, - {48, 0}, - {32, 0}, + {47, 0}, + {31, 0}, {319, 0}, {320, 0}, {322, 0}, {321, 0}, {9, 0}, {10, 0}, + {25, 0}, + {328, 0}, {26, 0}, - {328, 0}, - {27, 0}, {2, 0}, {3, 0}, {1, "None"}, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 03:19:30 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 03:19:30 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_delta_encoding_of_upper/low?= =?utf8?q?er/title_makes_a_glorious_return_=28=2312736=29?= Message-ID: http://hg.python.org/cpython/rev/03ea95e3b497 changeset: 74423:03ea95e3b497 user: Benjamin Peterson date: Sun Jan 15 21:19:20 2012 -0500 summary: delta encoding of upper/lower/title makes a glorious return (#12736) files: Objects/unicodectype.c | 22 +- Objects/unicodetype_db.h | 4967 +++++------------ Tools/unicode/makeunicodedata.py | 7 + 3 files changed, 1450 insertions(+), 3546 deletions(-) diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -27,9 +27,13 @@ #define EXTENDED_CASE_MASK 0x4000 typedef struct { - const Py_UCS4 upper; - const Py_UCS4 lower; - const Py_UCS4 title; + /* + These are either deltas to the character or offsets in + _PyUnicode_ExtendedCase. + */ + const int upper; + const int lower; + const int title; const unsigned char decimal; const unsigned char digit; const unsigned short flags; @@ -60,7 +64,7 @@ { const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - return ctype->title ? ctype->title : ch; + return ch + ctype->title; } /* Returns 1 for Unicode characters having the category 'Lt', 0 @@ -186,7 +190,7 @@ if (ctype->flags & EXTENDED_CASE_MASK) return _PyUnicode_ExtendedCase[ctype->upper & 0xFFFF]; - return ctype->upper ? ctype->upper : ch; + return ch + ctype->upper; } /* Returns the lowercase Unicode characters corresponding to ch or just @@ -198,7 +202,7 @@ if (ctype->flags & EXTENDED_CASE_MASK) return _PyUnicode_ExtendedCase[ctype->lower & 0xFFFF]; - return ctype->lower ? ctype->lower : ch; + return ch + ctype->lower; } int _PyUnicode_ToLowerFull(Py_UCS4 ch, Py_UCS4 *res) @@ -213,7 +217,7 @@ res[i] = _PyUnicode_ExtendedCase[index + i]; return n; } - res[0] = ctype->lower ? ctype->lower : ch; + res[0] = ch + ctype->lower; return 1; } @@ -229,7 +233,7 @@ res[i] = _PyUnicode_ExtendedCase[index + i]; return n; } - res[0] = ctype->title ? ctype->title : ch; + res[0] = ch + ctype->title; return 1; } @@ -245,7 +249,7 @@ res[i] = _PyUnicode_ExtendedCase[index + i]; return n; } - res[0] = ctype->upper ? ctype->upper : ch; + res[0] = ch + ctype->upper; return 1; } diff --git a/Objects/unicodetype_db.h b/Objects/unicodetype_db.h --- a/Objects/unicodetype_db.h +++ b/Objects/unicodetype_db.h @@ -19,59 +19,9 @@ {0, 0, 0, 7, 7, 3590}, {0, 0, 0, 8, 8, 3590}, {0, 0, 0, 9, 9, 3590}, - {65, 97, 65, 0, 0, 10113}, - {66, 98, 66, 0, 0, 10113}, - {67, 99, 67, 0, 0, 10113}, - {68, 100, 68, 0, 0, 10113}, - {69, 101, 69, 0, 0, 10113}, - {70, 102, 70, 0, 0, 10113}, - {71, 103, 71, 0, 0, 10113}, - {72, 104, 72, 0, 0, 10113}, - {73, 105, 73, 0, 0, 10113}, - {74, 106, 74, 0, 0, 10113}, - {75, 107, 75, 0, 0, 10113}, - {76, 108, 76, 0, 0, 10113}, - {77, 109, 77, 0, 0, 10113}, - {78, 110, 78, 0, 0, 10113}, - {79, 111, 79, 0, 0, 10113}, - {80, 112, 80, 0, 0, 10113}, - {81, 113, 81, 0, 0, 10113}, - {82, 114, 82, 0, 0, 10113}, - {83, 115, 83, 0, 0, 10113}, - {84, 116, 84, 0, 0, 10113}, - {85, 117, 85, 0, 0, 10113}, - {86, 118, 86, 0, 0, 10113}, - {87, 119, 87, 0, 0, 10113}, - {88, 120, 88, 0, 0, 10113}, - {89, 121, 89, 0, 0, 10113}, - {90, 122, 90, 0, 0, 10113}, + {0, 32, 0, 0, 0, 10113}, {0, 0, 0, 0, 0, 1536}, - {65, 97, 65, 0, 0, 9993}, - {66, 98, 66, 0, 0, 9993}, - {67, 99, 67, 0, 0, 9993}, - {68, 100, 68, 0, 0, 9993}, - {69, 101, 69, 0, 0, 9993}, - {70, 102, 70, 0, 0, 9993}, - {71, 103, 71, 0, 0, 9993}, - {72, 104, 72, 0, 0, 9993}, - {73, 105, 73, 0, 0, 9993}, - {74, 106, 74, 0, 0, 9993}, - {75, 107, 75, 0, 0, 9993}, - {76, 108, 76, 0, 0, 9993}, - {77, 109, 77, 0, 0, 9993}, - {78, 110, 78, 0, 0, 9993}, - {79, 111, 79, 0, 0, 9993}, - {80, 112, 80, 0, 0, 9993}, - {81, 113, 81, 0, 0, 9993}, - {82, 114, 82, 0, 0, 9993}, - {83, 115, 83, 0, 0, 9993}, - {84, 116, 84, 0, 0, 9993}, - {85, 117, 85, 0, 0, 9993}, - {86, 118, 86, 0, 0, 9993}, - {87, 119, 87, 0, 0, 9993}, - {88, 120, 88, 0, 0, 9993}, - {89, 121, 89, 0, 0, 9993}, - {90, 122, 90, 0, 0, 9993}, + {-32, 0, -32, 0, 0, 9993}, {0, 0, 0, 0, 0, 9993}, {0, 0, 0, 0, 0, 4096}, {0, 0, 0, 0, 2, 3076}, @@ -80,944 +30,109 @@ {0, 0, 0, 0, 0, 5632}, {0, 0, 0, 0, 1, 3076}, {0, 0, 0, 0, 0, 3072}, - {192, 224, 192, 0, 0, 10113}, - {193, 225, 193, 0, 0, 10113}, - {194, 226, 194, 0, 0, 10113}, - {195, 227, 195, 0, 0, 10113}, - {196, 228, 196, 0, 0, 10113}, - {197, 229, 197, 0, 0, 10113}, - {198, 230, 198, 0, 0, 10113}, - {199, 231, 199, 0, 0, 10113}, - {200, 232, 200, 0, 0, 10113}, - {201, 233, 201, 0, 0, 10113}, - {202, 234, 202, 0, 0, 10113}, - {203, 235, 203, 0, 0, 10113}, - {204, 236, 204, 0, 0, 10113}, - {205, 237, 205, 0, 0, 10113}, - {206, 238, 206, 0, 0, 10113}, - {207, 239, 207, 0, 0, 10113}, - {208, 240, 208, 0, 0, 10113}, - {209, 241, 209, 0, 0, 10113}, - {210, 242, 210, 0, 0, 10113}, - {211, 243, 211, 0, 0, 10113}, - {212, 244, 212, 0, 0, 10113}, - {213, 245, 213, 0, 0, 10113}, - {214, 246, 214, 0, 0, 10113}, - {216, 248, 216, 0, 0, 10113}, - {217, 249, 217, 0, 0, 10113}, - {218, 250, 218, 0, 0, 10113}, - {219, 251, 219, 0, 0, 10113}, - {220, 252, 220, 0, 0, 10113}, - {221, 253, 221, 0, 0, 10113}, - {222, 254, 222, 0, 0, 10113}, {33554438, 18874371, 33554440, 0, 0, 26377}, - {192, 224, 192, 0, 0, 9993}, - {193, 225, 193, 0, 0, 9993}, - {194, 226, 194, 0, 0, 9993}, - {195, 227, 195, 0, 0, 9993}, - {196, 228, 196, 0, 0, 9993}, - {197, 229, 197, 0, 0, 9993}, - {198, 230, 198, 0, 0, 9993}, - {199, 231, 199, 0, 0, 9993}, - {200, 232, 200, 0, 0, 9993}, - {201, 233, 201, 0, 0, 9993}, - {202, 234, 202, 0, 0, 9993}, - {203, 235, 203, 0, 0, 9993}, - {204, 236, 204, 0, 0, 9993}, - {205, 237, 205, 0, 0, 9993}, - {206, 238, 206, 0, 0, 9993}, - {207, 239, 207, 0, 0, 9993}, - {208, 240, 208, 0, 0, 9993}, - {209, 241, 209, 0, 0, 9993}, - {210, 242, 210, 0, 0, 9993}, - {211, 243, 211, 0, 0, 9993}, - {212, 244, 212, 0, 0, 9993}, - {213, 245, 213, 0, 0, 9993}, - {214, 246, 214, 0, 0, 9993}, - {216, 248, 216, 0, 0, 9993}, - {217, 249, 217, 0, 0, 9993}, - {218, 250, 218, 0, 0, 9993}, - {219, 251, 219, 0, 0, 9993}, - {220, 252, 220, 0, 0, 9993}, - {221, 253, 221, 0, 0, 9993}, - {222, 254, 222, 0, 0, 9993}, - {376, 255, 376, 0, 0, 9993}, - {256, 257, 256, 0, 0, 10113}, - {256, 257, 256, 0, 0, 9993}, - {258, 259, 258, 0, 0, 10113}, - {258, 259, 258, 0, 0, 9993}, - {260, 261, 260, 0, 0, 10113}, - {260, 261, 260, 0, 0, 9993}, - {262, 263, 262, 0, 0, 10113}, - {262, 263, 262, 0, 0, 9993}, - {264, 265, 264, 0, 0, 10113}, - {264, 265, 264, 0, 0, 9993}, - {266, 267, 266, 0, 0, 10113}, - {266, 267, 266, 0, 0, 9993}, - {268, 269, 268, 0, 0, 10113}, - {268, 269, 268, 0, 0, 9993}, - {270, 271, 270, 0, 0, 10113}, - {270, 271, 270, 0, 0, 9993}, - {272, 273, 272, 0, 0, 10113}, - {272, 273, 272, 0, 0, 9993}, - {274, 275, 274, 0, 0, 10113}, - {274, 275, 274, 0, 0, 9993}, - {276, 277, 276, 0, 0, 10113}, - {276, 277, 276, 0, 0, 9993}, - {278, 279, 278, 0, 0, 10113}, - {278, 279, 278, 0, 0, 9993}, - {280, 281, 280, 0, 0, 10113}, - {280, 281, 280, 0, 0, 9993}, - {282, 283, 282, 0, 0, 10113}, - {282, 283, 282, 0, 0, 9993}, - {284, 285, 284, 0, 0, 10113}, - {284, 285, 284, 0, 0, 9993}, - {286, 287, 286, 0, 0, 10113}, - {286, 287, 286, 0, 0, 9993}, - {288, 289, 288, 0, 0, 10113}, - {288, 289, 288, 0, 0, 9993}, - {290, 291, 290, 0, 0, 10113}, - {290, 291, 290, 0, 0, 9993}, - {292, 293, 292, 0, 0, 10113}, - {292, 293, 292, 0, 0, 9993}, - {294, 295, 294, 0, 0, 10113}, - {294, 295, 294, 0, 0, 9993}, - {296, 297, 296, 0, 0, 10113}, - {296, 297, 296, 0, 0, 9993}, - {298, 299, 298, 0, 0, 10113}, - {298, 299, 298, 0, 0, 9993}, - {300, 301, 300, 0, 0, 10113}, - {300, 301, 300, 0, 0, 9993}, - {302, 303, 302, 0, 0, 10113}, - {302, 303, 302, 0, 0, 9993}, + {121, 0, 121, 0, 0, 9993}, + {0, 1, 0, 0, 0, 10113}, + {-1, 0, -1, 0, 0, 9993}, {16777228, 33554442, 16777228, 0, 0, 26497}, - {73, 305, 73, 0, 0, 9993}, - {306, 307, 306, 0, 0, 10113}, - {306, 307, 306, 0, 0, 9993}, - {308, 309, 308, 0, 0, 10113}, - {308, 309, 308, 0, 0, 9993}, - {310, 311, 310, 0, 0, 10113}, - {310, 311, 310, 0, 0, 9993}, - {313, 314, 313, 0, 0, 10113}, - {313, 314, 313, 0, 0, 9993}, - {315, 316, 315, 0, 0, 10113}, - {315, 316, 315, 0, 0, 9993}, - {317, 318, 317, 0, 0, 10113}, - {317, 318, 317, 0, 0, 9993}, - {319, 320, 319, 0, 0, 10113}, - {319, 320, 319, 0, 0, 9993}, - {321, 322, 321, 0, 0, 10113}, - {321, 322, 321, 0, 0, 9993}, - {323, 324, 323, 0, 0, 10113}, - {323, 324, 323, 0, 0, 9993}, - {325, 326, 325, 0, 0, 10113}, - {325, 326, 325, 0, 0, 9993}, - {327, 328, 327, 0, 0, 10113}, - {327, 328, 327, 0, 0, 9993}, + {-232, 0, -232, 0, 0, 9993}, {33554448, 18874381, 33554448, 0, 0, 26377}, - {330, 331, 330, 0, 0, 10113}, - {330, 331, 330, 0, 0, 9993}, - {332, 333, 332, 0, 0, 10113}, - {332, 333, 332, 0, 0, 9993}, - {334, 335, 334, 0, 0, 10113}, - {334, 335, 334, 0, 0, 9993}, - {336, 337, 336, 0, 0, 10113}, - {336, 337, 336, 0, 0, 9993}, - {338, 339, 338, 0, 0, 10113}, - {338, 339, 338, 0, 0, 9993}, - {340, 341, 340, 0, 0, 10113}, - {340, 341, 340, 0, 0, 9993}, - {342, 343, 342, 0, 0, 10113}, - {342, 343, 342, 0, 0, 9993}, - {344, 345, 344, 0, 0, 10113}, - {344, 345, 344, 0, 0, 9993}, - {346, 347, 346, 0, 0, 10113}, - {346, 347, 346, 0, 0, 9993}, - {348, 349, 348, 0, 0, 10113}, - {348, 349, 348, 0, 0, 9993}, - {350, 351, 350, 0, 0, 10113}, - {350, 351, 350, 0, 0, 9993}, - {352, 353, 352, 0, 0, 10113}, - {352, 353, 352, 0, 0, 9993}, - {354, 355, 354, 0, 0, 10113}, - {354, 355, 354, 0, 0, 9993}, - {356, 357, 356, 0, 0, 10113}, - {356, 357, 356, 0, 0, 9993}, - {358, 359, 358, 0, 0, 10113}, - {358, 359, 358, 0, 0, 9993}, - {360, 361, 360, 0, 0, 10113}, - {360, 361, 360, 0, 0, 9993}, - {362, 363, 362, 0, 0, 10113}, - {362, 363, 362, 0, 0, 9993}, - {364, 365, 364, 0, 0, 10113}, - {364, 365, 364, 0, 0, 9993}, - {366, 367, 366, 0, 0, 10113}, - {366, 367, 366, 0, 0, 9993}, - {368, 369, 368, 0, 0, 10113}, - {368, 369, 368, 0, 0, 9993}, - {370, 371, 370, 0, 0, 10113}, - {370, 371, 370, 0, 0, 9993}, - {372, 373, 372, 0, 0, 10113}, - {372, 373, 372, 0, 0, 9993}, - {374, 375, 374, 0, 0, 10113}, - {374, 375, 374, 0, 0, 9993}, - {376, 255, 376, 0, 0, 10113}, - {377, 378, 377, 0, 0, 10113}, - {377, 378, 377, 0, 0, 9993}, - {379, 380, 379, 0, 0, 10113}, - {379, 380, 379, 0, 0, 9993}, - {381, 382, 381, 0, 0, 10113}, - {381, 382, 381, 0, 0, 9993}, + {0, -121, 0, 0, 0, 10113}, {16777236, 17825810, 16777236, 0, 0, 26377}, - {579, 384, 579, 0, 0, 9993}, - {385, 595, 385, 0, 0, 10113}, - {386, 387, 386, 0, 0, 10113}, - {386, 387, 386, 0, 0, 9993}, - {388, 389, 388, 0, 0, 10113}, - {388, 389, 388, 0, 0, 9993}, - {390, 596, 390, 0, 0, 10113}, - {391, 392, 391, 0, 0, 10113}, - {391, 392, 391, 0, 0, 9993}, - {393, 598, 393, 0, 0, 10113}, - {394, 599, 394, 0, 0, 10113}, - {395, 396, 395, 0, 0, 10113}, - {395, 396, 395, 0, 0, 9993}, - {398, 477, 398, 0, 0, 10113}, - {399, 601, 399, 0, 0, 10113}, - {400, 603, 400, 0, 0, 10113}, - {401, 402, 401, 0, 0, 10113}, - {401, 402, 401, 0, 0, 9993}, - {403, 608, 403, 0, 0, 10113}, - {404, 611, 404, 0, 0, 10113}, - {502, 405, 502, 0, 0, 9993}, - {406, 617, 406, 0, 0, 10113}, - {407, 616, 407, 0, 0, 10113}, - {408, 409, 408, 0, 0, 10113}, - {408, 409, 408, 0, 0, 9993}, - {573, 410, 573, 0, 0, 9993}, - {412, 623, 412, 0, 0, 10113}, - {413, 626, 413, 0, 0, 10113}, - {544, 414, 544, 0, 0, 9993}, - {415, 629, 415, 0, 0, 10113}, - {416, 417, 416, 0, 0, 10113}, - {416, 417, 416, 0, 0, 9993}, - {418, 419, 418, 0, 0, 10113}, - {418, 419, 418, 0, 0, 9993}, - {420, 421, 420, 0, 0, 10113}, - {420, 421, 420, 0, 0, 9993}, - {422, 640, 422, 0, 0, 10113}, - {423, 424, 423, 0, 0, 10113}, - {423, 424, 423, 0, 0, 9993}, - {425, 643, 425, 0, 0, 10113}, - {428, 429, 428, 0, 0, 10113}, - {428, 429, 428, 0, 0, 9993}, - {430, 648, 430, 0, 0, 10113}, - {431, 432, 431, 0, 0, 10113}, - {431, 432, 431, 0, 0, 9993}, - {433, 650, 433, 0, 0, 10113}, - {434, 651, 434, 0, 0, 10113}, - {435, 436, 435, 0, 0, 10113}, - {435, 436, 435, 0, 0, 9993}, - {437, 438, 437, 0, 0, 10113}, - {437, 438, 437, 0, 0, 9993}, - {439, 658, 439, 0, 0, 10113}, - {440, 441, 440, 0, 0, 10113}, - {440, 441, 440, 0, 0, 9993}, + {195, 0, 195, 0, 0, 9993}, + {0, 210, 0, 0, 0, 10113}, + {0, 206, 0, 0, 0, 10113}, + {0, 205, 0, 0, 0, 10113}, + {0, 79, 0, 0, 0, 10113}, + {0, 202, 0, 0, 0, 10113}, + {0, 203, 0, 0, 0, 10113}, + {0, 207, 0, 0, 0, 10113}, + {97, 0, 97, 0, 0, 9993}, + {0, 211, 0, 0, 0, 10113}, + {0, 209, 0, 0, 0, 10113}, + {163, 0, 163, 0, 0, 9993}, + {0, 213, 0, 0, 0, 10113}, + {130, 0, 130, 0, 0, 9993}, + {0, 214, 0, 0, 0, 10113}, + {0, 218, 0, 0, 0, 10113}, + {0, 217, 0, 0, 0, 10113}, + {0, 219, 0, 0, 0, 10113}, {0, 0, 0, 0, 0, 1793}, - {444, 445, 444, 0, 0, 10113}, - {444, 445, 444, 0, 0, 9993}, - {503, 447, 503, 0, 0, 9993}, - {452, 454, 453, 0, 0, 10113}, - {452, 454, 453, 0, 0, 10049}, - {452, 454, 453, 0, 0, 9993}, - {455, 457, 456, 0, 0, 10113}, - {455, 457, 456, 0, 0, 10049}, - {455, 457, 456, 0, 0, 9993}, - {458, 460, 459, 0, 0, 10113}, - {458, 460, 459, 0, 0, 10049}, - {458, 460, 459, 0, 0, 9993}, - {461, 462, 461, 0, 0, 10113}, - {461, 462, 461, 0, 0, 9993}, - {463, 464, 463, 0, 0, 10113}, - {463, 464, 463, 0, 0, 9993}, - {465, 466, 465, 0, 0, 10113}, - {465, 466, 465, 0, 0, 9993}, - {467, 468, 467, 0, 0, 10113}, - {467, 468, 467, 0, 0, 9993}, - {469, 470, 469, 0, 0, 10113}, - {469, 470, 469, 0, 0, 9993}, - {471, 472, 471, 0, 0, 10113}, - {471, 472, 471, 0, 0, 9993}, - {473, 474, 473, 0, 0, 10113}, - {473, 474, 473, 0, 0, 9993}, - {475, 476, 475, 0, 0, 10113}, - {475, 476, 475, 0, 0, 9993}, - {398, 477, 398, 0, 0, 9993}, - {478, 479, 478, 0, 0, 10113}, - {478, 479, 478, 0, 0, 9993}, - {480, 481, 480, 0, 0, 10113}, - {480, 481, 480, 0, 0, 9993}, - {482, 483, 482, 0, 0, 10113}, - {482, 483, 482, 0, 0, 9993}, - {484, 485, 484, 0, 0, 10113}, - {484, 485, 484, 0, 0, 9993}, - {486, 487, 486, 0, 0, 10113}, - {486, 487, 486, 0, 0, 9993}, - {488, 489, 488, 0, 0, 10113}, - {488, 489, 488, 0, 0, 9993}, - {490, 491, 490, 0, 0, 10113}, - {490, 491, 490, 0, 0, 9993}, - {492, 493, 492, 0, 0, 10113}, - {492, 493, 492, 0, 0, 9993}, - {494, 495, 494, 0, 0, 10113}, - {494, 495, 494, 0, 0, 9993}, + {56, 0, 56, 0, 0, 9993}, + {0, 2, 1, 0, 0, 10113}, + {-1, 1, 0, 0, 0, 10049}, + {-2, 0, -1, 0, 0, 9993}, + {-79, 0, -79, 0, 0, 9993}, {33554456, 18874389, 33554456, 0, 0, 26377}, - {497, 499, 498, 0, 0, 10113}, - {497, 499, 498, 0, 0, 10049}, - {497, 499, 498, 0, 0, 9993}, - {500, 501, 500, 0, 0, 10113}, - {500, 501, 500, 0, 0, 9993}, - {502, 405, 502, 0, 0, 10113}, - {503, 447, 503, 0, 0, 10113}, - {504, 505, 504, 0, 0, 10113}, - {504, 505, 504, 0, 0, 9993}, - {506, 507, 506, 0, 0, 10113}, - {506, 507, 506, 0, 0, 9993}, - {508, 509, 508, 0, 0, 10113}, - {508, 509, 508, 0, 0, 9993}, - {510, 511, 510, 0, 0, 10113}, - {510, 511, 510, 0, 0, 9993}, - {512, 513, 512, 0, 0, 10113}, - {512, 513, 512, 0, 0, 9993}, - {514, 515, 514, 0, 0, 10113}, - {514, 515, 514, 0, 0, 9993}, - {516, 517, 516, 0, 0, 10113}, - {516, 517, 516, 0, 0, 9993}, - {518, 519, 518, 0, 0, 10113}, - {518, 519, 518, 0, 0, 9993}, - {520, 521, 520, 0, 0, 10113}, - {520, 521, 520, 0, 0, 9993}, - {522, 523, 522, 0, 0, 10113}, - {522, 523, 522, 0, 0, 9993}, - {524, 525, 524, 0, 0, 10113}, - {524, 525, 524, 0, 0, 9993}, - {526, 527, 526, 0, 0, 10113}, - {526, 527, 526, 0, 0, 9993}, - {528, 529, 528, 0, 0, 10113}, - {528, 529, 528, 0, 0, 9993}, - {530, 531, 530, 0, 0, 10113}, - {530, 531, 530, 0, 0, 9993}, - {532, 533, 532, 0, 0, 10113}, - {532, 533, 532, 0, 0, 9993}, - {534, 535, 534, 0, 0, 10113}, - {534, 535, 534, 0, 0, 9993}, - {536, 537, 536, 0, 0, 10113}, - {536, 537, 536, 0, 0, 9993}, - {538, 539, 538, 0, 0, 10113}, - {538, 539, 538, 0, 0, 9993}, - {540, 541, 540, 0, 0, 10113}, - {540, 541, 540, 0, 0, 9993}, - {542, 543, 542, 0, 0, 10113}, - {542, 543, 542, 0, 0, 9993}, - {544, 414, 544, 0, 0, 10113}, - {546, 547, 546, 0, 0, 10113}, - {546, 547, 546, 0, 0, 9993}, - {548, 549, 548, 0, 0, 10113}, - {548, 549, 548, 0, 0, 9993}, - {550, 551, 550, 0, 0, 10113}, - {550, 551, 550, 0, 0, 9993}, - {552, 553, 552, 0, 0, 10113}, - {552, 553, 552, 0, 0, 9993}, - {554, 555, 554, 0, 0, 10113}, - {554, 555, 554, 0, 0, 9993}, - {556, 557, 556, 0, 0, 10113}, - {556, 557, 556, 0, 0, 9993}, - {558, 559, 558, 0, 0, 10113}, - {558, 559, 558, 0, 0, 9993}, - {560, 561, 560, 0, 0, 10113}, - {560, 561, 560, 0, 0, 9993}, - {562, 563, 562, 0, 0, 10113}, - {562, 563, 562, 0, 0, 9993}, - {570, 11365, 570, 0, 0, 10113}, - {571, 572, 571, 0, 0, 10113}, - {571, 572, 571, 0, 0, 9993}, - {573, 410, 573, 0, 0, 10113}, - {574, 11366, 574, 0, 0, 10113}, - {11390, 575, 11390, 0, 0, 9993}, - {11391, 576, 11391, 0, 0, 9993}, - {577, 578, 577, 0, 0, 10113}, - {577, 578, 577, 0, 0, 9993}, - {579, 384, 579, 0, 0, 10113}, - {580, 649, 580, 0, 0, 10113}, - {581, 652, 581, 0, 0, 10113}, - {582, 583, 582, 0, 0, 10113}, - {582, 583, 582, 0, 0, 9993}, - {584, 585, 584, 0, 0, 10113}, - {584, 585, 584, 0, 0, 9993}, - {586, 587, 586, 0, 0, 10113}, - {586, 587, 586, 0, 0, 9993}, - {588, 589, 588, 0, 0, 10113}, - {588, 589, 588, 0, 0, 9993}, - {590, 591, 590, 0, 0, 10113}, - {590, 591, 590, 0, 0, 9993}, - {11375, 592, 11375, 0, 0, 9993}, - {11373, 593, 11373, 0, 0, 9993}, - {11376, 594, 11376, 0, 0, 9993}, - {385, 595, 385, 0, 0, 9993}, - {390, 596, 390, 0, 0, 9993}, - {393, 598, 393, 0, 0, 9993}, - {394, 599, 394, 0, 0, 9993}, - {399, 601, 399, 0, 0, 9993}, - {400, 603, 400, 0, 0, 9993}, - {403, 608, 403, 0, 0, 9993}, - {404, 611, 404, 0, 0, 9993}, - {42893, 613, 42893, 0, 0, 9993}, - {407, 616, 407, 0, 0, 9993}, - {406, 617, 406, 0, 0, 9993}, - {11362, 619, 11362, 0, 0, 9993}, - {412, 623, 412, 0, 0, 9993}, - {11374, 625, 11374, 0, 0, 9993}, - {413, 626, 413, 0, 0, 9993}, - {415, 629, 415, 0, 0, 9993}, - {11364, 637, 11364, 0, 0, 9993}, - {422, 640, 422, 0, 0, 9993}, - {425, 643, 425, 0, 0, 9993}, - {430, 648, 430, 0, 0, 9993}, - {580, 649, 580, 0, 0, 9993}, - {433, 650, 433, 0, 0, 9993}, - {434, 651, 434, 0, 0, 9993}, - {581, 652, 581, 0, 0, 9993}, - {439, 658, 439, 0, 0, 9993}, + {0, -97, 0, 0, 0, 10113}, + {0, -56, 0, 0, 0, 10113}, + {0, -130, 0, 0, 0, 10113}, + {0, 10795, 0, 0, 0, 10113}, + {0, -163, 0, 0, 0, 10113}, + {0, 10792, 0, 0, 0, 10113}, + {10815, 0, 10815, 0, 0, 9993}, + {0, -195, 0, 0, 0, 10113}, + {0, 69, 0, 0, 0, 10113}, + {0, 71, 0, 0, 0, 10113}, + {10783, 0, 10783, 0, 0, 9993}, + {10780, 0, 10780, 0, 0, 9993}, + {10782, 0, 10782, 0, 0, 9993}, + {-210, 0, -210, 0, 0, 9993}, + {-206, 0, -206, 0, 0, 9993}, + {-205, 0, -205, 0, 0, 9993}, + {-202, 0, -202, 0, 0, 9993}, + {-203, 0, -203, 0, 0, 9993}, + {-207, 0, -207, 0, 0, 9993}, + {42280, 0, 42280, 0, 0, 9993}, + {-209, 0, -209, 0, 0, 9993}, + {-211, 0, -211, 0, 0, 9993}, + {10743, 0, 10743, 0, 0, 9993}, + {10749, 0, 10749, 0, 0, 9993}, + {-213, 0, -213, 0, 0, 9993}, + {-214, 0, -214, 0, 0, 9993}, + {10727, 0, 10727, 0, 0, 9993}, + {-218, 0, -218, 0, 0, 9993}, + {-69, 0, -69, 0, 0, 9993}, + {-217, 0, -217, 0, 0, 9993}, + {-71, 0, -71, 0, 0, 9993}, + {-219, 0, -219, 0, 0, 9993}, {0, 0, 0, 0, 0, 14089}, {0, 0, 0, 0, 0, 5889}, {16777244, 17825818, 16777244, 0, 0, 30216}, - {880, 881, 880, 0, 0, 10113}, - {880, 881, 880, 0, 0, 9993}, - {882, 883, 882, 0, 0, 10113}, - {882, 883, 882, 0, 0, 9993}, - {886, 887, 886, 0, 0, 10113}, - {886, 887, 886, 0, 0, 9993}, {0, 0, 0, 0, 0, 13321}, - {1021, 891, 1021, 0, 0, 9993}, - {1022, 892, 1022, 0, 0, 9993}, - {1023, 893, 1023, 0, 0, 9993}, - {902, 940, 902, 0, 0, 10113}, - {904, 941, 904, 0, 0, 10113}, - {905, 942, 905, 0, 0, 10113}, - {906, 943, 906, 0, 0, 10113}, - {908, 972, 908, 0, 0, 10113}, - {910, 973, 910, 0, 0, 10113}, - {911, 974, 911, 0, 0, 10113}, + {0, 38, 0, 0, 0, 10113}, + {0, 37, 0, 0, 0, 10113}, + {0, 64, 0, 0, 0, 10113}, + {0, 63, 0, 0, 0, 10113}, {50331681, 19922973, 50331681, 0, 0, 26377}, - {913, 945, 913, 0, 0, 10113}, - {914, 946, 914, 0, 0, 10113}, - {915, 947, 915, 0, 0, 10113}, - {916, 948, 916, 0, 0, 10113}, - {917, 949, 917, 0, 0, 10113}, - {918, 950, 918, 0, 0, 10113}, - {919, 951, 919, 0, 0, 10113}, - {920, 952, 920, 0, 0, 10113}, - {921, 953, 921, 0, 0, 10113}, - {922, 954, 922, 0, 0, 10113}, - {923, 955, 923, 0, 0, 10113}, - {924, 956, 924, 0, 0, 10113}, - {925, 957, 925, 0, 0, 10113}, - {926, 958, 926, 0, 0, 10113}, - {927, 959, 927, 0, 0, 10113}, - {928, 960, 928, 0, 0, 10113}, - {929, 961, 929, 0, 0, 10113}, - {931, 963, 931, 0, 0, 10113}, - {932, 964, 932, 0, 0, 10113}, - {933, 965, 933, 0, 0, 10113}, - {934, 966, 934, 0, 0, 10113}, - {935, 967, 935, 0, 0, 10113}, - {936, 968, 936, 0, 0, 10113}, - {937, 969, 937, 0, 0, 10113}, - {938, 970, 938, 0, 0, 10113}, - {939, 971, 939, 0, 0, 10113}, - {902, 940, 902, 0, 0, 9993}, - {904, 941, 904, 0, 0, 9993}, - {905, 942, 905, 0, 0, 9993}, - {906, 943, 906, 0, 0, 9993}, + {-38, 0, -38, 0, 0, 9993}, + {-37, 0, -37, 0, 0, 9993}, {50331688, 19922980, 50331688, 0, 0, 26377}, - {913, 945, 913, 0, 0, 9993}, - {914, 946, 914, 0, 0, 9993}, - {915, 947, 915, 0, 0, 9993}, - {916, 948, 916, 0, 0, 9993}, - {917, 949, 917, 0, 0, 9993}, - {918, 950, 918, 0, 0, 9993}, - {919, 951, 919, 0, 0, 9993}, - {920, 952, 920, 0, 0, 9993}, - {921, 953, 921, 0, 0, 9993}, - {922, 954, 922, 0, 0, 9993}, - {923, 955, 923, 0, 0, 9993}, - {924, 956, 924, 0, 0, 9993}, - {925, 957, 925, 0, 0, 9993}, - {926, 958, 926, 0, 0, 9993}, - {927, 959, 927, 0, 0, 9993}, - {928, 960, 928, 0, 0, 9993}, - {929, 961, 929, 0, 0, 9993}, {16777261, 17825835, 16777261, 0, 0, 26377}, - {931, 963, 931, 0, 0, 9993}, - {932, 964, 932, 0, 0, 9993}, - {933, 965, 933, 0, 0, 9993}, - {934, 966, 934, 0, 0, 9993}, - {935, 967, 935, 0, 0, 9993}, - {936, 968, 936, 0, 0, 9993}, - {937, 969, 937, 0, 0, 9993}, - {938, 970, 938, 0, 0, 9993}, - {939, 971, 939, 0, 0, 9993}, - {908, 972, 908, 0, 0, 9993}, - {910, 973, 910, 0, 0, 9993}, - {911, 974, 911, 0, 0, 9993}, - {975, 983, 975, 0, 0, 10113}, + {-64, 0, -64, 0, 0, 9993}, + {-63, 0, -63, 0, 0, 9993}, + {0, 8, 0, 0, 0, 10113}, {16777264, 17825838, 16777264, 0, 0, 26377}, {16777267, 17825841, 16777267, 0, 0, 26377}, {0, 0, 0, 0, 0, 10113}, {16777270, 17825844, 16777270, 0, 0, 26377}, {16777273, 17825847, 16777273, 0, 0, 26377}, - {975, 983, 975, 0, 0, 9993}, - {984, 985, 984, 0, 0, 10113}, - {984, 985, 984, 0, 0, 9993}, - {986, 987, 986, 0, 0, 10113}, - {986, 987, 986, 0, 0, 9993}, - {988, 989, 988, 0, 0, 10113}, - {988, 989, 988, 0, 0, 9993}, - {990, 991, 990, 0, 0, 10113}, - {990, 991, 990, 0, 0, 9993}, - {992, 993, 992, 0, 0, 10113}, - {992, 993, 992, 0, 0, 9993}, - {994, 995, 994, 0, 0, 10113}, - {994, 995, 994, 0, 0, 9993}, - {996, 997, 996, 0, 0, 10113}, - {996, 997, 996, 0, 0, 9993}, - {998, 999, 998, 0, 0, 10113}, - {998, 999, 998, 0, 0, 9993}, - {1000, 1001, 1000, 0, 0, 10113}, - {1000, 1001, 1000, 0, 0, 9993}, - {1002, 1003, 1002, 0, 0, 10113}, - {1002, 1003, 1002, 0, 0, 9993}, - {1004, 1005, 1004, 0, 0, 10113}, - {1004, 1005, 1004, 0, 0, 9993}, - {1006, 1007, 1006, 0, 0, 10113}, - {1006, 1007, 1006, 0, 0, 9993}, + {-8, 0, -8, 0, 0, 9993}, {16777276, 17825850, 16777276, 0, 0, 26377}, {16777279, 17825853, 16777279, 0, 0, 26377}, - {1017, 1010, 1017, 0, 0, 9993}, - {1012, 952, 1012, 0, 0, 10113}, + {7, 0, 7, 0, 0, 9993}, + {0, -60, 0, 0, 0, 10113}, {16777282, 17825856, 16777282, 0, 0, 26377}, - {1015, 1016, 1015, 0, 0, 10113}, - {1015, 1016, 1015, 0, 0, 9993}, - {1017, 1010, 1017, 0, 0, 10113}, - {1018, 1019, 1018, 0, 0, 10113}, - {1018, 1019, 1018, 0, 0, 9993}, - {1021, 891, 1021, 0, 0, 10113}, - {1022, 892, 1022, 0, 0, 10113}, - {1023, 893, 1023, 0, 0, 10113}, - {1024, 1104, 1024, 0, 0, 10113}, - {1025, 1105, 1025, 0, 0, 10113}, - {1026, 1106, 1026, 0, 0, 10113}, - {1027, 1107, 1027, 0, 0, 10113}, - {1028, 1108, 1028, 0, 0, 10113}, - {1029, 1109, 1029, 0, 0, 10113}, - {1030, 1110, 1030, 0, 0, 10113}, - {1031, 1111, 1031, 0, 0, 10113}, - {1032, 1112, 1032, 0, 0, 10113}, - {1033, 1113, 1033, 0, 0, 10113}, - {1034, 1114, 1034, 0, 0, 10113}, - {1035, 1115, 1035, 0, 0, 10113}, - {1036, 1116, 1036, 0, 0, 10113}, - {1037, 1117, 1037, 0, 0, 10113}, - {1038, 1118, 1038, 0, 0, 10113}, - {1039, 1119, 1039, 0, 0, 10113}, - {1040, 1072, 1040, 0, 0, 10113}, - {1041, 1073, 1041, 0, 0, 10113}, - {1042, 1074, 1042, 0, 0, 10113}, - {1043, 1075, 1043, 0, 0, 10113}, - {1044, 1076, 1044, 0, 0, 10113}, - {1045, 1077, 1045, 0, 0, 10113}, - {1046, 1078, 1046, 0, 0, 10113}, - {1047, 1079, 1047, 0, 0, 10113}, - {1048, 1080, 1048, 0, 0, 10113}, - {1049, 1081, 1049, 0, 0, 10113}, - {1050, 1082, 1050, 0, 0, 10113}, - {1051, 1083, 1051, 0, 0, 10113}, - {1052, 1084, 1052, 0, 0, 10113}, - {1053, 1085, 1053, 0, 0, 10113}, - {1054, 1086, 1054, 0, 0, 10113}, - {1055, 1087, 1055, 0, 0, 10113}, - {1056, 1088, 1056, 0, 0, 10113}, - {1057, 1089, 1057, 0, 0, 10113}, - {1058, 1090, 1058, 0, 0, 10113}, - {1059, 1091, 1059, 0, 0, 10113}, - {1060, 1092, 1060, 0, 0, 10113}, - {1061, 1093, 1061, 0, 0, 10113}, - {1062, 1094, 1062, 0, 0, 10113}, - {1063, 1095, 1063, 0, 0, 10113}, - {1064, 1096, 1064, 0, 0, 10113}, - {1065, 1097, 1065, 0, 0, 10113}, - {1066, 1098, 1066, 0, 0, 10113}, - {1067, 1099, 1067, 0, 0, 10113}, - {1068, 1100, 1068, 0, 0, 10113}, - {1069, 1101, 1069, 0, 0, 10113}, - {1070, 1102, 1070, 0, 0, 10113}, - {1071, 1103, 1071, 0, 0, 10113}, - {1040, 1072, 1040, 0, 0, 9993}, - {1041, 1073, 1041, 0, 0, 9993}, - {1042, 1074, 1042, 0, 0, 9993}, - {1043, 1075, 1043, 0, 0, 9993}, - {1044, 1076, 1044, 0, 0, 9993}, - {1045, 1077, 1045, 0, 0, 9993}, - {1046, 1078, 1046, 0, 0, 9993}, - {1047, 1079, 1047, 0, 0, 9993}, - {1048, 1080, 1048, 0, 0, 9993}, - {1049, 1081, 1049, 0, 0, 9993}, - {1050, 1082, 1050, 0, 0, 9993}, - {1051, 1083, 1051, 0, 0, 9993}, - {1052, 1084, 1052, 0, 0, 9993}, - {1053, 1085, 1053, 0, 0, 9993}, - {1054, 1086, 1054, 0, 0, 9993}, - {1055, 1087, 1055, 0, 0, 9993}, - {1056, 1088, 1056, 0, 0, 9993}, - {1057, 1089, 1057, 0, 0, 9993}, - {1058, 1090, 1058, 0, 0, 9993}, - {1059, 1091, 1059, 0, 0, 9993}, - {1060, 1092, 1060, 0, 0, 9993}, - {1061, 1093, 1061, 0, 0, 9993}, - {1062, 1094, 1062, 0, 0, 9993}, - {1063, 1095, 1063, 0, 0, 9993}, - {1064, 1096, 1064, 0, 0, 9993}, - {1065, 1097, 1065, 0, 0, 9993}, - {1066, 1098, 1066, 0, 0, 9993}, - {1067, 1099, 1067, 0, 0, 9993}, - {1068, 1100, 1068, 0, 0, 9993}, - {1069, 1101, 1069, 0, 0, 9993}, - {1070, 1102, 1070, 0, 0, 9993}, - {1071, 1103, 1071, 0, 0, 9993}, - {1024, 1104, 1024, 0, 0, 9993}, - {1025, 1105, 1025, 0, 0, 9993}, - {1026, 1106, 1026, 0, 0, 9993}, - {1027, 1107, 1027, 0, 0, 9993}, - {1028, 1108, 1028, 0, 0, 9993}, - {1029, 1109, 1029, 0, 0, 9993}, - {1030, 1110, 1030, 0, 0, 9993}, - {1031, 1111, 1031, 0, 0, 9993}, - {1032, 1112, 1032, 0, 0, 9993}, - {1033, 1113, 1033, 0, 0, 9993}, - {1034, 1114, 1034, 0, 0, 9993}, - {1035, 1115, 1035, 0, 0, 9993}, - {1036, 1116, 1036, 0, 0, 9993}, - {1037, 1117, 1037, 0, 0, 9993}, - {1038, 1118, 1038, 0, 0, 9993}, - {1039, 1119, 1039, 0, 0, 9993}, - {1120, 1121, 1120, 0, 0, 10113}, - {1120, 1121, 1120, 0, 0, 9993}, - {1122, 1123, 1122, 0, 0, 10113}, - {1122, 1123, 1122, 0, 0, 9993}, - {1124, 1125, 1124, 0, 0, 10113}, - {1124, 1125, 1124, 0, 0, 9993}, - {1126, 1127, 1126, 0, 0, 10113}, - {1126, 1127, 1126, 0, 0, 9993}, - {1128, 1129, 1128, 0, 0, 10113}, - {1128, 1129, 1128, 0, 0, 9993}, - {1130, 1131, 1130, 0, 0, 10113}, - {1130, 1131, 1130, 0, 0, 9993}, - {1132, 1133, 1132, 0, 0, 10113}, - {1132, 1133, 1132, 0, 0, 9993}, - {1134, 1135, 1134, 0, 0, 10113}, - {1134, 1135, 1134, 0, 0, 9993}, - {1136, 1137, 1136, 0, 0, 10113}, - {1136, 1137, 1136, 0, 0, 9993}, - {1138, 1139, 1138, 0, 0, 10113}, - {1138, 1139, 1138, 0, 0, 9993}, - {1140, 1141, 1140, 0, 0, 10113}, - {1140, 1141, 1140, 0, 0, 9993}, - {1142, 1143, 1142, 0, 0, 10113}, - {1142, 1143, 1142, 0, 0, 9993}, - {1144, 1145, 1144, 0, 0, 10113}, - {1144, 1145, 1144, 0, 0, 9993}, - {1146, 1147, 1146, 0, 0, 10113}, - {1146, 1147, 1146, 0, 0, 9993}, - {1148, 1149, 1148, 0, 0, 10113}, - {1148, 1149, 1148, 0, 0, 9993}, - {1150, 1151, 1150, 0, 0, 10113}, - {1150, 1151, 1150, 0, 0, 9993}, - {1152, 1153, 1152, 0, 0, 10113}, - {1152, 1153, 1152, 0, 0, 9993}, - {1162, 1163, 1162, 0, 0, 10113}, - {1162, 1163, 1162, 0, 0, 9993}, - {1164, 1165, 1164, 0, 0, 10113}, - {1164, 1165, 1164, 0, 0, 9993}, - {1166, 1167, 1166, 0, 0, 10113}, - {1166, 1167, 1166, 0, 0, 9993}, - {1168, 1169, 1168, 0, 0, 10113}, - {1168, 1169, 1168, 0, 0, 9993}, - {1170, 1171, 1170, 0, 0, 10113}, - {1170, 1171, 1170, 0, 0, 9993}, - {1172, 1173, 1172, 0, 0, 10113}, - {1172, 1173, 1172, 0, 0, 9993}, - {1174, 1175, 1174, 0, 0, 10113}, - {1174, 1175, 1174, 0, 0, 9993}, - {1176, 1177, 1176, 0, 0, 10113}, - {1176, 1177, 1176, 0, 0, 9993}, - {1178, 1179, 1178, 0, 0, 10113}, - {1178, 1179, 1178, 0, 0, 9993}, - {1180, 1181, 1180, 0, 0, 10113}, - {1180, 1181, 1180, 0, 0, 9993}, - {1182, 1183, 1182, 0, 0, 10113}, - {1182, 1183, 1182, 0, 0, 9993}, - {1184, 1185, 1184, 0, 0, 10113}, - {1184, 1185, 1184, 0, 0, 9993}, - {1186, 1187, 1186, 0, 0, 10113}, - {1186, 1187, 1186, 0, 0, 9993}, - {1188, 1189, 1188, 0, 0, 10113}, - {1188, 1189, 1188, 0, 0, 9993}, - {1190, 1191, 1190, 0, 0, 10113}, - {1190, 1191, 1190, 0, 0, 9993}, - {1192, 1193, 1192, 0, 0, 10113}, - {1192, 1193, 1192, 0, 0, 9993}, - {1194, 1195, 1194, 0, 0, 10113}, - {1194, 1195, 1194, 0, 0, 9993}, - {1196, 1197, 1196, 0, 0, 10113}, - {1196, 1197, 1196, 0, 0, 9993}, - {1198, 1199, 1198, 0, 0, 10113}, - {1198, 1199, 1198, 0, 0, 9993}, - {1200, 1201, 1200, 0, 0, 10113}, - {1200, 1201, 1200, 0, 0, 9993}, - {1202, 1203, 1202, 0, 0, 10113}, - {1202, 1203, 1202, 0, 0, 9993}, - {1204, 1205, 1204, 0, 0, 10113}, - {1204, 1205, 1204, 0, 0, 9993}, - {1206, 1207, 1206, 0, 0, 10113}, - {1206, 1207, 1206, 0, 0, 9993}, - {1208, 1209, 1208, 0, 0, 10113}, - {1208, 1209, 1208, 0, 0, 9993}, - {1210, 1211, 1210, 0, 0, 10113}, - {1210, 1211, 1210, 0, 0, 9993}, - {1212, 1213, 1212, 0, 0, 10113}, - {1212, 1213, 1212, 0, 0, 9993}, - {1214, 1215, 1214, 0, 0, 10113}, - {1214, 1215, 1214, 0, 0, 9993}, - {1216, 1231, 1216, 0, 0, 10113}, - {1217, 1218, 1217, 0, 0, 10113}, - {1217, 1218, 1217, 0, 0, 9993}, - {1219, 1220, 1219, 0, 0, 10113}, - {1219, 1220, 1219, 0, 0, 9993}, - {1221, 1222, 1221, 0, 0, 10113}, - {1221, 1222, 1221, 0, 0, 9993}, - {1223, 1224, 1223, 0, 0, 10113}, - {1223, 1224, 1223, 0, 0, 9993}, - {1225, 1226, 1225, 0, 0, 10113}, - {1225, 1226, 1225, 0, 0, 9993}, - {1227, 1228, 1227, 0, 0, 10113}, - {1227, 1228, 1227, 0, 0, 9993}, - {1229, 1230, 1229, 0, 0, 10113}, - {1229, 1230, 1229, 0, 0, 9993}, - {1216, 1231, 1216, 0, 0, 9993}, - {1232, 1233, 1232, 0, 0, 10113}, - {1232, 1233, 1232, 0, 0, 9993}, - {1234, 1235, 1234, 0, 0, 10113}, - {1234, 1235, 1234, 0, 0, 9993}, - {1236, 1237, 1236, 0, 0, 10113}, - {1236, 1237, 1236, 0, 0, 9993}, - {1238, 1239, 1238, 0, 0, 10113}, - {1238, 1239, 1238, 0, 0, 9993}, - {1240, 1241, 1240, 0, 0, 10113}, - {1240, 1241, 1240, 0, 0, 9993}, - {1242, 1243, 1242, 0, 0, 10113}, - {1242, 1243, 1242, 0, 0, 9993}, - {1244, 1245, 1244, 0, 0, 10113}, - {1244, 1245, 1244, 0, 0, 9993}, - {1246, 1247, 1246, 0, 0, 10113}, - {1246, 1247, 1246, 0, 0, 9993}, - {1248, 1249, 1248, 0, 0, 10113}, - {1248, 1249, 1248, 0, 0, 9993}, - {1250, 1251, 1250, 0, 0, 10113}, - {1250, 1251, 1250, 0, 0, 9993}, - {1252, 1253, 1252, 0, 0, 10113}, - {1252, 1253, 1252, 0, 0, 9993}, - {1254, 1255, 1254, 0, 0, 10113}, - {1254, 1255, 1254, 0, 0, 9993}, - {1256, 1257, 1256, 0, 0, 10113}, - {1256, 1257, 1256, 0, 0, 9993}, - {1258, 1259, 1258, 0, 0, 10113}, - {1258, 1259, 1258, 0, 0, 9993}, - {1260, 1261, 1260, 0, 0, 10113}, - {1260, 1261, 1260, 0, 0, 9993}, - {1262, 1263, 1262, 0, 0, 10113}, - {1262, 1263, 1262, 0, 0, 9993}, - {1264, 1265, 1264, 0, 0, 10113}, - {1264, 1265, 1264, 0, 0, 9993}, - {1266, 1267, 1266, 0, 0, 10113}, - {1266, 1267, 1266, 0, 0, 9993}, - {1268, 1269, 1268, 0, 0, 10113}, - {1268, 1269, 1268, 0, 0, 9993}, - {1270, 1271, 1270, 0, 0, 10113}, - {1270, 1271, 1270, 0, 0, 9993}, - {1272, 1273, 1272, 0, 0, 10113}, - {1272, 1273, 1272, 0, 0, 9993}, - {1274, 1275, 1274, 0, 0, 10113}, - {1274, 1275, 1274, 0, 0, 9993}, - {1276, 1277, 1276, 0, 0, 10113}, - {1276, 1277, 1276, 0, 0, 9993}, - {1278, 1279, 1278, 0, 0, 10113}, - {1278, 1279, 1278, 0, 0, 9993}, - {1280, 1281, 1280, 0, 0, 10113}, - {1280, 1281, 1280, 0, 0, 9993}, - {1282, 1283, 1282, 0, 0, 10113}, - {1282, 1283, 1282, 0, 0, 9993}, - {1284, 1285, 1284, 0, 0, 10113}, - {1284, 1285, 1284, 0, 0, 9993}, - {1286, 1287, 1286, 0, 0, 10113}, - {1286, 1287, 1286, 0, 0, 9993}, - {1288, 1289, 1288, 0, 0, 10113}, - {1288, 1289, 1288, 0, 0, 9993}, - {1290, 1291, 1290, 0, 0, 10113}, - {1290, 1291, 1290, 0, 0, 9993}, - {1292, 1293, 1292, 0, 0, 10113}, - {1292, 1293, 1292, 0, 0, 9993}, - {1294, 1295, 1294, 0, 0, 10113}, - {1294, 1295, 1294, 0, 0, 9993}, - {1296, 1297, 1296, 0, 0, 10113}, - {1296, 1297, 1296, 0, 0, 9993}, - {1298, 1299, 1298, 0, 0, 10113}, - {1298, 1299, 1298, 0, 0, 9993}, - {1300, 1301, 1300, 0, 0, 10113}, - {1300, 1301, 1300, 0, 0, 9993}, - {1302, 1303, 1302, 0, 0, 10113}, - {1302, 1303, 1302, 0, 0, 9993}, - {1304, 1305, 1304, 0, 0, 10113}, - {1304, 1305, 1304, 0, 0, 9993}, - {1306, 1307, 1306, 0, 0, 10113}, - {1306, 1307, 1306, 0, 0, 9993}, - {1308, 1309, 1308, 0, 0, 10113}, - {1308, 1309, 1308, 0, 0, 9993}, - {1310, 1311, 1310, 0, 0, 10113}, - {1310, 1311, 1310, 0, 0, 9993}, - {1312, 1313, 1312, 0, 0, 10113}, - {1312, 1313, 1312, 0, 0, 9993}, - {1314, 1315, 1314, 0, 0, 10113}, - {1314, 1315, 1314, 0, 0, 9993}, - {1316, 1317, 1316, 0, 0, 10113}, - {1316, 1317, 1316, 0, 0, 9993}, - {1318, 1319, 1318, 0, 0, 10113}, - {1318, 1319, 1318, 0, 0, 9993}, - {1329, 1377, 1329, 0, 0, 10113}, - {1330, 1378, 1330, 0, 0, 10113}, - {1331, 1379, 1331, 0, 0, 10113}, - {1332, 1380, 1332, 0, 0, 10113}, - {1333, 1381, 1333, 0, 0, 10113}, - {1334, 1382, 1334, 0, 0, 10113}, - {1335, 1383, 1335, 0, 0, 10113}, - {1336, 1384, 1336, 0, 0, 10113}, - {1337, 1385, 1337, 0, 0, 10113}, - {1338, 1386, 1338, 0, 0, 10113}, - {1339, 1387, 1339, 0, 0, 10113}, - {1340, 1388, 1340, 0, 0, 10113}, - {1341, 1389, 1341, 0, 0, 10113}, - {1342, 1390, 1342, 0, 0, 10113}, - {1343, 1391, 1343, 0, 0, 10113}, - {1344, 1392, 1344, 0, 0, 10113}, - {1345, 1393, 1345, 0, 0, 10113}, - {1346, 1394, 1346, 0, 0, 10113}, - {1347, 1395, 1347, 0, 0, 10113}, - {1348, 1396, 1348, 0, 0, 10113}, - {1349, 1397, 1349, 0, 0, 10113}, - {1350, 1398, 1350, 0, 0, 10113}, - {1351, 1399, 1351, 0, 0, 10113}, - {1352, 1400, 1352, 0, 0, 10113}, - {1353, 1401, 1353, 0, 0, 10113}, - {1354, 1402, 1354, 0, 0, 10113}, - {1355, 1403, 1355, 0, 0, 10113}, - {1356, 1404, 1356, 0, 0, 10113}, - {1357, 1405, 1357, 0, 0, 10113}, - {1358, 1406, 1358, 0, 0, 10113}, - {1359, 1407, 1359, 0, 0, 10113}, - {1360, 1408, 1360, 0, 0, 10113}, - {1361, 1409, 1361, 0, 0, 10113}, - {1362, 1410, 1362, 0, 0, 10113}, - {1363, 1411, 1363, 0, 0, 10113}, - {1364, 1412, 1364, 0, 0, 10113}, - {1365, 1413, 1365, 0, 0, 10113}, - {1366, 1414, 1366, 0, 0, 10113}, - {1329, 1377, 1329, 0, 0, 9993}, - {1330, 1378, 1330, 0, 0, 9993}, - {1331, 1379, 1331, 0, 0, 9993}, - {1332, 1380, 1332, 0, 0, 9993}, - {1333, 1381, 1333, 0, 0, 9993}, - {1334, 1382, 1334, 0, 0, 9993}, - {1335, 1383, 1335, 0, 0, 9993}, - {1336, 1384, 1336, 0, 0, 9993}, - {1337, 1385, 1337, 0, 0, 9993}, - {1338, 1386, 1338, 0, 0, 9993}, - {1339, 1387, 1339, 0, 0, 9993}, - {1340, 1388, 1340, 0, 0, 9993}, - {1341, 1389, 1341, 0, 0, 9993}, - {1342, 1390, 1342, 0, 0, 9993}, - {1343, 1391, 1343, 0, 0, 9993}, - {1344, 1392, 1344, 0, 0, 9993}, - {1345, 1393, 1345, 0, 0, 9993}, - {1346, 1394, 1346, 0, 0, 9993}, - {1347, 1395, 1347, 0, 0, 9993}, - {1348, 1396, 1348, 0, 0, 9993}, - {1349, 1397, 1349, 0, 0, 9993}, - {1350, 1398, 1350, 0, 0, 9993}, - {1351, 1399, 1351, 0, 0, 9993}, - {1352, 1400, 1352, 0, 0, 9993}, - {1353, 1401, 1353, 0, 0, 9993}, - {1354, 1402, 1354, 0, 0, 9993}, - {1355, 1403, 1355, 0, 0, 9993}, - {1356, 1404, 1356, 0, 0, 9993}, - {1357, 1405, 1357, 0, 0, 9993}, - {1358, 1406, 1358, 0, 0, 9993}, - {1359, 1407, 1359, 0, 0, 9993}, - {1360, 1408, 1360, 0, 0, 9993}, - {1361, 1409, 1361, 0, 0, 9993}, - {1362, 1410, 1362, 0, 0, 9993}, - {1363, 1411, 1363, 0, 0, 9993}, - {1364, 1412, 1364, 0, 0, 9993}, - {1365, 1413, 1365, 0, 0, 9993}, - {1366, 1414, 1366, 0, 0, 9993}, + {0, -7, 0, 0, 0, 10113}, + {0, 80, 0, 0, 0, 10113}, + {-80, 0, -80, 0, 0, 9993}, + {0, 15, 0, 0, 0, 10113}, + {-15, 0, -15, 0, 0, 9993}, + {0, 48, 0, 0, 0, 10113}, + {-48, 0, -48, 0, 0, 9993}, {33554502, 18874435, 33554504, 0, 0, 26377}, {0, 0, 0, 0, 0, 1537}, - {4256, 11520, 4256, 0, 0, 10113}, - {4257, 11521, 4257, 0, 0, 10113}, - {4258, 11522, 4258, 0, 0, 10113}, - {4259, 11523, 4259, 0, 0, 10113}, - {4260, 11524, 4260, 0, 0, 10113}, - {4261, 11525, 4261, 0, 0, 10113}, - {4262, 11526, 4262, 0, 0, 10113}, - {4263, 11527, 4263, 0, 0, 10113}, - {4264, 11528, 4264, 0, 0, 10113}, - {4265, 11529, 4265, 0, 0, 10113}, - {4266, 11530, 4266, 0, 0, 10113}, - {4267, 11531, 4267, 0, 0, 10113}, - {4268, 11532, 4268, 0, 0, 10113}, - {4269, 11533, 4269, 0, 0, 10113}, - {4270, 11534, 4270, 0, 0, 10113}, - {4271, 11535, 4271, 0, 0, 10113}, - {4272, 11536, 4272, 0, 0, 10113}, - {4273, 11537, 4273, 0, 0, 10113}, - {4274, 11538, 4274, 0, 0, 10113}, - {4275, 11539, 4275, 0, 0, 10113}, - {4276, 11540, 4276, 0, 0, 10113}, - {4277, 11541, 4277, 0, 0, 10113}, - {4278, 11542, 4278, 0, 0, 10113}, - {4279, 11543, 4279, 0, 0, 10113}, - {4280, 11544, 4280, 0, 0, 10113}, - {4281, 11545, 4281, 0, 0, 10113}, - {4282, 11546, 4282, 0, 0, 10113}, - {4283, 11547, 4283, 0, 0, 10113}, - {4284, 11548, 4284, 0, 0, 10113}, - {4285, 11549, 4285, 0, 0, 10113}, - {4286, 11550, 4286, 0, 0, 10113}, - {4287, 11551, 4287, 0, 0, 10113}, - {4288, 11552, 4288, 0, 0, 10113}, - {4289, 11553, 4289, 0, 0, 10113}, - {4290, 11554, 4290, 0, 0, 10113}, - {4291, 11555, 4291, 0, 0, 10113}, - {4292, 11556, 4292, 0, 0, 10113}, - {4293, 11557, 4293, 0, 0, 10113}, + {0, 7264, 0, 0, 0, 10113}, {0, 0, 0, 0, 1, 3588}, {0, 0, 0, 0, 2, 3588}, {0, 0, 0, 0, 3, 3588}, @@ -1028,158 +143,8 @@ {0, 0, 0, 0, 8, 3588}, {0, 0, 0, 0, 9, 3588}, {0, 0, 0, 0, 0, 3840}, - {42877, 7545, 42877, 0, 0, 9993}, - {11363, 7549, 11363, 0, 0, 9993}, - {7680, 7681, 7680, 0, 0, 10113}, - {7680, 7681, 7680, 0, 0, 9993}, - {7682, 7683, 7682, 0, 0, 10113}, - {7682, 7683, 7682, 0, 0, 9993}, - {7684, 7685, 7684, 0, 0, 10113}, - {7684, 7685, 7684, 0, 0, 9993}, - {7686, 7687, 7686, 0, 0, 10113}, - {7686, 7687, 7686, 0, 0, 9993}, - {7688, 7689, 7688, 0, 0, 10113}, - {7688, 7689, 7688, 0, 0, 9993}, - {7690, 7691, 7690, 0, 0, 10113}, - {7690, 7691, 7690, 0, 0, 9993}, - {7692, 7693, 7692, 0, 0, 10113}, - {7692, 7693, 7692, 0, 0, 9993}, - {7694, 7695, 7694, 0, 0, 10113}, - {7694, 7695, 7694, 0, 0, 9993}, - {7696, 7697, 7696, 0, 0, 10113}, - {7696, 7697, 7696, 0, 0, 9993}, - {7698, 7699, 7698, 0, 0, 10113}, - {7698, 7699, 7698, 0, 0, 9993}, - {7700, 7701, 7700, 0, 0, 10113}, - {7700, 7701, 7700, 0, 0, 9993}, - {7702, 7703, 7702, 0, 0, 10113}, - {7702, 7703, 7702, 0, 0, 9993}, - {7704, 7705, 7704, 0, 0, 10113}, - {7704, 7705, 7704, 0, 0, 9993}, - {7706, 7707, 7706, 0, 0, 10113}, - {7706, 7707, 7706, 0, 0, 9993}, - {7708, 7709, 7708, 0, 0, 10113}, - {7708, 7709, 7708, 0, 0, 9993}, - {7710, 7711, 7710, 0, 0, 10113}, - {7710, 7711, 7710, 0, 0, 9993}, - {7712, 7713, 7712, 0, 0, 10113}, - {7712, 7713, 7712, 0, 0, 9993}, - {7714, 7715, 7714, 0, 0, 10113}, - {7714, 7715, 7714, 0, 0, 9993}, - {7716, 7717, 7716, 0, 0, 10113}, - {7716, 7717, 7716, 0, 0, 9993}, - {7718, 7719, 7718, 0, 0, 10113}, - {7718, 7719, 7718, 0, 0, 9993}, - {7720, 7721, 7720, 0, 0, 10113}, - {7720, 7721, 7720, 0, 0, 9993}, - {7722, 7723, 7722, 0, 0, 10113}, - {7722, 7723, 7722, 0, 0, 9993}, - {7724, 7725, 7724, 0, 0, 10113}, - {7724, 7725, 7724, 0, 0, 9993}, - {7726, 7727, 7726, 0, 0, 10113}, - {7726, 7727, 7726, 0, 0, 9993}, - {7728, 7729, 7728, 0, 0, 10113}, - {7728, 7729, 7728, 0, 0, 9993}, - {7730, 7731, 7730, 0, 0, 10113}, - {7730, 7731, 7730, 0, 0, 9993}, - {7732, 7733, 7732, 0, 0, 10113}, - {7732, 7733, 7732, 0, 0, 9993}, - {7734, 7735, 7734, 0, 0, 10113}, - {7734, 7735, 7734, 0, 0, 9993}, - {7736, 7737, 7736, 0, 0, 10113}, - {7736, 7737, 7736, 0, 0, 9993}, - {7738, 7739, 7738, 0, 0, 10113}, - {7738, 7739, 7738, 0, 0, 9993}, - {7740, 7741, 7740, 0, 0, 10113}, - {7740, 7741, 7740, 0, 0, 9993}, - {7742, 7743, 7742, 0, 0, 10113}, - {7742, 7743, 7742, 0, 0, 9993}, - {7744, 7745, 7744, 0, 0, 10113}, - {7744, 7745, 7744, 0, 0, 9993}, - {7746, 7747, 7746, 0, 0, 10113}, - {7746, 7747, 7746, 0, 0, 9993}, - {7748, 7749, 7748, 0, 0, 10113}, - {7748, 7749, 7748, 0, 0, 9993}, - {7750, 7751, 7750, 0, 0, 10113}, - {7750, 7751, 7750, 0, 0, 9993}, - {7752, 7753, 7752, 0, 0, 10113}, - {7752, 7753, 7752, 0, 0, 9993}, - {7754, 7755, 7754, 0, 0, 10113}, - {7754, 7755, 7754, 0, 0, 9993}, - {7756, 7757, 7756, 0, 0, 10113}, - {7756, 7757, 7756, 0, 0, 9993}, - {7758, 7759, 7758, 0, 0, 10113}, - {7758, 7759, 7758, 0, 0, 9993}, - {7760, 7761, 7760, 0, 0, 10113}, - {7760, 7761, 7760, 0, 0, 9993}, - {7762, 7763, 7762, 0, 0, 10113}, - {7762, 7763, 7762, 0, 0, 9993}, - {7764, 7765, 7764, 0, 0, 10113}, - {7764, 7765, 7764, 0, 0, 9993}, - {7766, 7767, 7766, 0, 0, 10113}, - {7766, 7767, 7766, 0, 0, 9993}, - {7768, 7769, 7768, 0, 0, 10113}, - {7768, 7769, 7768, 0, 0, 9993}, - {7770, 7771, 7770, 0, 0, 10113}, - {7770, 7771, 7770, 0, 0, 9993}, - {7772, 7773, 7772, 0, 0, 10113}, - {7772, 7773, 7772, 0, 0, 9993}, - {7774, 7775, 7774, 0, 0, 10113}, - {7774, 7775, 7774, 0, 0, 9993}, - {7776, 7777, 7776, 0, 0, 10113}, - {7776, 7777, 7776, 0, 0, 9993}, - {7778, 7779, 7778, 0, 0, 10113}, - {7778, 7779, 7778, 0, 0, 9993}, - {7780, 7781, 7780, 0, 0, 10113}, - {7780, 7781, 7780, 0, 0, 9993}, - {7782, 7783, 7782, 0, 0, 10113}, - {7782, 7783, 7782, 0, 0, 9993}, - {7784, 7785, 7784, 0, 0, 10113}, - {7784, 7785, 7784, 0, 0, 9993}, - {7786, 7787, 7786, 0, 0, 10113}, - {7786, 7787, 7786, 0, 0, 9993}, - {7788, 7789, 7788, 0, 0, 10113}, - {7788, 7789, 7788, 0, 0, 9993}, - {7790, 7791, 7790, 0, 0, 10113}, - {7790, 7791, 7790, 0, 0, 9993}, - {7792, 7793, 7792, 0, 0, 10113}, - {7792, 7793, 7792, 0, 0, 9993}, - {7794, 7795, 7794, 0, 0, 10113}, - {7794, 7795, 7794, 0, 0, 9993}, - {7796, 7797, 7796, 0, 0, 10113}, - {7796, 7797, 7796, 0, 0, 9993}, - {7798, 7799, 7798, 0, 0, 10113}, - {7798, 7799, 7798, 0, 0, 9993}, - {7800, 7801, 7800, 0, 0, 10113}, - {7800, 7801, 7800, 0, 0, 9993}, - {7802, 7803, 7802, 0, 0, 10113}, - {7802, 7803, 7802, 0, 0, 9993}, - {7804, 7805, 7804, 0, 0, 10113}, - {7804, 7805, 7804, 0, 0, 9993}, - {7806, 7807, 7806, 0, 0, 10113}, - {7806, 7807, 7806, 0, 0, 9993}, - {7808, 7809, 7808, 0, 0, 10113}, - {7808, 7809, 7808, 0, 0, 9993}, - {7810, 7811, 7810, 0, 0, 10113}, - {7810, 7811, 7810, 0, 0, 9993}, - {7812, 7813, 7812, 0, 0, 10113}, - {7812, 7813, 7812, 0, 0, 9993}, - {7814, 7815, 7814, 0, 0, 10113}, - {7814, 7815, 7814, 0, 0, 9993}, - {7816, 7817, 7816, 0, 0, 10113}, - {7816, 7817, 7816, 0, 0, 9993}, - {7818, 7819, 7818, 0, 0, 10113}, - {7818, 7819, 7818, 0, 0, 9993}, - {7820, 7821, 7820, 0, 0, 10113}, - {7820, 7821, 7820, 0, 0, 9993}, - {7822, 7823, 7822, 0, 0, 10113}, - {7822, 7823, 7822, 0, 0, 9993}, - {7824, 7825, 7824, 0, 0, 10113}, - {7824, 7825, 7824, 0, 0, 9993}, - {7826, 7827, 7826, 0, 0, 10113}, - {7826, 7827, 7826, 0, 0, 9993}, - {7828, 7829, 7828, 0, 0, 10113}, - {7828, 7829, 7828, 0, 0, 9993}, + {35332, 0, 35332, 0, 0, 9993}, + {3814, 0, 3814, 0, 0, 9993}, {33554509, 18874442, 33554509, 0, 0, 26377}, {33554514, 18874447, 33554514, 0, 0, 26377}, {33554519, 18874452, 33554519, 0, 0, 26377}, @@ -1187,216 +152,18 @@ {33554529, 18874462, 33554529, 0, 0, 26377}, {16777317, 17825891, 16777317, 0, 0, 26377}, {16777321, 18874470, 16777321, 0, 0, 26497}, - {7840, 7841, 7840, 0, 0, 10113}, - {7840, 7841, 7840, 0, 0, 9993}, - {7842, 7843, 7842, 0, 0, 10113}, - {7842, 7843, 7842, 0, 0, 9993}, - {7844, 7845, 7844, 0, 0, 10113}, - {7844, 7845, 7844, 0, 0, 9993}, - {7846, 7847, 7846, 0, 0, 10113}, - {7846, 7847, 7846, 0, 0, 9993}, - {7848, 7849, 7848, 0, 0, 10113}, - {7848, 7849, 7848, 0, 0, 9993}, - {7850, 7851, 7850, 0, 0, 10113}, - {7850, 7851, 7850, 0, 0, 9993}, - {7852, 7853, 7852, 0, 0, 10113}, - {7852, 7853, 7852, 0, 0, 9993}, - {7854, 7855, 7854, 0, 0, 10113}, - {7854, 7855, 7854, 0, 0, 9993}, - {7856, 7857, 7856, 0, 0, 10113}, - {7856, 7857, 7856, 0, 0, 9993}, - {7858, 7859, 7858, 0, 0, 10113}, - {7858, 7859, 7858, 0, 0, 9993}, - {7860, 7861, 7860, 0, 0, 10113}, - {7860, 7861, 7860, 0, 0, 9993}, - {7862, 7863, 7862, 0, 0, 10113}, - {7862, 7863, 7862, 0, 0, 9993}, - {7864, 7865, 7864, 0, 0, 10113}, - {7864, 7865, 7864, 0, 0, 9993}, - {7866, 7867, 7866, 0, 0, 10113}, - {7866, 7867, 7866, 0, 0, 9993}, - {7868, 7869, 7868, 0, 0, 10113}, - {7868, 7869, 7868, 0, 0, 9993}, - {7870, 7871, 7870, 0, 0, 10113}, - {7870, 7871, 7870, 0, 0, 9993}, - {7872, 7873, 7872, 0, 0, 10113}, - {7872, 7873, 7872, 0, 0, 9993}, - {7874, 7875, 7874, 0, 0, 10113}, - {7874, 7875, 7874, 0, 0, 9993}, - {7876, 7877, 7876, 0, 0, 10113}, - {7876, 7877, 7876, 0, 0, 9993}, - {7878, 7879, 7878, 0, 0, 10113}, - {7878, 7879, 7878, 0, 0, 9993}, - {7880, 7881, 7880, 0, 0, 10113}, - {7880, 7881, 7880, 0, 0, 9993}, - {7882, 7883, 7882, 0, 0, 10113}, - {7882, 7883, 7882, 0, 0, 9993}, - {7884, 7885, 7884, 0, 0, 10113}, - {7884, 7885, 7884, 0, 0, 9993}, - {7886, 7887, 7886, 0, 0, 10113}, - {7886, 7887, 7886, 0, 0, 9993}, - {7888, 7889, 7888, 0, 0, 10113}, - {7888, 7889, 7888, 0, 0, 9993}, - {7890, 7891, 7890, 0, 0, 10113}, - {7890, 7891, 7890, 0, 0, 9993}, - {7892, 7893, 7892, 0, 0, 10113}, - {7892, 7893, 7892, 0, 0, 9993}, - {7894, 7895, 7894, 0, 0, 10113}, - {7894, 7895, 7894, 0, 0, 9993}, - {7896, 7897, 7896, 0, 0, 10113}, - {7896, 7897, 7896, 0, 0, 9993}, - {7898, 7899, 7898, 0, 0, 10113}, - {7898, 7899, 7898, 0, 0, 9993}, - {7900, 7901, 7900, 0, 0, 10113}, - {7900, 7901, 7900, 0, 0, 9993}, - {7902, 7903, 7902, 0, 0, 10113}, - {7902, 7903, 7902, 0, 0, 9993}, - {7904, 7905, 7904, 0, 0, 10113}, - {7904, 7905, 7904, 0, 0, 9993}, - {7906, 7907, 7906, 0, 0, 10113}, - {7906, 7907, 7906, 0, 0, 9993}, - {7908, 7909, 7908, 0, 0, 10113}, - {7908, 7909, 7908, 0, 0, 9993}, - {7910, 7911, 7910, 0, 0, 10113}, - {7910, 7911, 7910, 0, 0, 9993}, - {7912, 7913, 7912, 0, 0, 10113}, - {7912, 7913, 7912, 0, 0, 9993}, - {7914, 7915, 7914, 0, 0, 10113}, - {7914, 7915, 7914, 0, 0, 9993}, - {7916, 7917, 7916, 0, 0, 10113}, - {7916, 7917, 7916, 0, 0, 9993}, - {7918, 7919, 7918, 0, 0, 10113}, - {7918, 7919, 7918, 0, 0, 9993}, - {7920, 7921, 7920, 0, 0, 10113}, - {7920, 7921, 7920, 0, 0, 9993}, - {7922, 7923, 7922, 0, 0, 10113}, - {7922, 7923, 7922, 0, 0, 9993}, - {7924, 7925, 7924, 0, 0, 10113}, - {7924, 7925, 7924, 0, 0, 9993}, - {7926, 7927, 7926, 0, 0, 10113}, - {7926, 7927, 7926, 0, 0, 9993}, - {7928, 7929, 7928, 0, 0, 10113}, - {7928, 7929, 7928, 0, 0, 9993}, - {7930, 7931, 7930, 0, 0, 10113}, - {7930, 7931, 7930, 0, 0, 9993}, - {7932, 7933, 7932, 0, 0, 10113}, - {7932, 7933, 7932, 0, 0, 9993}, - {7934, 7935, 7934, 0, 0, 10113}, - {7934, 7935, 7934, 0, 0, 9993}, - {7944, 7936, 7944, 0, 0, 9993}, - {7945, 7937, 7945, 0, 0, 9993}, - {7946, 7938, 7946, 0, 0, 9993}, - {7947, 7939, 7947, 0, 0, 9993}, - {7948, 7940, 7948, 0, 0, 9993}, - {7949, 7941, 7949, 0, 0, 9993}, - {7950, 7942, 7950, 0, 0, 9993}, - {7951, 7943, 7951, 0, 0, 9993}, - {7944, 7936, 7944, 0, 0, 10113}, - {7945, 7937, 7945, 0, 0, 10113}, - {7946, 7938, 7946, 0, 0, 10113}, - {7947, 7939, 7947, 0, 0, 10113}, - {7948, 7940, 7948, 0, 0, 10113}, - {7949, 7941, 7949, 0, 0, 10113}, - {7950, 7942, 7950, 0, 0, 10113}, - {7951, 7943, 7951, 0, 0, 10113}, - {7960, 7952, 7960, 0, 0, 9993}, - {7961, 7953, 7961, 0, 0, 9993}, - {7962, 7954, 7962, 0, 0, 9993}, - {7963, 7955, 7963, 0, 0, 9993}, - {7964, 7956, 7964, 0, 0, 9993}, - {7965, 7957, 7965, 0, 0, 9993}, - {7960, 7952, 7960, 0, 0, 10113}, - {7961, 7953, 7961, 0, 0, 10113}, - {7962, 7954, 7962, 0, 0, 10113}, - {7963, 7955, 7963, 0, 0, 10113}, - {7964, 7956, 7964, 0, 0, 10113}, - {7965, 7957, 7965, 0, 0, 10113}, - {7976, 7968, 7976, 0, 0, 9993}, - {7977, 7969, 7977, 0, 0, 9993}, - {7978, 7970, 7978, 0, 0, 9993}, - {7979, 7971, 7979, 0, 0, 9993}, - {7980, 7972, 7980, 0, 0, 9993}, - {7981, 7973, 7981, 0, 0, 9993}, - {7982, 7974, 7982, 0, 0, 9993}, - {7983, 7975, 7983, 0, 0, 9993}, - {7976, 7968, 7976, 0, 0, 10113}, - {7977, 7969, 7977, 0, 0, 10113}, - {7978, 7970, 7978, 0, 0, 10113}, - {7979, 7971, 7979, 0, 0, 10113}, - {7980, 7972, 7980, 0, 0, 10113}, - {7981, 7973, 7981, 0, 0, 10113}, - {7982, 7974, 7982, 0, 0, 10113}, - {7983, 7975, 7983, 0, 0, 10113}, - {7992, 7984, 7992, 0, 0, 9993}, - {7993, 7985, 7993, 0, 0, 9993}, - {7994, 7986, 7994, 0, 0, 9993}, - {7995, 7987, 7995, 0, 0, 9993}, - {7996, 7988, 7996, 0, 0, 9993}, - {7997, 7989, 7997, 0, 0, 9993}, - {7998, 7990, 7998, 0, 0, 9993}, - {7999, 7991, 7999, 0, 0, 9993}, - {7992, 7984, 7992, 0, 0, 10113}, - {7993, 7985, 7993, 0, 0, 10113}, - {7994, 7986, 7994, 0, 0, 10113}, - {7995, 7987, 7995, 0, 0, 10113}, - {7996, 7988, 7996, 0, 0, 10113}, - {7997, 7989, 7997, 0, 0, 10113}, - {7998, 7990, 7998, 0, 0, 10113}, - {7999, 7991, 7999, 0, 0, 10113}, - {8008, 8000, 8008, 0, 0, 9993}, - {8009, 8001, 8009, 0, 0, 9993}, - {8010, 8002, 8010, 0, 0, 9993}, - {8011, 8003, 8011, 0, 0, 9993}, - {8012, 8004, 8012, 0, 0, 9993}, - {8013, 8005, 8013, 0, 0, 9993}, - {8008, 8000, 8008, 0, 0, 10113}, - {8009, 8001, 8009, 0, 0, 10113}, - {8010, 8002, 8010, 0, 0, 10113}, - {8011, 8003, 8011, 0, 0, 10113}, - {8012, 8004, 8012, 0, 0, 10113}, - {8013, 8005, 8013, 0, 0, 10113}, + {8, 0, 8, 0, 0, 9993}, + {0, -8, 0, 0, 0, 10113}, {33554541, 18874474, 33554541, 0, 0, 26377}, - {8025, 8017, 8025, 0, 0, 9993}, {50331763, 19923055, 50331763, 0, 0, 26377}, - {8027, 8019, 8027, 0, 0, 9993}, {50331770, 19923062, 50331770, 0, 0, 26377}, - {8029, 8021, 8029, 0, 0, 9993}, {50331777, 19923069, 50331777, 0, 0, 26377}, - {8031, 8023, 8031, 0, 0, 9993}, - {8025, 8017, 8025, 0, 0, 10113}, - {8027, 8019, 8027, 0, 0, 10113}, - {8029, 8021, 8029, 0, 0, 10113}, - {8031, 8023, 8031, 0, 0, 10113}, - {8040, 8032, 8040, 0, 0, 9993}, - {8041, 8033, 8041, 0, 0, 9993}, - {8042, 8034, 8042, 0, 0, 9993}, - {8043, 8035, 8043, 0, 0, 9993}, - {8044, 8036, 8044, 0, 0, 9993}, - {8045, 8037, 8045, 0, 0, 9993}, - {8046, 8038, 8046, 0, 0, 9993}, - {8047, 8039, 8047, 0, 0, 9993}, - {8040, 8032, 8040, 0, 0, 10113}, - {8041, 8033, 8041, 0, 0, 10113}, - {8042, 8034, 8042, 0, 0, 10113}, - {8043, 8035, 8043, 0, 0, 10113}, - {8044, 8036, 8044, 0, 0, 10113}, - {8045, 8037, 8045, 0, 0, 10113}, - {8046, 8038, 8046, 0, 0, 10113}, - {8047, 8039, 8047, 0, 0, 10113}, - {8122, 8048, 8122, 0, 0, 9993}, - {8123, 8049, 8123, 0, 0, 9993}, - {8136, 8050, 8136, 0, 0, 9993}, - {8137, 8051, 8137, 0, 0, 9993}, - {8138, 8052, 8138, 0, 0, 9993}, - {8139, 8053, 8139, 0, 0, 9993}, - {8154, 8054, 8154, 0, 0, 9993}, - {8155, 8055, 8155, 0, 0, 9993}, - {8184, 8056, 8184, 0, 0, 9993}, - {8185, 8057, 8185, 0, 0, 9993}, - {8170, 8058, 8170, 0, 0, 9993}, - {8171, 8059, 8171, 0, 0, 9993}, - {8186, 8060, 8186, 0, 0, 9993}, - {8187, 8061, 8187, 0, 0, 9993}, + {74, 0, 74, 0, 0, 9993}, + {86, 0, 86, 0, 0, 9993}, + {100, 0, 100, 0, 0, 9993}, + {128, 0, 128, 0, 0, 9993}, + {112, 0, 112, 0, 0, 9993}, + {126, 0, 126, 0, 0, 9993}, {33554567, 18874500, 16777353, 0, 0, 26377}, {33554573, 18874506, 16777359, 0, 0, 26377}, {33554579, 18874512, 16777365, 0, 0, 26377}, @@ -1445,17 +212,12 @@ {33554837, 18874770, 16777623, 0, 0, 26433}, {33554843, 18874776, 16777629, 0, 0, 26433}, {33554849, 18874782, 16777635, 0, 0, 26433}, - {8120, 8112, 8120, 0, 0, 9993}, - {8121, 8113, 8121, 0, 0, 9993}, {33554855, 18874788, 33554857, 0, 0, 26377}, {33554862, 18874795, 16777648, 0, 0, 26377}, {33554868, 18874801, 33554870, 0, 0, 26377}, {33554875, 18874808, 33554875, 0, 0, 26377}, {50332097, 19923389, 50332100, 0, 0, 26377}, - {8120, 8112, 8120, 0, 0, 10113}, - {8121, 8113, 8121, 0, 0, 10113}, - {8122, 8048, 8122, 0, 0, 10113}, - {8123, 8049, 8123, 0, 0, 10113}, + {0, -74, 0, 0, 0, 10113}, {33554890, 18874823, 16777676, 0, 0, 26433}, {16777679, 17826253, 16777679, 0, 0, 26377}, {33554899, 18874832, 33554901, 0, 0, 26377}, @@ -1463,43 +225,26 @@ {33554912, 18874845, 33554914, 0, 0, 26377}, {33554919, 18874852, 33554919, 0, 0, 26377}, {50332141, 19923433, 50332144, 0, 0, 26377}, - {8136, 8050, 8136, 0, 0, 10113}, - {8137, 8051, 8137, 0, 0, 10113}, - {8138, 8052, 8138, 0, 0, 10113}, - {8139, 8053, 8139, 0, 0, 10113}, + {0, -86, 0, 0, 0, 10113}, {33554934, 18874867, 16777720, 0, 0, 26433}, - {8152, 8144, 8152, 0, 0, 9993}, - {8153, 8145, 8153, 0, 0, 9993}, {50332157, 19923449, 50332157, 0, 0, 26377}, {50332164, 19923456, 50332164, 0, 0, 26377}, {33554954, 18874887, 33554954, 0, 0, 26377}, {50332176, 19923468, 50332176, 0, 0, 26377}, - {8152, 8144, 8152, 0, 0, 10113}, - {8153, 8145, 8153, 0, 0, 10113}, - {8154, 8054, 8154, 0, 0, 10113}, - {8155, 8055, 8155, 0, 0, 10113}, - {8168, 8160, 8168, 0, 0, 9993}, - {8169, 8161, 8169, 0, 0, 9993}, + {0, -100, 0, 0, 0, 10113}, {50332183, 19923475, 50332183, 0, 0, 26377}, {50332190, 19923482, 50332190, 0, 0, 26377}, {33554980, 18874913, 33554980, 0, 0, 26377}, - {8172, 8165, 8172, 0, 0, 9993}, {33554985, 18874918, 33554985, 0, 0, 26377}, {50332207, 19923499, 50332207, 0, 0, 26377}, - {8168, 8160, 8168, 0, 0, 10113}, - {8169, 8161, 8169, 0, 0, 10113}, - {8170, 8058, 8170, 0, 0, 10113}, - {8171, 8059, 8171, 0, 0, 10113}, - {8172, 8165, 8172, 0, 0, 10113}, + {0, -112, 0, 0, 0, 10113}, {33554997, 18874930, 33554999, 0, 0, 26377}, {33555004, 18874937, 16777790, 0, 0, 26377}, {33555010, 18874943, 33555012, 0, 0, 26377}, {33555017, 18874950, 33555017, 0, 0, 26377}, {50332239, 19923531, 50332242, 0, 0, 26377}, - {8184, 8056, 8184, 0, 0, 10113}, - {8185, 8057, 8185, 0, 0, 10113}, - {8186, 8060, 8186, 0, 0, 10113}, - {8187, 8061, 8187, 0, 0, 10113}, + {0, -128, 0, 0, 0, 10113}, + {0, -126, 0, 0, 0, 10113}, {33555032, 18874965, 16777818, 0, 0, 26433}, {0, 0, 0, 0, 0, 3076}, {0, 0, 0, 0, 4, 3076}, @@ -1509,534 +254,30 @@ {0, 0, 0, 0, 8, 3076}, {0, 0, 0, 0, 9, 3076}, {0, 0, 0, 0, 0, 1792}, - {8486, 969, 8486, 0, 0, 10113}, - {8490, 107, 8490, 0, 0, 10113}, - {8491, 229, 8491, 0, 0, 10113}, - {8498, 8526, 8498, 0, 0, 10113}, - {8498, 8526, 8498, 0, 0, 9993}, - {8544, 8560, 8544, 0, 0, 12160}, - {8545, 8561, 8545, 0, 0, 12160}, - {8546, 8562, 8546, 0, 0, 12160}, - {8547, 8563, 8547, 0, 0, 12160}, - {8548, 8564, 8548, 0, 0, 12160}, - {8549, 8565, 8549, 0, 0, 12160}, - {8550, 8566, 8550, 0, 0, 12160}, - {8551, 8567, 8551, 0, 0, 12160}, - {8552, 8568, 8552, 0, 0, 12160}, - {8553, 8569, 8553, 0, 0, 12160}, - {8554, 8570, 8554, 0, 0, 12160}, - {8555, 8571, 8555, 0, 0, 12160}, - {8556, 8572, 8556, 0, 0, 12160}, - {8557, 8573, 8557, 0, 0, 12160}, - {8558, 8574, 8558, 0, 0, 12160}, - {8559, 8575, 8559, 0, 0, 12160}, - {8544, 8560, 8544, 0, 0, 12040}, - {8545, 8561, 8545, 0, 0, 12040}, - {8546, 8562, 8546, 0, 0, 12040}, - {8547, 8563, 8547, 0, 0, 12040}, - {8548, 8564, 8548, 0, 0, 12040}, - {8549, 8565, 8549, 0, 0, 12040}, - {8550, 8566, 8550, 0, 0, 12040}, - {8551, 8567, 8551, 0, 0, 12040}, - {8552, 8568, 8552, 0, 0, 12040}, - {8553, 8569, 8553, 0, 0, 12040}, - {8554, 8570, 8554, 0, 0, 12040}, - {8555, 8571, 8555, 0, 0, 12040}, - {8556, 8572, 8556, 0, 0, 12040}, - {8557, 8573, 8557, 0, 0, 12040}, - {8558, 8574, 8558, 0, 0, 12040}, - {8559, 8575, 8559, 0, 0, 12040}, - {8579, 8580, 8579, 0, 0, 10113}, - {8579, 8580, 8579, 0, 0, 9993}, - {9398, 9424, 9398, 0, 0, 9344}, - {9399, 9425, 9399, 0, 0, 9344}, - {9400, 9426, 9400, 0, 0, 9344}, - {9401, 9427, 9401, 0, 0, 9344}, - {9402, 9428, 9402, 0, 0, 9344}, - {9403, 9429, 9403, 0, 0, 9344}, - {9404, 9430, 9404, 0, 0, 9344}, - {9405, 9431, 9405, 0, 0, 9344}, - {9406, 9432, 9406, 0, 0, 9344}, - {9407, 9433, 9407, 0, 0, 9344}, - {9408, 9434, 9408, 0, 0, 9344}, - {9409, 9435, 9409, 0, 0, 9344}, - {9410, 9436, 9410, 0, 0, 9344}, - {9411, 9437, 9411, 0, 0, 9344}, - {9412, 9438, 9412, 0, 0, 9344}, - {9413, 9439, 9413, 0, 0, 9344}, - {9414, 9440, 9414, 0, 0, 9344}, - {9415, 9441, 9415, 0, 0, 9344}, - {9416, 9442, 9416, 0, 0, 9344}, - {9417, 9443, 9417, 0, 0, 9344}, - {9418, 9444, 9418, 0, 0, 9344}, - {9419, 9445, 9419, 0, 0, 9344}, - {9420, 9446, 9420, 0, 0, 9344}, - {9421, 9447, 9421, 0, 0, 9344}, - {9422, 9448, 9422, 0, 0, 9344}, - {9423, 9449, 9423, 0, 0, 9344}, - {9398, 9424, 9398, 0, 0, 9224}, - {9399, 9425, 9399, 0, 0, 9224}, - {9400, 9426, 9400, 0, 0, 9224}, - {9401, 9427, 9401, 0, 0, 9224}, - {9402, 9428, 9402, 0, 0, 9224}, - {9403, 9429, 9403, 0, 0, 9224}, - {9404, 9430, 9404, 0, 0, 9224}, - {9405, 9431, 9405, 0, 0, 9224}, - {9406, 9432, 9406, 0, 0, 9224}, - {9407, 9433, 9407, 0, 0, 9224}, - {9408, 9434, 9408, 0, 0, 9224}, - {9409, 9435, 9409, 0, 0, 9224}, - {9410, 9436, 9410, 0, 0, 9224}, - {9411, 9437, 9411, 0, 0, 9224}, - {9412, 9438, 9412, 0, 0, 9224}, - {9413, 9439, 9413, 0, 0, 9224}, - {9414, 9440, 9414, 0, 0, 9224}, - {9415, 9441, 9415, 0, 0, 9224}, - {9416, 9442, 9416, 0, 0, 9224}, - {9417, 9443, 9417, 0, 0, 9224}, - {9418, 9444, 9418, 0, 0, 9224}, - {9419, 9445, 9419, 0, 0, 9224}, - {9420, 9446, 9420, 0, 0, 9224}, - {9421, 9447, 9421, 0, 0, 9224}, - {9422, 9448, 9422, 0, 0, 9224}, - {9423, 9449, 9423, 0, 0, 9224}, - {11264, 11312, 11264, 0, 0, 10113}, - {11265, 11313, 11265, 0, 0, 10113}, - {11266, 11314, 11266, 0, 0, 10113}, - {11267, 11315, 11267, 0, 0, 10113}, - {11268, 11316, 11268, 0, 0, 10113}, - {11269, 11317, 11269, 0, 0, 10113}, - {11270, 11318, 11270, 0, 0, 10113}, - {11271, 11319, 11271, 0, 0, 10113}, - {11272, 11320, 11272, 0, 0, 10113}, - {11273, 11321, 11273, 0, 0, 10113}, - {11274, 11322, 11274, 0, 0, 10113}, - {11275, 11323, 11275, 0, 0, 10113}, - {11276, 11324, 11276, 0, 0, 10113}, - {11277, 11325, 11277, 0, 0, 10113}, - {11278, 11326, 11278, 0, 0, 10113}, - {11279, 11327, 11279, 0, 0, 10113}, - {11280, 11328, 11280, 0, 0, 10113}, - {11281, 11329, 11281, 0, 0, 10113}, - {11282, 11330, 11282, 0, 0, 10113}, - {11283, 11331, 11283, 0, 0, 10113}, - {11284, 11332, 11284, 0, 0, 10113}, - {11285, 11333, 11285, 0, 0, 10113}, - {11286, 11334, 11286, 0, 0, 10113}, - {11287, 11335, 11287, 0, 0, 10113}, - {11288, 11336, 11288, 0, 0, 10113}, - {11289, 11337, 11289, 0, 0, 10113}, - {11290, 11338, 11290, 0, 0, 10113}, - {11291, 11339, 11291, 0, 0, 10113}, - {11292, 11340, 11292, 0, 0, 10113}, - {11293, 11341, 11293, 0, 0, 10113}, - {11294, 11342, 11294, 0, 0, 10113}, - {11295, 11343, 11295, 0, 0, 10113}, - {11296, 11344, 11296, 0, 0, 10113}, - {11297, 11345, 11297, 0, 0, 10113}, - {11298, 11346, 11298, 0, 0, 10113}, - {11299, 11347, 11299, 0, 0, 10113}, - {11300, 11348, 11300, 0, 0, 10113}, - {11301, 11349, 11301, 0, 0, 10113}, - {11302, 11350, 11302, 0, 0, 10113}, - {11303, 11351, 11303, 0, 0, 10113}, - {11304, 11352, 11304, 0, 0, 10113}, - {11305, 11353, 11305, 0, 0, 10113}, - {11306, 11354, 11306, 0, 0, 10113}, - {11307, 11355, 11307, 0, 0, 10113}, - {11308, 11356, 11308, 0, 0, 10113}, - {11309, 11357, 11309, 0, 0, 10113}, - {11310, 11358, 11310, 0, 0, 10113}, - {11264, 11312, 11264, 0, 0, 9993}, - {11265, 11313, 11265, 0, 0, 9993}, - {11266, 11314, 11266, 0, 0, 9993}, - {11267, 11315, 11267, 0, 0, 9993}, - {11268, 11316, 11268, 0, 0, 9993}, - {11269, 11317, 11269, 0, 0, 9993}, - {11270, 11318, 11270, 0, 0, 9993}, - {11271, 11319, 11271, 0, 0, 9993}, - {11272, 11320, 11272, 0, 0, 9993}, - {11273, 11321, 11273, 0, 0, 9993}, - {11274, 11322, 11274, 0, 0, 9993}, - {11275, 11323, 11275, 0, 0, 9993}, - {11276, 11324, 11276, 0, 0, 9993}, - {11277, 11325, 11277, 0, 0, 9993}, - {11278, 11326, 11278, 0, 0, 9993}, - {11279, 11327, 11279, 0, 0, 9993}, - {11280, 11328, 11280, 0, 0, 9993}, - {11281, 11329, 11281, 0, 0, 9993}, - {11282, 11330, 11282, 0, 0, 9993}, - {11283, 11331, 11283, 0, 0, 9993}, - {11284, 11332, 11284, 0, 0, 9993}, - {11285, 11333, 11285, 0, 0, 9993}, - {11286, 11334, 11286, 0, 0, 9993}, - {11287, 11335, 11287, 0, 0, 9993}, - {11288, 11336, 11288, 0, 0, 9993}, - {11289, 11337, 11289, 0, 0, 9993}, - {11290, 11338, 11290, 0, 0, 9993}, - {11291, 11339, 11291, 0, 0, 9993}, - {11292, 11340, 11292, 0, 0, 9993}, - {11293, 11341, 11293, 0, 0, 9993}, - {11294, 11342, 11294, 0, 0, 9993}, - {11295, 11343, 11295, 0, 0, 9993}, - {11296, 11344, 11296, 0, 0, 9993}, - {11297, 11345, 11297, 0, 0, 9993}, - {11298, 11346, 11298, 0, 0, 9993}, - {11299, 11347, 11299, 0, 0, 9993}, - {11300, 11348, 11300, 0, 0, 9993}, - {11301, 11349, 11301, 0, 0, 9993}, - {11302, 11350, 11302, 0, 0, 9993}, - {11303, 11351, 11303, 0, 0, 9993}, - {11304, 11352, 11304, 0, 0, 9993}, - {11305, 11353, 11305, 0, 0, 9993}, - {11306, 11354, 11306, 0, 0, 9993}, - {11307, 11355, 11307, 0, 0, 9993}, - {11308, 11356, 11308, 0, 0, 9993}, - {11309, 11357, 11309, 0, 0, 9993}, - {11310, 11358, 11310, 0, 0, 9993}, - {11360, 11361, 11360, 0, 0, 10113}, - {11360, 11361, 11360, 0, 0, 9993}, - {11362, 619, 11362, 0, 0, 10113}, - {11363, 7549, 11363, 0, 0, 10113}, - {11364, 637, 11364, 0, 0, 10113}, - {570, 11365, 570, 0, 0, 9993}, - {574, 11366, 574, 0, 0, 9993}, - {11367, 11368, 11367, 0, 0, 10113}, - {11367, 11368, 11367, 0, 0, 9993}, - {11369, 11370, 11369, 0, 0, 10113}, - {11369, 11370, 11369, 0, 0, 9993}, - {11371, 11372, 11371, 0, 0, 10113}, - {11371, 11372, 11371, 0, 0, 9993}, - {11373, 593, 11373, 0, 0, 10113}, - {11374, 625, 11374, 0, 0, 10113}, - {11375, 592, 11375, 0, 0, 10113}, - {11376, 594, 11376, 0, 0, 10113}, - {11378, 11379, 11378, 0, 0, 10113}, - {11378, 11379, 11378, 0, 0, 9993}, - {11381, 11382, 11381, 0, 0, 10113}, - {11381, 11382, 11381, 0, 0, 9993}, - {11390, 575, 11390, 0, 0, 10113}, - {11391, 576, 11391, 0, 0, 10113}, - {11392, 11393, 11392, 0, 0, 10113}, - {11392, 11393, 11392, 0, 0, 9993}, - {11394, 11395, 11394, 0, 0, 10113}, - {11394, 11395, 11394, 0, 0, 9993}, - {11396, 11397, 11396, 0, 0, 10113}, - {11396, 11397, 11396, 0, 0, 9993}, - {11398, 11399, 11398, 0, 0, 10113}, - {11398, 11399, 11398, 0, 0, 9993}, - {11400, 11401, 11400, 0, 0, 10113}, - {11400, 11401, 11400, 0, 0, 9993}, - {11402, 11403, 11402, 0, 0, 10113}, - {11402, 11403, 11402, 0, 0, 9993}, - {11404, 11405, 11404, 0, 0, 10113}, - {11404, 11405, 11404, 0, 0, 9993}, - {11406, 11407, 11406, 0, 0, 10113}, - {11406, 11407, 11406, 0, 0, 9993}, - {11408, 11409, 11408, 0, 0, 10113}, - {11408, 11409, 11408, 0, 0, 9993}, - {11410, 11411, 11410, 0, 0, 10113}, - {11410, 11411, 11410, 0, 0, 9993}, - {11412, 11413, 11412, 0, 0, 10113}, - {11412, 11413, 11412, 0, 0, 9993}, - {11414, 11415, 11414, 0, 0, 10113}, - {11414, 11415, 11414, 0, 0, 9993}, - {11416, 11417, 11416, 0, 0, 10113}, - {11416, 11417, 11416, 0, 0, 9993}, - {11418, 11419, 11418, 0, 0, 10113}, - {11418, 11419, 11418, 0, 0, 9993}, - {11420, 11421, 11420, 0, 0, 10113}, - {11420, 11421, 11420, 0, 0, 9993}, - {11422, 11423, 11422, 0, 0, 10113}, - {11422, 11423, 11422, 0, 0, 9993}, - {11424, 11425, 11424, 0, 0, 10113}, - {11424, 11425, 11424, 0, 0, 9993}, - {11426, 11427, 11426, 0, 0, 10113}, - {11426, 11427, 11426, 0, 0, 9993}, - {11428, 11429, 11428, 0, 0, 10113}, - {11428, 11429, 11428, 0, 0, 9993}, - {11430, 11431, 11430, 0, 0, 10113}, - {11430, 11431, 11430, 0, 0, 9993}, - {11432, 11433, 11432, 0, 0, 10113}, - {11432, 11433, 11432, 0, 0, 9993}, - {11434, 11435, 11434, 0, 0, 10113}, - {11434, 11435, 11434, 0, 0, 9993}, - {11436, 11437, 11436, 0, 0, 10113}, - {11436, 11437, 11436, 0, 0, 9993}, - {11438, 11439, 11438, 0, 0, 10113}, - {11438, 11439, 11438, 0, 0, 9993}, - {11440, 11441, 11440, 0, 0, 10113}, - {11440, 11441, 11440, 0, 0, 9993}, - {11442, 11443, 11442, 0, 0, 10113}, - {11442, 11443, 11442, 0, 0, 9993}, - {11444, 11445, 11444, 0, 0, 10113}, - {11444, 11445, 11444, 0, 0, 9993}, - {11446, 11447, 11446, 0, 0, 10113}, - {11446, 11447, 11446, 0, 0, 9993}, - {11448, 11449, 11448, 0, 0, 10113}, - {11448, 11449, 11448, 0, 0, 9993}, - {11450, 11451, 11450, 0, 0, 10113}, - {11450, 11451, 11450, 0, 0, 9993}, - {11452, 11453, 11452, 0, 0, 10113}, - {11452, 11453, 11452, 0, 0, 9993}, - {11454, 11455, 11454, 0, 0, 10113}, - {11454, 11455, 11454, 0, 0, 9993}, - {11456, 11457, 11456, 0, 0, 10113}, - {11456, 11457, 11456, 0, 0, 9993}, - {11458, 11459, 11458, 0, 0, 10113}, - {11458, 11459, 11458, 0, 0, 9993}, - {11460, 11461, 11460, 0, 0, 10113}, - {11460, 11461, 11460, 0, 0, 9993}, - {11462, 11463, 11462, 0, 0, 10113}, - {11462, 11463, 11462, 0, 0, 9993}, - {11464, 11465, 11464, 0, 0, 10113}, - {11464, 11465, 11464, 0, 0, 9993}, - {11466, 11467, 11466, 0, 0, 10113}, - {11466, 11467, 11466, 0, 0, 9993}, - {11468, 11469, 11468, 0, 0, 10113}, - {11468, 11469, 11468, 0, 0, 9993}, - {11470, 11471, 11470, 0, 0, 10113}, - {11470, 11471, 11470, 0, 0, 9993}, - {11472, 11473, 11472, 0, 0, 10113}, - {11472, 11473, 11472, 0, 0, 9993}, - {11474, 11475, 11474, 0, 0, 10113}, - {11474, 11475, 11474, 0, 0, 9993}, - {11476, 11477, 11476, 0, 0, 10113}, - {11476, 11477, 11476, 0, 0, 9993}, - {11478, 11479, 11478, 0, 0, 10113}, - {11478, 11479, 11478, 0, 0, 9993}, - {11480, 11481, 11480, 0, 0, 10113}, - {11480, 11481, 11480, 0, 0, 9993}, - {11482, 11483, 11482, 0, 0, 10113}, - {11482, 11483, 11482, 0, 0, 9993}, - {11484, 11485, 11484, 0, 0, 10113}, - {11484, 11485, 11484, 0, 0, 9993}, - {11486, 11487, 11486, 0, 0, 10113}, - {11486, 11487, 11486, 0, 0, 9993}, - {11488, 11489, 11488, 0, 0, 10113}, - {11488, 11489, 11488, 0, 0, 9993}, - {11490, 11491, 11490, 0, 0, 10113}, - {11490, 11491, 11490, 0, 0, 9993}, - {11499, 11500, 11499, 0, 0, 10113}, - {11499, 11500, 11499, 0, 0, 9993}, - {11501, 11502, 11501, 0, 0, 10113}, - {11501, 11502, 11501, 0, 0, 9993}, - {4256, 11520, 4256, 0, 0, 9993}, - {4257, 11521, 4257, 0, 0, 9993}, - {4258, 11522, 4258, 0, 0, 9993}, - {4259, 11523, 4259, 0, 0, 9993}, - {4260, 11524, 4260, 0, 0, 9993}, - {4261, 11525, 4261, 0, 0, 9993}, - {4262, 11526, 4262, 0, 0, 9993}, - {4263, 11527, 4263, 0, 0, 9993}, - {4264, 11528, 4264, 0, 0, 9993}, - {4265, 11529, 4265, 0, 0, 9993}, - {4266, 11530, 4266, 0, 0, 9993}, - {4267, 11531, 4267, 0, 0, 9993}, - {4268, 11532, 4268, 0, 0, 9993}, - {4269, 11533, 4269, 0, 0, 9993}, - {4270, 11534, 4270, 0, 0, 9993}, - {4271, 11535, 4271, 0, 0, 9993}, - {4272, 11536, 4272, 0, 0, 9993}, - {4273, 11537, 4273, 0, 0, 9993}, - {4274, 11538, 4274, 0, 0, 9993}, - {4275, 11539, 4275, 0, 0, 9993}, - {4276, 11540, 4276, 0, 0, 9993}, - {4277, 11541, 4277, 0, 0, 9993}, - {4278, 11542, 4278, 0, 0, 9993}, - {4279, 11543, 4279, 0, 0, 9993}, - {4280, 11544, 4280, 0, 0, 9993}, - {4281, 11545, 4281, 0, 0, 9993}, - {4282, 11546, 4282, 0, 0, 9993}, - {4283, 11547, 4283, 0, 0, 9993}, - {4284, 11548, 4284, 0, 0, 9993}, - {4285, 11549, 4285, 0, 0, 9993}, - {4286, 11550, 4286, 0, 0, 9993}, - {4287, 11551, 4287, 0, 0, 9993}, - {4288, 11552, 4288, 0, 0, 9993}, - {4289, 11553, 4289, 0, 0, 9993}, - {4290, 11554, 4290, 0, 0, 9993}, - {4291, 11555, 4291, 0, 0, 9993}, - {4292, 11556, 4292, 0, 0, 9993}, - {4293, 11557, 4293, 0, 0, 9993}, + {0, -7517, 0, 0, 0, 10113}, + {0, -8383, 0, 0, 0, 10113}, + {0, -8262, 0, 0, 0, 10113}, + {0, 28, 0, 0, 0, 10113}, + {-28, 0, -28, 0, 0, 9993}, + {0, 16, 0, 0, 0, 12160}, + {-16, 0, -16, 0, 0, 12040}, + {0, 26, 0, 0, 0, 9344}, + {-26, 0, -26, 0, 0, 9224}, + {0, -10743, 0, 0, 0, 10113}, + {0, -3814, 0, 0, 0, 10113}, + {0, -10727, 0, 0, 0, 10113}, + {-10795, 0, -10795, 0, 0, 9993}, + {-10792, 0, -10792, 0, 0, 9993}, + {0, -10780, 0, 0, 0, 10113}, + {0, -10749, 0, 0, 0, 10113}, + {0, -10783, 0, 0, 0, 10113}, + {0, -10782, 0, 0, 0, 10113}, + {0, -10815, 0, 0, 0, 10113}, + {-7264, 0, -7264, 0, 0, 9993}, {0, 0, 0, 0, 0, 5121}, {0, 0, 0, 0, 0, 3841}, - {42560, 42561, 42560, 0, 0, 10113}, - {42560, 42561, 42560, 0, 0, 9993}, - {42562, 42563, 42562, 0, 0, 10113}, - {42562, 42563, 42562, 0, 0, 9993}, - {42564, 42565, 42564, 0, 0, 10113}, - {42564, 42565, 42564, 0, 0, 9993}, - {42566, 42567, 42566, 0, 0, 10113}, - {42566, 42567, 42566, 0, 0, 9993}, - {42568, 42569, 42568, 0, 0, 10113}, - {42568, 42569, 42568, 0, 0, 9993}, - {42570, 42571, 42570, 0, 0, 10113}, - {42570, 42571, 42570, 0, 0, 9993}, - {42572, 42573, 42572, 0, 0, 10113}, - {42572, 42573, 42572, 0, 0, 9993}, - {42574, 42575, 42574, 0, 0, 10113}, - {42574, 42575, 42574, 0, 0, 9993}, - {42576, 42577, 42576, 0, 0, 10113}, - {42576, 42577, 42576, 0, 0, 9993}, - {42578, 42579, 42578, 0, 0, 10113}, - {42578, 42579, 42578, 0, 0, 9993}, - {42580, 42581, 42580, 0, 0, 10113}, - {42580, 42581, 42580, 0, 0, 9993}, - {42582, 42583, 42582, 0, 0, 10113}, - {42582, 42583, 42582, 0, 0, 9993}, - {42584, 42585, 42584, 0, 0, 10113}, - {42584, 42585, 42584, 0, 0, 9993}, - {42586, 42587, 42586, 0, 0, 10113}, - {42586, 42587, 42586, 0, 0, 9993}, - {42588, 42589, 42588, 0, 0, 10113}, - {42588, 42589, 42588, 0, 0, 9993}, - {42590, 42591, 42590, 0, 0, 10113}, - {42590, 42591, 42590, 0, 0, 9993}, - {42592, 42593, 42592, 0, 0, 10113}, - {42592, 42593, 42592, 0, 0, 9993}, - {42594, 42595, 42594, 0, 0, 10113}, - {42594, 42595, 42594, 0, 0, 9993}, - {42596, 42597, 42596, 0, 0, 10113}, - {42596, 42597, 42596, 0, 0, 9993}, - {42598, 42599, 42598, 0, 0, 10113}, - {42598, 42599, 42598, 0, 0, 9993}, - {42600, 42601, 42600, 0, 0, 10113}, - {42600, 42601, 42600, 0, 0, 9993}, - {42602, 42603, 42602, 0, 0, 10113}, - {42602, 42603, 42602, 0, 0, 9993}, - {42604, 42605, 42604, 0, 0, 10113}, - {42604, 42605, 42604, 0, 0, 9993}, - {42624, 42625, 42624, 0, 0, 10113}, - {42624, 42625, 42624, 0, 0, 9993}, - {42626, 42627, 42626, 0, 0, 10113}, - {42626, 42627, 42626, 0, 0, 9993}, - {42628, 42629, 42628, 0, 0, 10113}, - {42628, 42629, 42628, 0, 0, 9993}, - {42630, 42631, 42630, 0, 0, 10113}, - {42630, 42631, 42630, 0, 0, 9993}, - {42632, 42633, 42632, 0, 0, 10113}, - {42632, 42633, 42632, 0, 0, 9993}, - {42634, 42635, 42634, 0, 0, 10113}, - {42634, 42635, 42634, 0, 0, 9993}, - {42636, 42637, 42636, 0, 0, 10113}, - {42636, 42637, 42636, 0, 0, 9993}, - {42638, 42639, 42638, 0, 0, 10113}, - {42638, 42639, 42638, 0, 0, 9993}, - {42640, 42641, 42640, 0, 0, 10113}, - {42640, 42641, 42640, 0, 0, 9993}, - {42642, 42643, 42642, 0, 0, 10113}, - {42642, 42643, 42642, 0, 0, 9993}, - {42644, 42645, 42644, 0, 0, 10113}, - {42644, 42645, 42644, 0, 0, 9993}, - {42646, 42647, 42646, 0, 0, 10113}, - {42646, 42647, 42646, 0, 0, 9993}, - {42786, 42787, 42786, 0, 0, 10113}, - {42786, 42787, 42786, 0, 0, 9993}, - {42788, 42789, 42788, 0, 0, 10113}, - {42788, 42789, 42788, 0, 0, 9993}, - {42790, 42791, 42790, 0, 0, 10113}, - {42790, 42791, 42790, 0, 0, 9993}, - {42792, 42793, 42792, 0, 0, 10113}, - {42792, 42793, 42792, 0, 0, 9993}, - {42794, 42795, 42794, 0, 0, 10113}, - {42794, 42795, 42794, 0, 0, 9993}, - {42796, 42797, 42796, 0, 0, 10113}, - {42796, 42797, 42796, 0, 0, 9993}, - {42798, 42799, 42798, 0, 0, 10113}, - {42798, 42799, 42798, 0, 0, 9993}, - {42802, 42803, 42802, 0, 0, 10113}, - {42802, 42803, 42802, 0, 0, 9993}, - {42804, 42805, 42804, 0, 0, 10113}, - {42804, 42805, 42804, 0, 0, 9993}, - {42806, 42807, 42806, 0, 0, 10113}, - {42806, 42807, 42806, 0, 0, 9993}, - {42808, 42809, 42808, 0, 0, 10113}, - {42808, 42809, 42808, 0, 0, 9993}, - {42810, 42811, 42810, 0, 0, 10113}, - {42810, 42811, 42810, 0, 0, 9993}, - {42812, 42813, 42812, 0, 0, 10113}, - {42812, 42813, 42812, 0, 0, 9993}, - {42814, 42815, 42814, 0, 0, 10113}, - {42814, 42815, 42814, 0, 0, 9993}, - {42816, 42817, 42816, 0, 0, 10113}, - {42816, 42817, 42816, 0, 0, 9993}, - {42818, 42819, 42818, 0, 0, 10113}, - {42818, 42819, 42818, 0, 0, 9993}, - {42820, 42821, 42820, 0, 0, 10113}, - {42820, 42821, 42820, 0, 0, 9993}, - {42822, 42823, 42822, 0, 0, 10113}, - {42822, 42823, 42822, 0, 0, 9993}, - {42824, 42825, 42824, 0, 0, 10113}, - {42824, 42825, 42824, 0, 0, 9993}, - {42826, 42827, 42826, 0, 0, 10113}, - {42826, 42827, 42826, 0, 0, 9993}, - {42828, 42829, 42828, 0, 0, 10113}, - {42828, 42829, 42828, 0, 0, 9993}, - {42830, 42831, 42830, 0, 0, 10113}, - {42830, 42831, 42830, 0, 0, 9993}, - {42832, 42833, 42832, 0, 0, 10113}, - {42832, 42833, 42832, 0, 0, 9993}, - {42834, 42835, 42834, 0, 0, 10113}, - {42834, 42835, 42834, 0, 0, 9993}, - {42836, 42837, 42836, 0, 0, 10113}, - {42836, 42837, 42836, 0, 0, 9993}, - {42838, 42839, 42838, 0, 0, 10113}, - {42838, 42839, 42838, 0, 0, 9993}, - {42840, 42841, 42840, 0, 0, 10113}, - {42840, 42841, 42840, 0, 0, 9993}, - {42842, 42843, 42842, 0, 0, 10113}, - {42842, 42843, 42842, 0, 0, 9993}, - {42844, 42845, 42844, 0, 0, 10113}, - {42844, 42845, 42844, 0, 0, 9993}, - {42846, 42847, 42846, 0, 0, 10113}, - {42846, 42847, 42846, 0, 0, 9993}, - {42848, 42849, 42848, 0, 0, 10113}, - {42848, 42849, 42848, 0, 0, 9993}, - {42850, 42851, 42850, 0, 0, 10113}, - {42850, 42851, 42850, 0, 0, 9993}, - {42852, 42853, 42852, 0, 0, 10113}, - {42852, 42853, 42852, 0, 0, 9993}, - {42854, 42855, 42854, 0, 0, 10113}, - {42854, 42855, 42854, 0, 0, 9993}, - {42856, 42857, 42856, 0, 0, 10113}, - {42856, 42857, 42856, 0, 0, 9993}, - {42858, 42859, 42858, 0, 0, 10113}, - {42858, 42859, 42858, 0, 0, 9993}, - {42860, 42861, 42860, 0, 0, 10113}, - {42860, 42861, 42860, 0, 0, 9993}, - {42862, 42863, 42862, 0, 0, 10113}, - {42862, 42863, 42862, 0, 0, 9993}, - {42873, 42874, 42873, 0, 0, 10113}, - {42873, 42874, 42873, 0, 0, 9993}, - {42875, 42876, 42875, 0, 0, 10113}, - {42875, 42876, 42875, 0, 0, 9993}, - {42877, 7545, 42877, 0, 0, 10113}, - {42878, 42879, 42878, 0, 0, 10113}, - {42878, 42879, 42878, 0, 0, 9993}, - {42880, 42881, 42880, 0, 0, 10113}, - {42880, 42881, 42880, 0, 0, 9993}, - {42882, 42883, 42882, 0, 0, 10113}, - {42882, 42883, 42882, 0, 0, 9993}, - {42884, 42885, 42884, 0, 0, 10113}, - {42884, 42885, 42884, 0, 0, 9993}, - {42886, 42887, 42886, 0, 0, 10113}, - {42886, 42887, 42886, 0, 0, 9993}, - {42891, 42892, 42891, 0, 0, 10113}, - {42891, 42892, 42891, 0, 0, 9993}, - {42893, 613, 42893, 0, 0, 10113}, - {42896, 42897, 42896, 0, 0, 10113}, - {42896, 42897, 42896, 0, 0, 9993}, - {42912, 42913, 42912, 0, 0, 10113}, - {42912, 42913, 42912, 0, 0, 9993}, - {42914, 42915, 42914, 0, 0, 10113}, - {42914, 42915, 42914, 0, 0, 9993}, - {42916, 42917, 42916, 0, 0, 10113}, - {42916, 42917, 42916, 0, 0, 9993}, - {42918, 42919, 42918, 0, 0, 10113}, - {42918, 42919, 42918, 0, 0, 9993}, - {42920, 42921, 42920, 0, 0, 10113}, - {42920, 42921, 42920, 0, 0, 9993}, + {0, -35332, 0, 0, 0, 10113}, + {0, -42280, 0, 0, 0, 10113}, {33555038, 18874971, 33555040, 0, 0, 26377}, {33555045, 18874978, 33555047, 0, 0, 26377}, {33555052, 18874985, 33555054, 0, 0, 26377}, @@ -2050,139 +291,9 @@ {33555114, 18875047, 33555116, 0, 0, 26377}, {33555121, 18875054, 33555123, 0, 0, 26377}, {0, 0, 0, 0, 0, 1025}, - {65313, 65345, 65313, 0, 0, 10113}, - {65314, 65346, 65314, 0, 0, 10113}, - {65315, 65347, 65315, 0, 0, 10113}, - {65316, 65348, 65316, 0, 0, 10113}, - {65317, 65349, 65317, 0, 0, 10113}, - {65318, 65350, 65318, 0, 0, 10113}, - {65319, 65351, 65319, 0, 0, 10113}, - {65320, 65352, 65320, 0, 0, 10113}, - {65321, 65353, 65321, 0, 0, 10113}, - {65322, 65354, 65322, 0, 0, 10113}, - {65323, 65355, 65323, 0, 0, 10113}, - {65324, 65356, 65324, 0, 0, 10113}, - {65325, 65357, 65325, 0, 0, 10113}, - {65326, 65358, 65326, 0, 0, 10113}, - {65327, 65359, 65327, 0, 0, 10113}, - {65328, 65360, 65328, 0, 0, 10113}, - {65329, 65361, 65329, 0, 0, 10113}, - {65330, 65362, 65330, 0, 0, 10113}, - {65331, 65363, 65331, 0, 0, 10113}, - {65332, 65364, 65332, 0, 0, 10113}, - {65333, 65365, 65333, 0, 0, 10113}, - {65334, 65366, 65334, 0, 0, 10113}, - {65335, 65367, 65335, 0, 0, 10113}, - {65336, 65368, 65336, 0, 0, 10113}, - {65337, 65369, 65337, 0, 0, 10113}, - {65338, 65370, 65338, 0, 0, 10113}, - {65313, 65345, 65313, 0, 0, 9993}, - {65314, 65346, 65314, 0, 0, 9993}, - {65315, 65347, 65315, 0, 0, 9993}, - {65316, 65348, 65316, 0, 0, 9993}, - {65317, 65349, 65317, 0, 0, 9993}, - {65318, 65350, 65318, 0, 0, 9993}, - {65319, 65351, 65319, 0, 0, 9993}, - {65320, 65352, 65320, 0, 0, 9993}, - {65321, 65353, 65321, 0, 0, 9993}, - {65322, 65354, 65322, 0, 0, 9993}, - {65323, 65355, 65323, 0, 0, 9993}, - {65324, 65356, 65324, 0, 0, 9993}, - {65325, 65357, 65325, 0, 0, 9993}, - {65326, 65358, 65326, 0, 0, 9993}, - {65327, 65359, 65327, 0, 0, 9993}, - {65328, 65360, 65328, 0, 0, 9993}, - {65329, 65361, 65329, 0, 0, 9993}, - {65330, 65362, 65330, 0, 0, 9993}, - {65331, 65363, 65331, 0, 0, 9993}, - {65332, 65364, 65332, 0, 0, 9993}, - {65333, 65365, 65333, 0, 0, 9993}, - {65334, 65366, 65334, 0, 0, 9993}, - {65335, 65367, 65335, 0, 0, 9993}, - {65336, 65368, 65336, 0, 0, 9993}, - {65337, 65369, 65337, 0, 0, 9993}, - {65338, 65370, 65338, 0, 0, 9993}, {0, 0, 0, 0, 0, 5633}, - {66560, 66600, 66560, 0, 0, 10113}, - {66561, 66601, 66561, 0, 0, 10113}, - {66562, 66602, 66562, 0, 0, 10113}, - {66563, 66603, 66563, 0, 0, 10113}, - {66564, 66604, 66564, 0, 0, 10113}, - {66565, 66605, 66565, 0, 0, 10113}, - {66566, 66606, 66566, 0, 0, 10113}, - {66567, 66607, 66567, 0, 0, 10113}, - {66568, 66608, 66568, 0, 0, 10113}, - {66569, 66609, 66569, 0, 0, 10113}, - {66570, 66610, 66570, 0, 0, 10113}, - {66571, 66611, 66571, 0, 0, 10113}, - {66572, 66612, 66572, 0, 0, 10113}, - {66573, 66613, 66573, 0, 0, 10113}, - {66574, 66614, 66574, 0, 0, 10113}, - {66575, 66615, 66575, 0, 0, 10113}, - {66576, 66616, 66576, 0, 0, 10113}, - {66577, 66617, 66577, 0, 0, 10113}, - {66578, 66618, 66578, 0, 0, 10113}, - {66579, 66619, 66579, 0, 0, 10113}, - {66580, 66620, 66580, 0, 0, 10113}, - {66581, 66621, 66581, 0, 0, 10113}, - {66582, 66622, 66582, 0, 0, 10113}, - {66583, 66623, 66583, 0, 0, 10113}, - {66584, 66624, 66584, 0, 0, 10113}, - {66585, 66625, 66585, 0, 0, 10113}, - {66586, 66626, 66586, 0, 0, 10113}, - {66587, 66627, 66587, 0, 0, 10113}, - {66588, 66628, 66588, 0, 0, 10113}, - {66589, 66629, 66589, 0, 0, 10113}, - {66590, 66630, 66590, 0, 0, 10113}, - {66591, 66631, 66591, 0, 0, 10113}, - {66592, 66632, 66592, 0, 0, 10113}, - {66593, 66633, 66593, 0, 0, 10113}, - {66594, 66634, 66594, 0, 0, 10113}, - {66595, 66635, 66595, 0, 0, 10113}, - {66596, 66636, 66596, 0, 0, 10113}, - {66597, 66637, 66597, 0, 0, 10113}, - {66598, 66638, 66598, 0, 0, 10113}, - {66599, 66639, 66599, 0, 0, 10113}, - {66560, 66600, 66560, 0, 0, 9993}, - {66561, 66601, 66561, 0, 0, 9993}, - {66562, 66602, 66562, 0, 0, 9993}, - {66563, 66603, 66563, 0, 0, 9993}, - {66564, 66604, 66564, 0, 0, 9993}, - {66565, 66605, 66565, 0, 0, 9993}, - {66566, 66606, 66566, 0, 0, 9993}, - {66567, 66607, 66567, 0, 0, 9993}, - {66568, 66608, 66568, 0, 0, 9993}, - {66569, 66609, 66569, 0, 0, 9993}, - {66570, 66610, 66570, 0, 0, 9993}, - {66571, 66611, 66571, 0, 0, 9993}, - {66572, 66612, 66572, 0, 0, 9993}, - {66573, 66613, 66573, 0, 0, 9993}, - {66574, 66614, 66574, 0, 0, 9993}, - {66575, 66615, 66575, 0, 0, 9993}, - {66576, 66616, 66576, 0, 0, 9993}, - {66577, 66617, 66577, 0, 0, 9993}, - {66578, 66618, 66578, 0, 0, 9993}, - {66579, 66619, 66579, 0, 0, 9993}, - {66580, 66620, 66580, 0, 0, 9993}, - {66581, 66621, 66581, 0, 0, 9993}, - {66582, 66622, 66582, 0, 0, 9993}, - {66583, 66623, 66583, 0, 0, 9993}, - {66584, 66624, 66584, 0, 0, 9993}, - {66585, 66625, 66585, 0, 0, 9993}, - {66586, 66626, 66586, 0, 0, 9993}, - {66587, 66627, 66587, 0, 0, 9993}, - {66588, 66628, 66588, 0, 0, 9993}, - {66589, 66629, 66589, 0, 0, 9993}, - {66590, 66630, 66590, 0, 0, 9993}, - {66591, 66631, 66591, 0, 0, 9993}, - {66592, 66632, 66592, 0, 0, 9993}, - {66593, 66633, 66593, 0, 0, 9993}, - {66594, 66634, 66594, 0, 0, 9993}, - {66595, 66635, 66595, 0, 0, 9993}, - {66596, 66636, 66596, 0, 0, 9993}, - {66597, 66637, 66597, 0, 0, 9993}, - {66598, 66638, 66598, 0, 0, 9993}, - {66599, 66639, 66599, 0, 0, 9993}, + {0, 40, 0, 0, 0, 10113}, + {-40, 0, -40, 0, 0, 9993}, }; /* extended case mappings */ @@ -3393,1578 +1504,1360 @@ static unsigned short index2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 2, 4, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 6, 5, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 6, 5, 5, 5, 5, 5, 5, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 5, 5, 5, 6, 43, 6, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 5, 5, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 6, 5, 5, 5, 5, 5, 5, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 5, 5, 5, 6, 18, 6, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 5, 6, 5, 70, 5, 5, - 71, 5, 6, 5, 5, 72, 73, 6, 74, 5, 75, 6, 76, 70, 5, 77, 77, 77, 5, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 5, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 5, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 70, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 70, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 70, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 70, 70, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 70, 321, 322, 323, 70, 324, 321, 321, 321, 321, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 70, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, 428, 429, 430, 431, 432, 433, 434, 435, 70, 70, 70, 70, 70, 70, 436, - 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, - 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 70, 463, 464, - 70, 465, 70, 466, 70, 70, 70, 70, 467, 70, 70, 468, 70, 469, 70, 70, 470, - 471, 70, 472, 70, 70, 70, 473, 70, 474, 475, 70, 70, 476, 70, 70, 70, 70, - 70, 70, 70, 477, 70, 70, 478, 70, 70, 479, 70, 70, 70, 70, 480, 481, 482, - 483, 484, 70, 70, 70, 70, 70, 485, 70, 321, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 486, 486, 486, 486, 486, 486, 486, 486, 486, 487, 487, 487, 487, - 487, 487, 487, 486, 486, 6, 6, 6, 6, 487, 487, 487, 487, 487, 487, 487, - 487, 487, 487, 487, 487, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 486, - 486, 486, 486, 486, 6, 6, 6, 6, 6, 6, 6, 487, 6, 487, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 488, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 489, 490, 491, 492, 487, - 6, 493, 494, 0, 0, 495, 496, 497, 498, 5, 0, 0, 0, 0, 0, 6, 6, 499, 75, - 500, 501, 502, 0, 503, 0, 504, 505, 506, 507, 508, 509, 510, 511, 512, - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 0, 524, 525, 526, - 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, - 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, - 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, - 569, 570, 571, 571, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, - 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, - 595, 596, 597, 598, 599, 600, 601, 70, 602, 603, 5, 604, 605, 606, 607, - 608, 70, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, - 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, - 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, - 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, - 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, - 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, - 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, - 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, - 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, - 734, 735, 736, 737, 738, 739, 740, 741, 5, 75, 75, 75, 75, 75, 6, 6, 742, - 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, - 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, - 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, - 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, - 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, - 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, - 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, - 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, - 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, - 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, - 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, - 897, 898, 899, 0, 0, 0, 0, 0, 0, 0, 0, 0, 900, 901, 902, 903, 904, 905, - 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, - 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, - 934, 935, 936, 937, 0, 0, 487, 5, 5, 5, 5, 5, 5, 0, 938, 939, 940, 941, - 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, - 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, - 970, 971, 972, 973, 974, 975, 976, 0, 5, 5, 0, 0, 0, 0, 0, 0, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 5, 75, 5, 75, 75, 5, 75, 75, 5, 75, 0, 0, 0, 0, - 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 0, 0, 0, 0, 321, 321, 321, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 71, 71, 71, 71, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 5, 0, 0, 5, 5, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 487, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 5, 5, 5, 5, 321, 321, 75, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 321, 75, 75, 75, 75, 75, - 75, 75, 71, 5, 75, 75, 75, 75, 75, 75, 487, 487, 75, 75, 5, 75, 75, 75, - 75, 321, 321, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 321, 321, 321, 5, 5, - 321, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 71, 321, 75, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 487, 487, 5, 5, 5, 5, 487, 0, 0, 0, 0, 0, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 487, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 487, 75, 75, 75, 487, 75, 75, 75, 75, 75, 0, 0, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 75, 75, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 5, 6, 5, 20, 5, 5, + 21, 5, 6, 5, 5, 22, 23, 6, 24, 5, 25, 6, 26, 20, 5, 27, 27, 27, 5, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 5, 17, 17, 17, 17, 17, 17, 17, 28, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 5, 19, 19, 19, 19, 19, 19, 19, 29, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 32, 33, 30, 31, 30, 31, 30, 31, 20, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 34, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 35, 30, 31, 30, 31, 30, 31, 36, 37, 38, 30, 31, 30, 31, 39, + 30, 31, 40, 40, 30, 31, 20, 41, 42, 43, 30, 31, 40, 44, 45, 46, 47, 30, + 31, 48, 20, 46, 49, 50, 51, 30, 31, 30, 31, 30, 31, 52, 30, 31, 52, 20, + 20, 30, 31, 52, 30, 31, 53, 53, 30, 31, 30, 31, 54, 30, 31, 20, 55, 30, + 31, 20, 56, 55, 55, 55, 55, 57, 58, 59, 57, 58, 59, 57, 58, 59, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 60, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 61, 57, 58, + 59, 30, 31, 62, 63, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 64, 20, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 20, 20, 20, 20, 20, 20, 65, + 30, 31, 66, 67, 68, 68, 30, 31, 69, 70, 71, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 72, 73, 74, 75, 76, 20, 77, 77, 20, 78, 20, 79, 20, 20, 20, + 20, 77, 20, 20, 80, 20, 81, 20, 20, 82, 83, 20, 84, 20, 20, 20, 83, 20, + 85, 86, 20, 20, 87, 20, 20, 20, 20, 20, 20, 20, 88, 20, 20, 89, 20, 20, + 89, 20, 20, 20, 20, 89, 90, 91, 91, 92, 20, 20, 20, 20, 20, 93, 20, 55, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 95, 95, 95, 95, 95, 95, 95, 94, 94, 6, 6, 6, 6, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 94, 94, + 94, 94, 94, 6, 6, 6, 6, 6, 6, 6, 95, 6, 95, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 96, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 31, 30, 31, 95, 6, 30, 31, 0, 0, + 97, 50, 50, 50, 5, 0, 0, 0, 0, 0, 6, 6, 98, 25, 99, 99, 99, 0, 100, 0, + 101, 101, 102, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 103, 104, 104, 104, + 105, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 106, 19, 19, 19, 19, 19, 19, 19, 19, 19, 107, 108, 108, 109, 110, 111, + 112, 112, 112, 113, 114, 115, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 116, 117, 118, 20, + 119, 120, 5, 30, 31, 121, 30, 31, 20, 64, 64, 64, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 5, 25, 25, 25, 25, 25, 6, 6, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 124, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 125, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 0, 0, 95, 5, 5, 5, 5, 5, 5, + 0, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 128, 0, 5, 5, 0, 0, 0, + 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 5, 25, 5, 25, 25, 5, 25, 25, + 5, 25, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, + 0, 0, 0, 55, 55, 55, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, + 21, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 5, 0, 0, 5, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 95, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 5, 5, 55, 55, 25, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 5, 55, 25, 25, 25, 25, 25, 25, 25, 21, 5, 25, 25, 25, + 25, 25, 25, 95, 95, 25, 25, 5, 25, 25, 25, 25, 55, 55, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 55, 55, 55, 5, 5, 55, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 21, 55, 25, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 25, 25, 25, 25, 25, 25, 25, 25, 25, 95, 95, 5, 5, 5, 5, 95, + 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, 25, 25, 95, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 95, 25, 25, 25, 95, 25, 25, 25, 25, 25, 0, 0, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, + 25, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, + 25, 18, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 25, 18, 25, 55, 18, 18, 18, 25, 25, 25, 25, 25, 25, 25, 25, 18, + 18, 18, 18, 25, 18, 18, 55, 25, 25, 25, 25, 25, 25, 25, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 25, 25, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 5, 95, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 25, + 18, 18, 0, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, 0, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 0, 0, 0, 55, 55, 55, 55, 0, + 0, 25, 55, 18, 18, 18, 25, 25, 25, 25, 0, 0, 18, 18, 0, 0, 18, 18, 25, + 55, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 55, 55, 0, 55, 55, 55, 25, + 25, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 55, 55, 5, 5, 27, 27, 27, + 27, 27, 27, 5, 5, 0, 0, 0, 0, 0, 25, 25, 18, 0, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 0, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 0, 55, 55, 0, 55, 55, 0, 0, 25, 0, 18, 18, 18, 25, 25, 0, 0, 0, + 0, 25, 25, 0, 0, 25, 25, 25, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 55, 55, + 55, 55, 0, 55, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 25, 25, 55, 55, 55, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 18, 0, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 0, 55, 55, 55, 55, 55, 0, 0, 25, + 55, 18, 18, 18, 25, 25, 25, 25, 25, 0, 25, 25, 18, 0, 18, 18, 25, 0, 0, + 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 25, 25, 0, 0, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 25, 18, 18, 0, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, + 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 0, 55, 55, + 55, 55, 55, 0, 0, 25, 55, 18, 25, 18, 25, 25, 25, 25, 0, 0, 18, 18, 0, 0, + 18, 18, 25, 0, 0, 0, 0, 0, 0, 0, 0, 25, 18, 0, 0, 0, 0, 55, 55, 0, 55, + 55, 55, 25, 25, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 55, 27, 27, + 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 55, 0, 55, 55, 55, 55, + 55, 55, 0, 0, 0, 55, 55, 55, 0, 55, 55, 55, 55, 0, 0, 0, 55, 55, 0, 55, + 0, 55, 55, 0, 0, 0, 55, 55, 0, 0, 0, 55, 55, 55, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 18, 18, 25, 18, 18, 0, 0, 0, + 18, 18, 18, 0, 18, 18, 18, 25, 0, 0, 55, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 27, + 27, 27, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 18, 18, 18, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 0, 0, 0, 55, 25, + 25, 25, 18, 18, 18, 18, 0, 25, 25, 25, 0, 25, 25, 25, 25, 0, 0, 0, 0, 0, + 0, 0, 25, 25, 0, 55, 55, 0, 0, 0, 0, 0, 0, 55, 55, 25, 25, 0, 0, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, 27, 27, 27, + 27, 27, 5, 0, 0, 18, 18, 0, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, + 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 55, 55, 55, 0, 0, 25, 55, 18, 25, 18, 18, 18, 18, 18, 0, 25, 18, + 18, 0, 18, 18, 25, 25, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, + 55, 0, 55, 55, 25, 25, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 55, + 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 0, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 55, 18, 18, + 18, 25, 25, 25, 25, 0, 18, 18, 18, 0, 18, 18, 18, 25, 55, 0, 0, 0, 0, 0, + 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 25, 25, 0, 0, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 27, 27, 27, 27, 27, 27, 0, 0, 0, 5, 55, 55, 55, + 55, 55, 55, 0, 0, 18, 18, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 0, + 0, 0, 25, 0, 0, 0, 0, 18, 18, 18, 25, 25, 25, 0, 25, 0, 18, 18, 18, 18, + 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, + 18, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 25, 55, 129, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, + 5, 55, 55, 55, 55, 55, 55, 95, 25, 25, 25, 25, 25, 25, 25, 25, 5, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 43, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 75, 43, 75, 321, 43, 43, 43, 75, 75, - 75, 75, 75, 75, 75, 75, 43, 43, 43, 43, 75, 43, 43, 321, 75, 75, 75, 75, - 75, 75, 75, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 5, - 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 487, 321, 321, 321, 321, 321, - 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 75, 43, 43, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 0, - 0, 321, 321, 321, 321, 0, 0, 75, 321, 43, 43, 43, 75, 75, 75, 75, 0, 0, - 43, 43, 0, 0, 43, 43, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, - 321, 321, 0, 321, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 321, 321, 5, 5, 77, 77, 77, 77, 77, 77, 5, 5, 0, 0, 0, 0, 0, 75, - 75, 43, 0, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 321, 321, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, - 0, 321, 321, 0, 321, 321, 0, 321, 321, 0, 0, 75, 0, 43, 43, 43, 75, 75, - 0, 0, 0, 0, 75, 75, 0, 0, 75, 75, 75, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, - 321, 321, 321, 321, 0, 321, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 75, 75, 321, 321, 321, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 75, 43, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, - 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, - 321, 321, 0, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 75, 321, 43, 43, - 43, 75, 75, 75, 75, 75, 0, 75, 75, 43, 0, 43, 43, 75, 0, 0, 321, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 43, 43, 0, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, - 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, - 321, 321, 0, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 75, 321, 43, 75, - 43, 75, 75, 75, 75, 0, 0, 43, 43, 0, 0, 43, 43, 75, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 43, 0, 0, 0, 0, 321, 321, 0, 321, 321, 321, 75, 75, 0, 0, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 5, 321, 77, 77, 77, 77, 77, 77, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 75, 321, 0, 321, 321, 321, 321, 321, 321, 0, 0, 0, 321, - 321, 321, 0, 321, 321, 321, 321, 0, 0, 0, 321, 321, 0, 321, 0, 321, 321, - 0, 0, 0, 321, 321, 0, 0, 0, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 43, 43, 75, 43, 43, - 0, 0, 0, 43, 43, 43, 0, 43, 43, 43, 75, 0, 0, 321, 0, 0, 0, 0, 0, 0, 43, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 43, 43, 43, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 0, 321, 75, 75, 75, 43, - 43, 43, 43, 0, 75, 75, 75, 0, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, 0, 75, - 75, 0, 321, 321, 0, 0, 0, 0, 0, 0, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, - 77, 5, 0, 0, 43, 43, 0, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, - 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 0, 0, 75, - 321, 43, 75, 43, 43, 43, 43, 43, 0, 75, 43, 43, 0, 43, 43, 75, 75, 0, 0, - 0, 0, 0, 0, 0, 43, 43, 0, 0, 0, 0, 0, 0, 0, 321, 0, 321, 321, 75, 75, 0, - 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 321, 321, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 0, 0, 321, 43, 43, 43, 75, 75, 75, 75, 0, 43, 43, 43, - 0, 43, 43, 43, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, - 0, 321, 321, 75, 75, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 77, 77, - 77, 77, 77, 77, 0, 0, 0, 5, 321, 321, 321, 321, 321, 321, 0, 0, 43, 43, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 0, 0, 0, 75, 0, 0, 0, 0, 43, 43, 43, 75, - 75, 75, 0, 75, 0, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 321, 977, 75, 75, 75, 75, 75, 75, 75, - 0, 0, 0, 0, 5, 321, 321, 321, 321, 321, 321, 487, 75, 75, 75, 75, 75, 75, - 75, 75, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 55, 55, 0, 55, 0, 0, 55, 55, 0, 55, 0, 0, 55, 0, 0, 0, 0, 0, 0, 55, + 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 0, 55, 0, 55, + 0, 0, 55, 55, 0, 55, 55, 55, 55, 25, 55, 129, 25, 25, 25, 25, 25, 25, 0, + 25, 25, 55, 0, 0, 55, 55, 55, 55, 55, 0, 95, 0, 25, 25, 25, 25, 25, 25, + 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 321, 321, 0, 321, 0, 0, 321, 321, 0, 321, 0, 0, 321, - 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, - 321, 0, 321, 321, 321, 0, 321, 0, 321, 0, 0, 321, 321, 0, 321, 321, 321, - 321, 75, 321, 977, 75, 75, 75, 75, 75, 75, 0, 75, 75, 321, 0, 0, 321, - 321, 321, 321, 321, 0, 487, 0, 75, 75, 75, 75, 75, 75, 0, 0, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 0, 0, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, - 75, 5, 5, 5, 5, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 5, 75, 5, 75, 5, 75, 5, 5, 5, 5, 43, 43, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 0, 0, 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 43, 75, 75, 75, 75, 75, 5, 75, 75, 321, 321, 321, 321, 321, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 5, 5, 5, 5, 5, 5, 5, 5, 75, 5, 5, - 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 55, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 25, 25, 5, 5, 5, 5, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 5, 25, 5, 25, 5, 25, 5, 5, 5, + 5, 18, 18, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 18, 25, 25, 25, 25, 25, 5, 25, + 25, 55, 55, 55, 55, 55, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 0, 5, 5, 5, 5, 5, 5, 5, 5, 25, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 18, 18, 25, 25, 25, 25, 18, 25, 25, 25, 25, 25, 25, 18, 25, + 25, 18, 18, 25, 25, 55, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 5, 5, + 5, 5, 55, 55, 55, 55, 55, 55, 18, 18, 25, 25, 55, 55, 55, 55, 25, 25, 25, + 55, 18, 18, 18, 55, 55, 18, 18, 18, 18, 18, 18, 18, 55, 55, 55, 25, 25, + 25, 25, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 18, 18, + 25, 25, 18, 18, 18, 18, 18, 18, 25, 55, 18, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 18, 18, 18, 25, 5, 5, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5, + 95, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, + 55, 0, 55, 0, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, + 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 0, 55, 55, 55, + 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 0, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0, 0, 25, 25, 25, 5, 5, 5, 5, 5, 5, 5, 5, 5, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 5, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 2, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5, 5, 0, 0, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 5, 5, 5, 140, 140, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 25, + 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, 25, 5, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 0, 25, 25, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 21, 21, 18, 25, 25, 25, 25, 25, 25, 25, 18, 18, 18, 18, + 18, 18, 18, 18, 25, 18, 18, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 5, 5, 5, 95, 5, 5, 5, 5, 55, 25, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 0, 0, 0, 0, 0, 0, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 25, 25, 25, 2, 0, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 95, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 25, 55, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0, 0, 0, 25, 25, 25, 18, 18, 18, 18, 25, 25, 18, 18, 18, + 0, 0, 0, 0, 18, 18, 25, 18, 18, 18, 18, 18, 18, 25, 25, 25, 0, 0, 0, 0, + 5, 0, 0, 0, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 55, 55, 55, 55, + 55, 55, 55, 18, 18, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 131, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, + 25, 18, 18, 18, 0, 0, 5, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 18, 25, 18, 25, 25, 25, 25, 25, 25, 25, 0, 25, + 18, 25, 18, 18, 25, 25, 25, 25, 25, 25, 25, 25, 18, 18, 18, 18, 18, 18, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 25, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, + 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 95, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 43, 43, 75, 75, 75, 75, 43, 75, 75, 75, 75, 75, - 75, 43, 75, 75, 43, 43, 75, 75, 321, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 5, 5, 5, 5, 5, 5, 321, 321, 321, 321, 321, 321, 43, 43, 75, 75, 321, 321, - 321, 321, 75, 75, 75, 321, 43, 43, 43, 321, 321, 43, 43, 43, 43, 43, 43, - 43, 321, 321, 321, 75, 75, 75, 75, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 43, 43, 75, 75, 43, 43, 43, 43, 43, 43, - 75, 321, 43, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 43, 43, 43, 75, 5, 5, - 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, - 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, - 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 5, 487, 0, 0, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, - 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 321, - 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 0, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, - 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 321, - 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 0, 0, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 75, 75, 75, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 0, 0, 0, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 2, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, - 5, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 5, 5, 5, 1025, 1025, 1025, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 75, 75, 75, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 5, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, - 321, 321, 0, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 71, 71, 43, 75, 75, 75, 75, 75, 75, - 75, 43, 43, 43, 43, 43, 43, 43, 43, 75, 43, 43, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 5, 5, 5, 487, 5, 5, 5, 5, 321, 75, 0, 0, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, 75, 75, 2, - 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 487, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 75, 321, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 0, 0, 75, 75, 75, 43, 43, 43, 43, 75, 75, 43, 43, 43, 0, 0, 0, 0, - 43, 43, 75, 43, 43, 43, 43, 43, 43, 75, 75, 75, 0, 0, 0, 0, 5, 0, 0, 0, - 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, - 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 321, 321, 321, - 321, 321, 321, 321, 43, 43, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 1016, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 75, 43, 43, 43, 0, 0, 5, 5, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 43, 75, 43, 75, 75, 75, 75, - 75, 75, 75, 0, 75, 43, 75, 43, 43, 75, 75, 75, 75, 75, 75, 75, 75, 43, - 43, 43, 43, 43, 43, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 75, 7, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 487, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 25, 25, 25, 25, 18, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 25, 18, 25, 25, 25, 25, 25, 18, 25, 18, 18, 18, 18, 18, 25, 18, + 18, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 25, 25, 18, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 18, 25, 25, 25, 25, 18, + 18, 25, 25, 18, 0, 0, 0, 55, 55, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, + 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 25, 18, 25, 25, 18, 18, 18, 25, 18, 25, 25, 25, + 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 18, 18, 18, 18, 18, 18, 18, + 18, 25, 25, 25, 25, 25, 25, 25, 25, 18, 18, 25, 25, 0, 0, 0, 5, 5, 5, 5, + 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 55, 55, 55, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 95, 95, 95, 95, 95, 95, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 5, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 18, 25, 25, 25, 25, 25, + 25, 25, 55, 55, 55, 55, 25, 55, 55, 55, 55, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 94, 141, + 20, 20, 20, 142, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 25, 25, 25, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 143, 144, 145, 146, 147, 148, 20, 20, + 149, 20, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 150, 150, 150, 150, 150, 150, 150, 150, + 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 150, 0, + 0, 151, 151, 151, 151, 151, 151, 0, 0, 150, 150, 150, 150, 150, 150, 150, + 150, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, + 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 150, 150, 150, + 150, 150, 150, 0, 0, 151, 151, 151, 151, 151, 151, 0, 0, 152, 150, 153, + 150, 154, 150, 155, 150, 0, 151, 0, 151, 0, 151, 0, 151, 150, 150, 150, + 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 156, + 156, 157, 157, 157, 157, 158, 158, 159, 159, 160, 160, 161, 161, 0, 0, + 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + 204, 205, 206, 207, 208, 209, 150, 150, 210, 211, 212, 0, 213, 214, 151, + 151, 215, 215, 216, 6, 217, 6, 6, 6, 218, 219, 220, 0, 221, 222, 223, + 223, 223, 223, 224, 6, 6, 6, 150, 150, 225, 226, 0, 0, 227, 228, 151, + 151, 229, 229, 0, 6, 6, 6, 150, 150, 230, 231, 232, 118, 233, 234, 151, + 151, 235, 235, 121, 6, 6, 6, 0, 0, 236, 237, 238, 0, 239, 240, 241, 241, + 242, 242, 243, 6, 6, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 21, 21, 21, 21, + 21, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, + 6, 3, 3, 21, 21, 21, 21, 21, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 18, 18, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 18, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 21, + 21, 21, 21, 21, 21, 244, 95, 0, 0, 245, 246, 247, 248, 249, 250, 5, 5, 5, + 5, 5, 95, 244, 26, 22, 23, 245, 246, 247, 248, 249, 250, 5, 5, 5, 5, 5, + 0, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 95, 95, 0, 0, 0, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 6, 6, 6, 6, 25, 6, 6, 6, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 5, 5, 112, 5, 5, 5, 5, 112, 5, 5, 20, 112, 112, 112, 20, + 20, 112, 112, 112, 20, 5, 112, 5, 5, 251, 112, 112, 112, 112, 112, 5, 5, + 5, 5, 5, 5, 112, 5, 252, 5, 112, 5, 253, 254, 112, 112, 251, 20, 112, + 112, 255, 112, 20, 55, 55, 55, 55, 20, 5, 5, 20, 20, 112, 112, 5, 5, 5, + 5, 5, 112, 20, 20, 20, 20, 5, 5, 5, 5, 256, 5, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, 258, 258, 258, 258, + 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 140, 140, + 140, 30, 31, 140, 140, 140, 140, 27, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 26, 22, 23, 245, 246, 247, 248, 249, 250, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 26, 22, 23, 245, 246, 247, 248, 249, 250, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 26, 22, 23, 245, 246, 247, 248, 249, 250, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, + 260, 260, 260, 260, 260, 244, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, + 22, 23, 245, 246, 247, 248, 249, 250, 27, 244, 0, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 26, 22, 23, 245, 246, 247, 248, + 249, 250, 27, 26, 22, 23, 245, 246, 247, 248, 249, 250, 27, 26, 22, 23, + 245, 246, 247, 248, 249, 250, 27, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 0, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 0, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 0, + 30, 31, 261, 262, 263, 264, 265, 30, 31, 30, 31, 30, 31, 266, 267, 268, + 269, 20, 30, 31, 20, 30, 31, 20, 20, 20, 20, 20, 20, 94, 270, 270, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 20, 5, 5, 5, 5, 5, 5, 30, 31, 30, 31, + 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 27, 5, 5, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, + 271, 271, 271, 271, 271, 271, 271, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 95, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, + 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, + 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, + 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, + 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 272, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 2, 5, 5, 5, + 5, 95, 55, 140, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 140, 140, 140, 140, 140, 140, 140, 140, 140, 25, 25, + 25, 25, 25, 25, 5, 95, 95, 95, 95, 95, 5, 5, 140, 140, 140, 95, 55, 5, 5, + 5, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 25, 25, + 6, 6, 95, 95, 55, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 5, 95, 95, 95, 55, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 5, 5, 27, 27, 27, 27, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 55, 55, + 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 273, 55, 55, 273, 55, 55, 55, 273, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 273, 55, 273, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 273, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, + 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 273, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 273, 273, 273, 55, + 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 273, 273, + 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, + 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 273, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 273, 273, 273, 55, 273, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 273, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, + 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 95, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 95, 95, 95, 95, 95, 95, 5, 5, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 95, 5, 5, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 55, 55, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 30, 31, 30, 31, 30, 31, 55, 25, 6, 6, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 25, 5, 95, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 25, 25, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 95, 95, 95, 95, 95, 95, 95, 95, 95, 6, 6, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 20, 20, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 94, + 20, 20, 20, 20, 20, 20, 20, 20, 30, 31, 30, 31, 274, 30, 31, 30, 31, 30, + 31, 30, 31, 30, 31, 95, 6, 6, 30, 31, 275, 20, 0, 30, 31, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 43, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 75, 43, 75, 75, 75, 75, 75, 43, 75, 43, 43, 43, 43, 43, 75, 43, - 43, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 75, - 75, 43, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 43, 75, 75, 75, 75, 43, 43, 75, 75, 43, 0, 0, 0, 321, 321, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 75, 43, 75, 75, 43, 43, 43, 75, 43, - 75, 75, 75, 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 43, 43, 43, 43, 43, 43, 43, 43, 75, 75, 75, 75, - 75, 75, 75, 75, 43, 43, 75, 75, 0, 0, 0, 5, 5, 5, 5, 5, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 0, 0, 0, 321, 321, 321, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 487, 487, 487, 487, 487, 487, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 20, 55, 55, 55, 55, 55, 55, 55, 25, 55, 55, 55, 25, 55, + 55, 55, 55, 25, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 18, 18, 25, 25, 18, 5, 5, 5, 5, 0, 0, + 0, 0, 27, 27, 27, 27, 27, 27, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5, 5, 5, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 18, 18, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 55, 55, 55, 55, 55, 55, 5, 5, 5, 55, 0, 0, 0, 0, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, + 25, 25, 25, 25, 25, 25, 25, 5, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 25, 25, 25, 18, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 18, 18, 25, 25, 25, 25, 18, 18, + 25, 18, 18, 18, 18, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 95, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 75, 75, 75, 5, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 43, - 75, 75, 75, 75, 75, 75, 75, 321, 321, 321, 321, 75, 321, 321, 321, 321, - 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 486, 1026, 70, 70, 70, 1027, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, 486, - 486, 486, 486, 486, 486, 486, 486, 486, 486, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 1028, 1029, - 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, - 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, - 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, - 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, - 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, - 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, - 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, - 1114, 1115, 1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, - 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, - 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, - 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, - 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, - 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, 1182, 1183, 70, 70, 1184, - 70, 1185, 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, - 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, - 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, - 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231, - 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, 1243, - 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1255, - 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, - 1268, 1269, 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, - 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, 1291, - 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 0, 0, - 1303, 1304, 1305, 1306, 1307, 1308, 0, 0, 1309, 1310, 1311, 1312, 1313, - 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, - 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, - 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 1347, 1348, - 1349, 1350, 1351, 1352, 0, 0, 1353, 1354, 1355, 1356, 1357, 1358, 1359, - 1360, 0, 1361, 0, 1362, 0, 1363, 0, 1364, 1365, 1366, 1367, 1368, 1369, - 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, - 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, - 1394, 0, 0, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1404, - 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, - 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, - 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, - 1441, 1442, 1443, 1444, 1445, 1446, 1447, 0, 1448, 1449, 1450, 1451, - 1452, 1453, 1454, 6, 1455, 6, 6, 6, 1456, 1457, 1458, 0, 1459, 1460, - 1461, 1462, 1463, 1464, 1465, 6, 6, 6, 1466, 1467, 1468, 1469, 0, 0, - 1470, 1471, 1472, 1473, 1474, 1475, 0, 6, 6, 6, 1476, 1477, 1478, 1479, - 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 6, 6, 6, 0, 0, - 1489, 1490, 1491, 0, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 6, 6, 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71, 71, 71, 71, 71, 5, 5, 5, 5, 5, 5, 5, - 5, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 6, 3, 3, 71, 71, 71, 71, - 71, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 43, 43, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 43, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 2, 71, 71, 71, 71, 71, 0, 0, 0, 0, 0, 71, 71, 71, 71, 71, 71, 1499, - 487, 0, 0, 1500, 1501, 1502, 1503, 1504, 1505, 5, 5, 5, 5, 5, 487, 1499, - 76, 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 5, 5, 5, 5, 5, 0, 486, - 486, 486, 486, 486, 487, 487, 487, 487, 487, 487, 487, 487, 0, 0, 0, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 6, 6, 6, 6, 75, 6, 6, 6, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 5, 571, 5, 5, 5, 5, 571, 5, 5, 70, 571, 571, 571, - 70, 70, 571, 571, 571, 70, 5, 571, 5, 5, 1506, 571, 571, 571, 571, 571, - 5, 5, 5, 5, 5, 5, 571, 5, 1507, 5, 571, 5, 1508, 1509, 571, 571, 1506, - 70, 571, 571, 1510, 571, 70, 321, 321, 321, 321, 70, 5, 5, 70, 70, 571, - 571, 5, 5, 5, 5, 5, 571, 70, 70, 70, 70, 5, 5, 5, 5, 1511, 5, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 1512, 1513, 1514, - 1515, 1516, 1517, 1518, 1519, 1520, 1521, 1522, 1523, 1524, 1525, 1526, - 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, - 1539, 1540, 1541, 1542, 1543, 1025, 1025, 1025, 1544, 1545, 1025, 1025, - 1025, 1025, 77, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 72, 73, - 1500, 1501, 1502, 1503, 1504, 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 76, 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 76, 72, 73, 1500, 1501, 1502, 1503, 1504, - 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1546, 1547, 1548, - 1549, 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, - 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, 1572, - 1573, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, - 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, - 1597, 1499, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 76, 72, 73, 1500, - 1501, 1502, 1503, 1504, 1505, 77, 1499, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 76, 72, 73, 1500, 1501, 1502, 1503, - 1504, 1505, 77, 76, 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 77, 76, - 72, 73, 1500, 1501, 1502, 1503, 1504, 1505, 77, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, - 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 25, 25, 25, 25, 25, 25, 18, 18, 25, 25, 18, 18, 25, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 25, 55, 55, 55, 55, 55, 55, + 55, 55, 25, 18, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 5, 5, 5, + 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 95, + 55, 55, 55, 55, 55, 55, 5, 5, 5, 55, 18, 0, 0, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 25, 55, 25, 25, 25, 55, 55, 25, 25, 55, 55, + 55, 55, 55, 25, 25, 55, 25, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 95, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1598, 1599, 1600, 1601, 1602, 1603, - 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615, - 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, - 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, - 1640, 1641, 1642, 1643, 1644, 0, 1645, 1646, 1647, 1648, 1649, 1650, - 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660, 1661, 1662, - 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670, 1671, 1672, 1673, 1674, - 1675, 1676, 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, - 1687, 1688, 1689, 1690, 1691, 0, 1692, 1693, 1694, 1695, 1696, 1697, - 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 70, - 1709, 1710, 70, 1711, 1712, 70, 70, 70, 70, 70, 70, 486, 1713, 1714, - 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, 1723, 1724, 1725, 1726, - 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, - 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, 1750, - 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, 1760, 1761, 1762, - 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774, - 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, - 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, - 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, - 1811, 1812, 1813, 1814, 70, 5, 5, 5, 5, 5, 5, 1815, 1816, 1817, 1818, 75, - 75, 75, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 77, 5, 5, 1819, 1820, 1821, - 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, - 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, - 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 487, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 75, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, - 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, - 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, - 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 321, - 321, 321, 321, 321, 321, 321, 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 1857, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, + 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 0, 0, 0, 2, 5, 5, 5, 5, 487, 321, 1025, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 75, 75, 75, 75, 75, 75, 5, 487, 487, - 487, 487, 487, 5, 5, 1025, 1025, 1025, 487, 321, 5, 5, 5, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, - 0, 75, 75, 6, 6, 487, 487, 321, 5, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 487, - 487, 487, 321, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 0, 5, 5, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, - 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 0, 321, 321, 321, 321, 321, 1858, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 18, 18, 25, 18, 18, 25, 18, 18, 5, 18, 25, 0, 0, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, + 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 273, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 276, 277, 278, 279, 280, + 281, 282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 283, 284, 285, 286, 287, 0, + 0, 0, 0, 0, 55, 25, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 0, 55, + 0, 55, 55, 0, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 288, 288, 288, 288, 288, 288, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 288, 288, 5, 5, 0, 0, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 5, 5, 18, 18, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 18, 18, 18, 5, 5, 6, 0, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 0, 0, 0, 0, 288, 55, 288, 55, 288, 0, + 288, 55, 288, 55, 288, 55, 288, 55, 288, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 21, 0, 5, 5, 5, 5, 5, 5, 6, + 5, 5, 5, 5, 5, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 6, 5, 5, 5, + 5, 5, 5, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 5, 5, 5, 6, 18, 6, 19, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, + 19, 19, 19, 19, 19, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 95, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 289, 289, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 0, 0, 55, 55, 55, 55, 55, 55, 0, 0, + 55, 55, 55, 0, 0, 0, 5, 5, 5, 6, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 5, 5, 0, 0, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, + 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, + 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 0, 0, 0, 0, 0, 5, 5, 5, 0, 0, 0, 0, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 27, 27, 27, 27, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 27, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1858, 321, - 321, 1858, 321, 321, 321, 1858, 321, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, - 321, 321, 321, 321, 321, 321, 1858, 321, 1858, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 1858, 1858, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, - 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 1858, - 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 1858, 321, 1858, 1858, 1858, 321, 321, 321, 321, 321, 321, 1858, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 1858, 1858, 1858, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 1858, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 1858, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 1858, 1858, 1858, 321, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 25, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 487, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 0, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 140, 55, 55, 55, 55, 55, 55, 55, 55, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 0, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, + 55, 55, 5, 140, 140, 140, 140, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, + 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 0, 0, 55, 0, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 55, 55, 0, 0, 0, 55, 0, 0, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 0, 5, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 27, 27, 27, 27, 27, 27, 0, 0, 0, 5, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 25, + 25, 25, 0, 25, 25, 0, 0, 0, 0, 0, 25, 25, 25, 25, 55, 55, 55, 55, 0, 55, + 55, 55, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 25, 25, 25, + 0, 0, 0, 0, 25, 26, 22, 23, 245, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 27, 27, 5, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 0, 0, 27, 27, 27, 27, 27, 27, 27, 27, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 27, 27, 27, + 27, 27, 27, 27, 27, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 22, 23, 245, 246, 247, + 248, 249, 250, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 0, 18, 25, 18, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 26, 22, + 23, 245, 246, 247, 248, 249, 250, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 25, 25, 18, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 18, 18, + 18, 25, 25, 25, 25, 18, 18, 25, 25, 5, 5, 21, 5, 5, 5, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 251, 251, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 251, 251, 140, 140, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 487, 487, 487, 487, 487, 487, 5, 5, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 487, 5, 5, 5, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, - 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, - 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, - 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, - 1904, 321, 75, 6, 6, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 75, 75, 5, 487, 1905, - 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, - 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 0, 0, - 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 75, 75, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 487, 487, 487, 487, - 487, 487, 487, 487, 487, 6, 6, 1929, 1930, 1931, 1932, 1933, 1934, 1935, - 1936, 1937, 1938, 1939, 1940, 1941, 1942, 70, 70, 1943, 1944, 1945, 1946, - 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, - 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, - 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, - 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, - 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 486, 70, 70, - 70, 70, 70, 70, 70, 70, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, - 2013, 2014, 2015, 2016, 2017, 2018, 2019, 487, 6, 6, 2020, 2021, 2022, - 70, 0, 2023, 2024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2025, 2026, - 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 70, 321, 321, 321, 321, 321, 321, 321, 75, 321, 321, 321, 75, 321, 321, - 321, 321, 75, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 43, 43, 75, 75, - 43, 5, 5, 5, 5, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, 5, 5, 5, 5, 0, 0, 0, - 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 5, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 43, 43, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 75, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 5, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, - 0, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 321, 321, 321, 321, 321, 321, 5, 5, 5, 321, 0, 0, 0, 0, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, 5, 5, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 43, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 75, 75, 75, 43, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 75, 43, 43, 75, 75, 75, 75, 43, 43, 75, 43, 43, - 43, 43, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 487, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, - 75, 75, 43, 43, 75, 75, 43, 43, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 321, 321, 75, 321, 321, 321, 321, 321, 321, 321, 321, 75, 43, 0, 0, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 5, 5, 5, 5, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 487, 321, 321, - 321, 321, 321, 321, 5, 5, 5, 321, 43, 0, 0, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 75, 321, 75, 75, 75, 321, 321, 75, 75, 321, 321, 321, 321, 321, - 75, 75, 321, 75, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 321, 321, 487, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 0, 0, 321, - 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 43, 43, 75, 43, 43, 75, 43, 43, 5, 43, 75, 0, 0, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 1858, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 1858, 321, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2035, 2036, 2037, 2038, - 2039, 2040, 2041, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2042, 2043, 2044, - 2045, 2046, 0, 0, 0, 0, 0, 321, 75, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 0, 321, 321, 321, 321, 321, 0, 321, 0, 321, 321, 0, 321, 321, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 2047, - 2047, 2047, 2047, 2047, 2047, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 5, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 2047, 2047, 5, 5, 0, 0, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, - 0, 0, 0, 0, 0, 0, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 5, 5, 43, 43, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 43, 43, 43, 5, 5, 6, 0, 5, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 0, 0, 0, 0, 2047, 321, 2047, 321, - 2047, 0, 2047, 321, 2047, 321, 2047, 321, 2047, 321, 2047, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 71, 0, 5, 5, - 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 6, 5, 5, 5, 5, 5, 5, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, - 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, - 2068, 2069, 2070, 2071, 2072, 2073, 5, 5, 5, 6, 43, 6, 2074, 2075, 2076, - 2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088, - 2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 487, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 2100, 2100, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, - 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, - 321, 321, 321, 0, 0, 321, 321, 321, 0, 0, 0, 5, 5, 5, 6, 5, 5, 5, 0, 5, - 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 71, 71, 5, 5, 0, 0, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 0, 321, 321, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 5, 5, 5, 0, - 0, 0, 0, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 77, 77, 77, 77, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 77, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 18, 18, 25, 25, 25, 5, 5, 5, 18, 18, 18, 18, + 18, 18, 21, 21, 21, 21, 21, 21, 21, 21, 25, 25, 25, 25, 25, 25, 25, 25, + 5, 5, 25, 25, 25, 25, 25, 25, 25, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 25, 25, 25, 25, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 75, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 25, 25, 25, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 0, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 1025, 321, 321, 321, 321, 321, 321, 321, 321, 1025, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 0, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 321, 5, 1025, 1025, 1025, 1025, 1025, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2101, 2102, 2103, 2104, - 2105, 2106, 2107, 2108, 2109, 2110, 2111, 2112, 2113, 2114, 2115, 2116, - 2117, 2118, 2119, 2120, 2121, 2122, 2123, 2124, 2125, 2126, 2127, 2128, - 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2139, 2140, - 2141, 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, - 2153, 2154, 2155, 2156, 2157, 2158, 2159, 2160, 2161, 2162, 2163, 2164, - 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, - 2177, 2178, 2179, 2180, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 321, 321, 321, 321, 321, 321, 0, 0, 321, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 321, 0, 0, 0, - 321, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 5, 77, 77, 77, - 77, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 77, 77, 77, 77, 77, 77, 0, 0, 0, 5, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 75, 75, 75, 0, 75, 75, 0, 0, 0, 0, 0, 75, - 75, 75, 75, 321, 321, 321, 321, 0, 321, 321, 321, 0, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 75, 75, 75, 0, - 0, 0, 0, 75, 76, 72, 73, 1500, 77, 77, 77, 77, 0, 0, 0, 0, 0, 0, 0, 0, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 77, 77, 5, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 5, 5, 5, 5, 5, - 5, 5, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 77, 77, 77, 77, 77, - 77, 77, 77, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 77, 77, 77, 77, 77, 77, - 77, 77, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 72, 73, 1500, 1501, 1502, - 1503, 1504, 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 0, 43, 75, 43, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 76, 72, 73, 1500, 1501, - 1502, 1503, 1504, 1505, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 75, 43, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 43, 43, 43, 75, 75, 75, 75, 43, 43, 75, 75, - 5, 5, 71, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1506, 1506, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1506, 1506, 1025, 1025, - 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 1025, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 321, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 112, 0, 112, 112, 0, 0, 112, 0, 0, 112, 112, 0, 0, 112, 112, 112, + 112, 0, 112, 112, 112, 112, 112, 112, 112, 112, 20, 20, 20, 20, 0, 20, 0, + 20, 20, 20, 20, 20, 20, 20, 0, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 112, 112, 0, 112, 112, 112, 112, 0, 0, 112, 112, 112, + 112, 112, 112, 112, 112, 0, 112, 112, 112, 112, 112, 112, 112, 0, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 112, 112, 0, 112, 112, 112, 112, 0, 112, 112, + 112, 112, 112, 0, 112, 0, 0, 0, 112, 112, 112, 112, 112, 112, 112, 0, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 0, 0, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 5, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 5, 20, 20, 20, 20, 20, 20, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 5, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 5, 20, 20, 20, 20, 20, 20, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 5, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 20, 20, 20, 20, 20, 20, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 5, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 5, 20, 20, 20, 20, 20, 20, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 5, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 20, 20, 20, 20, + 20, 20, 112, 20, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, - 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 43, 43, 75, 75, 75, 5, 5, 5, 43, - 43, 43, 43, 43, 43, 71, 71, 71, 71, 71, 71, 71, 71, 75, 75, 75, 75, 75, - 75, 75, 75, 5, 5, 75, 75, 75, 75, 75, 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 75, 75, - 75, 75, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244, 244, 26, 22, 23, 245, 246, 247, + 248, 249, 250, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 75, 75, 75, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 0, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 571, 0, 571, 571, 0, 0, 571, 0, 0, 571, 571, 0, 0, - 571, 571, 571, 571, 0, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, - 70, 70, 0, 70, 0, 70, 70, 70, 70, 70, 70, 70, 0, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 0, 571, 571, 571, 571, - 0, 0, 571, 571, 571, 571, 571, 571, 571, 571, 0, 571, 571, 571, 571, 571, - 571, 571, 0, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 0, 571, 571, 571, - 571, 0, 571, 571, 571, 571, 571, 0, 571, 0, 0, 0, 571, 571, 571, 571, - 571, 571, 571, 0, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 0, 0, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 5, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 5, 70, 70, 70, 70, 70, 70, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 5, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 5, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 5, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 5, 70, 70, 70, 70, - 70, 70, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 5, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 5, 70, 70, 70, 70, 70, 70, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, 571, - 571, 571, 571, 571, 571, 571, 5, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 5, 70, 70, - 70, 70, 70, 70, 571, 70, 0, 0, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1499, 1499, 76, 72, 73, 1500, - 1501, 1502, 1503, 1504, 1505, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 5, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, - 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 0, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, - 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 0, 5, 0, 5, - 0, 5, 0, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 0, 5, 0, 0, 5, - 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 1858, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 1858, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 1858, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 1858, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, - 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, + 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 0, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, - 71, 71, 71, 71, 71, 71, 71, 71, 71, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 0, 5, 0, 5, 0, 5, 0, 5, 5, + 5, 0, 5, 5, 5, 5, 5, 5, 0, 0, 5, 5, 5, 5, 0, 5, 0, 0, 5, 5, 5, 5, 0, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, + 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 273, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 273, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, }; /* Returns the numeric value as double for Unicode characters diff --git a/Tools/unicode/makeunicodedata.py b/Tools/unicode/makeunicodedata.py --- a/Tools/unicode/makeunicodedata.py +++ b/Tools/unicode/makeunicodedata.py @@ -443,6 +443,13 @@ if sc is None: if upper == lower == title: upper = lower = title = 0 + else: + upper = upper - char + lower = lower - char + title = title - char + assert (abs(upper) <= 2147483647 and + abs(lower) <= 2147483647 and + abs(title) <= 2147483647) else: # This happens either when some character maps to more than one # character in uppercase, lowercase, or titlecase or the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 03:26:28 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 03:26:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_comment_about_how_flags_cou?= =?utf8?q?ld_be_expanded?= Message-ID: http://hg.python.org/cpython/rev/4cf9f7dc32c2 changeset: 74424:4cf9f7dc32c2 user: Benjamin Peterson date: Sun Jan 15 21:26:23 2012 -0500 summary: comment about how flags could be expanded files: Objects/unicodectype.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -34,6 +34,7 @@ const int upper; const int lower; const int title; + /* Note if more flag space is needed, decimal and digit could be unified. */ const unsigned char decimal; const unsigned char digit; const unsigned short flags; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 03:28:54 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 03:28:54 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_explain_why_we_?= =?utf8?q?need_this_grammar_file_=28closes_=2313766=29?= Message-ID: http://hg.python.org/cpython/rev/8f7e707ab729 changeset: 74425:8f7e707ab729 branch: 3.2 parent: 74421:1c0c6fa7341c user: Benjamin Peterson date: Sun Jan 15 21:28:00 2012 -0500 summary: explain why we need this grammar file (closes #13766) files: Lib/lib2to3/Grammar.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/lib2to3/Grammar.txt b/Lib/lib2to3/Grammar.txt --- a/Lib/lib2to3/Grammar.txt +++ b/Lib/lib2to3/Grammar.txt @@ -1,4 +1,4 @@ -# Grammar for Python +# Grammar for 2to3. This grammar supports Python 2.x and 3.x. # Note: Changing the grammar specified in this file will most likely # require corresponding changes in the parser module -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 03:28:55 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 03:28:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiBtZXJnZSAzLjIgKCMxMzc2Nik=?= Message-ID: http://hg.python.org/cpython/rev/ecc998ec8c6f changeset: 74426:ecc998ec8c6f parent: 74424:4cf9f7dc32c2 parent: 74425:8f7e707ab729 user: Benjamin Peterson date: Sun Jan 15 21:28:13 2012 -0500 summary: merge 3.2 (#13766) files: Lib/lib2to3/Grammar.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/lib2to3/Grammar.txt b/Lib/lib2to3/Grammar.txt --- a/Lib/lib2to3/Grammar.txt +++ b/Lib/lib2to3/Grammar.txt @@ -1,4 +1,4 @@ -# Grammar for Python +# Grammar for 2to3. This grammar supports Python 2.x and 3.x. # Note: Changing the grammar specified in this file will most likely # require corresponding changes in the parser module -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 03:28:55 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 03:28:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_explain_why_we_?= =?utf8?q?need_this_grammar_file_=28closes_=2313766=29?= Message-ID: http://hg.python.org/cpython/rev/5d1c177c585b changeset: 74427:5d1c177c585b branch: 2.7 parent: 74418:95b704cb7f7c user: Benjamin Peterson date: Sun Jan 15 21:28:00 2012 -0500 summary: explain why we need this grammar file (closes #13766) files: Lib/lib2to3/Grammar.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/lib2to3/Grammar.txt b/Lib/lib2to3/Grammar.txt --- a/Lib/lib2to3/Grammar.txt +++ b/Lib/lib2to3/Grammar.txt @@ -1,4 +1,4 @@ -# Grammar for Python +# Grammar for 2to3. This grammar supports Python 2.x and 3.x. # Note: Changing the grammar specified in this file will most likely # require corresponding changes in the parser module -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 03:33:40 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 03:33:40 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_old_titlecase_function_?= =?utf8?q?for_extended_case_chars?= Message-ID: http://hg.python.org/cpython/rev/f44829767dd4 changeset: 74428:f44829767dd4 parent: 74426:ecc998ec8c6f user: Benjamin Peterson date: Sun Jan 15 21:33:32 2012 -0500 summary: fix old titlecase function for extended case chars files: Objects/unicodectype.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Objects/unicodectype.c b/Objects/unicodectype.c --- a/Objects/unicodectype.c +++ b/Objects/unicodectype.c @@ -65,6 +65,8 @@ { const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + if (ctype->flags & EXTENDED_CASE_MASK) + return _PyUnicode_ExtendedCase[ctype->title & 0xFFFF]; return ch + ctype->title; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 04:43:15 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 04:43:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_kill_useless_import_added_b?= =?utf8?q?y_87331661042b?= Message-ID: http://hg.python.org/cpython/rev/685eacf0dc0c changeset: 74429:685eacf0dc0c user: Benjamin Peterson date: Sun Jan 15 22:43:10 2012 -0500 summary: kill useless import added by 87331661042b files: Lib/importlib/test/source/test_abc_loader.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/importlib/test/source/test_abc_loader.py b/Lib/importlib/test/source/test_abc_loader.py --- a/Lib/importlib/test/source/test_abc_loader.py +++ b/Lib/importlib/test/source/test_abc_loader.py @@ -5,7 +5,6 @@ from .. import util from . import util as source_util -import collections import imp import inspect import io -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jan 16 05:33:18 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 16 Jan 2012 05:33:18 +0100 Subject: [Python-checkins] Daily reference leaks (ecc998ec8c6f): sum=0 Message-ID: results for ecc998ec8c6f on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogPunmOX', '-x'] From python-checkins at python.org Mon Jan 16 07:29:51 2012 From: python-checkins at python.org (ezio.melotti) Date: Mon, 16 Jan 2012 07:29:51 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzEzNjk1OiBmaXgg?= =?utf8?q?a_couple_of_typos_in_the_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/2dd96cf324ee changeset: 74430:2dd96cf324ee branch: 2.7 parent: 74427:5d1c177c585b user: Ezio Melotti date: Mon Jan 16 08:21:24 2012 +0200 summary: #13695: fix a couple of typos in the doc. files: Doc/library/functools.rst | 4 ++-- Doc/library/unittest.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -26,8 +26,8 @@ tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition - tool for programs being converted to Py3.x where comparison functions are no - longer supported. + tool for programs being converted to Python 3 where comparison functions are + no longer supported. A compare function is any callable that accept two arguments, compares them, and returns a negative number for less-than, zero for equality, or a positive diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -840,13 +840,13 @@ In addition, if *first* and *second* are the exact same type and one of list, tuple, dict, set, frozenset or unicode or any type that a subclass - registers with :meth:`addTypeEqualityFunc` the type specific equality + registers with :meth:`addTypeEqualityFunc` the type-specific equality function will be called in order to generate a more useful default error message (see also the :ref:`list of type-specific methods `). .. versionchanged:: 2.7 - Added the automatic calling of type specific equality function. + Added the automatic calling of type-specific equality function. .. method:: assertNotEqual(first, second, msg=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 07:29:51 2012 From: python-checkins at python.org (ezio.melotti) Date: Mon, 16 Jan 2012 07:29:51 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzNjk1OiBmaXgg?= =?utf8?q?a_couple_of_typos_in_the_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/bff9ab281385 changeset: 74431:bff9ab281385 branch: 3.2 parent: 74425:8f7e707ab729 user: Ezio Melotti date: Mon Jan 16 08:28:54 2012 +0200 summary: #13695: fix a couple of typos in the doc. files: Doc/library/functools.rst | 2 +- Doc/library/unittest.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -24,7 +24,7 @@ tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition - tool for programs being converted from Py2.x which supported the use of + tool for programs being converted from Python 2 which supported the use of comparison functions. A compare function is any callable that accept two arguments, compares them, diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -869,13 +869,13 @@ In addition, if *first* and *second* are the exact same type and one of list, tuple, dict, set, frozenset or str or any type that a subclass - registers with :meth:`addTypeEqualityFunc` the type specific equality + registers with :meth:`addTypeEqualityFunc` the type-specific equality function will be called in order to generate a more useful default error message (see also the :ref:`list of type-specific methods `). .. versionchanged:: 3.1 - Added the automatic calling of type specific equality function. + Added the automatic calling of type-specific equality function. .. versionchanged:: 3.2 :meth:`assertMultiLineEqual` added as the default type equality -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 07:29:52 2012 From: python-checkins at python.org (ezio.melotti) Date: Mon, 16 Jan 2012 07:29:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=2313695=3A_merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/3b097e0892cf changeset: 74432:3b097e0892cf parent: 74429:685eacf0dc0c parent: 74431:bff9ab281385 user: Ezio Melotti date: Mon Jan 16 08:29:42 2012 +0200 summary: #13695: merge with 3.2. files: Doc/library/functools.rst | 2 +- Doc/library/unittest.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -24,7 +24,7 @@ tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition - tool for programs being converted from Py2.x which supported the use of + tool for programs being converted from Python 2 which supported the use of comparison functions. A compare function is any callable that accept two arguments, compares them, diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -873,13 +873,13 @@ In addition, if *first* and *second* are the exact same type and one of list, tuple, dict, set, frozenset or str or any type that a subclass - registers with :meth:`addTypeEqualityFunc` the type specific equality + registers with :meth:`addTypeEqualityFunc` the type-specific equality function will be called in order to generate a more useful default error message (see also the :ref:`list of type-specific methods `). .. versionchanged:: 3.1 - Added the automatic calling of type specific equality function. + Added the automatic calling of type-specific equality function. .. versionchanged:: 3.2 :meth:`assertMultiLineEqual` added as the default type equality -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 07:46:18 2012 From: python-checkins at python.org (ezio.melotti) Date: Mon, 16 Jan 2012 07:46:18 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzEzNzE1OiBmaXgg?= =?utf8?q?typo_in_unicodedata_doc=2E__Patch_by_Eli_Collins=2E?= Message-ID: http://hg.python.org/cpython/rev/b4dac315feef changeset: 74433:b4dac315feef branch: 2.7 parent: 74430:2dd96cf324ee user: Ezio Melotti date: Mon Jan 16 08:42:32 2012 +0200 summary: #13715: fix typo in unicodedata doc. Patch by Eli Collins. files: Doc/library/unicodedata.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -107,7 +107,7 @@ based on the definition of canonical equivalence and compatibility equivalence. In Unicode, several characters can be expressed in various way. For example, the character U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) can also be expressed as - the sequence U+0327 (COMBINING CEDILLA) U+0043 (LATIN CAPITAL LETTER C). + the sequence U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA). For each character, there are two normal forms: normal form C and normal form D. Normal form D (NFD) is also known as canonical decomposition, and translates -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 07:46:19 2012 From: python-checkins at python.org (ezio.melotti) Date: Mon, 16 Jan 2012 07:46:19 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzNzE1OiBmaXgg?= =?utf8?q?typo_in_unicodedata_doc=2E__Patch_by_Eli_Collins=2E?= Message-ID: http://hg.python.org/cpython/rev/f50ff6dd6b41 changeset: 74434:f50ff6dd6b41 branch: 3.2 parent: 74431:bff9ab281385 user: Ezio Melotti date: Mon Jan 16 08:42:32 2012 +0200 summary: #13715: fix typo in unicodedata doc. Patch by Eli Collins. files: Doc/library/unicodedata.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -105,7 +105,7 @@ based on the definition of canonical equivalence and compatibility equivalence. In Unicode, several characters can be expressed in various way. For example, the character U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) can also be expressed as - the sequence U+0327 (COMBINING CEDILLA) U+0043 (LATIN CAPITAL LETTER C). + the sequence U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA). For each character, there are two normal forms: normal form C and normal form D. Normal form D (NFD) is also known as canonical decomposition, and translates -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 07:46:20 2012 From: python-checkins at python.org (ezio.melotti) Date: Mon, 16 Jan 2012 07:46:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=2313715=3A_merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/f1408e41e306 changeset: 74435:f1408e41e306 parent: 74432:3b097e0892cf parent: 74434:f50ff6dd6b41 user: Ezio Melotti date: Mon Jan 16 08:46:11 2012 +0200 summary: #13715: merge with 3.2. files: Doc/library/unicodedata.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -108,7 +108,7 @@ based on the definition of canonical equivalence and compatibility equivalence. In Unicode, several characters can be expressed in various way. For example, the character U+00C7 (LATIN CAPITAL LETTER C WITH CEDILLA) can also be expressed as - the sequence U+0327 (COMBINING CEDILLA) U+0043 (LATIN CAPITAL LETTER C). + the sequence U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING CEDILLA). For each character, there are two normal forms: normal form C and normal form D. Normal form D (NFD) is also known as canonical decomposition, and translates -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 09:23:03 2012 From: python-checkins at python.org (terry.reedy) Date: Mon, 16 Jan 2012 09:23:03 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzY1MjggTm9uZSwg?= =?utf8?q?True=2C_False_are_keywords_in_3=2Ex=2E_Patch_by_Roger_Serwy=2E?= Message-ID: http://hg.python.org/cpython/rev/2d4ce2cdd6d4 changeset: 74436:2d4ce2cdd6d4 branch: 3.2 parent: 74434:f50ff6dd6b41 user: Terry Jan Reedy date: Mon Jan 16 03:20:27 2012 -0500 summary: #6528 None, True, False are keywords in 3.x. Patch by Roger Serwy. files: Lib/idlelib/ColorDelegator.py | 3 ++- Lib/idlelib/configDialog.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py --- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -15,7 +15,8 @@ def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" builtinlist = [str(name) for name in dir(builtins) - if not name.startswith('_')] + if not name.startswith('_') and \ + name not in keyword.kwlist] # self.file = open("file") : # 1st 'file' colorized normal, 2nd as builtin, 3rd as string builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -199,7 +199,7 @@ ("'string'",'string'),('\n var1 = ','normal'),("'selected'",'hilite'), ('\n var2 = ','normal'),("'found'",'hit'), ('\n var3 = ','normal'),('list', 'builtin'), ('(','normal'), - ('None', 'builtin'),(')\n\n','normal'), + ('None', 'keyword'),(')\n\n','normal'), (' error ','error'),(' ','normal'),('cursor |','cursor'), ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'), (' ','normal'),('stderr','stderr'),('\n','normal')) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 09:23:03 2012 From: python-checkins at python.org (terry.reedy) Date: Mon, 16 Jan 2012 09:23:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2_=236528_None=2C_True=2C_False_are_keywords_?= =?utf8?q?in_3=2Ex=2E_Patch_by_R=2E_Serwy=2E?= Message-ID: http://hg.python.org/cpython/rev/522f07bfa067 changeset: 74437:522f07bfa067 parent: 74435:f1408e41e306 parent: 74436:2d4ce2cdd6d4 user: Terry Jan Reedy date: Mon Jan 16 03:22:33 2012 -0500 summary: Merge with 3.2 #6528 None, True, False are keywords in 3.x. Patch by R. Serwy. files: Lib/idlelib/ColorDelegator.py | 3 ++- Lib/idlelib/configDialog.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/ColorDelegator.py b/Lib/idlelib/ColorDelegator.py --- a/Lib/idlelib/ColorDelegator.py +++ b/Lib/idlelib/ColorDelegator.py @@ -15,7 +15,8 @@ def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" builtinlist = [str(name) for name in dir(builtins) - if not name.startswith('_')] + if not name.startswith('_') and \ + name not in keyword.kwlist] # self.file = open("file") : # 1st 'file' colorized normal, 2nd as builtin, 3rd as string builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -199,7 +199,7 @@ ("'string'",'string'),('\n var1 = ','normal'),("'selected'",'hilite'), ('\n var2 = ','normal'),("'found'",'hit'), ('\n var3 = ','normal'),('list', 'builtin'), ('(','normal'), - ('None', 'builtin'),(')\n\n','normal'), + ('None', 'keyword'),(')\n\n','normal'), (' error ','error'),(' ','normal'),('cursor |','cursor'), ('\n ','normal'),('shell','console'),(' ','normal'),('stdout','stdout'), (' ','normal'),('stderr','stderr'),('\n','normal')) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 11:09:56 2012 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 16 Jan 2012 11:09:56 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Test_for_the_di?= =?utf8?q?rfd_library_function_=28for_use_in_some_upcoming?= Message-ID: http://hg.python.org/cpython/rev/9bfb93e2097d changeset: 74438:9bfb93e2097d branch: 3.2 parent: 74436:2d4ce2cdd6d4 user: Gregory P. Smith date: Mon Jan 16 02:05:23 2012 -0800 summary: Test for the dirfd library function (for use in some upcoming changes). files: configure.in | 2 +- pyconfig.h.in | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2587,7 +2587,7 @@ # checks for library functions AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ + clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \ diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -178,6 +178,9 @@ */ #undef HAVE_DIRENT_H +/* Define to 1 if you have the `dirfd' function. */ +#undef HAVE_DIRFD + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 11:09:57 2012 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 16 Jan 2012 11:09:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_regenerate_conf?= =?utf8?q?igure_using_autoconf=2E__includes_the_dirfd_test=2E?= Message-ID: http://hg.python.org/cpython/rev/87197ca3c8c6 changeset: 74439:87197ca3c8c6 branch: 3.2 user: Gregory P. Smith date: Mon Jan 16 02:05:55 2012 -0800 summary: regenerate configure using autoconf. includes the dirfd test. files: configure | 595 +++++++++++++++++++++-------------------- 1 files changed, 309 insertions(+), 286 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.in Revision. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for python 3.2. +# Generated by GNU Autoconf 2.68 for python 3.2. # # Report bugs to . # @@ -92,6 +92,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -217,11 +218,18 @@ # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -1178,7 +1186,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1516,7 +1524,7 @@ if $ac_init_version; then cat <<\_ACEOF python configure 3.2 -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1562,7 +1570,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1608,7 +1616,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1645,7 +1653,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1658,10 +1666,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1728,7 +1736,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1737,7 +1745,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1778,7 +1786,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1792,7 +1800,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1810,7 +1818,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1823,7 +1831,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1864,7 +1872,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1877,7 +1885,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1917,7 +1925,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t @@ -1930,7 +1938,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -1991,7 +1999,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t @@ -2168,7 +2176,7 @@ rm -f conftest.val fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_compute_int @@ -2181,7 +2189,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2236,7 +2244,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -2249,7 +2257,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if eval "test \"\${$4+set}\"" = set; then : +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2293,7 +2301,7 @@ eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member @@ -2308,7 +2316,7 @@ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2339,7 +2347,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF @@ -2347,7 +2355,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 3.2, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2605,7 +2613,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -3195,7 +3203,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3235,7 +3243,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3288,7 +3296,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3328,7 +3336,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3387,7 +3395,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3431,7 +3439,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3486,7 +3494,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3601,7 +3609,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -3644,7 +3652,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -3703,7 +3711,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -3714,7 +3722,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3755,7 +3763,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -3765,7 +3773,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3802,7 +3810,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3880,7 +3888,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -4015,7 +4023,7 @@ set dummy g++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CXX+set}" = set; then : +if ${ac_cv_path_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4056,7 +4064,7 @@ set dummy c++; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_CXX+set}" = set; then : +if ${ac_cv_path_CXX+:} false; then : $as_echo_n "(cached) " >&6 else case $CXX in @@ -4107,7 +4115,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CXX+set}" = set; then : +if ${ac_cv_prog_CXX+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then @@ -4208,7 +4216,7 @@ CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -4324,7 +4332,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -4336,7 +4344,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4399,7 +4407,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4466,7 +4474,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4595,7 +4603,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : +if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= @@ -4617,7 +4625,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : +if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4810,7 +4818,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } -if test "${ac_cv_c_inline+set}" = set; then : +if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no @@ -5011,7 +5019,7 @@ set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : +if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5051,7 +5059,7 @@ set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5105,7 +5113,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : +if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5155,7 +5163,7 @@ set dummy svnversion; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_SVNVERSION+set}" = set; then : +if ${ac_cv_prog_SVNVERSION+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$SVNVERSION"; then @@ -5206,7 +5214,7 @@ set dummy hg; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_HAS_HG+set}" = set; then : +if ${ac_cv_prog_HAS_HG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_HG"; then @@ -5260,7 +5268,7 @@ set dummy python; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_HAS_PYTHON+set}" = set; then : +if ${ac_cv_prog_HAS_PYTHON+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$HAS_PYTHON"; then @@ -5354,7 +5362,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : +if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -5547,7 +5555,7 @@ ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" save_CFLAGS="$CFLAGS" - if test "${ac_cv_no_strict_aliasing+set}" = set; then : + if ${ac_cv_no_strict_aliasing+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -5803,7 +5811,7 @@ # options before we can check whether -Kpthread improves anything. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads are available without options" >&5 $as_echo_n "checking whether pthreads are available without options... " >&6; } -if test "${ac_cv_pthread_is_default+set}" = set; then : +if ${ac_cv_pthread_is_default+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -5856,7 +5864,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kpthread" >&5 $as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } -if test "${ac_cv_kpthread+set}" = set; then : +if ${ac_cv_kpthread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5905,7 +5913,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -Kthread" >&5 $as_echo_n "checking whether $CC accepts -Kthread... " >&6; } -if test "${ac_cv_kthread+set}" = set; then : +if ${ac_cv_kthread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -5954,7 +5962,7 @@ # function available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5 $as_echo_n "checking whether $CC accepts -pthread... " >&6; } -if test "${ac_cv_thread+set}" = set; then : +if ${ac_cv_thread+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_cc="$CC" @@ -6039,7 +6047,7 @@ # checks for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6178,7 +6186,7 @@ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval "test \"\${$as_ac_Header+set}\"" = set; then : +if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6218,7 +6226,7 @@ if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6252,11 +6260,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_opendir+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no @@ -6275,7 +6283,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -6309,11 +6317,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_opendir+set}" = set; then : + if ${ac_cv_search_opendir+:} false; then : break fi done -if test "${ac_cv_search_opendir+set}" = set; then : +if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no @@ -6333,7 +6341,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } -if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then : +if ${ac_cv_header_sys_types_h_makedev+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6361,7 +6369,7 @@ if test $ac_cv_header_sys_types_h_makedev = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then : +if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h @@ -6371,7 +6379,7 @@ if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then : +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h @@ -6391,7 +6399,7 @@ #endif " -if test "x$ac_cv_header_term_h" = x""yes; then : +if test "x$ac_cv_header_term_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_TERM_H 1 _ACEOF @@ -6413,7 +6421,7 @@ #endif " -if test "x$ac_cv_header_linux_netlink_h" = x""yes; then : +if test "x$ac_cv_header_linux_netlink_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LINUX_NETLINK_H 1 _ACEOF @@ -6579,7 +6587,7 @@ # Type availability checks ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = x""yes; then : +if test "x$ac_cv_type_mode_t" = xyes; then : else @@ -6590,7 +6598,7 @@ fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = x""yes; then : +if test "x$ac_cv_type_off_t" = xyes; then : else @@ -6601,7 +6609,7 @@ fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = x""yes; then : +if test "x$ac_cv_type_pid_t" = xyes; then : else @@ -6617,7 +6625,7 @@ _ACEOF ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = x""yes; then : +if test "x$ac_cv_type_size_t" = xyes; then : else @@ -6629,7 +6637,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if test "${ac_cv_type_uid_t+set}" = set; then : +if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6708,7 +6716,7 @@ esac ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = x""yes; then : +if test "x$ac_cv_type_ssize_t" = xyes; then : $as_echo "#define HAVE_SSIZE_T 1" >>confdefs.h @@ -6723,7 +6731,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : +if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : @@ -6733,7 +6741,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi @@ -6756,7 +6764,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then : +if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : @@ -6766,7 +6774,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi @@ -6789,7 +6797,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } -if test "${ac_cv_sizeof_void_p+set}" = set; then : +if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : @@ -6799,7 +6807,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi @@ -6822,7 +6830,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : +if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : @@ -6832,7 +6840,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi @@ -6855,7 +6863,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } -if test "${ac_cv_sizeof_float+set}" = set; then : +if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : @@ -6865,7 +6873,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_float=0 fi @@ -6888,7 +6896,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : +if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : @@ -6898,7 +6906,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi @@ -6921,7 +6929,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fpos_t" >&5 $as_echo_n "checking size of fpos_t... " >&6; } -if test "${ac_cv_sizeof_fpos_t+set}" = set; then : +if ${ac_cv_sizeof_fpos_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fpos_t))" "ac_cv_sizeof_fpos_t" "$ac_includes_default"; then : @@ -6931,7 +6939,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (fpos_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_fpos_t=0 fi @@ -6954,7 +6962,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 $as_echo_n "checking size of size_t... " >&6; } -if test "${ac_cv_sizeof_size_t+set}" = set; then : +if ${ac_cv_sizeof_size_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : @@ -6964,7 +6972,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (size_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_size_t=0 fi @@ -6987,7 +6995,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pid_t" >&5 $as_echo_n "checking size of pid_t... " >&6; } -if test "${ac_cv_sizeof_pid_t+set}" = set; then : +if ${ac_cv_sizeof_pid_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pid_t))" "ac_cv_sizeof_pid_t" "$ac_includes_default"; then : @@ -6997,7 +7005,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pid_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_pid_t=0 fi @@ -7047,7 +7055,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } -if test "${ac_cv_sizeof_long_long+set}" = set; then : +if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : @@ -7057,7 +7065,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi @@ -7108,7 +7116,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 $as_echo_n "checking size of long double... " >&6; } -if test "${ac_cv_sizeof_long_double+set}" = set; then : +if ${ac_cv_sizeof_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : @@ -7118,7 +7126,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long double) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_double=0 fi @@ -7170,7 +7178,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 $as_echo_n "checking size of _Bool... " >&6; } -if test "${ac_cv_sizeof__Bool+set}" = set; then : +if ${ac_cv_sizeof__Bool+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : @@ -7180,7 +7188,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (_Bool) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof__Bool=0 fi @@ -7206,7 +7214,7 @@ #include #endif " -if test "x$ac_cv_type_uintptr_t" = x""yes; then : +if test "x$ac_cv_type_uintptr_t" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UINTPTR_T 1 @@ -7218,7 +7226,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of uintptr_t" >&5 $as_echo_n "checking size of uintptr_t... " >&6; } -if test "${ac_cv_sizeof_uintptr_t+set}" = set; then : +if ${ac_cv_sizeof_uintptr_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uintptr_t))" "ac_cv_sizeof_uintptr_t" "$ac_includes_default"; then : @@ -7228,7 +7236,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (uintptr_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_uintptr_t=0 fi @@ -7254,7 +7262,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } -if test "${ac_cv_sizeof_off_t+set}" = set; then : +if ${ac_cv_sizeof_off_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" " @@ -7269,7 +7277,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_off_t=0 fi @@ -7313,7 +7321,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5 $as_echo_n "checking size of time_t... " >&6; } -if test "${ac_cv_sizeof_time_t+set}" = set; then : +if ${ac_cv_sizeof_time_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" " @@ -7331,7 +7339,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (time_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_time_t=0 fi @@ -7388,7 +7396,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of pthread_t" >&5 $as_echo_n "checking size of pthread_t... " >&6; } -if test "${ac_cv_sizeof_pthread_t+set}" = set; then : +if ${ac_cv_sizeof_pthread_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (pthread_t))" "ac_cv_sizeof_pthread_t" " @@ -7403,7 +7411,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (pthread_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_pthread_t=0 fi @@ -7835,7 +7843,7 @@ # checks for libraries { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7869,7 +7877,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -7880,7 +7888,7 @@ # Dynamic linking for SunOS/Solaris and SYSV { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : +if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -7914,7 +7922,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -7928,7 +7936,7 @@ if test "$with_threads" = "yes" -o -z "$with_threads"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5 $as_echo_n "checking for library containing sem_init... " >&6; } -if test "${ac_cv_search_sem_init+set}" = set; then : +if ${ac_cv_search_sem_init+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -7962,11 +7970,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_sem_init+set}" = set; then : + if ${ac_cv_search_sem_init+:} false; then : break fi done -if test "${ac_cv_search_sem_init+set}" = set; then : +if ${ac_cv_search_sem_init+:} false; then : else ac_cv_search_sem_init=no @@ -7989,7 +7997,7 @@ # check if we need libintl for locale functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for textdomain in -lintl" >&5 $as_echo_n "checking for textdomain in -lintl... " >&6; } -if test "${ac_cv_lib_intl_textdomain+set}" = set; then : +if ${ac_cv_lib_intl_textdomain+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8023,7 +8031,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_textdomain" >&5 $as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = x""yes; then : +if test "x$ac_cv_lib_intl_textdomain" = xyes; then : $as_echo "#define WITH_LIBINTL 1" >>confdefs.h @@ -8070,7 +8078,7 @@ # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for t_open in -lnsl" >&5 $as_echo_n "checking for t_open in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_t_open+set}" = set; then : +if ${ac_cv_lib_nsl_t_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8104,13 +8112,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_t_open" >&5 $as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = x""yes; then : +if test "x$ac_cv_lib_nsl_t_open" = xyes; then : LIBS="-lnsl $LIBS" fi # SVR4 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 $as_echo_n "checking for socket in -lsocket... " >&6; } -if test "${ac_cv_lib_socket_socket+set}" = set; then : +if ${ac_cv_lib_socket_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8144,7 +8152,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 $as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then : +if test "x$ac_cv_lib_socket_socket" = xyes; then : LIBS="-lsocket $LIBS" fi # SVR4 sockets @@ -8170,7 +8178,7 @@ set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in @@ -8213,7 +8221,7 @@ set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in @@ -8495,7 +8503,7 @@ $as_echo "#define _REENTRANT 1" >>confdefs.h ac_fn_c_check_header_mongrel "$LINENO" "cthreads.h" "ac_cv_header_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_cthreads_h" = x""yes; then : +if test "x$ac_cv_header_cthreads_h" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8508,7 +8516,7 @@ else ac_fn_c_check_header_mongrel "$LINENO" "mach/cthreads.h" "ac_cv_header_mach_cthreads_h" "$ac_includes_default" -if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then : +if test "x$ac_cv_header_mach_cthreads_h" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h $as_echo "#define C_THREADS 1" >>confdefs.h @@ -8552,7 +8560,7 @@ LIBS=$_libs ac_fn_c_check_func "$LINENO" "pthread_detach" "ac_cv_func_pthread_detach" -if test "x$ac_cv_func_pthread_detach" = x""yes; then : +if test "x$ac_cv_func_pthread_detach" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8561,7 +8569,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthreads" >&5 $as_echo_n "checking for pthread_create in -lpthreads... " >&6; } -if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then : +if ${ac_cv_lib_pthreads_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8595,7 +8603,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_create" >&5 $as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_pthreads_pthread_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8605,7 +8613,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 $as_echo_n "checking for pthread_create in -lc_r... " >&6; } -if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then : +if ${ac_cv_lib_c_r_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8639,7 +8647,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 $as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_c_r_pthread_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8649,7 +8657,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_create_system in -lpthread" >&5 $as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then : +if ${ac_cv_lib_pthread___pthread_create_system+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8683,7 +8691,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_create_system" >&5 $as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then : +if test "x$ac_cv_lib_pthread___pthread_create_system" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8693,7 +8701,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lcma" >&5 $as_echo_n "checking for pthread_create in -lcma... " >&6; } -if test "${ac_cv_lib_cma_pthread_create+set}" = set; then : +if ${ac_cv_lib_cma_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8727,7 +8735,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cma_pthread_create" >&5 $as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then : +if test "x$ac_cv_lib_cma_pthread_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h posix_threads=yes @@ -8759,7 +8767,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usconfig in -lmpc" >&5 $as_echo_n "checking for usconfig in -lmpc... " >&6; } -if test "${ac_cv_lib_mpc_usconfig+set}" = set; then : +if ${ac_cv_lib_mpc_usconfig+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8793,7 +8801,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpc_usconfig" >&5 $as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then : +if test "x$ac_cv_lib_mpc_usconfig" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lmpc" @@ -8805,7 +8813,7 @@ if test "$posix_threads" != "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thr_create in -lthread" >&5 $as_echo_n "checking for thr_create in -lthread... " >&6; } -if test "${ac_cv_lib_thread_thr_create+set}" = set; then : +if ${ac_cv_lib_thread_thr_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8839,7 +8847,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_thread_thr_create" >&5 $as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = x""yes; then : +if test "x$ac_cv_lib_thread_thr_create" = xyes; then : $as_echo "#define WITH_THREAD 1" >>confdefs.h LIBS="$LIBS -lthread" @@ -8884,7 +8892,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 $as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } - if test "${ac_cv_pthread_system_supported+set}" = set; then : + if ${ac_cv_pthread_system_supported+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -8927,7 +8935,7 @@ for ac_func in pthread_sigmask do : ac_fn_c_check_func "$LINENO" "pthread_sigmask" "ac_cv_func_pthread_sigmask" -if test "x$ac_cv_func_pthread_sigmask" = x""yes; then : +if test "x$ac_cv_func_pthread_sigmask" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PTHREAD_SIGMASK 1 _ACEOF @@ -9319,7 +9327,7 @@ $as_echo "$with_valgrind" >&6; } if test "$with_valgrind" != no; then ac_fn_c_check_header_mongrel "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = x""yes; then : +if test "x$ac_cv_header_valgrind_valgrind_h" = xyes; then : $as_echo "#define WITH_VALGRIND 1" >>confdefs.h @@ -9341,7 +9349,7 @@ for ac_func in dlopen do : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : +if test "x$ac_cv_func_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLOPEN 1 _ACEOF @@ -9402,7 +9410,7 @@ # checks for library functions for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ + clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \ @@ -9668,7 +9676,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5 $as_echo_n "checking for flock declaration... " >&6; } -if test "${ac_cv_flock_decl+set}" = set; then : +if ${ac_cv_flock_decl+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9698,7 +9706,7 @@ for ac_func in flock do : ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock" -if test "x$ac_cv_func_flock" = x""yes; then : +if test "x$ac_cv_func_flock" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FLOCK 1 _ACEOF @@ -9706,7 +9714,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5 $as_echo_n "checking for flock in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_flock+set}" = set; then : +if ${ac_cv_lib_bsd_flock+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9740,7 +9748,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5 $as_echo "$ac_cv_lib_bsd_flock" >&6; } -if test "x$ac_cv_lib_bsd_flock" = x""yes; then : +if test "x$ac_cv_lib_bsd_flock" = xyes; then : $as_echo "#define HAVE_FLOCK 1" >>confdefs.h @@ -9817,7 +9825,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_TRUE+set}" = set; then : +if ${ac_cv_prog_TRUE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$TRUE"; then @@ -9857,7 +9865,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lc" >&5 $as_echo_n "checking for inet_aton in -lc... " >&6; } -if test "${ac_cv_lib_c_inet_aton+set}" = set; then : +if ${ac_cv_lib_c_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9891,12 +9899,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_inet_aton" >&5 $as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = x""yes; then : +if test "x$ac_cv_lib_c_inet_aton" = xyes; then : $ac_cv_prog_TRUE else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_aton in -lresolv" >&5 $as_echo_n "checking for inet_aton in -lresolv... " >&6; } -if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then : +if ${ac_cv_lib_resolv_inet_aton+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -9930,7 +9938,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_inet_aton" >&5 $as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then : +if test "x$ac_cv_lib_resolv_inet_aton" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -9947,7 +9955,7 @@ # exit Python { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chflags" >&5 $as_echo_n "checking for chflags... " >&6; } -if test "${ac_cv_have_chflags+set}" = set; then : +if ${ac_cv_have_chflags+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -9981,7 +9989,7 @@ $as_echo "$ac_cv_have_chflags" >&6; } if test "$ac_cv_have_chflags" = cross ; then ac_fn_c_check_func "$LINENO" "chflags" "ac_cv_func_chflags" -if test "x$ac_cv_func_chflags" = x""yes; then : +if test "x$ac_cv_func_chflags" = xyes; then : ac_cv_have_chflags="yes" else ac_cv_have_chflags="no" @@ -9996,7 +10004,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lchflags" >&5 $as_echo_n "checking for lchflags... " >&6; } -if test "${ac_cv_have_lchflags+set}" = set; then : +if ${ac_cv_have_lchflags+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10030,7 +10038,7 @@ $as_echo "$ac_cv_have_lchflags" >&6; } if test "$ac_cv_have_lchflags" = cross ; then ac_fn_c_check_func "$LINENO" "lchflags" "ac_cv_func_lchflags" -if test "x$ac_cv_func_lchflags" = x""yes; then : +if test "x$ac_cv_func_lchflags" = xyes; then : ac_cv_have_lchflags="yes" else ac_cv_have_lchflags="no" @@ -10054,7 +10062,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateCopy in -lz" >&5 $as_echo_n "checking for inflateCopy in -lz... " >&6; } -if test "${ac_cv_lib_z_inflateCopy+set}" = set; then : +if ${ac_cv_lib_z_inflateCopy+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10088,7 +10096,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateCopy" >&5 $as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then : +if test "x$ac_cv_lib_z_inflateCopy" = xyes; then : $as_echo "#define HAVE_ZLIB_COPY 1" >>confdefs.h @@ -10231,7 +10239,7 @@ for ac_func in openpty do : ac_fn_c_check_func "$LINENO" "openpty" "ac_cv_func_openpty" -if test "x$ac_cv_func_openpty" = x""yes; then : +if test "x$ac_cv_func_openpty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -10239,7 +10247,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lutil" >&5 $as_echo_n "checking for openpty in -lutil... " >&6; } -if test "${ac_cv_lib_util_openpty+set}" = set; then : +if ${ac_cv_lib_util_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10273,13 +10281,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_openpty" >&5 $as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = x""yes; then : +if test "x$ac_cv_lib_util_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty in -lbsd" >&5 $as_echo_n "checking for openpty in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_openpty+set}" = set; then : +if ${ac_cv_lib_bsd_openpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10313,7 +10321,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_openpty" >&5 $as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = x""yes; then : +if test "x$ac_cv_lib_bsd_openpty" = xyes; then : $as_echo "#define HAVE_OPENPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10328,7 +10336,7 @@ for ac_func in forkpty do : ac_fn_c_check_func "$LINENO" "forkpty" "ac_cv_func_forkpty" -if test "x$ac_cv_func_forkpty" = x""yes; then : +if test "x$ac_cv_func_forkpty" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -10336,7 +10344,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 $as_echo_n "checking for forkpty in -lutil... " >&6; } -if test "${ac_cv_lib_util_forkpty+set}" = set; then : +if ${ac_cv_lib_util_forkpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10370,13 +10378,13 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 $as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = x""yes; then : +if test "x$ac_cv_lib_util_forkpty" = xyes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lutil" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lbsd" >&5 $as_echo_n "checking for forkpty in -lbsd... " >&6; } -if test "${ac_cv_lib_bsd_forkpty+set}" = set; then : +if ${ac_cv_lib_bsd_forkpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10410,7 +10418,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_forkpty" >&5 $as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then : +if test "x$ac_cv_lib_bsd_forkpty" = xyes; then : $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h LIBS="$LIBS -lbsd" fi @@ -10427,7 +10435,7 @@ for ac_func in memmove do : ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = x""yes; then : +if test "x$ac_cv_func_memmove" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_MEMMOVE 1 _ACEOF @@ -10451,7 +10459,7 @@ ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = x""yes; then : +if test "x$ac_cv_func_dup2" = xyes; then : $as_echo "#define HAVE_DUP2 1" >>confdefs.h else @@ -10464,7 +10472,7 @@ fi ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = x""yes; then : +if test "x$ac_cv_func_getcwd" = xyes; then : $as_echo "#define HAVE_GETCWD 1" >>confdefs.h else @@ -10477,7 +10485,7 @@ fi ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = x""yes; then : +if test "x$ac_cv_func_strdup" = xyes; then : $as_echo "#define HAVE_STRDUP 1" >>confdefs.h else @@ -10493,7 +10501,7 @@ for ac_func in getpgrp do : ac_fn_c_check_func "$LINENO" "getpgrp" "ac_cv_func_getpgrp" -if test "x$ac_cv_func_getpgrp" = x""yes; then : +if test "x$ac_cv_func_getpgrp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPGRP 1 _ACEOF @@ -10521,7 +10529,7 @@ for ac_func in setpgrp do : ac_fn_c_check_func "$LINENO" "setpgrp" "ac_cv_func_setpgrp" -if test "x$ac_cv_func_setpgrp" = x""yes; then : +if test "x$ac_cv_func_setpgrp" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SETPGRP 1 _ACEOF @@ -10549,7 +10557,7 @@ for ac_func in gettimeofday do : ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = x""yes; then : +if test "x$ac_cv_func_gettimeofday" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETTIMEOFDAY 1 _ACEOF @@ -10651,7 +10659,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking getaddrinfo bug" >&5 $as_echo_n "checking getaddrinfo bug... " >&6; } - if test "${ac_cv_buggy_getaddrinfo+set}" = set; then : + if ${ac_cv_buggy_getaddrinfo+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10780,7 +10788,7 @@ for ac_func in getnameinfo do : ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo" -if test "x$ac_cv_func_getnameinfo" = x""yes; then : +if test "x$ac_cv_func_getnameinfo" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETNAMEINFO 1 _ACEOF @@ -10792,7 +10800,7 @@ # checks for structures { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if test "${ac_cv_header_time+set}" = set; then : +if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10827,7 +10835,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } -if test "${ac_cv_struct_tm+set}" = set; then : +if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10864,7 +10872,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -10880,7 +10888,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = x""yes; then : +if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -10892,7 +10900,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if test "${ac_cv_var_tzname+set}" = set; then : +if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -10928,7 +10936,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -10938,7 +10946,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -10948,7 +10956,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_flags" "ac_cv_member_struct_stat_st_flags" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_flags" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -10958,7 +10966,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_gen" "ac_cv_member_struct_stat_st_gen" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_gen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -10968,7 +10976,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtime" "ac_cv_member_struct_stat_st_birthtime" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_birthtime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -10978,7 +10986,7 @@ fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then : +if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -11000,7 +11008,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5 $as_echo_n "checking for time.h that defines altzone... " >&6; } -if test "${ac_cv_header_time_altzone+set}" = set; then : +if ${ac_cv_header_time_altzone+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11064,7 +11072,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for addrinfo" >&5 $as_echo_n "checking for addrinfo... " >&6; } -if test "${ac_cv_struct_addrinfo+set}" = set; then : +if ${ac_cv_struct_addrinfo+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11096,7 +11104,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sockaddr_storage" >&5 $as_echo_n "checking for sockaddr_storage... " >&6; } -if test "${ac_cv_struct_sockaddr_storage+set}" = set; then : +if ${ac_cv_struct_sockaddr_storage+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11132,7 +11140,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 $as_echo_n "checking whether char is unsigned... " >&6; } -if test "${ac_cv_c_char_unsigned+set}" = set; then : +if ${ac_cv_c_char_unsigned+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11164,7 +11172,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if test "${ac_cv_c_const+set}" = set; then : +if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11452,7 +11460,7 @@ ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : +if test "x$ac_cv_func_gethostbyname_r" = xyes; then : $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h @@ -11583,7 +11591,7 @@ for ac_func in gethostbyname do : ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = x""yes; then : +if test "x$ac_cv_func_gethostbyname" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETHOSTBYNAME 1 _ACEOF @@ -11605,12 +11613,12 @@ # Linux requires this for correct f.p. operations ac_fn_c_check_func "$LINENO" "__fpu_control" "ac_cv_func___fpu_control" -if test "x$ac_cv_func___fpu_control" = x""yes; then : +if test "x$ac_cv_func___fpu_control" = xyes; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __fpu_control in -lieee" >&5 $as_echo_n "checking for __fpu_control in -lieee... " >&6; } -if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then : +if ${ac_cv_lib_ieee___fpu_control+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11644,7 +11652,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee___fpu_control" >&5 $as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then : +if test "x$ac_cv_lib_ieee___fpu_control" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -11738,7 +11746,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are little-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are little-endian IEEE 754 binary64... " >&6; } -if test "${ac_cv_little_endian_double+set}" = set; then : +if ${ac_cv_little_endian_double+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11780,7 +11788,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are big-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are big-endian IEEE 754 binary64... " >&6; } -if test "${ac_cv_big_endian_double+set}" = set; then : +if ${ac_cv_big_endian_double+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11826,7 +11834,7 @@ # conversions work. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C doubles are ARM mixed-endian IEEE 754 binary64" >&5 $as_echo_n "checking whether C doubles are ARM mixed-endian IEEE 754 binary64... " >&6; } -if test "${ac_cv_mixed_endian_double+set}" = set; then : +if ${ac_cv_mixed_endian_double+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11996,7 +12004,7 @@ ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include " -if test "x$ac_cv_have_decl_isinf" = x""yes; then : +if test "x$ac_cv_have_decl_isinf" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12007,7 +12015,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include " -if test "x$ac_cv_have_decl_isnan" = x""yes; then : +if test "x$ac_cv_have_decl_isnan" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12018,7 +12026,7 @@ _ACEOF ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include " -if test "x$ac_cv_have_decl_isfinite" = x""yes; then : +if test "x$ac_cv_have_decl_isfinite" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -12033,7 +12041,7 @@ # -0. on some architectures. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tanh preserves the sign of zero" >&5 $as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } -if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then : +if ${ac_cv_tanh_preserves_zero_sign+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12081,7 +12089,7 @@ # -0. See issue #9920. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether log1p drops the sign of negative zero" >&5 $as_echo_n "checking whether log1p drops the sign of negative zero... " >&6; } - if test "${ac_cv_log1p_drops_zero_sign+set}" = set; then : + if ${ac_cv_log1p_drops_zero_sign+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12133,7 +12141,7 @@ # sem_open results in a 'Signal 12' error. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX semaphores are enabled" >&5 $as_echo_n "checking whether POSIX semaphores are enabled... " >&6; } -if test "${ac_cv_posix_semaphores_enabled+set}" = set; then : +if ${ac_cv_posix_semaphores_enabled+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12184,7 +12192,7 @@ # Multiprocessing check for broken sem_getvalue { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken sem_getvalue" >&5 $as_echo_n "checking for broken sem_getvalue... " >&6; } -if test "${ac_cv_broken_sem_getvalue+set}" = set; then : +if ${ac_cv_broken_sem_getvalue+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -12249,7 +12257,7 @@ 15|30) ;; *) - as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; + as_fn_error $? "bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_big_digits" >&5 $as_echo "$enable_big_digits" >&6; } @@ -12267,7 +12275,7 @@ # check for wchar.h ac_fn_c_check_header_mongrel "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" -if test "x$ac_cv_header_wchar_h" = x""yes; then : +if test "x$ac_cv_header_wchar_h" = xyes; then : $as_echo "#define HAVE_WCHAR_H 1" >>confdefs.h @@ -12290,7 +12298,7 @@ # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 $as_echo_n "checking size of wchar_t... " >&6; } -if test "${ac_cv_sizeof_wchar_t+set}" = set; then : +if ${ac_cv_sizeof_wchar_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include @@ -12301,7 +12309,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (wchar_t) -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_wchar_t=0 fi @@ -12356,7 +12364,7 @@ # check whether wchar_t is signed or not { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wchar_t is signed" >&5 $as_echo_n "checking whether wchar_t is signed... " >&6; } - if test "${ac_cv_wchar_t_signed+set}" = set; then : + if ${ac_cv_wchar_t_signed+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12452,7 +12460,7 @@ # check for endianness { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown @@ -12671,7 +12679,7 @@ ;; #( *) as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac @@ -12743,7 +12751,7 @@ # or fills with zeros (like the Cray J90, according to Tim Peters). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether right shift extends the sign bit" >&5 $as_echo_n "checking whether right shift extends the sign bit... " >&6; } -if test "${ac_cv_rshift_extends_sign+set}" = set; then : +if ${ac_cv_rshift_extends_sign+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12782,7 +12790,7 @@ # check for getc_unlocked and related locking functions { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getc_unlocked() and friends" >&5 $as_echo_n "checking for getc_unlocked() and friends... " >&6; } -if test "${ac_cv_have_getc_unlocked+set}" = set; then : +if ${ac_cv_have_getc_unlocked+:} false; then : $as_echo_n "(cached) " >&6 else @@ -12880,7 +12888,7 @@ # check for readline 2.1 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_callback_handler_install in -lreadline" >&5 $as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then : +if ${ac_cv_lib_readline_rl_callback_handler_install+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -12914,7 +12922,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 $as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_callback_handler_install" = xyes; then : $as_echo "#define HAVE_RL_CALLBACK 1" >>confdefs.h @@ -12966,7 +12974,7 @@ # check for readline 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_pre_input_hook in -lreadline" >&5 $as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then : +if ${ac_cv_lib_readline_rl_pre_input_hook+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13000,7 +13008,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_pre_input_hook" = xyes; then : $as_echo "#define HAVE_RL_PRE_INPUT_HOOK 1" >>confdefs.h @@ -13010,7 +13018,7 @@ # also in 4.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_display_matches_hook in -lreadline" >&5 $as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then : +if ${ac_cv_lib_readline_rl_completion_display_matches_hook+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13044,7 +13052,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = xyes; then : $as_echo "#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1" >>confdefs.h @@ -13054,7 +13062,7 @@ # check for readline 4.2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then : +if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -13088,7 +13096,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 $as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then : +if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : $as_echo "#define HAVE_RL_COMPLETION_MATCHES 1" >>confdefs.h @@ -13129,7 +13137,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken nice()" >&5 $as_echo_n "checking for broken nice()... " >&6; } -if test "${ac_cv_broken_nice+set}" = set; then : +if ${ac_cv_broken_nice+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13170,7 +13178,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken poll()" >&5 $as_echo_n "checking for broken poll()... " >&6; } -if test "${ac_cv_broken_poll+set}" = set; then : +if ${ac_cv_broken_poll+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13225,7 +13233,7 @@ #include <$ac_cv_struct_tm> " -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then : +if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -13241,7 +13249,7 @@ else ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include " -if test "x$ac_cv_have_decl_tzname" = x""yes; then : +if test "x$ac_cv_have_decl_tzname" = xyes; then : ac_have_decl=1 else ac_have_decl=0 @@ -13253,7 +13261,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5 $as_echo_n "checking for tzname... " >&6; } -if test "${ac_cv_var_tzname+set}" = set; then : +if ${ac_cv_var_tzname+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13292,7 +13300,7 @@ # check tzset(3) exists and works like we expect it to { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working tzset()" >&5 $as_echo_n "checking for working tzset()... " >&6; } -if test "${ac_cv_working_tzset+set}" = set; then : +if ${ac_cv_working_tzset+:} false; then : $as_echo_n "(cached) " >&6 else @@ -13389,7 +13397,7 @@ # Look for subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec in struct stat" >&5 $as_echo_n "checking for tv_nsec in struct stat... " >&6; } -if test "${ac_cv_stat_tv_nsec+set}" = set; then : +if ${ac_cv_stat_tv_nsec+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13426,7 +13434,7 @@ # Look for BSD style subsecond timestamps in struct stat { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tv_nsec2 in struct stat" >&5 $as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } -if test "${ac_cv_stat_tv_nsec2+set}" = set; then : +if ${ac_cv_stat_tv_nsec2+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13463,7 +13471,7 @@ # On HP/UX 11.0, mvwdelch is a block with a return statement { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mvwdelch is an expression" >&5 $as_echo_n "checking whether mvwdelch is an expression... " >&6; } -if test "${ac_cv_mvwdelch_is_expression+set}" = set; then : +if ${ac_cv_mvwdelch_is_expression+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13500,7 +13508,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether WINDOW has _flags" >&5 $as_echo_n "checking whether WINDOW has _flags... " >&6; } -if test "${ac_cv_window_has_flags+set}" = set; then : +if ${ac_cv_window_has_flags+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13648,7 +13656,7 @@ then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %lld and %llu printf() format support" >&5 $as_echo_n "checking for %lld and %llu printf() format support... " >&6; } - if test "${ac_cv_have_long_long_format+set}" = set; then : + if ${ac_cv_have_long_long_format+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13718,7 +13726,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for %zd printf() format support" >&5 $as_echo_n "checking for %zd printf() format support... " >&6; } -if test "${ac_cv_have_size_t_format+set}" = set; then : +if ${ac_cv_have_size_t_format+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13791,7 +13799,7 @@ #endif " -if test "x$ac_cv_type_socklen_t" = x""yes; then : +if test "x$ac_cv_type_socklen_t" = xyes; then : else @@ -13802,7 +13810,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken mbstowcs" >&5 $as_echo_n "checking for broken mbstowcs... " >&6; } -if test "${ac_cv_broken_mbstowcs+set}" = set; then : +if ${ac_cv_broken_mbstowcs+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13842,7 +13850,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports computed gotos" >&5 $as_echo_n "checking whether $CC supports computed gotos... " >&6; } -if test "${ac_cv_computed_gotos+set}" = set; then : +if ${ac_cv_computed_gotos+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -13922,11 +13930,11 @@ case $ac_sys_system in - OSF*) as_fn_error $? "OSF* systems are deprecated unless somebody volunteers. Check http://bugs.python.org/issue8606" "$LINENO" 5 ;; + OSF*) as_fn_error $? "OSF* systems are deprecated unless somebody volunteers. Check http://bugs.python.org/issue8606" "$LINENO" 5 ;; esac ac_fn_c_check_func "$LINENO" "pipe2" "ac_cv_func_pipe2" -if test "x$ac_cv_func_pipe2" = x""yes; then : +if test "x$ac_cv_func_pipe2" = xyes; then : $as_echo "#define HAVE_PIPE2 1" >>confdefs.h @@ -14021,10 +14029,21 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -14057,7 +14076,7 @@ -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -14158,6 +14177,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -14465,7 +14485,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 3.2, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -14527,7 +14547,7 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ python config.status 3.2 -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. @@ -14658,7 +14678,7 @@ "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; "Modules/ld_so_aix") CONFIG_FILES="$CONFIG_FILES Modules/ld_so_aix" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -14680,9 +14700,10 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -14690,12 +14711,13 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -14717,7 +14739,7 @@ ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$tmp/subs1.awk" && +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF @@ -14745,7 +14767,7 @@ rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -14793,7 +14815,7 @@ rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -14825,7 +14847,7 @@ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF @@ -14859,7 +14881,7 @@ # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -14871,8 +14893,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -14973,7 +14995,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -14992,7 +15014,7 @@ for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -15001,7 +15023,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -15027,8 +15049,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -15158,21 +15180,22 @@ s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} - rm -f "$tmp/stdin" + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -15183,20 +15206,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 11:09:58 2012 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 16 Jan 2012 11:09:58 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Add_a_test_for_the_dirfd_library_function_=28to_be_used_in_a?= =?utf8?q?n_upcoming?= Message-ID: http://hg.python.org/cpython/rev/5ec2b05c2d35 changeset: 74440:5ec2b05c2d35 parent: 74437:522f07bfa067 parent: 74439:87197ca3c8c6 user: Gregory P. Smith date: Mon Jan 16 02:09:11 2012 -0800 summary: Add a test for the dirfd library function (to be used in an upcoming change). configure will be regenerated in the next commit. files: configure.in | 2 +- pyconfig.h.in | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2562,7 +2562,7 @@ # checks for library functions AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid execv faccessat fchmod fchmodat fchown fchownat \ + clock confstr ctermid dirfd execv faccessat fchmod fchmodat fchown fchownat \ fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \ futimens futimes gai_strerror \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -181,6 +181,9 @@ */ #undef HAVE_DIRENT_H +/* Define to 1 if you have the `dirfd' function. */ +#undef HAVE_DIRFD + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 11:09:59 2012 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 16 Jan 2012 11:09:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_regenerated_using_autoconf?= =?utf8?q?=2C_includes_dirfd_test=2E?= Message-ID: http://hg.python.org/cpython/rev/62f3163cadc3 changeset: 74441:62f3163cadc3 user: Gregory P. Smith date: Mon Jan 16 02:09:41 2012 -0800 summary: regenerated using autoconf, includes dirfd test. files: configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -9396,7 +9396,7 @@ # checks for library functions for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid execv faccessat fchmod fchmodat fchown fchownat \ + clock confstr ctermid dirfd execv faccessat fchmod fchmodat fchown fchownat \ fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \ futimens futimes gai_strerror \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:49:28 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:49:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_rewrite_such_that_this_actu?= =?utf8?q?ally_makes_sense?= Message-ID: http://hg.python.org/cpython/rev/0debff8be37e changeset: 74442:0debff8be37e user: Benjamin Peterson date: Mon Jan 16 09:42:36 2012 -0500 summary: rewrite such that this actually makes sense files: Python/ast.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -490,7 +490,7 @@ return res; } -/* This is down here, so defines like "test" don't intefere with access AST above. */ +/* This is done here, so defines like "test" don't intefere with AST use above. */ #include "grammar.h" #include "parsetok.h" #include "graminit.h" -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:49:28 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:49:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_PyUnicode=5FDecodeUTF8_will?= =?utf8?q?_always_return_a_ready_string?= Message-ID: http://hg.python.org/cpython/rev/f5214817ed57 changeset: 74443:f5214817ed57 user: Benjamin Peterson date: Mon Jan 16 09:47:42 2012 -0500 summary: PyUnicode_DecodeUTF8 will always return a ready string files: Python/ast.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -532,8 +532,9 @@ { _Py_IDENTIFIER(normalize); PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL); - if (!id || PyUnicode_READY(id) == -1) + if (!id) return NULL; + assert(PyUnicode_IS_READY(id)); /* Check whether there are non-ASCII characters in the identifier; if so, normalize to NFKC. */ if (PyUnicode_MAX_CHAR_VALUE((PyUnicodeObject *)id) >= 128) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:49:29 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:49:29 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_use_helpful_PyUnicode=5FIS?= =?utf8?q?=5FASCII_macro?= Message-ID: http://hg.python.org/cpython/rev/fe40a87484cc changeset: 74444:fe40a87484cc user: Benjamin Peterson date: Mon Jan 16 09:49:20 2012 -0500 summary: use helpful PyUnicode_IS_ASCII macro files: Python/ast.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -537,7 +537,7 @@ assert(PyUnicode_IS_READY(id)); /* Check whether there are non-ASCII characters in the identifier; if so, normalize to NFKC. */ - if (PyUnicode_MAX_CHAR_VALUE((PyUnicodeObject *)id) >= 128) { + if (PyUnicode_IS_ASCII(id)) { PyObject *m = PyImport_ImportModuleNoBlock("unicodedata"); PyObject *id2; if (!m) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:54:35 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:54:35 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_possible_refleaks?= Message-ID: http://hg.python.org/cpython/rev/5ef589e38985 changeset: 74445:5ef589e38985 user: Benjamin Peterson date: Mon Jan 16 09:50:48 2012 -0500 summary: fix possible refleaks files: Python/ast.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -540,13 +540,15 @@ if (PyUnicode_IS_ASCII(id)) { PyObject *m = PyImport_ImportModuleNoBlock("unicodedata"); PyObject *id2; - if (!m) + if (!m) { + Py_DECREF(id); return NULL; + } id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id); Py_DECREF(m); + Py_DECREF(id); if (!id2) return NULL; - Py_DECREF(id); id = id2; } PyUnicode_InternInPlace(&id); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:54:36 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:54:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_murder_tabs?= Message-ID: http://hg.python.org/cpython/rev/62545104f9c0 changeset: 74446:62545104f9c0 user: Benjamin Peterson date: Mon Jan 16 09:54:28 2012 -0500 summary: murder tabs files: Parser/Python.asdl | 170 ++++++++++++++++---------------- 1 files changed, 85 insertions(+), 85 deletions(-) diff --git a/Parser/Python.asdl b/Parser/Python.asdl --- a/Parser/Python.asdl +++ b/Parser/Python.asdl @@ -2,119 +2,119 @@ module Python { - mod = Module(stmt* body) - | Interactive(stmt* body) - | Expression(expr body) + mod = Module(stmt* body) + | Interactive(stmt* body) + | Expression(expr body) - -- not really an actual node but useful in Jython's typesystem. - | Suite(stmt* body) + -- not really an actual node but useful in Jython's typesystem. + | Suite(stmt* body) - stmt = FunctionDef(identifier name, arguments args, + stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns) - | ClassDef(identifier name, - expr* bases, - keyword* keywords, - expr? starargs, - expr? kwargs, - stmt* body, - expr* decorator_list) - | Return(expr? value) + | ClassDef(identifier name, + expr* bases, + keyword* keywords, + expr? starargs, + expr? kwargs, + stmt* body, + expr* decorator_list) + | Return(expr? value) - | Delete(expr* targets) - | Assign(expr* targets, expr value) - | AugAssign(expr target, operator op, expr value) + | Delete(expr* targets) + | Assign(expr* targets, expr value) + | AugAssign(expr target, operator op, expr value) - -- use 'orelse' because else is a keyword in target languages - | For(expr target, expr iter, stmt* body, stmt* orelse) - | While(expr test, stmt* body, stmt* orelse) - | If(expr test, stmt* body, stmt* orelse) - | With(withitem* items, stmt* body) + -- use 'orelse' because else is a keyword in target languages + | For(expr target, expr iter, stmt* body, stmt* orelse) + | While(expr test, stmt* body, stmt* orelse) + | If(expr test, stmt* body, stmt* orelse) + | With(withitem* items, stmt* body) - | Raise(expr? exc, expr? cause) - | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) - | Assert(expr test, expr? msg) + | Raise(expr? exc, expr? cause) + | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) + | Assert(expr test, expr? msg) - | Import(alias* names) - | ImportFrom(identifier? module, alias* names, int? level) + | Import(alias* names) + | ImportFrom(identifier? module, alias* names, int? level) - | Global(identifier* names) - | Nonlocal(identifier* names) - | Expr(expr value) - | Pass | Break | Continue + | Global(identifier* names) + | Nonlocal(identifier* names) + | Expr(expr value) + | Pass | Break | Continue - -- XXX Jython will be different - -- col_offset is the byte offset in the utf8 string the parser uses - attributes (int lineno, int col_offset) + -- XXX Jython will be different + -- col_offset is the byte offset in the utf8 string the parser uses + attributes (int lineno, int col_offset) - -- BoolOp() can use left & right? - expr = BoolOp(boolop op, expr* values) - | BinOp(expr left, operator op, expr right) - | UnaryOp(unaryop op, expr operand) - | Lambda(arguments args, expr body) - | IfExp(expr test, expr body, expr orelse) - | Dict(expr* keys, expr* values) - | Set(expr* elts) - | ListComp(expr elt, comprehension* generators) - | SetComp(expr elt, comprehension* generators) - | DictComp(expr key, expr value, comprehension* generators) - | GeneratorExp(expr elt, comprehension* generators) - -- the grammar constrains where yield expressions can occur - | Yield(expr? value) + -- BoolOp() can use left & right? + expr = BoolOp(boolop op, expr* values) + | BinOp(expr left, operator op, expr right) + | UnaryOp(unaryop op, expr operand) + | Lambda(arguments args, expr body) + | IfExp(expr test, expr body, expr orelse) + | Dict(expr* keys, expr* values) + | Set(expr* elts) + | ListComp(expr elt, comprehension* generators) + | SetComp(expr elt, comprehension* generators) + | DictComp(expr key, expr value, comprehension* generators) + | GeneratorExp(expr elt, comprehension* generators) + -- the grammar constrains where yield expressions can occur + | Yield(expr? value) | YieldFrom(expr? value) - -- need sequences for compare to distinguish between - -- x < 4 < 3 and (x < 4) < 3 - | Compare(expr left, cmpop* ops, expr* comparators) - | Call(expr func, expr* args, keyword* keywords, - expr? starargs, expr? kwargs) - | Num(object n) -- a number as a PyObject. - | Str(string s) -- need to specify raw, unicode, etc? - | Bytes(bytes s) - | Ellipsis - -- other literals? bools? + -- need sequences for compare to distinguish between + -- x < 4 < 3 and (x < 4) < 3 + | Compare(expr left, cmpop* ops, expr* comparators) + | Call(expr func, expr* args, keyword* keywords, + expr? starargs, expr? kwargs) + | Num(object n) -- a number as a PyObject. + | Str(string s) -- need to specify raw, unicode, etc? + | Bytes(bytes s) + | Ellipsis + -- other literals? bools? - -- the following expression can appear in assignment context - | Attribute(expr value, identifier attr, expr_context ctx) - | Subscript(expr value, slice slice, expr_context ctx) - | Starred(expr value, expr_context ctx) - | Name(identifier id, expr_context ctx) - | List(expr* elts, expr_context ctx) - | Tuple(expr* elts, expr_context ctx) + -- the following expression can appear in assignment context + | Attribute(expr value, identifier attr, expr_context ctx) + | Subscript(expr value, slice slice, expr_context ctx) + | Starred(expr value, expr_context ctx) + | Name(identifier id, expr_context ctx) + | List(expr* elts, expr_context ctx) + | Tuple(expr* elts, expr_context ctx) - -- col_offset is the byte offset in the utf8 string the parser uses - attributes (int lineno, int col_offset) + -- col_offset is the byte offset in the utf8 string the parser uses + attributes (int lineno, int col_offset) - expr_context = Load | Store | Del | AugLoad | AugStore | Param + expr_context = Load | Store | Del | AugLoad | AugStore | Param - slice = Slice(expr? lower, expr? upper, expr? step) - | ExtSlice(slice* dims) - | Index(expr value) + slice = Slice(expr? lower, expr? upper, expr? step) + | ExtSlice(slice* dims) + | Index(expr value) - boolop = And | Or + boolop = And | Or - operator = Add | Sub | Mult | Div | Mod | Pow | LShift + operator = Add | Sub | Mult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv - unaryop = Invert | Not | UAdd | USub + unaryop = Invert | Not | UAdd | USub - cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn + cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn - comprehension = (expr target, expr iter, expr* ifs) + comprehension = (expr target, expr iter, expr* ifs) - excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body) - attributes (int lineno, int col_offset) + excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body) + attributes (int lineno, int col_offset) - arguments = (arg* args, identifier? vararg, expr? varargannotation, + arguments = (arg* args, identifier? vararg, expr? varargannotation, arg* kwonlyargs, identifier? kwarg, expr? kwargannotation, expr* defaults, expr* kw_defaults) - arg = (identifier arg, expr? annotation) + arg = (identifier arg, expr? annotation) - -- keyword arguments supplied to call - keyword = (identifier arg, expr value) + -- keyword arguments supplied to call + keyword = (identifier arg, expr value) - -- import name with optional 'as' alias. - alias = (identifier name, identifier? asname) + -- import name with optional 'as' alias. + alias = (identifier name, identifier? asname) - withitem = (expr context_expr, expr? optional_vars) + withitem = (expr context_expr, expr? optional_vars) } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:56:00 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:56:00 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_invert_condition_=28head_ba?= =?utf8?b?bmcp?= Message-ID: http://hg.python.org/cpython/rev/ca5c5142da58 changeset: 74447:ca5c5142da58 user: Benjamin Peterson date: Mon Jan 16 09:55:53 2012 -0500 summary: invert condition (head bang) files: Python/ast.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -537,7 +537,7 @@ assert(PyUnicode_IS_READY(id)); /* Check whether there are non-ASCII characters in the identifier; if so, normalize to NFKC. */ - if (PyUnicode_IS_ASCII(id)) { + if (!PyUnicode_IS_ASCII(id)) { PyObject *m = PyImport_ImportModuleNoBlock("unicodedata"); PyObject *id2; if (!m) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 15:56:39 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 15:56:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_spelling?= Message-ID: http://hg.python.org/cpython/rev/525188cb79fc changeset: 74448:525188cb79fc user: Benjamin Peterson date: Mon Jan 16 09:56:35 2012 -0500 summary: fix spelling files: Python/ast.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -490,7 +490,7 @@ return res; } -/* This is done here, so defines like "test" don't intefere with AST use above. */ +/* This is done here, so defines like "test" don't interfere with AST use above. */ #include "grammar.h" #include "parsetok.h" #include "graminit.h" -- Repository URL: http://hg.python.org/cpython From brett at python.org Mon Jan 16 17:17:42 2012 From: brett at python.org (Brett Cannon) Date: Mon, 16 Jan 2012 11:17:42 -0500 Subject: [Python-checkins] peps: Bring the Python 3.3 feature list up to date. In-Reply-To: References: Message-ID: Is the change to the pyc format big enough news to go into the release PEP? Or should that just be a "What's New" topic? On Fri, Jan 13, 2012 at 15:18, georg.brandl wrote: > http://hg.python.org/peps/rev/ea3ffa3611e5 > changeset: 4012:ea3ffa3611e5 > user: Georg Brandl > date: Fri Jan 13 21:18:11 2012 +0100 > summary: > Bring the Python 3.3 feature list up to date. > > files: > pep-0398.txt | 17 ++++++++++++----- > 1 files changed, 12 insertions(+), 5 deletions(-) > > > diff --git a/pep-0398.txt b/pep-0398.txt > --- a/pep-0398.txt > +++ b/pep-0398.txt > @@ -57,27 +57,34 @@ > Features for 3.3 > ================ > > +Implemented PEPs: > + > +* PEP 380: Syntax for Delegating to a Subgenerator > +* PEP 393: Flexible String Representation > +* PEP 3151: Reworking the OS and IO exception hierarchy > +* PEP 3155: Qualified name for classes and functions > + > +Other final large-scale changes: > + > +* Addition of the "packaging" module, deprecating "distutils" > +* Addition of the faulthandler module > + > Candidate PEPs: > > * PEP 362: Function Signature Object > -* PEP 380: Syntax for Delegating to a Subgenerator > * PEP 382: Namespace Packages > -* PEP 393: Flexible String Representation > * PEP 395: Module Aliasing > * PEP 397: Python launcher for Windows > * PEP 3143: Standard daemon process library > -* PEP 3151: Reworking the OS and IO exception hierarchy > > (Note that these are not accepted yet and even if they are, they might > not be finished in time for Python 3.3.) > > Other planned large-scale changes: > > -* Addition of the "packaging" module, replacing "distutils" > * Implementing ``__import__`` using importlib > * Email version 6 > * A standard event-loop interface (PEP by Jim Fulton pending) > -* Adding the faulthandler module. > * Breaking out standard library and docs in separate repos? > * A PEP on supplementing C modules with equivalent Python modules? > > > -- > Repository URL: http://hg.python.org/peps > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Mon Jan 16 17:46:36 2012 From: python-checkins at python.org (brett.cannon) Date: Mon, 16 Jan 2012 17:46:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313588=3A_Rename_de?= =?utf8?q?corators_in_importlib=2E?= Message-ID: http://hg.python.org/cpython/rev/9935f7837c4b changeset: 74449:9935f7837c4b user: Brett Cannon date: Mon Jan 16 11:46:22 2012 -0500 summary: Issue #13588: Rename decorators in importlib. More descriptive names are now used in order to make tracebacks more readable. files: Lib/importlib/_bootstrap.py | 36 ++++++++++++------------ Misc/ACKS | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -122,26 +122,26 @@ def set_package(fxn): """Set __package__ on the returned module.""" - def wrapper(*args, **kwargs): + def set_package_wrapper(*args, **kwargs): module = fxn(*args, **kwargs) if not hasattr(module, '__package__') or module.__package__ is None: module.__package__ = module.__name__ if not hasattr(module, '__path__'): module.__package__ = module.__package__.rpartition('.')[0] return module - _wrap(wrapper, fxn) - return wrapper + _wrap(set_package_wrapper, fxn) + return set_package_wrapper def set_loader(fxn): """Set __loader__ on the returned module.""" - def wrapper(self, *args, **kwargs): + def set_loader_wrapper(self, *args, **kwargs): module = fxn(self, *args, **kwargs) if not hasattr(module, '__loader__'): module.__loader__ = self return module - _wrap(wrapper, fxn) - return wrapper + _wrap(set_loader_wrapper, fxn) + return set_loader_wrapper def module_for_loader(fxn): @@ -157,7 +157,7 @@ the second argument. """ - def decorated(self, fullname, *args, **kwargs): + def module_for_loader_wrapper(self, fullname, *args, **kwargs): module = sys.modules.get(fullname) is_reload = bool(module) if not is_reload: @@ -172,8 +172,8 @@ if not is_reload: del sys.modules[fullname] raise - _wrap(decorated, fxn) - return decorated + _wrap(module_for_loader_wrapper, fxn) + return module_for_loader_wrapper def _check_name(method): @@ -184,32 +184,32 @@ compared against. If the comparison fails then ImportError is raised. """ - def inner(self, name, *args, **kwargs): + def _check_name_wrapper(self, name, *args, **kwargs): if self._name != name: raise ImportError("loader cannot handle %s" % name) return method(self, name, *args, **kwargs) - _wrap(inner, method) - return inner + _wrap(_check_name_wrapper, method) + return _check_name_wrapper def _requires_builtin(fxn): """Decorator to verify the named module is built-in.""" - def wrapper(self, fullname): + def _requires_builtin_wrapper(self, fullname): if fullname not in sys.builtin_module_names: raise ImportError("{0} is not a built-in module".format(fullname)) return fxn(self, fullname) - _wrap(wrapper, fxn) - return wrapper + _wrap(_requires_builtin_wrapper, fxn) + return _requires_builtin_wrapper def _requires_frozen(fxn): """Decorator to verify the named module is frozen.""" - def wrapper(self, fullname): + def _requires_frozen_wrapper(self, fullname): if not imp.is_frozen(fullname): raise ImportError("{0} is not a frozen module".format(fullname)) return fxn(self, fullname) - _wrap(wrapper, fxn) - return wrapper + _wrap(_requires_frozen_wrapper, fxn) + return _requires_frozen_wrapper def _suffix_list(suffix_type): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -754,6 +754,7 @@ Randy Pausch Samuele Pedroni Marcel van der Peijl +Berker Peksag Steven Pemberton Santiago Peres?n George Peristerakis -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 18:06:35 2012 From: python-checkins at python.org (sandro.tosi) Date: Mon, 16 Jan 2012 18:06:35 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWU6ICMxMjQw?= =?utf8?q?9=3A_remove_obsolete_susp-entries?= Message-ID: http://hg.python.org/cpython/rev/7167c04780ed changeset: 74450:7167c04780ed branch: 2.7 parent: 74433:b4dac315feef user: Sandro Tosi date: Mon Jan 16 18:01:55 2012 +0100 summary: Issue: #12409: remove obsolete susp-entries files: Doc/tools/sphinxext/susp-ignored.csv | 106 --------------- 1 files changed, 0 insertions(+), 106 deletions(-) diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -164,35 +164,6 @@ whatsnew/2.5,,:step,[start:stop:step] whatsnew/2.5,,:stop,[start:stop:step] distutils/examples,267,`,This is the description of the ``foobar`` package. -documenting/fromlatex,39,:func,:func:`str(object)` -documenting/fromlatex,39,`,:func:`str(object)` -documenting/fromlatex,39,`,``str(object)`` -documenting/fromlatex,55,.. deprecated:,.. deprecated:: 2.5 -documenting/fromlatex,66,.. note:,.. note:: -documenting/fromlatex,76,:samp,":samp:`open({filename}, {mode})`" -documenting/fromlatex,76,`,":samp:`open({filename}, {mode})`" -documenting/fromlatex,80,`,``'c'`` -documenting/fromlatex,80,`,`Title `_ -documenting/fromlatex,80,`,``code`` -documenting/fromlatex,80,`,`Title `_ -documenting/fromlatex,99,:file,:file:`C:\\Temp\\my.tmp` -documenting/fromlatex,99,`,:file:`C:\\Temp\\my.tmp` -documenting/fromlatex,99,`,"``open(""C:\Temp\my.tmp"")``" -documenting/fromlatex,129,.. function:,.. function:: do_foo(bar) -documenting/fromlatex,141,.. function:,".. function:: open(filename[, mode[, buffering]])" -documenting/fromlatex,152,.. function:,.. function:: foo_* -documenting/fromlatex,152,:noindex,:noindex: -documenting/fromlatex,162,.. describe:,.. describe:: a == b -documenting/fromlatex,168,.. cmdoption:,.. cmdoption:: -O -documenting/fromlatex,168,.. envvar:,.. envvar:: PYTHONINSPECT -documenting/rest,33,`,``text`` -documenting/rest,47,:rolename,:rolename:`content` -documenting/rest,47,`,:rolename:`content` -documenting/rest,103,::,This is a normal text paragraph. The next paragraph is a code sample:: -documenting/rest,130,`,`Link text `_ -documenting/rest,187,.. function:,.. function:: foo(x) -documenting/rest,187,:bar,:bar: no -documenting/rest,208,.. rubric:,.. rubric:: Footnotes faq/programming,,:reduce,"print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(" @@ -224,81 +195,4 @@ howto/pyporting,75,::,# make sure to use :: Python *and* :: Python :: 3 so howto/pyporting,75,::,"'Programming Language :: Python'," howto/pyporting,75,::,'Programming Language :: Python :: 3' -documenting/markup,33,.. sectionauthor:,.. sectionauthor:: Guido van Rossum -documenting/markup,42,:mod,:mod:`parrot` -- Dead parrot access -documenting/markup,42,`,:mod:`parrot` -- Dead parrot access -documenting/markup,42,.. module:,.. module:: parrot -documenting/markup,42,:platform,":platform: Unix, Windows" -documenting/markup,42,:synopsis,:synopsis: Analyze and reanimate dead parrots. -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: Eric Cleese -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: John Idle -documenting/markup,88,:noindex,:noindex: -documenting/markup,95,.. function:,.. function:: spam(eggs) -documenting/markup,95,:noindex,:noindex: -documenting/markup,101,.. method:,.. method:: FileInput.input(...) -documenting/markup,121,.. cfunction:,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,131,.. cmember:,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,150,.. cvar:,.. c:var:: PyObject* PyClass_Type -documenting/markup,179,.. function:,".. function:: Timer.repeat([repeat=3[, number=1000000]])" -documenting/markup,209,.. cmdoption:,.. cmdoption:: -m -documenting/markup,227,.. describe:,.. describe:: opcode -documenting/markup,256,.. highlightlang:,.. highlightlang:: c -documenting/markup,276,.. literalinclude:,.. literalinclude:: example.py -documenting/markup,291,:rolename,:rolename:`content` -documenting/markup,291,`,:rolename:`content` -documenting/markup,296,:role,:role:`title ` -documenting/markup,296,`,:role:`title ` -documenting/markup,302,:meth,:meth:`~Queue.Queue.get` -documenting/markup,302,`,:meth:`~Queue.Queue.get` -documenting/markup,350,:func,:func:`filter` -documenting/markup,350,`,:func:`filter` -documenting/markup,350,:func,:func:`foo.filter` -documenting/markup,350,`,:func:`foo.filter` -documenting/markup,356,:func,:func:`open` -documenting/markup,356,`,:func:`open` -documenting/markup,356,:func,:func:`.open` -documenting/markup,356,`,:func:`.open` -documenting/markup,435,:file,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,435,`,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,454,:kbd,:kbd:`C-x C-f` -documenting/markup,454,`,:kbd:`C-x C-f` -documenting/markup,454,:kbd,:kbd:`Control-x Control-f` -documenting/markup,454,`,:kbd:`Control-x Control-f` -documenting/markup,468,:mailheader,:mailheader:`Content-Type` -documenting/markup,468,`,:mailheader:`Content-Type` -documenting/markup,477,:manpage,:manpage:`ls(1)` -documenting/markup,477,`,:manpage:`ls(1)` -documenting/markup,493,:menuselection,:menuselection:`Start --> Programs` -documenting/markup,493,`,:menuselection:`Start --> Programs` -documenting/markup,508,`,``code`` -documenting/markup,526,:file,:file: -documenting/markup,526,`,``code`` -documenting/markup,561,:ref,:ref:`label-name` -documenting/markup,561,`,:ref:`label-name` -documenting/markup,565,:ref,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,565,`,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,574,:ref,:ref: -documenting/markup,595,.. note:,.. note:: -documenting/markup,622,.. versionadded:,.. versionadded:: 2.5 -documenting/markup,647,::,.. impl-detail:: -documenting/markup,647,::,.. impl-detail:: This shortly mentions an implementation detail. -documenting/markup,667,.. seealso:,.. seealso:: -documenting/markup,667,:mod,Module :mod:`zipfile` -documenting/markup,667,`,Module :mod:`zipfile` -documenting/markup,667,:mod,Documentation of the :mod:`zipfile` standard module. -documenting/markup,667,`,Documentation of the :mod:`zipfile` standard module. -documenting/markup,667,`,"`GNU tar manual, Basic Tar Format `_" -documenting/markup,681,.. centered:,.. centered:: -documenting/markup,726,.. toctree:,.. toctree:: -documenting/markup,726,:maxdepth,:maxdepth: 2 -documenting/markup,742,.. index:,.. index:: -documenting/markup,772,.. index:,".. index:: BNF, grammar, syntax, notation" -documenting/markup,803,`,"unaryneg ::= ""-"" `integer`" -documenting/markup,808,.. productionlist:,.. productionlist:: -documenting/markup,808,`,"try1_stmt: ""try"" "":"" `suite`" -documenting/markup,808,`,": (""except"" [`expression` ["","" `target`]] "":"" `suite`)+" -documenting/markup,808,`,": [""else"" "":"" `suite`]" -documenting/markup,808,`,": [""finally"" "":"" `suite`]" -documenting/markup,808,`,"try2_stmt: ""try"" "":"" `suite`" -documenting/markup,808,`,": ""finally"" "":"" `suite`" library/urllib2,67,:close,Connection:close -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 18:06:35 2012 From: python-checkins at python.org (sandro.tosi) Date: Mon, 16 Jan 2012 18:06:35 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWU6ICMxMjQw?= =?utf8?q?9=3A_remove_obsolete_susp-entries?= Message-ID: http://hg.python.org/cpython/rev/153e32333aaa changeset: 74451:153e32333aaa branch: 3.2 parent: 74439:87197ca3c8c6 user: Sandro Tosi date: Mon Jan 16 18:02:09 2012 +0100 summary: Issue: #12409: remove obsolete susp-entries files: Doc/tools/sphinxext/susp-ignored.csv | 128 --------------- 1 files changed, 0 insertions(+), 128 deletions(-) diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -164,35 +164,6 @@ whatsnew/2.5,,:step,[start:stop:step] whatsnew/2.5,,:stop,[start:stop:step] distutils/examples,267,`,This is the description of the ``foobar`` package. -documenting/fromlatex,39,:func,:func:`str(object)` -documenting/fromlatex,39,`,:func:`str(object)` -documenting/fromlatex,39,`,``str(object)`` -documenting/fromlatex,55,.. deprecated:,.. deprecated:: 2.5 -documenting/fromlatex,66,.. note:,.. note:: -documenting/fromlatex,76,:samp,":samp:`open({filename}, {mode})`" -documenting/fromlatex,76,`,":samp:`open({filename}, {mode})`" -documenting/fromlatex,80,`,``'c'`` -documenting/fromlatex,80,`,`Title `_ -documenting/fromlatex,80,`,``code`` -documenting/fromlatex,80,`,`Title `_ -documenting/fromlatex,99,:file,:file:`C:\\Temp\\my.tmp` -documenting/fromlatex,99,`,:file:`C:\\Temp\\my.tmp` -documenting/fromlatex,99,`,"``open(""C:\Temp\my.tmp"")``" -documenting/fromlatex,129,.. function:,.. function:: do_foo(bar) -documenting/fromlatex,141,.. function:,".. function:: open(filename[, mode[, buffering]])" -documenting/fromlatex,152,.. function:,.. function:: foo_* -documenting/fromlatex,152,:noindex,:noindex: -documenting/fromlatex,162,.. describe:,.. describe:: a == b -documenting/fromlatex,168,.. cmdoption:,.. cmdoption:: -O -documenting/fromlatex,168,.. envvar:,.. envvar:: PYTHONINSPECT -documenting/rest,33,`,``text`` -documenting/rest,47,:rolename,:rolename:`content` -documenting/rest,47,`,:rolename:`content` -documenting/rest,103,::,This is a normal text paragraph. The next paragraph is a code sample:: -documenting/rest,130,`,`Link text `_ -documenting/rest,187,.. function:,.. function:: foo(x) -documenting/rest,187,:bar,:bar: no -documenting/rest,208,.. rubric:,.. rubric:: Footnotes faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(" @@ -271,7 +242,6 @@ howto/logging,,:logger,severity:logger name:message howto/logging,,:message,severity:logger name:message library/logging.handlers,,:port,host:port -documenting/markup,613,`,:ref:`link text ` library/imaplib,116,:MM,"""DD-Mmm-YYYY HH:MM:SS" library/imaplib,116,:SS,"""DD-Mmm-YYYY HH:MM:SS" whatsnew/3.2,,::,"$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" @@ -292,104 +262,6 @@ whatsnew/3.2,,:affe,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:deaf,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:feed,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," -documenting/markup,33,.. sectionauthor:,.. sectionauthor:: Guido van Rossum -documenting/markup,42,:mod,:mod:`parrot` -- Dead parrot access -documenting/markup,42,`,:mod:`parrot` -- Dead parrot access -documenting/markup,42,.. module:,.. module:: parrot -documenting/markup,42,:platform,":platform: Unix, Windows" -documenting/markup,42,:synopsis,:synopsis: Analyze and reanimate dead parrots. -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: Eric Cleese -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: John Idle -documenting/markup,88,:noindex,:noindex: -documenting/markup,95,.. function:,.. function:: spam(eggs) -documenting/markup,95,:noindex,:noindex: -documenting/markup,101,.. method:,.. method:: FileInput.input(...) -documenting/markup,121,:function,c:function -documenting/markup,121,.. c:,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,121,::,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,131,:member,c:member -documenting/markup,131,.. c:,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,131,::,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,139,:macro,c:macro -documenting/markup,143,:type,c:type -documenting/markup,150,:var,c:var -documenting/markup,150,.. cvar:,.. cvar:: PyObject* PyClass_Type -documenting/markup,179,.. function:,".. function:: repeat([repeat=3[, number=1000000]])" -documenting/markup,210,.. decorator:,.. decorator:: removename -documenting/markup,210,.. decorator:,.. decorator:: setnewname(name) -documenting/markup,210,:func,:func: -documenting/markup,237,.. class:,.. class:: Spam -documenting/markup,237,.. data:,.. data:: ham -documenting/markup,237,.. data:,.. data:: Spam.eggs -documenting/markup,250,:meth,:meth: -documenting/markup,263,.. cmdoption:,.. cmdoption:: -m -documenting/markup,281,.. describe:,.. describe:: opcode -documenting/markup,310,.. highlightlang:,.. highlightlang:: c -documenting/markup,330,.. literalinclude:,.. literalinclude:: example.py -documenting/markup,345,:rolename,:rolename:`content` -documenting/markup,345,`,:rolename:`content` -documenting/markup,350,:role,:role:`title ` -documenting/markup,350,`,:role:`title ` -documenting/markup,356,:meth,:meth:`~Queue.Queue.get` -documenting/markup,356,`,:meth:`~Queue.Queue.get` -documenting/markup,404,:func,:func:`filter` -documenting/markup,404,`,:func:`filter` -documenting/markup,404,:func,:func:`foo.filter` -documenting/markup,404,`,:func:`foo.filter` -documenting/markup,410,:func,:func:`open` -documenting/markup,410,`,:func:`open` -documenting/markup,410,:func,:func:`.open` -documenting/markup,410,`,:func:`.open` -documenting/markup,426,:data,c:data -documenting/markup,430,:func,c:func -documenting/markup,434,:macro,c:macro -documenting/markup,438,:type,c:type -documenting/markup,443,:member,c:member -documenting/markup,493,:file,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,493,`,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,512,:kbd,:kbd:`C-x C-f` -documenting/markup,512,`,:kbd:`C-x C-f` -documenting/markup,512,:kbd,:kbd:`Control-x Control-f` -documenting/markup,512,`,:kbd:`Control-x Control-f` -documenting/markup,526,:mailheader,:mailheader:`Content-Type` -documenting/markup,526,`,:mailheader:`Content-Type` -documenting/markup,535,:manpage,:manpage:`ls(1)` -documenting/markup,535,`,:manpage:`ls(1)` -documenting/markup,551,:menuselection,:menuselection:`Start --> Programs` -documenting/markup,551,`,:menuselection:`Start --> Programs` -documenting/markup,566,`,``code`` -documenting/markup,585,:file,:file: -documenting/markup,585,`,``code`` -documenting/markup,615,:ref,:ref:`label-name` -documenting/markup,615,`,:ref:`label-name` -documenting/markup,619,:ref,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,619,`,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,628,:ref,:ref: -documenting/markup,630,:ref,:ref:`link text ` -documenting/markup,630,`,:ref:`link text ` -documenting/markup,651,.. note:,.. note:: -documenting/markup,678,.. versionadded:,.. versionadded:: 3.1 -documenting/markup,703,::,.. impl-detail:: -documenting/markup,703,::,.. impl-detail:: This shortly mentions an implementation detail. -documenting/markup,723,.. seealso:,.. seealso:: -documenting/markup,723,:mod,Module :mod:`zipfile` -documenting/markup,723,`,Module :mod:`zipfile` -documenting/markup,723,:mod,Documentation of the :mod:`zipfile` standard module. -documenting/markup,723,`,Documentation of the :mod:`zipfile` standard module. -documenting/markup,723,`,"`GNU tar manual, Basic Tar Format `_" -documenting/markup,737,.. centered:,.. centered:: -documenting/markup,782,.. toctree:,.. toctree:: -documenting/markup,782,:maxdepth,:maxdepth: 2 -documenting/markup,798,.. index:,.. index:: -documenting/markup,828,.. index:,".. index:: BNF, grammar, syntax, notation" -documenting/markup,859,`,"unaryneg ::= ""-"" `integer`" -documenting/markup,864,.. productionlist:,.. productionlist:: -documenting/markup,864,`,"try1_stmt: ""try"" "":"" `suite`" -documenting/markup,864,`,": (""except"" [`expression` ["","" `target`]] "":"" `suite`)+" -documenting/markup,864,`,": [""else"" "":"" `suite`]" -documenting/markup,864,`,": [""finally"" "":"" `suite`]" -documenting/markup,864,`,"try2_stmt: ""try"" "":"" `suite`" -documenting/markup,864,`,": ""finally"" "":"" `suite`" library/pprint,209,::,"'classifiers': ['Development Status :: 4 - Beta'," library/pprint,209,::,"'Intended Audience :: Developers'," library/pprint,209,::,"'License :: OSI Approved :: MIT License'," -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 18:06:36 2012 From: python-checkins at python.org (sandro.tosi) Date: Mon, 16 Jan 2012 18:06:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue=3A_=2312409=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/a6bf08666da2 changeset: 74452:a6bf08666da2 parent: 74449:9935f7837c4b parent: 74451:153e32333aaa user: Sandro Tosi date: Mon Jan 16 18:03:51 2012 +0100 summary: Issue: #12409: merge with 3.2 files: Doc/tools/sphinxext/susp-ignored.csv | 221 --------------- 1 files changed, 0 insertions(+), 221 deletions(-) diff --git a/Doc/tools/sphinxext/susp-ignored.csv b/Doc/tools/sphinxext/susp-ignored.csv --- a/Doc/tools/sphinxext/susp-ignored.csv +++ b/Doc/tools/sphinxext/susp-ignored.csv @@ -164,128 +164,6 @@ whatsnew/2.5,,:step,[start:stop:step] whatsnew/2.5,,:stop,[start:stop:step] distutils/examples,267,`,This is the description of the ``foobar`` package. -documenting/fromlatex,39,:func,:func:`str(object)` -documenting/fromlatex,39,`,:func:`str(object)` -documenting/fromlatex,39,`,``str(object)`` -documenting/fromlatex,55,.. deprecated:,.. deprecated:: 2.5 -documenting/fromlatex,66,.. note:,.. note:: -documenting/fromlatex,76,:samp,":samp:`open({filename}, {mode})`" -documenting/fromlatex,76,`,":samp:`open({filename}, {mode})`" -documenting/fromlatex,80,`,``'c'`` -documenting/fromlatex,80,`,`Title `_ -documenting/fromlatex,80,`,``code`` -documenting/fromlatex,80,`,`Title `_ -documenting/fromlatex,99,:file,:file:`C:\\Temp\\my.tmp` -documenting/fromlatex,99,`,:file:`C:\\Temp\\my.tmp` -documenting/fromlatex,99,`,"``open(""C:\Temp\my.tmp"")``" -documenting/fromlatex,129,.. function:,.. function:: do_foo(bar) -documenting/fromlatex,141,.. function:,".. function:: open(filename[, mode[, buffering]])" -documenting/fromlatex,152,.. function:,.. function:: foo_* -documenting/fromlatex,152,:noindex,:noindex: -documenting/fromlatex,162,.. describe:,.. describe:: a == b -documenting/fromlatex,168,.. cmdoption:,.. cmdoption:: -O -documenting/fromlatex,168,.. envvar:,.. envvar:: PYTHONINSPECT -documenting/markup,33,.. sectionauthor:,.. sectionauthor:: Guido van Rossum -documenting/markup,42,:mod,:mod:`parrot` -- Dead parrot access -documenting/markup,42,`,:mod:`parrot` -- Dead parrot access -documenting/markup,42,.. module:,.. module:: parrot -documenting/markup,42,:platform,":platform: Unix, Windows" -documenting/markup,42,:synopsis,:synopsis: Analyze and reanimate dead parrots. -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: Eric Cleese -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: John Idle -documenting/markup,88,:noindex,:noindex: -documenting/markup,95,.. function:,.. function:: spam(eggs) -documenting/markup,95,:noindex,:noindex: -documenting/markup,101,.. method:,.. method:: FileInput.input(...) -documenting/markup,121,:function,c:function -documenting/markup,121,.. c:,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,121,::,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,131,:member,c:member -documenting/markup,131,.. c:,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,131,::,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,139,:macro,c:macro -documenting/markup,143,:type,c:type -documenting/markup,150,:var,c:var -documenting/markup,150,.. cvar:,.. cvar:: PyObject* PyClass_Type -documenting/markup,179,.. function:,".. function:: Timer.repeat([repeat=3[, number=1000000]])" -documenting/markup,210,.. decorator:,.. decorator:: removename -documenting/markup,210,.. decorator:,.. decorator:: setnewname(name) -documenting/markup,210,:func,:func: -documenting/markup,233,:meth,:meth: -documenting/markup,246,.. cmdoption:,.. cmdoption:: -m -documenting/markup,264,.. describe:,.. describe:: opcode -documenting/markup,293,.. highlightlang:,.. highlightlang:: c -documenting/markup,313,.. literalinclude:,.. literalinclude:: example.py -documenting/markup,328,:rolename,:rolename:`content` -documenting/markup,328,`,:rolename:`content` -documenting/markup,333,:role,:role:`title ` -documenting/markup,333,`,:role:`title ` -documenting/markup,339,:meth,:meth:`~Queue.Queue.get` -documenting/markup,339,`,:meth:`~Queue.Queue.get` -documenting/markup,387,:func,:func:`filter` -documenting/markup,387,`,:func:`filter` -documenting/markup,387,:func,:func:`foo.filter` -documenting/markup,387,`,:func:`foo.filter` -documenting/markup,393,:func,:func:`open` -documenting/markup,393,`,:func:`open` -documenting/markup,393,:func,:func:`.open` -documenting/markup,393,`,:func:`.open` -documenting/markup,409,:data,c:data -documenting/markup,413,:func,c:func -documenting/markup,417,:macro,c:macro -documenting/markup,421,:type,c:type -documenting/markup,426,:member,c:member -documenting/markup,476,:file,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,476,`,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,495,:kbd,:kbd:`C-x C-f` -documenting/markup,495,`,:kbd:`C-x C-f` -documenting/markup,495,:kbd,:kbd:`Control-x Control-f` -documenting/markup,495,`,:kbd:`Control-x Control-f` -documenting/markup,509,:mailheader,:mailheader:`Content-Type` -documenting/markup,509,`,:mailheader:`Content-Type` -documenting/markup,518,:manpage,:manpage:`ls(1)` -documenting/markup,518,`,:manpage:`ls(1)` -documenting/markup,534,:menuselection,:menuselection:`Start --> Programs` -documenting/markup,534,`,:menuselection:`Start --> Programs` -documenting/markup,549,`,``code`` -documenting/markup,567,:file,:file: -documenting/markup,567,`,``code`` -documenting/markup,602,:ref,:ref:`label-name` -documenting/markup,602,`,:ref:`label-name` -documenting/markup,606,:ref,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,606,`,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,615,:ref,:ref: -documenting/markup,636,.. note:,.. note:: -documenting/markup,663,.. versionadded:,.. versionadded:: 3.1 -documenting/markup,688,::,.. impl-detail:: -documenting/markup,688,::,.. impl-detail:: This shortly mentions an implementation detail. -documenting/markup,708,.. seealso:,.. seealso:: -documenting/markup,708,:mod,Module :mod:`zipfile` -documenting/markup,708,`,Module :mod:`zipfile` -documenting/markup,708,:mod,Documentation of the :mod:`zipfile` standard module. -documenting/markup,708,`,Documentation of the :mod:`zipfile` standard module. -documenting/markup,708,`,"`GNU tar manual, Basic Tar Format `_" -documenting/markup,722,.. centered:,.. centered:: -documenting/markup,767,.. toctree:,.. toctree:: -documenting/markup,767,:maxdepth,:maxdepth: 2 -documenting/markup,783,.. index:,.. index:: -documenting/markup,813,.. index:,".. index:: BNF, grammar, syntax, notation" -documenting/markup,844,`,"unaryneg ::= ""-"" `integer`" -documenting/markup,849,.. productionlist:,.. productionlist:: -documenting/markup,849,`,"try1_stmt: ""try"" "":"" `suite`" -documenting/markup,849,`,": (""except"" [`expression` ["","" `target`]] "":"" `suite`)+" -documenting/markup,849,`,": [""else"" "":"" `suite`]" -documenting/markup,849,`,": [""finally"" "":"" `suite`]" -documenting/markup,849,`,"try2_stmt: ""try"" "":"" `suite`" -documenting/markup,849,`,": ""finally"" "":"" `suite`" -documenting/rest,33,`,``text`` -documenting/rest,47,:rolename,:rolename:`content` -documenting/rest,47,`,:rolename:`content` -documenting/rest,103,::,This is a normal text paragraph. The next paragraph is a code sample:: -documenting/rest,130,`,`Link text `_ -documenting/rest,187,.. function:,.. function:: foo(x) -documenting/rest,187,:bar,:bar: no -documenting/rest,208,.. rubric:,.. rubric:: Footnotes faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y," faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro," faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(" @@ -364,7 +242,6 @@ howto/logging,,:logger,severity:logger name:message howto/logging,,:message,severity:logger name:message library/logging.handlers,,:port,host:port -documenting/markup,613,`,:ref:`link text ` library/imaplib,116,:MM,"""DD-Mmm-YYYY HH:MM:SS" library/imaplib,116,:SS,"""DD-Mmm-YYYY HH:MM:SS" whatsnew/3.2,,::,"$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" @@ -385,104 +262,6 @@ whatsnew/3.2,,:affe,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:deaf,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," whatsnew/3.2,,:feed,"netloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]'," -documenting/markup,33,.. sectionauthor:,.. sectionauthor:: Guido van Rossum -documenting/markup,42,:mod,:mod:`parrot` -- Dead parrot access -documenting/markup,42,`,:mod:`parrot` -- Dead parrot access -documenting/markup,42,.. module:,.. module:: parrot -documenting/markup,42,:platform,":platform: Unix, Windows" -documenting/markup,42,:synopsis,:synopsis: Analyze and reanimate dead parrots. -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: Eric Cleese -documenting/markup,42,.. moduleauthor:,.. moduleauthor:: John Idle -documenting/markup,88,:noindex,:noindex: -documenting/markup,95,.. function:,.. function:: spam(eggs) -documenting/markup,95,:noindex,:noindex: -documenting/markup,101,.. method:,.. method:: FileInput.input(...) -documenting/markup,121,:function,c:function -documenting/markup,121,.. c:,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,121,::,".. c:function:: PyObject* PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)" -documenting/markup,131,:member,c:member -documenting/markup,131,.. c:,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,131,::,.. c:member:: PyObject* PyTypeObject.tp_bases -documenting/markup,139,:macro,c:macro -documenting/markup,143,:type,c:type -documenting/markup,150,:var,c:var -documenting/markup,150,.. cvar:,.. cvar:: PyObject* PyClass_Type -documenting/markup,179,.. function:,".. function:: repeat([repeat=3[, number=1000000]])" -documenting/markup,210,.. decorator:,.. decorator:: removename -documenting/markup,210,.. decorator:,.. decorator:: setnewname(name) -documenting/markup,210,:func,:func: -documenting/markup,237,.. class:,.. class:: Spam -documenting/markup,237,.. data:,.. data:: ham -documenting/markup,237,.. data:,.. data:: Spam.eggs -documenting/markup,250,:meth,:meth: -documenting/markup,263,.. cmdoption:,.. cmdoption:: -m -documenting/markup,281,.. describe:,.. describe:: opcode -documenting/markup,310,.. highlightlang:,.. highlightlang:: c -documenting/markup,330,.. literalinclude:,.. literalinclude:: example.py -documenting/markup,345,:rolename,:rolename:`content` -documenting/markup,345,`,:rolename:`content` -documenting/markup,350,:role,:role:`title ` -documenting/markup,350,`,:role:`title ` -documenting/markup,356,:meth,:meth:`~Queue.Queue.get` -documenting/markup,356,`,:meth:`~Queue.Queue.get` -documenting/markup,404,:func,:func:`filter` -documenting/markup,404,`,:func:`filter` -documenting/markup,404,:func,:func:`foo.filter` -documenting/markup,404,`,:func:`foo.filter` -documenting/markup,410,:func,:func:`open` -documenting/markup,410,`,:func:`open` -documenting/markup,410,:func,:func:`.open` -documenting/markup,410,`,:func:`.open` -documenting/markup,426,:data,c:data -documenting/markup,430,:func,c:func -documenting/markup,434,:macro,c:macro -documenting/markup,438,:type,c:type -documenting/markup,443,:member,c:member -documenting/markup,493,:file,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,493,`,... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... -documenting/markup,512,:kbd,:kbd:`C-x C-f` -documenting/markup,512,`,:kbd:`C-x C-f` -documenting/markup,512,:kbd,:kbd:`Control-x Control-f` -documenting/markup,512,`,:kbd:`Control-x Control-f` -documenting/markup,526,:mailheader,:mailheader:`Content-Type` -documenting/markup,526,`,:mailheader:`Content-Type` -documenting/markup,535,:manpage,:manpage:`ls(1)` -documenting/markup,535,`,:manpage:`ls(1)` -documenting/markup,551,:menuselection,:menuselection:`Start --> Programs` -documenting/markup,551,`,:menuselection:`Start --> Programs` -documenting/markup,566,`,``code`` -documenting/markup,585,:file,:file: -documenting/markup,585,`,``code`` -documenting/markup,615,:ref,:ref:`label-name` -documenting/markup,615,`,:ref:`label-name` -documenting/markup,619,:ref,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,619,`,"It refers to the section itself, see :ref:`my-reference-label`." -documenting/markup,628,:ref,:ref: -documenting/markup,630,:ref,:ref:`link text ` -documenting/markup,630,`,:ref:`link text ` -documenting/markup,651,.. note:,.. note:: -documenting/markup,678,.. versionadded:,.. versionadded:: 3.1 -documenting/markup,703,::,.. impl-detail:: -documenting/markup,703,::,.. impl-detail:: This shortly mentions an implementation detail. -documenting/markup,723,.. seealso:,.. seealso:: -documenting/markup,723,:mod,Module :mod:`zipfile` -documenting/markup,723,`,Module :mod:`zipfile` -documenting/markup,723,:mod,Documentation of the :mod:`zipfile` standard module. -documenting/markup,723,`,Documentation of the :mod:`zipfile` standard module. -documenting/markup,723,`,"`GNU tar manual, Basic Tar Format `_" -documenting/markup,737,.. centered:,.. centered:: -documenting/markup,782,.. toctree:,.. toctree:: -documenting/markup,782,:maxdepth,:maxdepth: 2 -documenting/markup,798,.. index:,.. index:: -documenting/markup,828,.. index:,".. index:: BNF, grammar, syntax, notation" -documenting/markup,859,`,"unaryneg ::= ""-"" `integer`" -documenting/markup,864,.. productionlist:,.. productionlist:: -documenting/markup,864,`,"try1_stmt: ""try"" "":"" `suite`" -documenting/markup,864,`,": (""except"" [`expression` ["","" `target`]] "":"" `suite`)+" -documenting/markup,864,`,": [""else"" "":"" `suite`]" -documenting/markup,864,`,": [""finally"" "":"" `suite`]" -documenting/markup,864,`,"try2_stmt: ""try"" "":"" `suite`" -documenting/markup,864,`,": ""finally"" "":"" `suite`" library/pprint,209,::,"'classifiers': ['Development Status :: 4 - Beta'," library/pprint,209,::,"'Intended Audience :: Developers'," library/pprint,209,::,"'License :: OSI Approved :: MIT License'," -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 20:28:55 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 20:28:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_don=27t_ready_in_case=5Fope?= =?utf8?q?ration=2C_since_most_callers_do_it_themselves?= Message-ID: http://hg.python.org/cpython/rev/c3972c4d7edb changeset: 74453:c3972c4d7edb user: Benjamin Peterson date: Mon Jan 16 14:28:50 2012 -0500 summary: don't ready in case_operation, since most callers do it themselves files: Objects/unicodeobject.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9644,8 +9644,7 @@ void *data, *outdata; Py_UCS4 maxchar = 0, *tmp, *tmpend; - if (PyUnicode_READY(self) == -1) - return NULL; + assert(PyUnicode_IS_READY(self)); kind = PyUnicode_KIND(self); data = PyUnicode_DATA(self); @@ -10512,6 +10511,8 @@ static PyObject* unicode_title(PyObject *self) { + if (PyUnicode_READY(self) == -1) + return NULL; return case_operation(self, do_title); } @@ -12657,6 +12658,8 @@ static PyObject* unicode_swapcase(PyObject *self) { + if (PyUnicode_READY(self) == -1) + return NULL; return case_operation(self, do_swapcase); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 21:36:51 2012 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jan 2012 21:36:51 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_=22documenting=22_la?= =?utf8?q?tex_document=2E?= Message-ID: http://hg.python.org/cpython/rev/a52476f21af6 changeset: 74454:a52476f21af6 user: Georg Brandl date: Mon Jan 16 21:39:56 2012 +0100 summary: Remove "documenting" latex document. files: Doc/conf.py | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -117,8 +117,6 @@ 'The Python/C API', _stdauthor, 'manual'), ('distutils/index', 'distutils.tex', 'Distributing Python Modules', _stdauthor, 'manual'), - ('documenting/index', 'documenting.tex', - 'Documenting Python', 'Georg Brandl', 'manual'), ('extending/index', 'extending.tex', 'Extending and Embedding Python', _stdauthor, 'manual'), ('install/index', 'install.tex', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 21:36:52 2012 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jan 2012 21:36:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Remove_=22docum?= =?utf8?q?enting=22_latex_document=2E?= Message-ID: http://hg.python.org/cpython/rev/769cfbbf13dd changeset: 74455:769cfbbf13dd branch: 3.2 parent: 74451:153e32333aaa user: Georg Brandl date: Mon Jan 16 21:40:12 2012 +0100 summary: Remove "documenting" latex document. files: Doc/conf.py | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -117,8 +117,6 @@ 'The Python/C API', _stdauthor, 'manual'), ('distutils/index', 'distutils.tex', 'Distributing Python Modules', _stdauthor, 'manual'), - ('documenting/index', 'documenting.tex', - 'Documenting Python', 'Georg Brandl', 'manual'), ('extending/index', 'extending.tex', 'Extending and Embedding Python', _stdauthor, 'manual'), ('install/index', 'install.tex', -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 21:36:55 2012 From: python-checkins at python.org (georg.brandl) Date: Mon, 16 Jan 2012 21:36:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Remove_=22documenting=22_latex_document=2E?= Message-ID: http://hg.python.org/cpython/rev/9f1cd58568ba changeset: 74456:9f1cd58568ba parent: 74454:a52476f21af6 parent: 74455:769cfbbf13dd user: Georg Brandl date: Mon Jan 16 21:40:20 2012 +0100 summary: Remove "documenting" latex document. files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 23:23:08 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 23:23:08 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_streamline_normalizer_ident?= =?utf8?q?ification_a_bit?= Message-ID: http://hg.python.org/cpython/rev/0677f05d6ece changeset: 74457:0677f05d6ece user: Benjamin Peterson date: Mon Jan 16 17:22:31 2012 -0500 summary: streamline normalizer identification a bit files: Python/ast.c | 80 +++++++++++++++++++++++++++------------ 1 files changed, 55 insertions(+), 25 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -500,6 +500,8 @@ char *c_encoding; /* source encoding */ PyArena *c_arena; /* arena for allocating memeory */ const char *c_filename; /* filename */ + PyObject *c_normalize; /* Normalization function from unicodedata. */ + PyObject *c_normalize_args; /* Normalization argument tuple. */ }; static asdl_seq *seq_for_testlist(struct compiling *, const node *); @@ -527,36 +529,54 @@ #define COMP_LISTCOMP 1 #define COMP_SETCOMP 2 +static int +init_normalization(struct compiling *c) +{ + PyObject *m = PyImport_ImportModuleNoBlock("unicodedata"); + if (!m) + return 0; + c->c_normalize = PyObject_GetAttrString(m, "normalize"); + Py_DECREF(m); + if (!c->c_normalize) + return 0; + c->c_normalize_args = Py_BuildValue("(sN)", "NFKC", Py_None); + PyTuple_SET_ITEM(c->c_normalize_args, 1, NULL); + if (!c->c_normalize_args) { + Py_CLEAR(c->c_normalize); + return 0; + } + return 1; +} + static identifier -new_identifier(const char* n, PyArena *arena) +new_identifier(const char* n, struct compiling *c) { - _Py_IDENTIFIER(normalize); PyObject* id = PyUnicode_DecodeUTF8(n, strlen(n), NULL); if (!id) return NULL; + /* PyUnicode_DecodeUTF8 should always return a ready string. */ assert(PyUnicode_IS_READY(id)); /* Check whether there are non-ASCII characters in the identifier; if so, normalize to NFKC. */ if (!PyUnicode_IS_ASCII(id)) { - PyObject *m = PyImport_ImportModuleNoBlock("unicodedata"); PyObject *id2; - if (!m) { + if (!c->c_normalize && !init_normalization(c)) { Py_DECREF(id); return NULL; } - id2 = _PyObject_CallMethodId(m, &PyId_normalize, "sO", "NFKC", id); - Py_DECREF(m); + PyTuple_SET_ITEM(c->c_normalize_args, 1, id); + id2 = PyObject_Call(c->c_normalize, c->c_normalize_args, NULL); Py_DECREF(id); if (!id2) return NULL; id = id2; } PyUnicode_InternInPlace(&id); - PyArena_AddPyObject(arena, id); + PyArena_AddPyObject(c->c_arena, id); return id; } -#define NEW_IDENTIFIER(n) new_identifier(STR(n), c->c_arena) +#define NEW_IDENTIFIER(n) new_identifier(STR(n), c) /* This routine provides an invalid object for the syntax error. The outermost routine must unpack this error and create the @@ -706,13 +726,14 @@ stmt_ty s; node *ch; struct compiling c; + mod_ty res = NULL; if (flags && flags->cf_flags & PyCF_SOURCE_IS_UTF8) { c.c_encoding = "utf-8"; if (TYPE(n) == encoding_decl) { #if 0 ast_error(n, "encoding declaration in Unicode string"); - goto error; + goto out; #endif n = CHILD(n, 0); } @@ -725,13 +746,14 @@ } c.c_arena = arena; c.c_filename = filename; + c.c_normalize = c.c_normalize_args = NULL; k = 0; switch (TYPE(n)) { case file_input: stmts = asdl_seq_new(num_stmts(n), arena); if (!stmts) - return NULL; + goto out; for (i = 0; i < NCH(n) - 1; i++) { ch = CHILD(n, i); if (TYPE(ch) == NEWLINE) @@ -741,7 +763,7 @@ if (num == 1) { s = ast_for_stmt(&c, ch); if (!s) - goto error; + goto out; asdl_seq_SET(stmts, k++, s); } else { @@ -750,42 +772,44 @@ for (j = 0; j < num; j++) { s = ast_for_stmt(&c, CHILD(ch, j * 2)); if (!s) - goto error; + goto out; asdl_seq_SET(stmts, k++, s); } } } - return Module(stmts, arena); + res = Module(stmts, arena); + break; case eval_input: { expr_ty testlist_ast; /* XXX Why not comp_for here? */ testlist_ast = ast_for_testlist(&c, CHILD(n, 0)); if (!testlist_ast) - goto error; - return Expression(testlist_ast, arena); + goto out; + res = Expression(testlist_ast, arena); + break; } case single_input: if (TYPE(CHILD(n, 0)) == NEWLINE) { stmts = asdl_seq_new(1, arena); if (!stmts) - goto error; + goto out; asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset, arena)); if (!asdl_seq_GET(stmts, 0)) - goto error; - return Interactive(stmts, arena); + goto out; + res = Interactive(stmts, arena); } else { n = CHILD(n, 0); num = num_stmts(n); stmts = asdl_seq_new(num, arena); if (!stmts) - goto error; + goto out; if (num == 1) { s = ast_for_stmt(&c, n); if (!s) - goto error; + goto out; asdl_seq_SET(stmts, 0, s); } else { @@ -796,21 +820,27 @@ break; s = ast_for_stmt(&c, CHILD(n, i)); if (!s) - goto error; + goto out; asdl_seq_SET(stmts, i / 2, s); } } - return Interactive(stmts, arena); + res = Interactive(stmts, arena); + break; } default: PyErr_Format(PyExc_SystemError, "invalid node %d for PyAST_FromNode", TYPE(n)); - goto error; + goto out; } - error: + out: + if (c.c_normalize) { + Py_DECREF(c.c_normalize); + PyTuple_SET_ITEM(c.c_normalize_args, 1, NULL); + Py_DECREF(c.c_normalize_args); + } ast_error_finish(filename); - return NULL; + return res; } /* Return the AST repr. of the operator represented as syntax (|, ^, etc.) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 23:31:48 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 23:31:48 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_move_LINENO_define_to_where?= =?utf8?q?_it_actually_belongs?= Message-ID: http://hg.python.org/cpython/rev/169fbbac2dec changeset: 74458:169fbbac2dec user: Benjamin Peterson date: Mon Jan 16 17:29:05 2012 -0500 summary: move LINENO define to where it actually belongs files: Include/node.h | 1 + Python/ast.c | 4 ---- 2 files changed, 1 insertions(+), 4 deletions(-) diff --git a/Include/node.h b/Include/node.h --- a/Include/node.h +++ b/Include/node.h @@ -28,6 +28,7 @@ #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) #define TYPE(n) ((n)->n_type) #define STR(n) ((n)->n_str) +#define LINENO(n) ((n)->n_lineno) /* Assert that the type of a node is what we expect */ #define REQ(n, type) assert(TYPE(n) == (type)) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -521,10 +521,6 @@ static PyObject *parsestrplus(struct compiling *, const node *n, int *bytesmode); -#ifndef LINENO -#define LINENO(n) ((n)->n_lineno) -#endif - #define COMP_GENEXP 0 #define COMP_LISTCOMP 1 #define COMP_SETCOMP 2 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 23:31:48 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 23:31:48 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_only_finish_error_if_one_oc?= =?utf8?q?curred?= Message-ID: http://hg.python.org/cpython/rev/8241fc821e2b changeset: 74459:8241fc821e2b user: Benjamin Peterson date: Mon Jan 16 17:31:43 2012 -0500 summary: only finish error if one occurred files: Python/ast.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -835,7 +835,8 @@ PyTuple_SET_ITEM(c.c_normalize_args, 1, NULL); Py_DECREF(c.c_normalize_args); } - ast_error_finish(filename); + if (!res) + ast_error_finish(filename); return res; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 23:44:17 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 16 Jan 2012 23:44:17 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_break_out_switch_at_correct?= =?utf8?q?_place?= Message-ID: http://hg.python.org/cpython/rev/953d6ee29464 changeset: 74460:953d6ee29464 user: Benjamin Peterson date: Mon Jan 16 17:44:12 2012 -0500 summary: break out switch at correct place files: Python/ast.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -822,8 +822,8 @@ } res = Interactive(stmts, arena); - break; } + break; default: PyErr_Format(PyExc_SystemError, "invalid node %d for PyAST_FromNode", TYPE(n)); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 16 23:58:07 2012 From: python-checkins at python.org (jesus.cea) Date: Mon, 16 Jan 2012 23:58:07 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Berkeley_DB=3A_?= =?utf8?q?Erratic_behaviour_of_=22DBEnv-=3Erep=5Felect=28=29=22_because_a_?= =?utf8?q?typo?= Message-ID: http://hg.python.org/cpython/rev/b103cc65e53d changeset: 74461:b103cc65e53d branch: 2.7 parent: 74450:7167c04780ed user: Jesus Cea date: Mon Jan 16 23:57:34 2012 +0100 summary: Berkeley DB: Erratic behaviour of "DBEnv->rep_elect()" because a typo files: Modules/_bsddb.c | 2 +- Modules/bsddb.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -7257,7 +7257,7 @@ } CHECK_ENV_NOT_CLOSED(self); MYDB_BEGIN_ALLOW_THREADS; - err = self->db_env->rep_elect(self->db_env, nvotes, nvotes, 0); + err = self->db_env->rep_elect(self->db_env, nsites, nvotes, 0); MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); RETURN_NONE(); diff --git a/Modules/bsddb.h b/Modules/bsddb.h --- a/Modules/bsddb.h +++ b/Modules/bsddb.h @@ -109,7 +109,7 @@ #error "eek! DBVER can't handle minor versions > 9" #endif -#define PY_BSDDB_VERSION "4.8.4.1" +#define PY_BSDDB_VERSION "4.8.4.2" /* Python object definitions */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 00:02:25 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 17 Jan 2012 00:02:25 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_fix_indentation?= Message-ID: http://hg.python.org/cpython/rev/ffb58df8f9ea changeset: 74462:ffb58df8f9ea parent: 74460:953d6ee29464 user: Benjamin Peterson date: Mon Jan 16 18:02:21 2012 -0500 summary: fix indentation files: Python/ast.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -2530,13 +2530,13 @@ * then is very confusing. */ if (e->kind == Lambda_kind) { - ast_error(CHILD(ch, 0), "lambda cannot contain assignment"); - return NULL; + ast_error(CHILD(ch, 0), "lambda cannot contain assignment"); + return NULL; } else if (e->kind != Name_kind) { - ast_error(CHILD(ch, 0), "keyword can't be an expression"); - return NULL; + ast_error(CHILD(ch, 0), "keyword can't be an expression"); + return NULL; } else if (forbidden_name(e->v.Name.id, ch, 1)) { - return NULL; + return NULL; } key = e->v.Name.id; for (k = 0; k < nkeywords; k++) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 00:17:20 2012 From: python-checkins at python.org (jesus.cea) Date: Tue, 17 Jan 2012 00:17:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Berkeley_DB=3A_?= =?utf8?q?Erratic_behaviour_of_=22DBEnv-=3Erep=5Felect=28=29=22_because_a_?= =?utf8?q?typo?= Message-ID: http://hg.python.org/cpython/rev/f2ef537aaf61 changeset: 74463:f2ef537aaf61 branch: 2.7 parent: 74461:b103cc65e53d user: Jesus Cea date: Tue Jan 17 00:17:10 2012 +0100 summary: Berkeley DB: Erratic behaviour of "DBEnv->rep_elect()" because a typo files: Misc/NEWS | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -374,6 +374,9 @@ Extension Modules ----------------- +- bsddb module: Erratic behaviour of "DBEnv->rep_elect()" because a typo. + Possible crash. + - Issue #13774: json: Fix a SystemError when a bogus encoding is passed to json.loads(). -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jan 17 05:33:01 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 17 Jan 2012 05:33:01 +0100 Subject: [Python-checkins] Daily reference leaks (ffb58df8f9ea): sum=0 Message-ID: results for ffb58df8f9ea on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog7VM3fy', '-x'] From python-checkins at python.org Tue Jan 17 07:53:27 2012 From: python-checkins at python.org (ezio.melotti) Date: Tue, 17 Jan 2012 07:53:27 +0100 (CET) Subject: [Python-checkins] r88930 - in tracker/instances: board/html/page.html jobs/html/page.html python-dev-spambayes-integration/html/page.html python-dev/html/page.html python-dev/rietveld/templates/base.html security/html/page.html Message-ID: <3TS2Fg0kmFzMw0@mail.python.org> Author: ezio.melotti Date: Tue Jan 17 07:53:26 2012 New Revision: 88930 Log: Update copyright year to 2012. Modified: tracker/instances/board/html/page.html tracker/instances/jobs/html/page.html tracker/instances/python-dev-spambayes-integration/html/page.html tracker/instances/python-dev/html/page.html tracker/instances/python-dev/rietveld/templates/base.html tracker/instances/security/html/page.html Modified: tracker/instances/board/html/page.html ============================================================================== --- tracker/instances/board/html/page.html (original) +++ tracker/instances/board/html/page.html Tue Jan 17 07:53:26 2012 @@ -231,7 +231,7 @@ hosting by Upfront Systems / powered by Roundup -Copyright © 1990-2011, Python Software Foundation
    +Copyright © 1990-2012, Python Software Foundation
    Legal Statements Modified: tracker/instances/jobs/html/page.html ============================================================================== --- tracker/instances/jobs/html/page.html (original) +++ tracker/instances/jobs/html/page.html Tue Jan 17 07:53:26 2012 @@ -220,7 +220,7 @@ hosting by Upfront Systems / powered by Roundup -Copyright © 1990-2011, Python Software Foundation
    +Copyright © 1990-2012, Python Software Foundation
    Legal Statements Modified: tracker/instances/python-dev-spambayes-integration/html/page.html ============================================================================== --- tracker/instances/python-dev-spambayes-integration/html/page.html (original) +++ tracker/instances/python-dev-spambayes-integration/html/page.html Tue Jan 17 07:53:26 2012 @@ -225,7 +225,7 @@ hosting by Upfront Systems / powered by Roundup -Copyright © 1990-2011, Python Software Foundation
    +Copyright © 1990-2012, Python Software Foundation
    Legal Statements Modified: tracker/instances/python-dev/html/page.html ============================================================================== --- tracker/instances/python-dev/html/page.html (original) +++ tracker/instances/python-dev/html/page.html Tue Jan 17 07:53:26 2012 @@ -280,7 +280,7 @@ hosting by Upfront Systems / powered by Roundup -Copyright © 1990-2011, Python Software Foundation
    +Copyright © 1990-2012, Python Software Foundation
    Legal Statements Modified: tracker/instances/python-dev/rietveld/templates/base.html ============================================================================== --- tracker/instances/python-dev/rietveld/templates/base.html (original) +++ tracker/instances/python-dev/rietveld/templates/base.html Tue Jan 17 07:53:26 2012 @@ -212,7 +212,7 @@ Website maintained by the Python community
    hosting by Upfront Systems
    -Copyright © 1990-2011, Python Software Foundation
    +Copyright © 1990-2012, Python Software Foundation
    Legal Statements Modified: tracker/instances/security/html/page.html ============================================================================== --- tracker/instances/security/html/page.html (original) +++ tracker/instances/security/html/page.html Tue Jan 17 07:53:26 2012 @@ -231,7 +231,7 @@ hosting by Upfront Systems / powered by Roundup -Copyright © 1990-2011, Python Software Foundation
    +Copyright © 1990-2012, Python Software Foundation
    Legal Statements From python-checkins at python.org Tue Jan 17 08:08:14 2012 From: python-checkins at python.org (ezio.melotti) Date: Tue, 17 Jan 2012 08:08:14 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_=2313794=3A_Update_copyrig?= =?utf8?q?ht_year_to_2012_in_the_devguide=2E?= Message-ID: http://hg.python.org/devguide/rev/8f3a3247972b changeset: 480:8f3a3247972b user: Ezio Melotti date: Tue Jan 17 09:08:05 2012 +0200 summary: #13794: Update copyright year to 2012 in the devguide. files: conf.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/conf.py b/conf.py --- a/conf.py +++ b/conf.py @@ -43,7 +43,7 @@ # General information about the project. project = u'Python Developer\'s Guide' -copyright = u'2011, Python Software Foundation' +copyright = u'2011-2012, Python Software Foundation' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 17 08:38:18 2012 From: python-checkins at python.org (ezio.melotti) Date: Tue, 17 Jan 2012 08:38:18 +0100 (CET) Subject: [Python-checkins] r88931 - tracker/instances/python-dev/html/page.html Message-ID: <3TS3FQ3vqbzMv2@mail.python.org> Author: ezio.melotti Date: Tue Jan 17 08:38:18 2012 New Revision: 88931 Log: Remove obsolete stylesheets. Modified: tracker/instances/python-dev/html/page.html Modified: tracker/instances/python-dev/html/page.html ============================================================================== --- tracker/instances/python-dev/html/page.html (original) +++ tracker/instances/python-dev/html/page.html Tue Jan 17 08:38:18 2012 @@ -5,10 +5,7 @@ title goes here - - - Author: ezio.melotti Date: Tue Jan 17 09:15:49 2012 New Revision: 88932 Log: Improve the print css and merge it with the default one. Modified: tracker/instances/python-dev/html/page.html tracker/instances/python-dev/html/style.css Modified: tracker/instances/python-dev/html/page.html ============================================================================== --- tracker/instances/python-dev/html/page.html (original) +++ tracker/instances/python-dev/html/page.html Tue Jan 17 09:15:49 2012 @@ -5,7 +5,6 @@ title goes here - http://hg.python.org/devguide/rev/2e05050e6879 changeset: 481:2e05050e6879 user: Ezio Melotti date: Tue Jan 17 11:45:37 2012 +0200 summary: Replace some nbsp with normal spaces and an en dash with a normal dash. files: setup.rst | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -198,46 +198,46 @@ every rule. ``Doc`` - ??? The official documentation. This is what http://docs.python.org/ uses. + The official documentation. This is what http://docs.python.org/ uses. To build the docs, see ``Doc/README.txt``. ``Grammar`` - ??? Contains the :abbr:`EBNF (Extended Backus?Naur Form)` grammar file for + Contains the :abbr:`EBNF (Extended Backus-Naur Form)` grammar file for Python. ``Include`` - ??? Contains all interpreter-wide header files. + Contains all interpreter-wide header files. ``Lib`` - ??? The part of the standard library implemented in pure Python. + The part of the standard library implemented in pure Python. ``Mac`` - ??? Mac-specific code (e.g., using IDLE as an OS X application). + Mac-specific code (e.g., using IDLE as an OS X application). ``Misc`` - ??? Things that do not belong elsewhere. Typically this is varying kinds of + Things that do not belong elsewhere. Typically this is varying kinds of developer-specific documentation. ``Modules`` - ??? The part of the standard library (plus some other code) that is implemented + The part of the standard library (plus some other code) that is implemented in C. ``Objects`` - ??? Code for all built-in types. + Code for all built-in types. ``PC`` - ??? Windows-specific code along with build files for VC 6, 7, & 8 along with + Windows-specific code along with build files for VC 6, 7, & 8 along with OS/2. ``PCbuild`` - ??? Build files for VC 9 and newer. + Build files for VC 9 and newer. ``Parser`` - ??? Code related to the parser. The definition of the AST nodes is also kept + Code related to the parser. The definition of the AST nodes is also kept here. ``Python`` - ??? The code that makes up the CPython interpreter. This includes the compiler, + The code that makes up the CPython interpreter. This includes the compiler, eval loop and various built-in modules. ``Tools`` -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 17 16:53:34 2012 From: python-checkins at python.org (ronald.oussoren) Date: Tue, 17 Jan 2012 16:53:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_missing_sentinel_to_PyC?= =?utf8?q?ursesWindow=5Fgetsets?= Message-ID: http://hg.python.org/cpython/rev/61211368292d changeset: 74464:61211368292d parent: 74462:ffb58df8f9ea user: Ronald Oussoren date: Tue Jan 17 16:53:20 2012 +0100 summary: Add missing sentinel to PyCursesWindow_getsets The PyCursesWindow_getsets array was introduced without sentinel in c3581ca21a57. files: Modules/_cursesmodule.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -2056,7 +2056,8 @@ {"encoding", (getter)PyCursesWindow_get_encoding, (setter)PyCursesWindow_set_encoding, - "the typecode character used to create the array"} + "the typecode character used to create the array"}, + {NULL, NULL, NULL, NULL } /* sentinel */ }; /* -------------------------------------------------------*/ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 17:19:34 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 17 Jan 2012 17:19:34 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNTg5?= =?utf8?q?=3A_Fix_some_serialization_primitives_in_the_aifc_module=2E?= Message-ID: http://hg.python.org/cpython/rev/f715c4a5a107 changeset: 74465:f715c4a5a107 branch: 3.2 parent: 74455:769cfbbf13dd user: Antoine Pitrou date: Tue Jan 17 17:13:04 2012 +0100 summary: Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. files: Lib/aifc.py | 48 +++++++++++++++++++----------- Lib/test/test_aifc.py | 37 +++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -162,6 +162,12 @@ except struct.error: raise EOFError +def _read_ushort(file): + try: + return struct.unpack('>H', file.read(2))[0] + except struct.error: + raise EOFError + def _read_string(file): length = ord(file.read(1)) if length == 0: @@ -194,13 +200,19 @@ def _write_short(f, x): f.write(struct.pack('>h', x)) +def _write_ushort(f, x): + f.write(struct.pack('>H', x)) + def _write_long(f, x): + f.write(struct.pack('>l', x)) + +def _write_ulong(f, x): f.write(struct.pack('>L', x)) def _write_string(f, s): if len(s) > 255: raise ValueError("string exceeds maximum pstring length") - f.write(struct.pack('b', len(s))) + f.write(struct.pack('B', len(s))) f.write(s) if len(s) & 1 == 0: f.write(b'\x00') @@ -218,7 +230,7 @@ lomant = 0 else: fmant, expon = math.frexp(x) - if expon > 16384 or fmant >= 1: # Infinity or NaN + if expon > 16384 or fmant >= 1 or fmant != fmant: # Infinity or NaN expon = sign|0x7FFF himant = 0 lomant = 0 @@ -234,9 +246,9 @@ fmant = math.ldexp(fmant - fsmant, 32) fsmant = math.floor(fmant) lomant = int(fsmant) - _write_short(f, expon) - _write_long(f, himant) - _write_long(f, lomant) + _write_ushort(f, expon) + _write_ulong(f, himant) + _write_ulong(f, lomant) from chunk import Chunk @@ -762,15 +774,15 @@ if self._aifc: self._file.write(b'AIFC') self._file.write(b'FVER') - _write_long(self._file, 4) - _write_long(self._file, self._version) + _write_ulong(self._file, 4) + _write_ulong(self._file, self._version) else: self._file.write(b'AIFF') self._file.write(b'COMM') - _write_long(self._file, commlength) + _write_ulong(self._file, commlength) _write_short(self._file, self._nchannels) self._nframes_pos = self._file.tell() - _write_long(self._file, self._nframes) + _write_ulong(self._file, self._nframes) _write_short(self._file, self._sampwidth * 8) _write_float(self._file, self._framerate) if self._aifc: @@ -778,9 +790,9 @@ _write_string(self._file, self._compname) self._file.write(b'SSND') self._ssnd_length_pos = self._file.tell() - _write_long(self._file, self._datalength + 8) - _write_long(self._file, 0) - _write_long(self._file, 0) + _write_ulong(self._file, self._datalength + 8) + _write_ulong(self._file, 0) + _write_ulong(self._file, 0) def _write_form_length(self, datalength): if self._aifc: @@ -791,8 +803,8 @@ else: commlength = 18 verslength = 0 - _write_long(self._file, 4 + verslength + self._marklength + \ - 8 + commlength + 16 + datalength) + _write_ulong(self._file, 4 + verslength + self._marklength + \ + 8 + commlength + 16 + datalength) return commlength def _patchheader(self): @@ -810,9 +822,9 @@ self._file.seek(self._form_length_pos, 0) dummy = self._write_form_length(datalength) self._file.seek(self._nframes_pos, 0) - _write_long(self._file, self._nframeswritten) + _write_ulong(self._file, self._nframeswritten) self._file.seek(self._ssnd_length_pos, 0) - _write_long(self._file, datalength + 8) + _write_ulong(self._file, datalength + 8) self._file.seek(curpos, 0) self._nframes = self._nframeswritten self._datalength = datalength @@ -827,13 +839,13 @@ length = length + len(name) + 1 + 6 if len(name) & 1 == 0: length = length + 1 - _write_long(self._file, length) + _write_ulong(self._file, length) self._marklength = length + 8 _write_short(self._file, len(self._markers)) for marker in self._markers: id, pos, name = marker _write_short(self._file, id) - _write_long(self._file, pos) + _write_ulong(self._file, pos) _write_string(self._file, name) def open(f, mode=None): diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -144,8 +144,45 @@ self.assertRaises(aifc.Error, f.getmark, 3) +class AIFCLowLevelTest(unittest.TestCase): + + def test_read_written(self): + def read_written(self, what): + f = io.BytesIO() + getattr(aifc, '_write_' + what)(f, x) + f.seek(0) + return getattr(aifc, '_read_' + what)(f) + for x in (-1, 0, 0.1, 1): + self.assertEqual(read_written(x, 'float'), x) + for x in (float('NaN'), float('Inf')): + self.assertEqual(read_written(x, 'float'), aifc._HUGE_VAL) + for x in (b'', b'foo', b'a' * 255): + self.assertEqual(read_written(x, 'string'), x) + for x in (-0x7FFFFFFF, -1, 0, 1, 0x7FFFFFFF): + self.assertEqual(read_written(x, 'long'), x) + for x in (0, 1, 0xFFFFFFFF): + self.assertEqual(read_written(x, 'ulong'), x) + for x in (-0x7FFF, -1, 0, 1, 0x7FFF): + self.assertEqual(read_written(x, 'short'), x) + for x in (0, 1, 0xFFFF): + self.assertEqual(read_written(x, 'ushort'), x) + + def test_read_raises(self): + f = io.BytesIO(b'\x00') + self.assertRaises(EOFError, aifc._read_ulong, f) + self.assertRaises(EOFError, aifc._read_long, f) + self.assertRaises(EOFError, aifc._read_ushort, f) + self.assertRaises(EOFError, aifc._read_short, f) + + def test_write_long_string_raises(self): + f = io.BytesIO() + with self.assertRaises(ValueError): + aifc._write_string(f, b'too long' * 255) + + def test_main(): run_unittest(AIFCTest) + run_unittest(AIFCLowLevelTest) if __name__ == "__main__": diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -719,6 +719,7 @@ Michael Piotrowski Antoine Pitrou Jean-Fran?ois Pi?ronne +Oleg Plakhotnyuk Guilherme Polo Michael Pomraning Iustin Pop diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -100,6 +100,9 @@ Library ------- +- Issue #13589: Fix some serialization primitives in the aifc module. + Patch by Oleg Plakhotnyuk. + - Issue #13642: Unquote before b64encoding user:password during Basic Authentication. Patch contributed by Joonas Kuorilehto. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 17:19:35 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 17 Jan 2012 17:19:35 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313589=3A_Fix_some_serialization_primitives_in_the_a?= =?utf8?q?ifc_module=2E?= Message-ID: http://hg.python.org/cpython/rev/b039965b0066 changeset: 74466:b039965b0066 parent: 74464:61211368292d parent: 74465:f715c4a5a107 user: Antoine Pitrou date: Tue Jan 17 17:14:30 2012 +0100 summary: Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. files: Lib/aifc.py | 48 +++++++++++++++++++----------- Lib/test/test_aifc.py | 37 +++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + 4 files changed, 71 insertions(+), 18 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -162,6 +162,12 @@ except struct.error: raise EOFError +def _read_ushort(file): + try: + return struct.unpack('>H', file.read(2))[0] + except struct.error: + raise EOFError + def _read_string(file): length = ord(file.read(1)) if length == 0: @@ -194,13 +200,19 @@ def _write_short(f, x): f.write(struct.pack('>h', x)) +def _write_ushort(f, x): + f.write(struct.pack('>H', x)) + def _write_long(f, x): + f.write(struct.pack('>l', x)) + +def _write_ulong(f, x): f.write(struct.pack('>L', x)) def _write_string(f, s): if len(s) > 255: raise ValueError("string exceeds maximum pstring length") - f.write(struct.pack('b', len(s))) + f.write(struct.pack('B', len(s))) f.write(s) if len(s) & 1 == 0: f.write(b'\x00') @@ -218,7 +230,7 @@ lomant = 0 else: fmant, expon = math.frexp(x) - if expon > 16384 or fmant >= 1: # Infinity or NaN + if expon > 16384 or fmant >= 1 or fmant != fmant: # Infinity or NaN expon = sign|0x7FFF himant = 0 lomant = 0 @@ -234,9 +246,9 @@ fmant = math.ldexp(fmant - fsmant, 32) fsmant = math.floor(fmant) lomant = int(fsmant) - _write_short(f, expon) - _write_long(f, himant) - _write_long(f, lomant) + _write_ushort(f, expon) + _write_ulong(f, himant) + _write_ulong(f, lomant) from chunk import Chunk @@ -762,15 +774,15 @@ if self._aifc: self._file.write(b'AIFC') self._file.write(b'FVER') - _write_long(self._file, 4) - _write_long(self._file, self._version) + _write_ulong(self._file, 4) + _write_ulong(self._file, self._version) else: self._file.write(b'AIFF') self._file.write(b'COMM') - _write_long(self._file, commlength) + _write_ulong(self._file, commlength) _write_short(self._file, self._nchannels) self._nframes_pos = self._file.tell() - _write_long(self._file, self._nframes) + _write_ulong(self._file, self._nframes) _write_short(self._file, self._sampwidth * 8) _write_float(self._file, self._framerate) if self._aifc: @@ -778,9 +790,9 @@ _write_string(self._file, self._compname) self._file.write(b'SSND') self._ssnd_length_pos = self._file.tell() - _write_long(self._file, self._datalength + 8) - _write_long(self._file, 0) - _write_long(self._file, 0) + _write_ulong(self._file, self._datalength + 8) + _write_ulong(self._file, 0) + _write_ulong(self._file, 0) def _write_form_length(self, datalength): if self._aifc: @@ -791,8 +803,8 @@ else: commlength = 18 verslength = 0 - _write_long(self._file, 4 + verslength + self._marklength + \ - 8 + commlength + 16 + datalength) + _write_ulong(self._file, 4 + verslength + self._marklength + \ + 8 + commlength + 16 + datalength) return commlength def _patchheader(self): @@ -810,9 +822,9 @@ self._file.seek(self._form_length_pos, 0) dummy = self._write_form_length(datalength) self._file.seek(self._nframes_pos, 0) - _write_long(self._file, self._nframeswritten) + _write_ulong(self._file, self._nframeswritten) self._file.seek(self._ssnd_length_pos, 0) - _write_long(self._file, datalength + 8) + _write_ulong(self._file, datalength + 8) self._file.seek(curpos, 0) self._nframes = self._nframeswritten self._datalength = datalength @@ -827,13 +839,13 @@ length = length + len(name) + 1 + 6 if len(name) & 1 == 0: length = length + 1 - _write_long(self._file, length) + _write_ulong(self._file, length) self._marklength = length + 8 _write_short(self._file, len(self._markers)) for marker in self._markers: id, pos, name = marker _write_short(self._file, id) - _write_long(self._file, pos) + _write_ulong(self._file, pos) _write_string(self._file, name) def open(f, mode=None): diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -144,8 +144,45 @@ self.assertRaises(aifc.Error, f.getmark, 3) +class AIFCLowLevelTest(unittest.TestCase): + + def test_read_written(self): + def read_written(self, what): + f = io.BytesIO() + getattr(aifc, '_write_' + what)(f, x) + f.seek(0) + return getattr(aifc, '_read_' + what)(f) + for x in (-1, 0, 0.1, 1): + self.assertEqual(read_written(x, 'float'), x) + for x in (float('NaN'), float('Inf')): + self.assertEqual(read_written(x, 'float'), aifc._HUGE_VAL) + for x in (b'', b'foo', b'a' * 255): + self.assertEqual(read_written(x, 'string'), x) + for x in (-0x7FFFFFFF, -1, 0, 1, 0x7FFFFFFF): + self.assertEqual(read_written(x, 'long'), x) + for x in (0, 1, 0xFFFFFFFF): + self.assertEqual(read_written(x, 'ulong'), x) + for x in (-0x7FFF, -1, 0, 1, 0x7FFF): + self.assertEqual(read_written(x, 'short'), x) + for x in (0, 1, 0xFFFF): + self.assertEqual(read_written(x, 'ushort'), x) + + def test_read_raises(self): + f = io.BytesIO(b'\x00') + self.assertRaises(EOFError, aifc._read_ulong, f) + self.assertRaises(EOFError, aifc._read_long, f) + self.assertRaises(EOFError, aifc._read_ushort, f) + self.assertRaises(EOFError, aifc._read_short, f) + + def test_write_long_string_raises(self): + f = io.BytesIO() + with self.assertRaises(ValueError): + aifc._write_string(f, b'too long' * 255) + + def test_main(): run_unittest(AIFCTest) + run_unittest(AIFCLowLevelTest) if __name__ == "__main__": diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -782,6 +782,7 @@ Michael Piotrowski Antoine Pitrou Jean-Fran?ois Pi?ronne +Oleg Plakhotnyuk Remi Pointel Guilherme Polo Michael Pomraning diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -447,6 +447,9 @@ Library ------- +- Issue #13589: Fix some serialization primitives in the aifc module. + Patch by Oleg Plakhotnyuk. + - Issue #13642: Unquote before b64encoding user:password during Basic Authentication. Patch contributed by Joonas Kuorilehto. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 17:19:36 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 17 Jan 2012 17:19:36 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNTg5?= =?utf8?q?=3A_Fix_some_serialization_primitives_in_the_aifc_module=2E?= Message-ID: http://hg.python.org/cpython/rev/8fac90d0f4cd changeset: 74467:8fac90d0f4cd branch: 2.7 parent: 74463:f2ef537aaf61 user: Antoine Pitrou date: Tue Jan 17 17:13:04 2012 +0100 summary: Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. files: Lib/aifc.py | 48 +++++++++++++++++++----------- Lib/test/test_aifc.py | 38 ++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + 4 files changed, 72 insertions(+), 18 deletions(-) diff --git a/Lib/aifc.py b/Lib/aifc.py --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -162,6 +162,12 @@ except struct.error: raise EOFError +def _read_ushort(file): + try: + return struct.unpack('>H', file.read(2))[0] + except struct.error: + raise EOFError + def _read_string(file): length = ord(file.read(1)) if length == 0: @@ -194,13 +200,19 @@ def _write_short(f, x): f.write(struct.pack('>h', x)) +def _write_ushort(f, x): + f.write(struct.pack('>H', x)) + def _write_long(f, x): + f.write(struct.pack('>l', x)) + +def _write_ulong(f, x): f.write(struct.pack('>L', x)) def _write_string(f, s): if len(s) > 255: raise ValueError("string exceeds maximum pstring length") - f.write(chr(len(s))) + f.write(struct.pack('B', len(s))) f.write(s) if len(s) & 1 == 0: f.write(chr(0)) @@ -218,7 +230,7 @@ lomant = 0 else: fmant, expon = math.frexp(x) - if expon > 16384 or fmant >= 1: # Infinity or NaN + if expon > 16384 or fmant >= 1 or fmant != fmant: # Infinity or NaN expon = sign|0x7FFF himant = 0 lomant = 0 @@ -234,9 +246,9 @@ fmant = math.ldexp(fmant - fsmant, 32) fsmant = math.floor(fmant) lomant = long(fsmant) - _write_short(f, expon) - _write_long(f, himant) - _write_long(f, lomant) + _write_ushort(f, expon) + _write_ulong(f, himant) + _write_ulong(f, lomant) from chunk import Chunk @@ -840,15 +852,15 @@ if self._aifc: self._file.write('AIFC') self._file.write('FVER') - _write_long(self._file, 4) - _write_long(self._file, self._version) + _write_ulong(self._file, 4) + _write_ulong(self._file, self._version) else: self._file.write('AIFF') self._file.write('COMM') - _write_long(self._file, commlength) + _write_ulong(self._file, commlength) _write_short(self._file, self._nchannels) self._nframes_pos = self._file.tell() - _write_long(self._file, self._nframes) + _write_ulong(self._file, self._nframes) _write_short(self._file, self._sampwidth * 8) _write_float(self._file, self._framerate) if self._aifc: @@ -856,9 +868,9 @@ _write_string(self._file, self._compname) self._file.write('SSND') self._ssnd_length_pos = self._file.tell() - _write_long(self._file, self._datalength + 8) - _write_long(self._file, 0) - _write_long(self._file, 0) + _write_ulong(self._file, self._datalength + 8) + _write_ulong(self._file, 0) + _write_ulong(self._file, 0) def _write_form_length(self, datalength): if self._aifc: @@ -869,8 +881,8 @@ else: commlength = 18 verslength = 0 - _write_long(self._file, 4 + verslength + self._marklength + \ - 8 + commlength + 16 + datalength) + _write_ulong(self._file, 4 + verslength + self._marklength + \ + 8 + commlength + 16 + datalength) return commlength def _patchheader(self): @@ -888,9 +900,9 @@ self._file.seek(self._form_length_pos, 0) dummy = self._write_form_length(datalength) self._file.seek(self._nframes_pos, 0) - _write_long(self._file, self._nframeswritten) + _write_ulong(self._file, self._nframeswritten) self._file.seek(self._ssnd_length_pos, 0) - _write_long(self._file, datalength + 8) + _write_ulong(self._file, datalength + 8) self._file.seek(curpos, 0) self._nframes = self._nframeswritten self._datalength = datalength @@ -905,13 +917,13 @@ length = length + len(name) + 1 + 6 if len(name) & 1 == 0: length = length + 1 - _write_long(self._file, length) + _write_ulong(self._file, length) self._marklength = length + 8 _write_short(self._file, len(self._markers)) for marker in self._markers: id, pos, name = marker _write_short(self._file, id) - _write_long(self._file, pos) + _write_ulong(self._file, pos) _write_string(self._file, name) def open(f, mode=None): diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py --- a/Lib/test/test_aifc.py +++ b/Lib/test/test_aifc.py @@ -1,6 +1,7 @@ from test.test_support import findfile, run_unittest, TESTFN import unittest import os +import io import aifc @@ -107,8 +108,45 @@ self.assertEqual(testfile.closed, True) +class AIFCLowLevelTest(unittest.TestCase): + + def test_read_written(self): + def read_written(self, what): + f = io.BytesIO() + getattr(aifc, '_write_' + what)(f, x) + f.seek(0) + return getattr(aifc, '_read_' + what)(f) + for x in (-1, 0, 0.1, 1): + self.assertEqual(read_written(x, 'float'), x) + for x in (float('NaN'), float('Inf')): + self.assertEqual(read_written(x, 'float'), aifc._HUGE_VAL) + for x in (b'', b'foo', b'a' * 255): + self.assertEqual(read_written(x, 'string'), x) + for x in (-0x7FFFFFFF, -1, 0, 1, 0x7FFFFFFF): + self.assertEqual(read_written(x, 'long'), x) + for x in (0, 1, 0xFFFFFFFF): + self.assertEqual(read_written(x, 'ulong'), x) + for x in (-0x7FFF, -1, 0, 1, 0x7FFF): + self.assertEqual(read_written(x, 'short'), x) + for x in (0, 1, 0xFFFF): + self.assertEqual(read_written(x, 'ushort'), x) + + def test_read_raises(self): + f = io.BytesIO(b'\x00') + self.assertRaises(EOFError, aifc._read_ulong, f) + self.assertRaises(EOFError, aifc._read_long, f) + self.assertRaises(EOFError, aifc._read_ushort, f) + self.assertRaises(EOFError, aifc._read_short, f) + + def test_write_long_string_raises(self): + f = io.BytesIO() + with self.assertRaises(ValueError): + aifc._write_string(f, b'too long' * 255) + + def test_main(): run_unittest(AIFCTest) + run_unittest(AIFCLowLevelTest) if __name__ == "__main__": diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -662,6 +662,7 @@ Michael Piotrowski Antoine Pitrou Jean-Fran?ois Pi?ronne +Oleg Plakhotnyuk Guilherme Polo Michael Pomraning Iustin Pop diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -89,6 +89,9 @@ Library ------- +- Issue #13589: Fix some serialization primitives in the aifc module. + Patch by Oleg Plakhotnyuk. + - Issue #13642: Unquote before b64encoding user:password during Basic Authentication. Patch contributed by Joonas Kuorilehto and Michele Orr?. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 18:36:09 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 17 Jan 2012 18:36:09 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_revert_part_of_?= =?utf8?q?cefe4f38fa0e=2C_as_agreed_with_=C3=89ric?= Message-ID: http://hg.python.org/cpython/rev/ef1612a6a4f7 changeset: 74468:ef1612a6a4f7 branch: 2.7 user: Sandro Tosi date: Tue Jan 17 18:32:02 2012 +0100 summary: revert part of cefe4f38fa0e, as agreed with ?ric files: Doc/glossary.rst | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -519,11 +519,10 @@ nested scope The ability to refer to a variable in an enclosing definition. For instance, a function defined inside another function can refer to - variables in the outer function. Note that nested scopes by default work - only for reference and not for assignment. Local variables both read and - write in the innermost scope. Likewise, global variables read and write - to the global namespace. The :keyword:`nonlocal` allows writing to outer - scopes. + variables in the outer function. Note that nested scopes work only for + reference and not for assignment which will always write to the innermost + scope. In contrast, local variables both read and write in the innermost + scope. Likewise, global variables read and write to the global namespace. new-style class Any class which inherits from :class:`object`. This includes all built-in -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 19:00:27 2012 From: python-checkins at python.org (sandro.tosi) Date: Tue, 17 Jan 2012 19:00:27 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogZmlsZS5uZXh0KCkg?= =?utf8?q?doc_refers_to_itself?= Message-ID: http://hg.python.org/cpython/rev/51e11b4937b7 changeset: 74469:51e11b4937b7 branch: 2.7 user: Sandro Tosi date: Tue Jan 17 18:57:30 2012 +0100 summary: file.next() doc refers to itself files: Doc/library/stdtypes.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2372,12 +2372,12 @@ A file object is its own iterator, for example ``iter(f)`` returns *f* (unless *f* is closed). When a file is used as an iterator, typically in a :keyword:`for` loop (for example, ``for line in f: print line``), the - :meth:`next` method is called repeatedly. This method returns the next input + :meth:`~file.next` method is called repeatedly. This method returns the next input line, or raises :exc:`StopIteration` when EOF is hit when the file is open for reading (behavior is undefined when the file is open for writing). In order to make a :keyword:`for` loop the most efficient way of looping over the lines of a - file (a very common operation), the :meth:`next` method uses a hidden read-ahead - buffer. As a consequence of using a read-ahead buffer, combining :meth:`next` + file (a very common operation), the :meth:`~file.next` method uses a hidden read-ahead + buffer. As a consequence of using a read-ahead buffer, combining :meth:`~file.next` with other file methods (like :meth:`readline`) does not work right. However, using :meth:`seek` to reposition the file to an absolute position will flush the read-ahead buffer. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 21:31:59 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 17 Jan 2012 21:31:59 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Draft_for_PEP_407=3A_New_relea?= =?utf8?q?se_cycle_and_introducing_long-term_support_versions?= Message-ID: http://hg.python.org/peps/rev/b1706ab0f0c2 changeset: 4014:b1706ab0f0c2 user: Antoine Pitrou date: Tue Jan 17 21:29:56 2012 +0100 summary: Draft for PEP 407: New release cycle and introducing long-term support versions files: pep-0407.txt | 173 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 173 insertions(+), 0 deletions(-) diff --git a/pep-0407.txt b/pep-0407.txt new file mode 100644 --- /dev/null +++ b/pep-0407.txt @@ -0,0 +1,173 @@ +PEP: 407 +Title: New release cycle and introducing long-term support versions +Version: $Revision$ +Last-Modified: $Date$ +Author: Antoine Pitrou , + Georg Brandl , + Barry Warsaw +Status: Draft +Type: Process +Content-Type: text/x-rst +Created: 2012-01-12 +Post-History: +Resolution: TBD + + +Abstract +======== + +Finding a release cycle for an open-source project is a delicate +exercise in managing mutually contradicting constraints: developer +manpower, availability of release management volunteers, ease of +maintenance for users and third-party packagers, quick availability of +new features (and behavioural changes), availability of bug fixes +without pulling in new features or behavioural changes. + +The current release cycle errs on the conservative side. It is +adequate for people who value stability over reactivity. This PEP is +an attempt to keep the stability that has become a Python trademark, +while offering a more fluid release of features, by introducing the +notion of long-term support versions. + + +Scope +===== + +This PEP doesn't try to change the maintenance period or release +scheme for the 2.7 branch. Only 3.x versions are considered. + + +Proposal +======== + +Under the proposed scheme, there would be two kinds of feature +versions (sometimes dubbed "minor versions", for example 3.2 or 3.3): +normal feature versions and long-term support (LTS) versions. + +Normal feature versions would get either zero or at most one bugfix +release; the latter only if needed to fix critical issues. Security +fix handling for these branches needs to be decided. + +LTS versions would get regular bugfix releases until the next LTS +version is out. They then would go into security fixes mode, up to a +termination date at the release manager's discretion. + +Periodicity +----------- + +A new feature version would be released every X months. We +tentatively propose X = 6 months. + +LTS versions would be one out of N feature versions. We tentatively +propose N = 4. + +With these figures, a new LTS version would be out every 24 months, +and remain supported until the next LTS version 24 months later. This +is mildly similar to today's 18 months bugfix cycle for every feature +version. + +Pre-release versions +-------------------- + +More frequent feature releases imply a smaller number of disruptive +changes per release. Therefore, the number of pre-release builds +(alphas and betas) can be brought down considerably. Two alpha builds +and a single beta build would probably be enough in the regular case. +The number of release candidates depends, as usual, on the number of +last-minute fixes before final release. + + +Effects +======= + +Effect on development cycle +--------------------------- + +More feature releases might mean more stress on the development and +release management teams. This is quantitatively alleviated by the +smaller number of pre-release versions; and qualitatively by the +lesser amount of disruptive changes (meaning less potential for +breakage). The shorter feature freeze period (after the first beta +build until the final release) is easier to accept. The rush for +adding features just before feature freeze should also be much +smaller. + +Effect on bugfix cycle +---------------------- + +The effect on fixing bugs should be minimal with the proposed figures. +The same number of branches would be simultaneously open for regular +maintenance (two until 2.x is terminated, then one). + +Effect on workflow +------------------ + +The workflow for new features would be the same: developers would only +commit them on the ``default`` branch. + +The workflow for bug fixes would be slightly updated: developers would +commit bug fixes to the current LTS branch (for example ``3.3``) and +then merge them into ``default``. + +If some critical fixes are needed to a non-LTS version, they can be +grafted from the current LTS branch to the non-LTS branch, just like +fixes are ported from 3.x to 2.7 today. + +Effect on the community +----------------------- + +People who value stability can just synchronize on the LTS releases +which, with the proposed figures, would give a similar support cycle +(both in duration and in stability). + +People who value reactivity and access to new features (without taking +the risk to install alpha versions or Mercurial snapshots) would get +much more value from the new release cycle than currently. + +People who want to contribute new features or improvements would be +more motivated to do so, knowing that their contributions will be more +quickly available to normal users. Also, a smaller feature freeze +period makes it less cumbersome to interact with contributors of +features. + + +Discussion +========== + +These are open issues that should be worked out during discussion: + +* Decide on X (months between feature releases) and N (feature releases + per LTS release) as defined above. + +* For given values of X and N, is the no-bugfix-releases policy for + non-LTS versions feasible? + +* Restrict new syntax and similar changes (i.e. everything that was + prohibited by PEP 3003) to LTS versions? + +* What is the effect on packagers such as Linux distributions? + +* How will release version numbers or other identifying and marketing + material make it clear to users which versions are normal feature + releases and which are LTS releases? How do we manage user + expectations? + +A community poll or survey to collect opinions from the greater Python +community would be valuable before making a final decision. + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Tue Jan 17 21:39:43 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 17 Jan 2012 21:39:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313727=3A_Add_3_mac?= =?utf8?q?ros_to_access_PyDateTime=5FDelta_members=3A?= Message-ID: http://hg.python.org/cpython/rev/463acb73fd79 changeset: 74470:463acb73fd79 parent: 74466:b039965b0066 user: Amaury Forgeot d'Arc date: Tue Jan 17 21:31:50 2012 +0100 summary: Issue #13727: Add 3 macros to access PyDateTime_Delta members: PyDateTime_DELTA_GET_DAYS, PyDateTime_DELTA_GET_SECONDS, PyDateTime_DELTA_GET_MICROSECONDS. Please use them instead of directly accessing PyDateTime_Delta struct members. files: Doc/c-api/datetime.rst | 25 +++++++++++++++++++++++++ Include/datetime.h | 6 ++++++ Misc/NEWS | 4 ++++ 3 files changed, 35 insertions(+), 0 deletions(-) diff --git a/Doc/c-api/datetime.rst b/Doc/c-api/datetime.rst --- a/Doc/c-api/datetime.rst +++ b/Doc/c-api/datetime.rst @@ -170,6 +170,31 @@ Return the microsecond, as an int from 0 through 999999. +Macros to extract fields from time delta objects. The argument must be an +instance of :c:data:`PyDateTime_Delta`, including subclasses. The argument must +not be *NULL*, and the type is not checked: + +.. c:function:: int PyDateTime_DELTA_GET_DAYS(PyDateTime_Delta *o) + + Return the number of days, as an int from -999999999 to 999999999. + + .. versionadded:: 3.3 + + +.. c:function:: int PyDateTime_DELTA_GET_SECONDS(PyDateTime_Delta *o) + + Return the number of seconds, as an int from 0 through 86399. + + .. versionadded:: 3.3 + + +.. c:function:: int PyDateTime_DELTA_GET_MICROSECOND(PyDateTime_Delta *o) + + Return the number of microseconds, as an int from 0 through 999999. + + .. versionadded:: 3.3 + + Macros for the convenience of modules implementing the DB API: .. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args) diff --git a/Include/datetime.h b/Include/datetime.h --- a/Include/datetime.h +++ b/Include/datetime.h @@ -135,6 +135,12 @@ (((PyDateTime_Time*)o)->data[4] << 8) | \ ((PyDateTime_Time*)o)->data[5]) +/* Apply for time delta instances */ +#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days) +#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds) +#define PyDateTime_DELTA_GET_MICROSECONDS(o) \ + (((PyDateTime_Delta*)o)->microseconds) + /* Define structure for C API. */ typedef struct { diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2056,6 +2056,10 @@ C-API ----- +- Issue #13727: Add 3 macros to access PyDateTime_Delta members: + PyDateTime_DELTA_GET_DAYS, PyDateTime_DELTA_GET_SECONDS, + PyDateTime_DELTA_GET_MICROSECONDS. + - Issue #10542: Add 4 macros to work with surrogates: Py_UNICODE_IS_SURROGATE, Py_UNICODE_IS_HIGH_SURROGATE, Py_UNICODE_IS_LOW_SURROGATE, Py_UNICODE_JOIN_SURROGATES. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 17 23:05:52 2012 From: python-checkins at python.org (ezio.melotti) Date: Tue, 17 Jan 2012 23:05:52 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_=2313808=3A_fix_a_link_and?= =?utf8?q?_specify_the_IRC_server=2E?= Message-ID: http://hg.python.org/devguide/rev/471f70b0b6b0 changeset: 482:471f70b0b6b0 user: Ezio Melotti date: Wed Jan 18 00:05:41 2012 +0200 summary: #13808: fix a link and specify the IRC server. files: faq.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/faq.rst b/faq.rst --- a/faq.rst +++ b/faq.rst @@ -16,11 +16,12 @@ Where should I ask general Python questions? -------------------------------------------- -General Python questions should still go to `python-list`_ or `python-tutor`_ -or similar resources, such as StackOverflow_ or ``#python`` on IRC. +General Python questions should still go to `python-list`_ or `tutor`_ +or similar resources, such as StackOverflow_ or the ``#python`` IRC channel +on Freenode. .. _python-list: http://mail.python.org/mailman/listinfo/python-list -.. _python-tutor: http://mail.python.org/mailman/listinfo/python-tutor +.. _tutor: http://mail.python.org/mailman/listinfo/tutor .. _StackOverflow: http://stackoverflow.com/ -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 17 23:27:05 2012 From: python-checkins at python.org (ezio.melotti) Date: Tue, 17 Jan 2012 23:27:05 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Link_to_the_Freenode_websi?= =?utf8?q?te_and_mention_=23python-dev=2E?= Message-ID: http://hg.python.org/devguide/rev/1a25c29fb571 changeset: 483:1a25c29fb571 user: Ezio Melotti date: Wed Jan 18 00:26:54 2012 +0200 summary: Link to the Freenode website and mention #python-dev. files: faq.rst | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/faq.rst b/faq.rst --- a/faq.rst +++ b/faq.rst @@ -18,11 +18,12 @@ General Python questions should still go to `python-list`_ or `tutor`_ or similar resources, such as StackOverflow_ or the ``#python`` IRC channel -on Freenode. +on Freenode_. .. _python-list: http://mail.python.org/mailman/listinfo/python-list .. _tutor: http://mail.python.org/mailman/listinfo/tutor .. _StackOverflow: http://stackoverflow.com/ +.. _Freenode: http://freenode.net/ Where should I suggest new features and language changes? @@ -49,6 +50,8 @@ The `Python Mentors`_ program is specifically about encouraging developers and others that would like to contribute to Python development in general, rather than necessarily being focused on one particular issue. +Some core developers are also available on the ``#python-dev`` IRC channel on +Freenode_. .. _Python Mentors: http://pythonmentors.com -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Wed Jan 18 00:24:08 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 00:24:08 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Test_running_of?= =?utf8?q?_code_in_a_sub-interpreter?= Message-ID: http://hg.python.org/cpython/rev/eb47af6e9e22 changeset: 74471:eb47af6e9e22 branch: 3.2 parent: 74465:f715c4a5a107 user: Antoine Pitrou date: Wed Jan 18 00:21:11 2012 +0100 summary: Test running of code in a sub-interpreter (prelude to issue #6531). files: Lib/test/test_capi.py | 17 +++++++++++++++++ Modules/_testcapimodule.c | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -3,6 +3,7 @@ from __future__ import with_statement import os +import pickle import random import subprocess import sys @@ -137,6 +138,22 @@ self.pendingcalls_submit(l, n) self.pendingcalls_wait(l, n) + def test_subinterps(self): + # XXX this test leaks in refleak runs + import builtins + r, w = os.pipe() + code = """if 1: + import sys, builtins, pickle + with open({:d}, "wb") as f: + pickle.dump(id(sys.modules), f) + pickle.dump(id(builtins), f) + """.format(w) + with open(r, "rb") as f: + ret = _testcapi.run_in_subinterp(code) + self.assertEqual(ret, 0) + self.assertNotEqual(pickle.load(f), id(sys.modules)) + self.assertNotEqual(pickle.load(f), id(builtins)) + # Bug #6012 class Test6012(unittest.TestCase): def test(self): diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2300,6 +2300,32 @@ return NULL; } +/* To run some code in a sub-interpreter. */ +static PyObject * +run_in_subinterp(PyObject *self, PyObject *args) +{ + const char *code; + int r; + PyThreadState *substate, *mainstate; + + if (!PyArg_ParseTuple(args, "s:run_in_subinterp", + &code)) + return NULL; + + mainstate = PyThreadState_Get(); + + PyThreadState_Swap(NULL); + + substate = Py_NewInterpreter(); + r = PyRun_SimpleString(code); + Py_EndInterpreter(substate); + + PyThreadState_Swap(mainstate); + + return PyLong_FromLong(r); +} + + static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, {"raise_memoryerror", (PyCFunction)raise_memoryerror, METH_NOARGS}, @@ -2385,6 +2411,7 @@ {"make_memoryview_from_NULL_pointer", (PyCFunction)make_memoryview_from_NULL_pointer, METH_NOARGS}, {"crash_no_current_thread", (PyCFunction)crash_no_current_thread, METH_NOARGS}, + {"run_in_subinterp", run_in_subinterp, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 00:24:09 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 00:24:09 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Test_running_of_code_in_a_sub-interpreter?= Message-ID: http://hg.python.org/cpython/rev/a108818aaa0d changeset: 74472:a108818aaa0d parent: 74470:463acb73fd79 parent: 74471:eb47af6e9e22 user: Antoine Pitrou date: Wed Jan 18 00:22:06 2012 +0100 summary: Test running of code in a sub-interpreter (prelude to issue #6531). files: Lib/test/test_capi.py | 17 +++++++++++++++++ Modules/_testcapimodule.c | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -3,6 +3,7 @@ from __future__ import with_statement import os +import pickle import random import subprocess import sys @@ -137,6 +138,22 @@ self.pendingcalls_submit(l, n) self.pendingcalls_wait(l, n) + def test_subinterps(self): + # XXX this test leaks in refleak runs + import builtins + r, w = os.pipe() + code = """if 1: + import sys, builtins, pickle + with open({:d}, "wb") as f: + pickle.dump(id(sys.modules), f) + pickle.dump(id(builtins), f) + """.format(w) + with open(r, "rb") as f: + ret = _testcapi.run_in_subinterp(code) + self.assertEqual(ret, 0) + self.assertNotEqual(pickle.load(f), id(sys.modules)) + self.assertNotEqual(pickle.load(f), id(builtins)) + # Bug #6012 class Test6012(unittest.TestCase): def test(self): diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2379,6 +2379,32 @@ return NULL; } +/* To run some code in a sub-interpreter. */ +static PyObject * +run_in_subinterp(PyObject *self, PyObject *args) +{ + const char *code; + int r; + PyThreadState *substate, *mainstate; + + if (!PyArg_ParseTuple(args, "s:run_in_subinterp", + &code)) + return NULL; + + mainstate = PyThreadState_Get(); + + PyThreadState_Swap(NULL); + + substate = Py_NewInterpreter(); + r = PyRun_SimpleString(code); + Py_EndInterpreter(substate); + + PyThreadState_Swap(mainstate); + + return PyLong_FromLong(r); +} + + static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, {"raise_memoryerror", (PyCFunction)raise_memoryerror, METH_NOARGS}, @@ -2467,6 +2493,7 @@ {"make_memoryview_from_NULL_pointer", (PyCFunction)make_memoryview_from_NULL_pointer, METH_NOARGS}, {"crash_no_current_thread", (PyCFunction)crash_no_current_thread, METH_NOARGS}, + {"run_in_subinterp", run_in_subinterp, METH_VARARGS}, {NULL, NULL} /* sentinel */ }; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 00:57:42 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 18 Jan 2012 00:57:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313809=3A_Make_bz2_?= =?utf8?q?module_work_with_threads_disabled=2E?= Message-ID: http://hg.python.org/cpython/rev/2fb93282887a changeset: 74473:2fb93282887a user: Nadeem Vawda date: Wed Jan 18 01:57:14 2012 +0200 summary: Issue #13809: Make bz2 module work with threads disabled. Original patch by Amaury Forgeot d'Arc. files: Lib/bz2.py | 8 ++++++-- Lib/test/test_bz2.py | 7 +++++++ Misc/NEWS | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Lib/bz2.py b/Lib/bz2.py --- a/Lib/bz2.py +++ b/Lib/bz2.py @@ -10,9 +10,13 @@ __author__ = "Nadeem Vawda " import io -import threading import warnings +try: + from threading import RLock +except ImportError: + from dummy_threading import RLock + from _bz2 import BZ2Compressor, BZ2Decompressor @@ -53,7 +57,7 @@ """ # This lock must be recursive, so that BufferedIOBase's # readline(), readlines() and writelines() don't deadlock. - self._lock = threading.RLock() + self._lock = RLock() self._fp = None self._closefp = False self._mode = _MODE_CLOSED diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -463,6 +463,13 @@ for t in threads: t.join() + def testWithoutThreading(self): + bz2 = support.import_fresh_module("bz2", blocked=("threading",)) + with bz2.BZ2File(self.filename, "wb") as f: + f.write(b"abc") + with bz2.BZ2File(self.filename, "rb") as f: + self.assertEqual(f.read(), b"abc") + def testMixedIterationAndReads(self): self.createTempFile() linelen = len(self.TEXT_LINES[0]) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -447,6 +447,9 @@ Library ------- +- Issue #13809: Fix regression where bz2 module wouldn't work when threads are + disabled. Original patch by Amaury Forgeot d'Arc. + - Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 01:32:16 2012 From: python-checkins at python.org (ezio.melotti) Date: Wed, 18 Jan 2012 01:32:16 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Add_missing_versionadded_in?= =?utf8?q?_webbrowser_doc=2E?= Message-ID: http://hg.python.org/cpython/rev/6497196cad81 changeset: 74474:6497196cad81 user: Ezio Melotti date: Wed Jan 18 02:32:07 2012 +0200 summary: Add missing versionadded in webbrowser doc. files: Doc/library/webbrowser.rst | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -164,12 +164,15 @@ (4) Only on Mac OS X platform. +.. versionadded:: 3.3 + Support for Chrome/Chromium has been added. + Here are some simple examples:: - url = 'http://www.python.org/' + url = 'http://docs.python.org/' # Open URL in a new tab, if a browser window is already open. - webbrowser.open_new_tab(url + 'doc/') + webbrowser.open_new_tab(url) # Open URL in new window, raising the window if possible. webbrowser.open_new(url) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 01:53:14 2012 From: python-checkins at python.org (victor.stinner) Date: Wed, 18 Jan 2012 01:53:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Close_=2310278=3A_Add_time?= =?utf8?q?=2Ewallclock=28=29_function=2C_monotonic_clock=2E?= Message-ID: http://hg.python.org/cpython/rev/bb10cd354e49 changeset: 74475:bb10cd354e49 user: Victor Stinner date: Wed Jan 18 01:50:21 2012 +0100 summary: Close #10278: Add time.wallclock() function, monotonic clock. files: Doc/library/time.rst | 12 +++++++ Doc/whatsnew/3.3.rst | 12 ++++--- Lib/test/test_time.py | 7 ++++ Misc/NEWS | 2 + Modules/timemodule.c | 47 +++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 5 deletions(-) diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -183,6 +183,18 @@ .. versionadded:: 3.3 +.. function:: wallclock() + + .. index:: + single: Wallclock + single: benchmarking + + Return the current time in fractions of a second to the system's best ability. + Use this when the most accurate representation of wall-clock is required, i.e. + when "processor time" is inappropriate. The reference point of the returned + value is undefined so only the difference of consecutive calls is valid. + + .. versionadded: 3.3 .. function:: ctime([secs]) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -396,12 +396,14 @@ time ---- -* The :mod:`time` module has new :func:`~time.clock_getres` and - :func:`~time.clock_gettime` functions and ``CLOCK_xxx`` constants. - :func:`~time.clock_gettime` can be used with :data:`time.CLOCK_MONOTONIC` to - get a monotonic clock. +The :mod:`time` module has new functions: - (Contributed by Victor Stinner in :issue:`10278`) +* :func:`~time.clock_getres` and :func:`~time.clock_gettime` functions and + ``CLOCK_xxx`` constants. :func:`~time.clock_gettime` can be used with + :data:`time.CLOCK_MONOTONIC` to get a monotonic clock. +* :func:`~time.wallclock`: monotonic clock. + +(Contributed by Victor Stinner in :issue:`10278`) ftplib diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -332,6 +332,13 @@ self.assertEqual(time.strftime('%Z', tt), tzname) + def test_wallclock(self): + t0 = time.wallclock() + time.sleep(0.1) + t1 = time.wallclock() + t = t1 - t0 + self.assertAlmostEqual(t, 0.1, places=2) + class TestLocale(unittest.TestCase): def setUp(self): self.oldloc = locale.setlocale(locale.LC_ALL) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -447,6 +447,8 @@ Library ------- +- Issue #10278: Add time.wallclock() function, monotonic clock. + - Issue #13809: Fix regression where bz2 module wouldn't work when threads are disabled. Original patch by Amaury Forgeot d'Arc. diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -733,6 +733,52 @@ should not be relied on."); #endif /* HAVE_WORKING_TZSET */ +static PyObject * +time_wallclock(PyObject *self, PyObject *unused) +{ +#if defined(MS_WINDOWS) && !defined(__BORLANDC__) + return time_clock(self, NULL); +#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) + static int clk_index = 0; + clockid_t clk_ids[] = { +#ifdef CLOCK_MONOTONIC_RAW + CLOCK_MONOTONIC_RAW, +#endif + CLOCK_MONOTONIC +#ifdef CLOCK_REALTIME + /* On Linux, CLOCK_REALTIME uses the same clock than gettimeofday(), + but clock_gettime() has a nanosecond resolution. */ + , CLOCK_REALTIME +#endif + }; + int ret; + struct timespec tp; + + while (0 <= clk_index) { + clockid_t clk_id = clk_ids[clk_index]; + ret = clock_gettime(clk_id, &tp); + if (ret == 0) + return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9); + + clk_index++; + if (Py_ARRAY_LENGTH(clk_ids) <= clk_index) + clk_index = -1; + } + return time_time(self, NULL); +#else + return time_time(self, NULL); +#endif +} + +PyDoc_STRVAR(wallclock_doc, +"wallclock() -> float\n\ +\n\ +Return the current time in fractions of a second to the system's best\n\ +ability. Use this when the most accurate representation of wall-clock is\n\ +required, i.e. when "processor time" is inappropriate. The reference point\n\ +of the returned value is undefined so only the difference of consecutive\n\ +calls is valid."); + static void PyInit_timezone(PyObject *m) { /* This code moved from PyInit_time wholesale to allow calling it from @@ -868,6 +914,7 @@ #ifdef HAVE_WORKING_TZSET {"tzset", time_tzset, METH_NOARGS, tzset_doc}, #endif + {"wallclock", time_wallclock, METH_NOARGS, wallclock_doc}, {NULL, NULL} /* sentinel */ }; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 01:57:36 2012 From: python-checkins at python.org (victor.stinner) Date: Wed, 18 Jan 2012 01:57:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2310278=3A_fix_a_typ?= =?utf8?q?o_in_the_doc?= Message-ID: http://hg.python.org/cpython/rev/1de276420470 changeset: 74476:1de276420470 user: Victor Stinner date: Wed Jan 18 01:57:19 2012 +0100 summary: Issue #10278: fix a typo in the doc files: Modules/timemodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -775,7 +775,7 @@ \n\ Return the current time in fractions of a second to the system's best\n\ ability. Use this when the most accurate representation of wall-clock is\n\ -required, i.e. when "processor time" is inappropriate. The reference point\n\ +required, i.e. when \"processor time\" is inappropriate. The reference point\n\ of the returned value is undefined so only the difference of consecutive\n\ calls is valid."); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 02:08:27 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 02:08:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_error_handling_in_timem?= =?utf8?q?odule=2Ec?= Message-ID: http://hg.python.org/cpython/rev/26b6732ecb87 changeset: 74477:26b6732ecb87 parent: 74472:a108818aaa0d user: Antoine Pitrou date: Wed Jan 18 01:41:44 2012 +0100 summary: Fix error handling in timemodule.c files: Modules/timemodule.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -128,8 +128,10 @@ return NULL; ret = clock_gettime((clockid_t)clk_id, &tp); - if (ret != 0) + if (ret != 0) { PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9); } @@ -152,8 +154,10 @@ return NULL; ret = clock_getres((clockid_t)clk_id, &tp); - if (ret != 0) + if (ret != 0) { PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 02:08:28 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 02:08:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/12de1ad1cee8 changeset: 74478:12de1ad1cee8 parent: 74477:26b6732ecb87 parent: 74476:1de276420470 user: Antoine Pitrou date: Wed Jan 18 02:05:38 2012 +0100 summary: Merge files: Doc/library/time.rst | 12 ++++++ Doc/library/webbrowser.rst | 7 ++- Doc/whatsnew/3.3.rst | 12 +++-- Lib/bz2.py | 8 +++- Lib/test/test_bz2.py | 7 +++ Lib/test/test_time.py | 7 +++ Misc/NEWS | 5 ++ Modules/timemodule.c | 47 ++++++++++++++++++++++++++ 8 files changed, 96 insertions(+), 9 deletions(-) diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -183,6 +183,18 @@ .. versionadded:: 3.3 +.. function:: wallclock() + + .. index:: + single: Wallclock + single: benchmarking + + Return the current time in fractions of a second to the system's best ability. + Use this when the most accurate representation of wall-clock is required, i.e. + when "processor time" is inappropriate. The reference point of the returned + value is undefined so only the difference of consecutive calls is valid. + + .. versionadded: 3.3 .. function:: ctime([secs]) diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -164,12 +164,15 @@ (4) Only on Mac OS X platform. +.. versionadded:: 3.3 + Support for Chrome/Chromium has been added. + Here are some simple examples:: - url = 'http://www.python.org/' + url = 'http://docs.python.org/' # Open URL in a new tab, if a browser window is already open. - webbrowser.open_new_tab(url + 'doc/') + webbrowser.open_new_tab(url) # Open URL in new window, raising the window if possible. webbrowser.open_new(url) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -396,12 +396,14 @@ time ---- -* The :mod:`time` module has new :func:`~time.clock_getres` and - :func:`~time.clock_gettime` functions and ``CLOCK_xxx`` constants. - :func:`~time.clock_gettime` can be used with :data:`time.CLOCK_MONOTONIC` to - get a monotonic clock. +The :mod:`time` module has new functions: - (Contributed by Victor Stinner in :issue:`10278`) +* :func:`~time.clock_getres` and :func:`~time.clock_gettime` functions and + ``CLOCK_xxx`` constants. :func:`~time.clock_gettime` can be used with + :data:`time.CLOCK_MONOTONIC` to get a monotonic clock. +* :func:`~time.wallclock`: monotonic clock. + +(Contributed by Victor Stinner in :issue:`10278`) ftplib diff --git a/Lib/bz2.py b/Lib/bz2.py --- a/Lib/bz2.py +++ b/Lib/bz2.py @@ -10,9 +10,13 @@ __author__ = "Nadeem Vawda " import io -import threading import warnings +try: + from threading import RLock +except ImportError: + from dummy_threading import RLock + from _bz2 import BZ2Compressor, BZ2Decompressor @@ -53,7 +57,7 @@ """ # This lock must be recursive, so that BufferedIOBase's # readline(), readlines() and writelines() don't deadlock. - self._lock = threading.RLock() + self._lock = RLock() self._fp = None self._closefp = False self._mode = _MODE_CLOSED diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -463,6 +463,13 @@ for t in threads: t.join() + def testWithoutThreading(self): + bz2 = support.import_fresh_module("bz2", blocked=("threading",)) + with bz2.BZ2File(self.filename, "wb") as f: + f.write(b"abc") + with bz2.BZ2File(self.filename, "rb") as f: + self.assertEqual(f.read(), b"abc") + def testMixedIterationAndReads(self): self.createTempFile() linelen = len(self.TEXT_LINES[0]) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -332,6 +332,13 @@ self.assertEqual(time.strftime('%Z', tt), tzname) + def test_wallclock(self): + t0 = time.wallclock() + time.sleep(0.1) + t1 = time.wallclock() + t = t1 - t0 + self.assertAlmostEqual(t, 0.1, places=2) + class TestLocale(unittest.TestCase): def setUp(self): self.oldloc = locale.setlocale(locale.LC_ALL) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -447,6 +447,11 @@ Library ------- +- Issue #10278: Add time.wallclock() function, monotonic clock. + +- Issue #13809: Fix regression where bz2 module wouldn't work when threads are + disabled. Original patch by Amaury Forgeot d'Arc. + - Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -737,6 +737,52 @@ should not be relied on."); #endif /* HAVE_WORKING_TZSET */ +static PyObject * +time_wallclock(PyObject *self, PyObject *unused) +{ +#if defined(MS_WINDOWS) && !defined(__BORLANDC__) + return time_clock(self, NULL); +#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) + static int clk_index = 0; + clockid_t clk_ids[] = { +#ifdef CLOCK_MONOTONIC_RAW + CLOCK_MONOTONIC_RAW, +#endif + CLOCK_MONOTONIC +#ifdef CLOCK_REALTIME + /* On Linux, CLOCK_REALTIME uses the same clock than gettimeofday(), + but clock_gettime() has a nanosecond resolution. */ + , CLOCK_REALTIME +#endif + }; + int ret; + struct timespec tp; + + while (0 <= clk_index) { + clockid_t clk_id = clk_ids[clk_index]; + ret = clock_gettime(clk_id, &tp); + if (ret == 0) + return PyFloat_FromDouble(tp.tv_sec + tp.tv_nsec * 1e-9); + + clk_index++; + if (Py_ARRAY_LENGTH(clk_ids) <= clk_index) + clk_index = -1; + } + return time_time(self, NULL); +#else + return time_time(self, NULL); +#endif +} + +PyDoc_STRVAR(wallclock_doc, +"wallclock() -> float\n\ +\n\ +Return the current time in fractions of a second to the system's best\n\ +ability. Use this when the most accurate representation of wall-clock is\n\ +required, i.e. when \"processor time\" is inappropriate. The reference point\n\ +of the returned value is undefined so only the difference of consecutive\n\ +calls is valid."); + static void PyInit_timezone(PyObject *m) { /* This code moved from PyInit_time wholesale to allow calling it from @@ -872,6 +918,7 @@ #ifdef HAVE_WORKING_TZSET {"tzset", time_tzset, METH_NOARGS, tzset_doc}, #endif + {"wallclock", time_wallclock, METH_NOARGS, wallclock_doc}, {NULL, NULL} /* sentinel */ }; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:01:37 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:01:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Closes_=2313803?= =?utf8?q?=3A_Under_Solaris=2C_distutils_doesn=27t_include_bitness_in_the?= Message-ID: http://hg.python.org/cpython/rev/284550d0d8ae changeset: 74479:284550d0d8ae branch: 2.7 parent: 74469:51e11b4937b7 user: Jesus Cea date: Wed Jan 18 03:51:38 2012 +0100 summary: Closes #13803: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 3 ++- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -6,7 +6,7 @@ __revision__ = "$Id$" -import sys, os, string, re +import sys, os, string, re, platform from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -76,6 +76,7 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) + machine += ".%s" % platform.architecture()[0] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,9 @@ - Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. +- Issue #13803: Under Solaris, distutils doesn't include bitness + in the directory name. + - Issue #13642: Unquote before b64encoding user:password during Basic Authentication. Patch contributed by Joonas Kuorilehto and Michele Orr?. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:01:38 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:01:38 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Closes_=2313803?= =?utf8?q?=3A_Under_Solaris=2C_distutils_doesn=27t_include_bitness_in_the?= Message-ID: http://hg.python.org/cpython/rev/eed73b16e71f changeset: 74480:eed73b16e71f branch: 3.2 parent: 74471:eb47af6e9e22 user: Jesus Cea date: Wed Jan 18 03:58:42 2012 +0100 summary: Closes #13803: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 2 ++ Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -9,6 +9,7 @@ import imp import sys import string +import platform from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -77,6 +78,7 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) + machine += ".%s" % platform.architecture()[0] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -100,6 +100,9 @@ Library ------- +- Issue #13803: Under Solaris, distutils doesn't include bitness + in the directory name. + - Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:01:39 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:01:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_MERGE=3A_Closes_=2313803=3A_Under_Solaris=2C_distutils_doesn?= =?utf8?q?=27t_include_bitness_in_the?= Message-ID: http://hg.python.org/cpython/rev/8d0ccb4ad206 changeset: 74481:8d0ccb4ad206 parent: 74478:12de1ad1cee8 parent: 74480:eed73b16e71f user: Jesus Cea date: Wed Jan 18 04:01:24 2012 +0100 summary: MERGE: Closes #13803: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 2 ++ Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -9,6 +9,7 @@ import imp import sys import string +import platform from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -77,6 +78,7 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) + machine += ".%s" % platform.architecture()[0] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -447,6 +447,9 @@ Library ------- +- Issue #13803: Under Solaris, distutils doesn't include bitness + in the directory name. + - Issue #10278: Add time.wallclock() function, monotonic clock. - Issue #13809: Fix regression where bz2 module wouldn't work when threads are -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:28:12 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:28:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Emergency_fix_f?= =?utf8?q?or_=2313803_bootstrap_issue=3A_Under_Solaris=2C_distutils_doesn?= =?utf8?q?=27t?= Message-ID: http://hg.python.org/cpython/rev/2ec4ab2a6f65 changeset: 74482:2ec4ab2a6f65 branch: 2.7 parent: 74479:284550d0d8ae user: Jesus Cea date: Wed Jan 18 04:25:28 2012 +0100 summary: Emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -6,7 +6,7 @@ __revision__ = "$Id$" -import sys, os, string, re, platform +import sys, os, string, re from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -76,7 +76,11 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) - machine += ".%s" % platform.architecture()[0] + # We can't use "platform.architecture()[0]" because a + # bootstrap problem. We use a dict to get an error + # if some suspicious happens. + bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} + machine += ".%s" % bitness[sys.maxint] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:28:13 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:28:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Emergency_fix_f?= =?utf8?q?or_=2313803_bootstrap_issue=3A_Under_Solaris=2C_distutils_doesn?= =?utf8?q?=27t?= Message-ID: http://hg.python.org/cpython/rev/9d62f5aa35ff changeset: 74483:9d62f5aa35ff branch: 3.2 parent: 74480:eed73b16e71f user: Jesus Cea date: Wed Jan 18 04:27:37 2012 +0100 summary: Emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -9,7 +9,6 @@ import imp import sys import string -import platform from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -78,7 +77,11 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) - machine += ".%s" % platform.architecture()[0] + # We can't use "platform.architecture()[0]" because a + # bootstrap problem. We use a dict to get an error + # if some suspicious happens. + bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} + machine += ".%s" % bitness[sys.maxint] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:28:14 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:28:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_MERGE=3A_Emergency_fix_for_=2313803_bootstrap_issue=3A_Under?= =?utf8?q?_Solaris=2C_distutils?= Message-ID: http://hg.python.org/cpython/rev/4a6e0b6d493b changeset: 74484:4a6e0b6d493b parent: 74481:8d0ccb4ad206 parent: 74483:9d62f5aa35ff user: Jesus Cea date: Wed Jan 18 04:28:05 2012 +0100 summary: MERGE: Emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -9,7 +9,6 @@ import imp import sys import string -import platform from distutils.errors import DistutilsPlatformError from distutils.dep_util import newer from distutils.spawn import spawn @@ -78,7 +77,11 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) - machine += ".%s" % platform.architecture()[0] + # We can't use "platform.architecture()[0]" because a + # bootstrap problem. We use a dict to get an error + # if some suspicious happens. + bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} + machine += ".%s" % bitness[sys.maxint] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:40:11 2012 From: python-checkins at python.org (ezio.melotti) Date: Wed, 18 Jan 2012 04:40:11 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Use_ASCII_quotes_and_fix_ma?= =?utf8?q?rkup=2E?= Message-ID: http://hg.python.org/cpython/rev/6a6b226961aa changeset: 74485:6a6b226961aa user: Ezio Melotti date: Wed Jan 18 05:40:00 2012 +0200 summary: Use ASCII quotes and fix markup. files: Doc/howto/logging-cookbook.rst | 4 ++-- Doc/library/logging.handlers.rst | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1126,7 +1126,7 @@ rh.rotator = rotator rh.namer = namer -These are not ?true? .gz files, as they are bare compressed data, with no -?container? such as you?d find in an actual gzip file. This snippet is just +These are not "true" .gz files, as they are bare compressed data, with no +"container" such as you?d find in an actual gzip file. This snippet is just for illustration purposes. diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -209,7 +209,7 @@ The default implementation calls the 'namer' attribute of the handler, if it's callable, passing the default name to it. If the attribute isn't - callable (the default is `None`), the name is returned unchanged. + callable (the default is ``None``), the name is returned unchanged. :param default_name: The default name for the log file. @@ -222,7 +222,7 @@ The default implementation calls the 'rotator' attribute of the handler, if it's callable, passing the source and dest arguments to it. If the - attribute isn't callable (the default is `None`), the source is simply + attribute isn't callable (the default is ``None``), the source is simply renamed to the destination. :param source: The source filename. This is normally the base @@ -780,7 +780,7 @@ .. method:: close() - Calls :meth:`flush`, sets the target to :const:`None` and clears the + Calls :meth:`flush`, sets the target to ``None`` and clears the buffer. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:43:36 2012 From: python-checkins at python.org (ezio.melotti) Date: Wed, 18 Jan 2012 04:43:36 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzNjY1OiBzL3N0?= =?utf8?q?ring/bytes/_in_error_message=2E?= Message-ID: http://hg.python.org/cpython/rev/b4d9243d16c9 changeset: 74486:b4d9243d16c9 branch: 3.2 parent: 74483:9d62f5aa35ff user: Ezio Melotti date: Wed Jan 18 05:42:39 2012 +0200 summary: #13665: s/string/bytes/ in error message. files: Modules/_ctypes/cfield.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1372,7 +1372,7 @@ _RET(value); } PyErr_Format(PyExc_TypeError, - "string or integer address expected instead of %s instance", + "bytes or integer address expected instead of %s instance", value->ob_type->tp_name); return NULL; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:43:37 2012 From: python-checkins at python.org (ezio.melotti) Date: Wed, 18 Jan 2012 04:43:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_=2313665=3A_merge_with_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/0c0ffebfccb0 changeset: 74487:0c0ffebfccb0 parent: 74485:6a6b226961aa parent: 74486:b4d9243d16c9 user: Ezio Melotti date: Wed Jan 18 05:43:21 2012 +0200 summary: #13665: merge with 3.2. files: Modules/_ctypes/cfield.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1365,7 +1365,7 @@ _RET(value); } PyErr_Format(PyExc_TypeError, - "string or integer address expected instead of %s instance", + "bytes or integer address expected instead of %s instance", value->ob_type->tp_name); return NULL; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:49:59 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:49:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Yet_another_eme?= =?utf8?q?rgency_fix_for_=2313803_bootstrap_issue=3A_Under_Solaris=2C_dist?= =?utf8?q?utils?= Message-ID: http://hg.python.org/cpython/rev/4074439c3894 changeset: 74488:4074439c3894 branch: 2.7 parent: 74482:2ec4ab2a6f65 user: Jesus Cea date: Wed Jan 18 04:43:50 2012 +0100 summary: Yet another emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/sysconfig.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -582,6 +582,11 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) + # We can't use "platform.architecture()[0]" because a + # bootstrap problem. We use a dict to get an error + # if some suspicious happens. + bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} + machine += ".%s" % bitness[sys.maxint] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:50:00 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:50:00 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Yet_another_eme?= =?utf8?q?rgency_fix_for_=2313803_bootstrap_issue=3A_Under_Solaris=2C_dist?= =?utf8?q?utils?= Message-ID: http://hg.python.org/cpython/rev/37efae3bf912 changeset: 74489:37efae3bf912 branch: 3.2 parent: 74486:b4d9243d16c9 user: Jesus Cea date: Wed Jan 18 04:49:26 2012 +0100 summary: Yet another emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/sysconfig.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -639,6 +639,11 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) + # We can't use "platform.architecture()[0]" because a + # bootstrap problem. We use a dict to get an error + # if some suspicious happens. + bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} + machine += ".%s" % bitness[sys.maxint] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 04:50:01 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 04:50:01 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_MERGE=3A_Yet_another_emergency_fix_for_=2313803_bootstrap_is?= =?utf8?q?sue=3A_Under_Solaris=2C?= Message-ID: http://hg.python.org/cpython/rev/afdce2e2f98d changeset: 74490:afdce2e2f98d parent: 74487:0c0ffebfccb0 parent: 74489:37efae3bf912 user: Jesus Cea date: Wed Jan 18 04:49:54 2012 +0100 summary: MERGE: Yet another emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/sysconfig.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -652,6 +652,11 @@ if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) + # We can't use "platform.architecture()[0]" because a + # bootstrap problem. We use a dict to get an error + # if some suspicious happens. + bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} + machine += ".%s" % bitness[sys.maxint] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 05:05:46 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 05:05:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_And_yet_another?= =?utf8?q?_emergency_fix_for_=2313803_bootstrap_issue=3A_Under_Solaris=2C?= Message-ID: http://hg.python.org/cpython/rev/147ad02875fa changeset: 74491:147ad02875fa branch: 3.2 parent: 74489:37efae3bf912 user: Jesus Cea date: Wed Jan 18 05:04:49 2012 +0100 summary: And yet another emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 2 +- Lib/sysconfig.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -81,7 +81,7 @@ # bootstrap problem. We use a dict to get an error # if some suspicious happens. bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} - machine += ".%s" % bitness[sys.maxint] + machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -643,7 +643,7 @@ # bootstrap problem. We use a dict to get an error # if some suspicious happens. bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} - machine += ".%s" % bitness[sys.maxint] + machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 05:05:49 2012 From: python-checkins at python.org (jesus.cea) Date: Wed, 18 Jan 2012 05:05:49 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_MERGE=3A_And_yet_another_emergency_fix_for_=2313803_bootstra?= =?utf8?q?p_issue=3A_Under_Solaris=2C?= Message-ID: http://hg.python.org/cpython/rev/582274636446 changeset: 74492:582274636446 parent: 74490:afdce2e2f98d parent: 74491:147ad02875fa user: Jesus Cea date: Wed Jan 18 05:05:41 2012 +0100 summary: MERGE: And yet another emergency fix for #13803 bootstrap issue: Under Solaris, distutils doesn't include bitness in the directory name files: Lib/distutils/util.py | 2 +- Lib/sysconfig.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py --- a/Lib/distutils/util.py +++ b/Lib/distutils/util.py @@ -81,7 +81,7 @@ # bootstrap problem. We use a dict to get an error # if some suspicious happens. bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} - machine += ".%s" % bitness[sys.maxint] + machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -656,7 +656,7 @@ # bootstrap problem. We use a dict to get an error # if some suspicious happens. bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} - machine += ".%s" % bitness[sys.maxint] + machine += ".%s" % bitness[sys.maxsize] # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jan 18 05:31:56 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 18 Jan 2012 05:31:56 +0100 Subject: [Python-checkins] Daily reference leaks (12de1ad1cee8): sum=6024 Message-ID: results for 12de1ad1cee8 on branch "default" -------------------------------------------- test_capi leaked [2008, 2008, 2008] references, sum=6024 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogIIXMkv', '-x'] From python-checkins at python.org Wed Jan 18 08:32:31 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 18 Jan 2012 08:32:31 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzgx?= =?utf8?q?=3A_Fix_GzipFile_to_work_with_os=2Efdopen=28=29=27d_file_objects?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/7d405058e458 changeset: 74493:7d405058e458 branch: 3.2 parent: 74491:147ad02875fa user: Nadeem Vawda date: Wed Jan 18 09:25:58 2012 +0200 summary: Issue #13781: Fix GzipFile to work with os.fdopen()'d file objects. files: Lib/gzip.py | 6 ++++-- Lib/test/test_gzip.py | 8 ++++++++ Misc/NEWS | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Lib/gzip.py b/Lib/gzip.py --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -156,8 +156,10 @@ if fileobj is None: fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') if filename is None: - if hasattr(fileobj, 'name'): filename = fileobj.name - else: filename = '' + if hasattr(fileobj, 'name') and isinstance(fileobj.name, str): + filename = fileobj.name + else: + filename = '' if mode is None: if hasattr(fileobj, 'mode'): mode = fileobj.mode else: mode = 'rb' diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -323,6 +323,14 @@ self.assertEqual(f.read(100), b'') self.assertEqual(nread, len(uncompressed)) + def test_fileobj_from_fdopen(self): + # Issue #13781: Opening a GzipFile for writing fails when using a + # fileobj created with os.fdopen(). + fd = os.open(self.filename, os.O_WRONLY | os.O_CREAT) + with os.fdopen(fd, "wb") as f: + with gzip.GzipFile(fileobj=f, mode="w") as g: + pass + # Testing compress/decompress shortcut functions def test_compress(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -100,6 +100,9 @@ Library ------- +- Issue #13781: Fix GzipFile bug that caused an exception to be raised when + opening for writing using a fileobj returned by os.fdopen(). + - Issue #13803: Under Solaris, distutils doesn't include bitness in the directory name. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 08:32:37 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 18 Jan 2012 08:32:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge=3A_=2313781=3A_Fix_GzipFile_to_work_with_os=2Efdopen?= =?utf8?b?KCknZCBmaWxlIG9iamVjdHMu?= Message-ID: http://hg.python.org/cpython/rev/fe36edf3a341 changeset: 74494:fe36edf3a341 parent: 74492:582274636446 parent: 74493:7d405058e458 user: Nadeem Vawda date: Wed Jan 18 09:32:25 2012 +0200 summary: Merge: #13781: Fix GzipFile to work with os.fdopen()'d file objects. files: Lib/gzip.py | 6 ++++-- Lib/test/test_gzip.py | 8 ++++++++ Misc/NEWS | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Lib/gzip.py b/Lib/gzip.py --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -144,8 +144,10 @@ if fileobj is None: fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') if filename is None: - if hasattr(fileobj, 'name'): filename = fileobj.name - else: filename = '' + if hasattr(fileobj, 'name') and isinstance(fileobj.name, str): + filename = fileobj.name + else: + filename = '' if mode is None: if hasattr(fileobj, 'mode'): mode = fileobj.mode else: mode = 'rb' diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -346,6 +346,14 @@ with io.TextIOWrapper(f, encoding="ascii") as t: self.assertEqual(t.readlines(), lines) + def test_fileobj_from_fdopen(self): + # Issue #13781: Opening a GzipFile for writing fails when using a + # fileobj created with os.fdopen(). + fd = os.open(self.filename, os.O_WRONLY | os.O_CREAT) + with os.fdopen(fd, "wb") as f: + with gzip.GzipFile(fileobj=f, mode="w") as g: + pass + # Testing compress/decompress shortcut functions def test_compress(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -447,6 +447,9 @@ Library ------- +- Issue #13781: Fix GzipFile bug that caused an exception to be raised when + opening for writing using a fileobj returned by os.fdopen(). + - Issue #13803: Under Solaris, distutils doesn't include bitness in the directory name. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 08:57:48 2012 From: python-checkins at python.org (georg.brandl) Date: Wed, 18 Jan 2012 08:57:48 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Clraify=2E?= Message-ID: http://hg.python.org/peps/rev/2e47274a5580 changeset: 4015:2e47274a5580 user: Georg Brandl date: Wed Jan 18 09:01:22 2012 +0100 summary: Clraify. files: pep-0407.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0407.txt b/pep-0407.txt --- a/pep-0407.txt +++ b/pep-0407.txt @@ -96,7 +96,7 @@ ---------------------- The effect on fixing bugs should be minimal with the proposed figures. -The same number of branches would be simultaneously open for regular +The same number of branches would be simultaneously open for bugfix maintenance (two until 2.x is terminated, then one). Effect on workflow -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Jan 18 14:04:27 2012 From: python-checkins at python.org (lars.gustaebel) Date: Wed, 18 Jan 2012 14:04:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=235689=3A_Avoid_exce?= =?utf8?q?ssive_memory_usage_by_using_the_default_lzma_preset=2E?= Message-ID: http://hg.python.org/cpython/rev/b86b54fcb5c2 changeset: 74495:b86b54fcb5c2 user: Lars Gust?bel date: Wed Jan 18 14:01:17 2012 +0100 summary: Issue #5689: Avoid excessive memory usage by using the default lzma preset. files: Lib/tarfile.py | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1807,7 +1807,7 @@ return t @classmethod - def xzopen(cls, name, mode="r", fileobj=None, preset=9, **kwargs): + def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs): """Open lzma compressed tar archive name for reading or writing. Appending is not allowed. """ @@ -1819,10 +1819,6 @@ except ImportError: raise CompressionError("lzma module is not available") - if mode == "r": - # LZMAFile complains about a preset argument in read mode. - preset = None - fileobj = lzma.LZMAFile(filename=name if fileobj is None else None, mode=mode, fileobj=fileobj, preset=preset) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 15:30:32 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 15:30:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_a_memory_le?= =?utf8?q?ak_when_initializing_the_standard_I/O_streams=2E?= Message-ID: http://hg.python.org/cpython/rev/93e86b9318f7 changeset: 74496:93e86b9318f7 branch: 3.2 parent: 74493:7d405058e458 user: Antoine Pitrou date: Wed Jan 18 15:14:46 2012 +0100 summary: Fix a memory leak when initializing the standard I/O streams. files: Python/pythonrun.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1012,7 +1012,8 @@ const char * encoding; encoding = _PyUnicode_AsString(encoding_attr); if (encoding != NULL) { - _PyCodec_Lookup(encoding); + PyObject *codec_info = _PyCodec_Lookup(encoding); + Py_XDECREF(codec_info); } Py_DECREF(encoding_attr); } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 15:30:33 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 15:30:33 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_a_memory_leak_when_initializing_the_standard_I/O_streams?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/a321ffb21367 changeset: 74497:a321ffb21367 parent: 74495:b86b54fcb5c2 parent: 74496:93e86b9318f7 user: Antoine Pitrou date: Wed Jan 18 15:28:38 2012 +0100 summary: Fix a memory leak when initializing the standard I/O streams. files: Python/pythonrun.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1032,7 +1032,8 @@ const char * encoding; encoding = _PyUnicode_AsString(encoding_attr); if (encoding != NULL) { - _PyCodec_Lookup(encoding); + PyObject *codec_info = _PyCodec_Lookup(encoding); + Py_XDECREF(codec_info); } Py_DECREF(encoding_attr); } -- Repository URL: http://hg.python.org/cpython From ncoghlan at gmail.com Wed Jan 18 16:06:07 2012 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 19 Jan 2012 01:06:07 +1000 Subject: [Python-checkins] Daily reference leaks (12de1ad1cee8): sum=6024 In-Reply-To: References: Message-ID: On Wed, Jan 18, 2012 at 2:31 PM, wrote: > results for 12de1ad1cee8 on branch "default" > -------------------------------------------- > > test_capi leaked [2008, 2008, 2008] references, sum=6024 Yikes, you weren't kidding about that new subinterpreter code execution test upsetting the refleak detection... Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From python-checkins at python.org Wed Jan 18 16:23:04 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 16:23:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_leaking_a_R?= =?utf8?q?untimeError_objects_when_creating_sub-interpreters?= Message-ID: http://hg.python.org/cpython/rev/ab5b47bf6711 changeset: 74498:ab5b47bf6711 branch: 3.2 parent: 74496:93e86b9318f7 user: Antoine Pitrou date: Wed Jan 18 16:13:31 2012 +0100 summary: Fix leaking a RuntimeError objects when creating sub-interpreters files: Objects/exceptions.c | 44 ++++++++++++++++--------------- 1 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2093,27 +2093,29 @@ preallocate_memerrors(); - PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL); - if (!PyExc_RecursionErrorInst) - Py_FatalError("Cannot pre-allocate RuntimeError instance for " - "recursion errors"); - else { - PyBaseExceptionObject *err_inst = - (PyBaseExceptionObject *)PyExc_RecursionErrorInst; - PyObject *args_tuple; - PyObject *exc_message; - exc_message = PyUnicode_FromString("maximum recursion depth exceeded"); - if (!exc_message) - Py_FatalError("cannot allocate argument for RuntimeError " - "pre-allocation"); - args_tuple = PyTuple_Pack(1, exc_message); - if (!args_tuple) - Py_FatalError("cannot allocate tuple for RuntimeError " - "pre-allocation"); - Py_DECREF(exc_message); - if (BaseException_init(err_inst, args_tuple, NULL)) - Py_FatalError("init of pre-allocated RuntimeError failed"); - Py_DECREF(args_tuple); + if (!PyExc_RecursionErrorInst) { + PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL); + if (!PyExc_RecursionErrorInst) + Py_FatalError("Cannot pre-allocate RuntimeError instance for " + "recursion errors"); + else { + PyBaseExceptionObject *err_inst = + (PyBaseExceptionObject *)PyExc_RecursionErrorInst; + PyObject *args_tuple; + PyObject *exc_message; + exc_message = PyUnicode_FromString("maximum recursion depth exceeded"); + if (!exc_message) + Py_FatalError("cannot allocate argument for RuntimeError " + "pre-allocation"); + args_tuple = PyTuple_Pack(1, exc_message); + if (!args_tuple) + Py_FatalError("cannot allocate tuple for RuntimeError " + "pre-allocation"); + Py_DECREF(exc_message); + if (BaseException_init(err_inst, args_tuple, NULL)) + Py_FatalError("init of pre-allocated RuntimeError failed"); + Py_DECREF(args_tuple); + } } Py_DECREF(bltinmod); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 16:23:06 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 16:23:06 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_the_=5Fio_m?= =?utf8?q?odule_leaking_references_when_a_sub-interpreter_is_created=2E?= Message-ID: http://hg.python.org/cpython/rev/5fb379fcdc75 changeset: 74499:5fb379fcdc75 branch: 3.2 user: Antoine Pitrou date: Wed Jan 18 16:13:56 2012 +0100 summary: Fix the _io module leaking references when a sub-interpreter is created. files: Modules/_io/_iomodule.c | 84 ++++++++++++---------------- 1 files changed, 36 insertions(+), 48 deletions(-) diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -741,58 +741,46 @@ ADD_TYPE(&PyIncrementalNewlineDecoder_Type, "IncrementalNewlineDecoder"); /* Interned strings */ - if (!(_PyIO_str_close = PyUnicode_InternFromString("close"))) +#define ADD_INTERNED(name) \ + if (!_PyIO_str_ ## name && \ + !(_PyIO_str_ ## name = PyUnicode_InternFromString(# name))) \ goto fail; - if (!(_PyIO_str_closed = PyUnicode_InternFromString("closed"))) + + ADD_INTERNED(close) + ADD_INTERNED(closed) + ADD_INTERNED(decode) + ADD_INTERNED(encode) + ADD_INTERNED(fileno) + ADD_INTERNED(flush) + ADD_INTERNED(getstate) + ADD_INTERNED(isatty) + ADD_INTERNED(newlines) + ADD_INTERNED(read) + ADD_INTERNED(read1) + ADD_INTERNED(readable) + ADD_INTERNED(readinto) + ADD_INTERNED(readline) + ADD_INTERNED(reset) + ADD_INTERNED(seek) + ADD_INTERNED(seekable) + ADD_INTERNED(setstate) + ADD_INTERNED(tell) + ADD_INTERNED(truncate) + ADD_INTERNED(write) + ADD_INTERNED(writable) + + if (!_PyIO_str_nl && + !(_PyIO_str_nl = PyUnicode_InternFromString("\n"))) goto fail; - if (!(_PyIO_str_decode = PyUnicode_InternFromString("decode"))) + + if (!_PyIO_empty_str && + !(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0))) goto fail; - if (!(_PyIO_str_encode = PyUnicode_InternFromString("encode"))) + if (!_PyIO_empty_bytes && + !(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) goto fail; - if (!(_PyIO_str_fileno = PyUnicode_InternFromString("fileno"))) - goto fail; - if (!(_PyIO_str_flush = PyUnicode_InternFromString("flush"))) - goto fail; - if (!(_PyIO_str_getstate = PyUnicode_InternFromString("getstate"))) - goto fail; - if (!(_PyIO_str_isatty = PyUnicode_InternFromString("isatty"))) - goto fail; - if (!(_PyIO_str_newlines = PyUnicode_InternFromString("newlines"))) - goto fail; - if (!(_PyIO_str_nl = PyUnicode_InternFromString("\n"))) - goto fail; - if (!(_PyIO_str_read = PyUnicode_InternFromString("read"))) - goto fail; - if (!(_PyIO_str_read1 = PyUnicode_InternFromString("read1"))) - goto fail; - if (!(_PyIO_str_readable = PyUnicode_InternFromString("readable"))) - goto fail; - if (!(_PyIO_str_readinto = PyUnicode_InternFromString("readinto"))) - goto fail; - if (!(_PyIO_str_readline = PyUnicode_InternFromString("readline"))) - goto fail; - if (!(_PyIO_str_reset = PyUnicode_InternFromString("reset"))) - goto fail; - if (!(_PyIO_str_seek = PyUnicode_InternFromString("seek"))) - goto fail; - if (!(_PyIO_str_seekable = PyUnicode_InternFromString("seekable"))) - goto fail; - if (!(_PyIO_str_setstate = PyUnicode_InternFromString("setstate"))) - goto fail; - if (!(_PyIO_str_tell = PyUnicode_InternFromString("tell"))) - goto fail; - if (!(_PyIO_str_truncate = PyUnicode_InternFromString("truncate"))) - goto fail; - if (!(_PyIO_str_write = PyUnicode_InternFromString("write"))) - goto fail; - if (!(_PyIO_str_writable = PyUnicode_InternFromString("writable"))) - goto fail; - - if (!(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0))) - goto fail; - if (!(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) - goto fail; - if (!(_PyIO_zero = PyLong_FromLong(0L))) + if (!_PyIO_zero && + !(_PyIO_zero = PyLong_FromLong(0L))) goto fail; state->initialized = 1; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 16:23:10 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 16:23:10 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_refleak_fixes_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/095de2293f39 changeset: 74500:095de2293f39 parent: 74497:a321ffb21367 parent: 74499:5fb379fcdc75 user: Antoine Pitrou date: Wed Jan 18 16:19:19 2012 +0100 summary: Merge refleak fixes from 3.2 files: Modules/_io/_iomodule.c | 87 ++++++++++++---------------- Objects/exceptions.c | 44 +++++++------- 2 files changed, 60 insertions(+), 71 deletions(-) diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -677,60 +677,47 @@ ADD_TYPE(&PyIncrementalNewlineDecoder_Type, "IncrementalNewlineDecoder"); /* Interned strings */ - if (!(_PyIO_str_close = PyUnicode_InternFromString("close"))) +#define ADD_INTERNED(name) \ + if (!_PyIO_str_ ## name && \ + !(_PyIO_str_ ## name = PyUnicode_InternFromString(# name))) \ goto fail; - if (!(_PyIO_str_closed = PyUnicode_InternFromString("closed"))) + + ADD_INTERNED(close) + ADD_INTERNED(closed) + ADD_INTERNED(decode) + ADD_INTERNED(encode) + ADD_INTERNED(fileno) + ADD_INTERNED(flush) + ADD_INTERNED(getstate) + ADD_INTERNED(isatty) + ADD_INTERNED(newlines) + ADD_INTERNED(read) + ADD_INTERNED(read1) + ADD_INTERNED(readable) + ADD_INTERNED(readall) + ADD_INTERNED(readinto) + ADD_INTERNED(readline) + ADD_INTERNED(reset) + ADD_INTERNED(seek) + ADD_INTERNED(seekable) + ADD_INTERNED(setstate) + ADD_INTERNED(tell) + ADD_INTERNED(truncate) + ADD_INTERNED(write) + ADD_INTERNED(writable) + + if (!_PyIO_str_nl && + !(_PyIO_str_nl = PyUnicode_InternFromString("\n"))) goto fail; - if (!(_PyIO_str_decode = PyUnicode_InternFromString("decode"))) + + if (!_PyIO_empty_str && + !(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0))) goto fail; - if (!(_PyIO_str_encode = PyUnicode_InternFromString("encode"))) + if (!_PyIO_empty_bytes && + !(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) goto fail; - if (!(_PyIO_str_fileno = PyUnicode_InternFromString("fileno"))) - goto fail; - if (!(_PyIO_str_flush = PyUnicode_InternFromString("flush"))) - goto fail; - if (!(_PyIO_str_getstate = PyUnicode_InternFromString("getstate"))) - goto fail; - if (!(_PyIO_str_isatty = PyUnicode_InternFromString("isatty"))) - goto fail; - if (!(_PyIO_str_newlines = PyUnicode_InternFromString("newlines"))) - goto fail; - if (!(_PyIO_str_nl = PyUnicode_InternFromString("\n"))) - goto fail; - if (!(_PyIO_str_read = PyUnicode_InternFromString("read"))) - goto fail; - if (!(_PyIO_str_read1 = PyUnicode_InternFromString("read1"))) - goto fail; - if (!(_PyIO_str_readable = PyUnicode_InternFromString("readable"))) - goto fail; - if (!(_PyIO_str_readall = PyUnicode_InternFromString("readall"))) - goto fail; - if (!(_PyIO_str_readinto = PyUnicode_InternFromString("readinto"))) - goto fail; - if (!(_PyIO_str_readline = PyUnicode_InternFromString("readline"))) - goto fail; - if (!(_PyIO_str_reset = PyUnicode_InternFromString("reset"))) - goto fail; - if (!(_PyIO_str_seek = PyUnicode_InternFromString("seek"))) - goto fail; - if (!(_PyIO_str_seekable = PyUnicode_InternFromString("seekable"))) - goto fail; - if (!(_PyIO_str_setstate = PyUnicode_InternFromString("setstate"))) - goto fail; - if (!(_PyIO_str_tell = PyUnicode_InternFromString("tell"))) - goto fail; - if (!(_PyIO_str_truncate = PyUnicode_InternFromString("truncate"))) - goto fail; - if (!(_PyIO_str_write = PyUnicode_InternFromString("write"))) - goto fail; - if (!(_PyIO_str_writable = PyUnicode_InternFromString("writable"))) - goto fail; - - if (!(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0))) - goto fail; - if (!(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) - goto fail; - if (!(_PyIO_zero = PyLong_FromLong(0L))) + if (!_PyIO_zero && + !(_PyIO_zero = PyLong_FromLong(0L))) goto fail; state->initialized = 1; diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2437,27 +2437,29 @@ preallocate_memerrors(); - PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL); - if (!PyExc_RecursionErrorInst) - Py_FatalError("Cannot pre-allocate RuntimeError instance for " - "recursion errors"); - else { - PyBaseExceptionObject *err_inst = - (PyBaseExceptionObject *)PyExc_RecursionErrorInst; - PyObject *args_tuple; - PyObject *exc_message; - exc_message = PyUnicode_FromString("maximum recursion depth exceeded"); - if (!exc_message) - Py_FatalError("cannot allocate argument for RuntimeError " - "pre-allocation"); - args_tuple = PyTuple_Pack(1, exc_message); - if (!args_tuple) - Py_FatalError("cannot allocate tuple for RuntimeError " - "pre-allocation"); - Py_DECREF(exc_message); - if (BaseException_init(err_inst, args_tuple, NULL)) - Py_FatalError("init of pre-allocated RuntimeError failed"); - Py_DECREF(args_tuple); + if (!PyExc_RecursionErrorInst) { + PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL); + if (!PyExc_RecursionErrorInst) + Py_FatalError("Cannot pre-allocate RuntimeError instance for " + "recursion errors"); + else { + PyBaseExceptionObject *err_inst = + (PyBaseExceptionObject *)PyExc_RecursionErrorInst; + PyObject *args_tuple; + PyObject *exc_message; + exc_message = PyUnicode_FromString("maximum recursion depth exceeded"); + if (!exc_message) + Py_FatalError("cannot allocate argument for RuntimeError " + "pre-allocation"); + args_tuple = PyTuple_Pack(1, exc_message); + if (!args_tuple) + Py_FatalError("cannot allocate tuple for RuntimeError " + "pre-allocation"); + Py_DECREF(exc_message); + if (BaseException_init(err_inst, args_tuple, NULL)) + Py_FatalError("init of pre-allocated RuntimeError failed"); + Py_DECREF(args_tuple); + } } Py_DECREF(bltinmod); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 17:41:02 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 17:41:02 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Revert_part_of_?= =?utf8?q?13f56cd8dec1_=28issue_=231785=29_to_avoid_breaking_getmembers=28?= =?utf8?q?=29_with?= Message-ID: http://hg.python.org/cpython/rev/f824744557ba changeset: 74501:f824744557ba branch: 2.7 parent: 74488:4074439c3894 user: Antoine Pitrou date: Wed Jan 18 17:39:01 2012 +0100 summary: Revert part of 13f56cd8dec1 (issue #1785) to avoid breaking getmembers() with unbound methods. Python 3 isn't affected (unbound methods don't exist). Thanks to Vincent Pelletier for noticing. files: Lib/inspect.py | 19 +------ Lib/test/test_inspect.py | 64 ++++++++------------------- 2 files changed, 23 insertions(+), 60 deletions(-) diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -247,23 +247,12 @@ def getmembers(object, predicate=None): """Return all members of an object as (name, value) pairs sorted by name. Optionally, only return members that satisfy a given predicate.""" - if isclass(object): - mro = (object,) + getmro(object) - else: - mro = () results = [] for key in dir(object): - # First try to get the value via __dict__. Some descriptors don't - # like calling their __get__ (see bug #1785). - for base in mro: - if key in base.__dict__: - value = base.__dict__[key] - break - else: - try: - value = getattr(object, key) - except AttributeError: - continue + try: + value = getattr(object, key) + except AttributeError: + continue if not predicate or predicate(value): results.append((key, value)) results.sort() diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -600,56 +600,30 @@ if isinstance(builtin, type): inspect.classify_class_attrs(builtin) - def test_getmembers_descriptors(self): + def test_getmembers_method(self): # Old-style classes - class A: - dd = _BrokenDataDescriptor() - md = _BrokenMethodDescriptor() + class B: + def f(self): + pass - self.assertEqual(inspect.getmembers(A, inspect.ismethoddescriptor), - [('md', A.__dict__['md'])]) - self.assertEqual(inspect.getmembers(A, inspect.isdatadescriptor), - [('dd', A.__dict__['dd'])]) - - class B(A): - pass - - self.assertEqual(inspect.getmembers(B, inspect.ismethoddescriptor), - [('md', A.__dict__['md'])]) - self.assertEqual(inspect.getmembers(B, inspect.isdatadescriptor), - [('dd', A.__dict__['dd'])]) + self.assertIn(('f', B.f), inspect.getmembers(B)) + # contrary to spec, ismethod() is also True for unbound methods + # (see #1785) + self.assertIn(('f', B.f), inspect.getmembers(B, inspect.ismethod)) + b = B() + self.assertIn(('f', b.f), inspect.getmembers(b)) + self.assertIn(('f', b.f), inspect.getmembers(b, inspect.ismethod)) # New-style classes - class A(object): - dd = _BrokenDataDescriptor() - md = _BrokenMethodDescriptor() + class B(object): + def f(self): + pass - def pred_wrapper(pred): - # A quick'n'dirty way to discard standard attributes of new-style - # classes. - class Empty(object): - pass - def wrapped(x): - if hasattr(x, '__name__') and hasattr(Empty, x.__name__): - return False - return pred(x) - return wrapped - - ismethoddescriptor = pred_wrapper(inspect.ismethoddescriptor) - isdatadescriptor = pred_wrapper(inspect.isdatadescriptor) - - self.assertEqual(inspect.getmembers(A, ismethoddescriptor), - [('md', A.__dict__['md'])]) - self.assertEqual(inspect.getmembers(A, isdatadescriptor), - [('dd', A.__dict__['dd'])]) - - class B(A): - pass - - self.assertEqual(inspect.getmembers(B, ismethoddescriptor), - [('md', A.__dict__['md'])]) - self.assertEqual(inspect.getmembers(B, isdatadescriptor), - [('dd', A.__dict__['dd'])]) + self.assertIn(('f', B.f), inspect.getmembers(B)) + self.assertIn(('f', B.f), inspect.getmembers(B, inspect.ismethod)) + b = B() + self.assertIn(('f', b.f), inspect.getmembers(b)) + self.assertIn(('f', b.f), inspect.getmembers(b, inspect.ismethod)) class TestGetcallargsFunctions(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 17:44:51 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 17:44:51 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Add_part_of_tes?= =?utf8?q?t=5Finspect_test_from_2=2E7?= Message-ID: http://hg.python.org/cpython/rev/93de14a05172 changeset: 74502:93de14a05172 branch: 3.2 parent: 74499:5fb379fcdc75 user: Antoine Pitrou date: Wed Jan 18 17:40:18 2012 +0100 summary: Add part of test_inspect test from 2.7 files: Lib/test/test_inspect.py | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -650,6 +650,17 @@ self.assertEqual(inspect.getmembers(B, isdatadescriptor), [('dd', A.__dict__['dd'])]) + def test_getmembers_method(self): + class B: + def f(self): + pass + + self.assertIn(('f', B.f), inspect.getmembers(B)) + self.assertNotIn(('f', B.f), inspect.getmembers(B, inspect.ismethod)) + b = B() + self.assertIn(('f', b.f), inspect.getmembers(b)) + self.assertIn(('f', b.f), inspect.getmembers(b, inspect.ismethod)) + class TestGetcallargsFunctions(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 17:44:52 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 17:44:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Add_part_of_test=5Finspect_test_from_2=2E7?= Message-ID: http://hg.python.org/cpython/rev/4724133dc974 changeset: 74503:4724133dc974 parent: 74500:095de2293f39 parent: 74502:93de14a05172 user: Antoine Pitrou date: Wed Jan 18 17:40:48 2012 +0100 summary: Add part of test_inspect test from 2.7 files: Lib/test/test_inspect.py | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -650,6 +650,17 @@ self.assertEqual(inspect.getmembers(B, isdatadescriptor), [('dd', A.__dict__['dd'])]) + def test_getmembers_method(self): + class B: + def f(self): + pass + + self.assertIn(('f', B.f), inspect.getmembers(B)) + self.assertNotIn(('f', B.f), inspect.getmembers(B, inspect.ismethod)) + b = B() + self.assertIn(('f', b.f), inspect.getmembers(b)) + self.assertIn(('f', b.f), inspect.getmembers(b, inspect.ismethod)) + class TestGetcallargsFunctions(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 19:26:06 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 19:26:06 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_the_issue_of_single-digit_?= =?utf8?q?version_numbers=2E?= Message-ID: http://hg.python.org/peps/rev/ffbb60b5724b changeset: 4016:ffbb60b5724b user: Antoine Pitrou date: Wed Jan 18 19:20:58 2012 +0100 summary: Add the issue of single-digit version numbers. files: pep-0407.txt | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/pep-0407.txt b/pep-0407.txt --- a/pep-0407.txt +++ b/pep-0407.txt @@ -152,6 +152,10 @@ releases and which are LTS releases? How do we manage user expectations? +* Does the faster release cycle mean we could some day reach 3.10 and + above? Some people expressed a tacit expectation that version numbers + always fit in one decimal digit. + A community poll or survey to collect opinions from the greater Python community would be valuable before making a final decision. -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Wed Jan 18 20:23:41 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 20:23:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_the_builtin?= =?utf8?q?_module_initialization_code_to_store_the_init_function_for?= Message-ID: http://hg.python.org/cpython/rev/f0cbceef47c3 changeset: 74504:f0cbceef47c3 branch: 3.2 parent: 74502:93de14a05172 user: Antoine Pitrou date: Wed Jan 18 20:16:09 2012 +0100 summary: Fix the builtin module initialization code to store the init function for future reinitialization. files: Misc/NEWS | 3 +++ Python/import.c | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Fix the builtin module initialization code to store the init function for + future reinitialization. + - Issue #13629: Renumber the tokens in token.h so that they match the indexes into _PyParser_TokenNames. diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -2169,6 +2169,7 @@ for (p = PyImport_Inittab; p->name != NULL; p++) { PyObject *mod; + PyModuleDef *def; if (strcmp(name, p->name) == 0) { if (p->initfunc == NULL) { PyErr_Format(PyExc_ImportError, @@ -2181,6 +2182,9 @@ mod = (*p->initfunc)(); if (mod == 0) return -1; + /* Remember pointer to module init function. */ + def = PyModule_GetDef(mod); + def->m_base.m_init = p->initfunc; if (_PyImport_FixupBuiltin(mod, name) < 0) return -1; /* FixupExtension has put the module into sys.modules, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 20:23:42 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 20:23:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_the_builtin_module_initialization_code_to_store_the_init?= =?utf8?q?_function_for?= Message-ID: http://hg.python.org/cpython/rev/3fee4f07aeab changeset: 74505:3fee4f07aeab parent: 74503:4724133dc974 parent: 74504:f0cbceef47c3 user: Antoine Pitrou date: Wed Jan 18 20:17:58 2012 +0100 summary: Fix the builtin module initialization code to store the init function for future reinitialization. files: Misc/NEWS | 3 +++ Python/import.c | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Fix the builtin module initialization code to store the init function for + future reinitialization. + - Issue #13629: Renumber the tokens in token.h so that they match the indexes into _PyParser_TokenNames. diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -2542,6 +2542,7 @@ for (p = PyImport_Inittab; p->name != NULL; p++) { PyObject *mod; + PyModuleDef *def; if (PyUnicode_CompareWithASCIIString(name, p->name) == 0) { if (p->initfunc == NULL) { PyErr_Format(PyExc_ImportError, @@ -2554,6 +2555,9 @@ mod = (*p->initfunc)(); if (mod == 0) return -1; + /* Remember pointer to module init function. */ + def = PyModule_GetDef(mod); + def->m_base.m_init = p->initfunc; if (_PyImport_FixupExtensionObject(mod, name, name) < 0) return -1; /* FixupExtension has put the module into sys.modules, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 21:29:34 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 21:29:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_refleaks_in?= =?utf8?q?_test=5Fcapi?= Message-ID: http://hg.python.org/cpython/rev/5ffa409af22e changeset: 74506:5ffa409af22e branch: 3.2 parent: 74504:f0cbceef47c3 user: Antoine Pitrou date: Wed Jan 18 21:23:13 2012 +0100 summary: Fix refleaks in test_capi (this was easier than I thought!) files: Objects/exceptions.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -1959,10 +1959,14 @@ */ PyObject *PyExc_RecursionErrorInst = NULL; -#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \ - Py_FatalError("exceptions bootstrapping error."); +#define PRE_INIT(TYPE) \ + if (!(_PyExc_ ## TYPE.tp_flags & Py_TPFLAGS_READY)) { \ + if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \ + Py_FatalError("exceptions bootstrapping error."); \ + Py_INCREF(PyExc_ ## TYPE); \ + } -#define POST_INIT(TYPE) Py_INCREF(PyExc_ ## TYPE); \ +#define POST_INIT(TYPE) \ if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \ Py_FatalError("Module dictionary insertion problem."); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 21:29:35 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 21:29:35 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_some_of_the_refleaks_in_test=5Fcapi_=28ported_from_3=2E2?= =?utf8?q?=29?= Message-ID: http://hg.python.org/cpython/rev/0db59d274d68 changeset: 74507:0db59d274d68 parent: 74505:3fee4f07aeab parent: 74506:5ffa409af22e user: Antoine Pitrou date: Wed Jan 18 21:24:18 2012 +0100 summary: Fix some of the refleaks in test_capi (ported from 3.2) files: Objects/exceptions.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2213,10 +2213,14 @@ */ PyObject *PyExc_RecursionErrorInst = NULL; -#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \ - Py_FatalError("exceptions bootstrapping error."); +#define PRE_INIT(TYPE) \ + if (!(_PyExc_ ## TYPE.tp_flags & Py_TPFLAGS_READY)) { \ + if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \ + Py_FatalError("exceptions bootstrapping error."); \ + Py_INCREF(PyExc_ ## TYPE); \ + } -#define POST_INIT(TYPE) Py_INCREF(PyExc_ ## TYPE); \ +#define POST_INIT(TYPE) \ if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \ Py_FatalError("Module dictionary insertion problem."); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 21:49:01 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 21:49:01 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_some_of_the_remaining_t?= =?utf8?q?est=5Fcapi_refleaks?= Message-ID: http://hg.python.org/cpython/rev/29a28018e567 changeset: 74508:29a28018e567 user: Antoine Pitrou date: Wed Jan 18 21:29:05 2012 +0100 summary: Fix some of the remaining test_capi refleaks files: Objects/exceptions.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2225,6 +2225,7 @@ Py_FatalError("Module dictionary insertion problem."); #define INIT_ALIAS(NAME, TYPE) Py_INCREF(PyExc_ ## TYPE); \ + Py_XDECREF(PyExc_ ## NAME); \ PyExc_ ## NAME = PyExc_ ## TYPE; \ if (PyDict_SetItemString(bdict, # NAME, PyExc_ ## NAME)) \ Py_FatalError("Module dictionary insertion problem."); @@ -2234,6 +2235,7 @@ assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \ if (!_code || PyDict_SetItem(errnomap, _code, PyExc_ ## TYPE)) \ Py_FatalError("errmap insertion problem."); \ + Py_DECREF(_code); \ } #ifdef MS_WINDOWS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 21:49:02 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 21:49:02 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_some_of_the_remaining_t?= =?utf8?q?est=5Fcapi_leaks?= Message-ID: http://hg.python.org/cpython/rev/44d8aa3c1003 changeset: 74509:44d8aa3c1003 user: Antoine Pitrou date: Wed Jan 18 21:35:21 2012 +0100 summary: Fix some of the remaining test_capi leaks files: Objects/exceptions.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -2400,9 +2400,11 @@ POST_INIT(BytesWarning) POST_INIT(ResourceWarning) - errnomap = PyDict_New(); - if (!errnomap) - Py_FatalError("Cannot allocate map from errnos to OSError subclasses"); + if (!errnomap) { + errnomap = PyDict_New(); + if (!errnomap) + Py_FatalError("Cannot allocate map from errnos to OSError subclasses"); + } /* OSError subclasses */ POST_INIT(ConnectionError); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 21:49:03 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 21:49:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Finally_fix_all_test=5Fcapi?= =?utf8?q?_refleaks?= Message-ID: http://hg.python.org/cpython/rev/c19b0ae5cd91 changeset: 74510:c19b0ae5cd91 user: Antoine Pitrou date: Wed Jan 18 21:45:15 2012 +0100 summary: Finally fix all test_capi refleaks files: Python/_warnings.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -958,23 +958,30 @@ if (m == NULL) return NULL; - _filters = init_filters(); - if (_filters == NULL) - return NULL; + if (_filters == NULL) { + _filters = init_filters(); + if (_filters == NULL) + return NULL; + } Py_INCREF(_filters); if (PyModule_AddObject(m, "filters", _filters) < 0) return NULL; - _once_registry = PyDict_New(); - if (_once_registry == NULL) - return NULL; + if (_once_registry == NULL) { + _once_registry = PyDict_New(); + if (_once_registry == NULL) + return NULL; + } Py_INCREF(_once_registry); if (PyModule_AddObject(m, "_onceregistry", _once_registry) < 0) return NULL; - _default_action = PyUnicode_FromString("default"); - if (_default_action == NULL) - return NULL; + if (_default_action == NULL) { + _default_action = PyUnicode_FromString("default"); + if (_default_action == NULL) + return NULL; + } + Py_INCREF(_default_action); if (PyModule_AddObject(m, "_defaultaction", _default_action) < 0) return NULL; return m; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 22:35:47 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 22:35:47 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzIy?= =?utf8?q?=3A_Avoid_silencing_ImportErrors_when_initializing_the_codecs?= Message-ID: http://hg.python.org/cpython/rev/46b245f03f54 changeset: 74511:46b245f03f54 branch: 3.2 parent: 74506:5ffa409af22e user: Antoine Pitrou date: Wed Jan 18 22:30:21 2012 +0100 summary: Issue #13722: Avoid silencing ImportErrors when initializing the codecs registry. files: Misc/NEWS | 3 +++ Python/codecs.c | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -103,6 +103,9 @@ Library ------- +- Issue #13722: Avoid silencing ImportErrors when initializing the codecs + registry. + - Issue #13781: Fix GzipFile bug that caused an exception to be raised when opening for writing using a fileobj returned by os.fdopen(). diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -1067,15 +1067,6 @@ mod = PyImport_ImportModuleNoBlock("encodings"); if (mod == NULL) { - if (PyErr_ExceptionMatches(PyExc_ImportError)) { - /* Ignore ImportErrors... this is done so that - distributions can disable the encodings package. Note - that other errors are not masked, e.g. SystemErrors - raised to inform the user of an error in the Python - configuration are still reported back to the user. */ - PyErr_Clear(); - return 0; - } return -1; } Py_DECREF(mod); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 22:35:48 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 22:35:48 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313722=3A_Avoid_silencing_ImportErrors_when_initiali?= =?utf8?q?zing_the_codecs?= Message-ID: http://hg.python.org/cpython/rev/f55529aa023d changeset: 74512:f55529aa023d parent: 74510:c19b0ae5cd91 parent: 74511:46b245f03f54 user: Antoine Pitrou date: Wed Jan 18 22:31:12 2012 +0100 summary: Issue #13722: Avoid silencing ImportErrors when initializing the codecs registry. files: Misc/NEWS | 3 +++ Python/codecs.c | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -450,6 +450,9 @@ Library ------- +- Issue #13722: Avoid silencing ImportErrors when initializing the codecs + registry. + - Issue #13781: Fix GzipFile bug that caused an exception to be raised when opening for writing using a fileobj returned by os.fdopen(). diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -1041,15 +1041,6 @@ mod = PyImport_ImportModuleNoBlock("encodings"); if (mod == NULL) { - if (PyErr_ExceptionMatches(PyExc_ImportError)) { - /* Ignore ImportErrors... this is done so that - distributions can disable the encodings package. Note - that other errors are not masked, e.g. SystemErrors - raised to inform the user of an error in the Python - configuration are still reported back to the user. */ - PyErr_Clear(); - return 0; - } return -1; } Py_DECREF(mod); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 22:37:46 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 18 Jan 2012 22:37:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Be_more_lenient_in_test=5Fw?= =?utf8?q?allclock_=28issue_=2310278=29=2E?= Message-ID: http://hg.python.org/cpython/rev/83e8c3a6a81c changeset: 74513:83e8c3a6a81c user: Antoine Pitrou date: Wed Jan 18 22:35:21 2012 +0100 summary: Be more lenient in test_wallclock (issue #10278). files: Lib/test/test_time.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -331,13 +331,13 @@ pass self.assertEqual(time.strftime('%Z', tt), tzname) - def test_wallclock(self): t0 = time.wallclock() time.sleep(0.1) t1 = time.wallclock() t = t1 - t0 - self.assertAlmostEqual(t, 0.1, places=2) + self.assertAlmostEqual(t, 0.1, delta=0.2) + class TestLocale(unittest.TestCase): def setUp(self): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 18 23:41:56 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 18 Jan 2012 23:41:56 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNzgx?= =?utf8?q?=3A_Fix_GzipFile_to_work_with_os=2Efdopen=28=29=27d_file_objects?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/a08e9e84f33f changeset: 74514:a08e9e84f33f branch: 2.7 parent: 74501:f824744557ba user: Nadeem Vawda date: Thu Jan 19 00:40:46 2012 +0200 summary: Issue #13781: Fix GzipFile to work with os.fdopen()'d file objects. files: Lib/gzip.py | 8 ++++++-- Lib/test/test_gzip.py | 8 ++++++++ Misc/NEWS | 3 +++ Modules/posixmodule.c | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Lib/gzip.py b/Lib/gzip.py --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -88,8 +88,12 @@ if fileobj is None: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') if filename is None: - if hasattr(fileobj, 'name'): filename = fileobj.name - else: filename = '' + # Issue #13781: os.fdopen() creates a fileobj with a bogus name + # attribute. Avoid saving this in the gzip header's filename field. + if hasattr(fileobj, 'name') and fileobj.name != '': + filename = fileobj.name + else: + filename = '' if mode is None: if hasattr(fileobj, 'mode'): mode = fileobj.mode else: mode = 'rb' diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -274,6 +274,14 @@ d = f.read() self.assertEqual(d, data1 * 50, "Incorrect data in file") + def test_fileobj_from_fdopen(self): + # Issue #13781: Creating a GzipFile using a fileobj from os.fdopen() + # should not embed the fake filename "" in the output file. + fd = os.open(self.filename, os.O_WRONLY | os.O_CREAT) + with os.fdopen(fd, "wb") as f: + with gzip.GzipFile(fileobj=f, mode="w") as g: + self.assertEqual(g.name, "") + def test_main(verbose=None): test_support.run_unittest(TestGzip) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -89,6 +89,9 @@ Library ------- +- Issue #13781: Prevent gzip.GzipFile from using the dummy filename provided by + file objects opened with os.fdopen(). + - Issue #13589: Fix some serialization primitives in the aifc module. Patch by Oleg Plakhotnyuk. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6755,6 +6755,8 @@ PyMem_FREE(mode); if (fp == NULL) return posix_error(); + /* The dummy filename used here must be kept in sync with the value + tested against in gzip.GzipFile.__init__() - see issue #13781. */ f = PyFile_FromFile(fp, "", orgmode, fclose); if (f != NULL) PyFile_SetBufSize(f, bufsize); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 05:09:41 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 19 Jan 2012 05:09:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_improve_casefold/lower/uppe?= =?utf8?q?r_docs?= Message-ID: http://hg.python.org/cpython/rev/0b5ce36a7a24 changeset: 74515:0b5ce36a7a24 parent: 74513:83e8c3a6a81c user: Benjamin Peterson date: Wed Jan 18 23:09:32 2012 -0500 summary: improve casefold/lower/upper docs files: Doc/library/stdtypes.rst | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1005,7 +1005,16 @@ .. method:: str.casefold() Return a casefolded copy of the string. Casefolded strings may be used for - caseless matching. For example, ``"MASSE".casefold() == "ma?e".casefold()``. + caseless matching. + + Casefolding is similar to lowercasing but more aggressive because it is + intended to remove all case distinctions in a string. For example, the German + lowercase letter ``'?'`` is equivalent to ``"ss"``. Since it is already + lowercase, :meth:`lower` would do nothing to ``'?'``; :meth:`casefold` + converts it to ``"ss"``. + + The casefolding algorithm is described in section 3.13 of the Unicode + Standard. .. versionadded:: 3.3 @@ -1217,6 +1226,9 @@ Return a copy of the string with all the cased characters [4]_ converted to lowercase. + The lowercasing algorithm used is described in section 3.13 of the Unicode + Standard. + .. method:: str.lstrip([chars]) @@ -1420,7 +1432,11 @@ Return a copy of the string with all the cased characters [4]_ converted to uppercase. Note that ``str.upper().isupper()`` might be ``False`` if ``s`` contains uncased characters or if the Unicode category of the resulting - character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter, titlecase). + character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter, + titlecase). + + The uppercasing algorithm used is described in section 3.13 of the Unicode + Standard. .. method:: str.zfill(width) -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Jan 19 05:34:40 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 19 Jan 2012 05:34:40 +0100 Subject: [Python-checkins] Daily reference leaks (83e8c3a6a81c): sum=0 Message-ID: results for 83e8c3a6a81c on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogEJM4xJ', '-x'] From python-checkins at python.org Thu Jan 19 07:46:54 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 19 Jan 2012 07:46:54 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIxMzQ6?= =?utf8?q?_Clarify_token=2EOP_handling_rationale_in_tokenize_documentation?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/75baef657770 changeset: 74516:75baef657770 branch: 2.7 parent: 74514:a08e9e84f33f user: Meador Inge date: Thu Jan 19 00:17:44 2012 -0600 summary: Issue #2134: Clarify token.OP handling rationale in tokenize documentation. files: Doc/library/tokenize.rst | 6 ++++++ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -15,6 +15,12 @@ well, making it useful for implementing "pretty-printers," including colorizers for on-screen displays. +To simplify token stream handling, all :ref:`operators` and :ref:`delimiters` +tokens are returned using the generic :data:`token.OP` token type. The exact +type can be determined by checking the token ``string`` field on the +:term:`named tuple` returned from :func:`tokenize.tokenize` for the character +sequence that identifies a specific operator token. + The primary entry point is a :term:`generator`: .. function:: generate_tokens(readline) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -495,6 +495,9 @@ Documentation ------------- +- Issue #2134: The tokenize documentation has been clarified to explain why + all operator and delimiter tokens are treated as token.OP tokens. + - Issue #13513: Fix io.IOBase documentation to correctly link to the io.IOBase.readline method instead of the readline module. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 07:46:55 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 19 Jan 2012 07:46:55 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzIxMzQ6?= =?utf8?q?_Clarify_token=2EOP_handling_rationale_in_tokenize_documentation?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/dfd74d752b0e changeset: 74517:dfd74d752b0e branch: 3.2 parent: 74511:46b245f03f54 user: Meador Inge date: Thu Jan 19 00:22:22 2012 -0600 summary: Issue #2134: Clarify token.OP handling rationale in tokenize documentation. files: Doc/library/tokenize.rst | 6 ++++++ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -15,6 +15,12 @@ as well, making it useful for implementing "pretty-printers," including colorizers for on-screen displays. +To simplify token stream handling, all :ref:`operators` and :ref:`delimiters` +tokens are returned using the generic :data:`token.OP` token type. The exact +type can be determined by checking the token ``string`` field on the +:term:`named tuple` returned from :func:`tokenize.tokenize` for the character +sequence that identifies a specific operator token. + The primary entry point is a :term:`generator`: .. function:: tokenize(readline) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -418,6 +418,9 @@ Documentation ------------- +- Issue #2134: The tokenize documentation has been clarified to explain why + all operator and delimiter tokens are treated as token.OP tokens. + - Issue #13513: Fix io.IOBase documentation to correctly link to the io.IOBase.readline method instead of the readline module. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 07:46:56 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 19 Jan 2012 07:46:56 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Null_merge?= Message-ID: http://hg.python.org/cpython/rev/c535fcd2f0d4 changeset: 74518:c535fcd2f0d4 parent: 74515:0b5ce36a7a24 parent: 74517:dfd74d752b0e user: Meador Inge date: Thu Jan 19 00:34:21 2012 -0600 summary: Null merge files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 07:46:57 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 19 Jan 2012 07:46:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=232134=3A_Add_suppor?= =?utf8?q?t_for_tokenize=2ETokenInfo=2Eexact=5Ftype=2E?= Message-ID: http://hg.python.org/cpython/rev/f4976fa6e830 changeset: 74519:f4976fa6e830 user: Meador Inge date: Thu Jan 19 00:44:45 2012 -0600 summary: Issue #2134: Add support for tokenize.TokenInfo.exact_type. files: Doc/library/tokenize.rst | 53 ++++++++++++++++++- Lib/test/test_tokenize.py | 75 ++++++++++++++++++++++++++- Lib/tokenize.py | 59 ++++++++++++++++++++- Misc/NEWS | 3 + 4 files changed, 187 insertions(+), 3 deletions(-) diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -15,6 +15,11 @@ as well, making it useful for implementing "pretty-printers," including colorizers for on-screen displays. +To simplify token stream handling, all :ref:`operators` and :ref:`delimiters` +tokens are returned using the generic :data:`token.OP` token type. The exact +type can be determined by checking the ``exact_type`` property on the +:term:`named tuple` returned from :func:`tokenize.tokenize`. + Tokenizing Input ---------------- @@ -36,9 +41,17 @@ returned as a :term:`named tuple` with the field names: ``type string start end line``. + The returned :term:`named tuple` has a additional property named + ``exact_type`` that contains the exact operator type for + :data:`token.OP` tokens. For all other token types ``exact_type`` + equals the named tuple ``type`` field. + .. versionchanged:: 3.1 Added support for named tuples. + .. versionchanged:: 3.3 + Added support for ``exact_type``. + :func:`tokenize` determines the source encoding of the file by looking for a UTF-8 BOM or encoding cookie, according to :pep:`263`. @@ -131,7 +144,19 @@ .. code-block:: sh - python -m tokenize [filename.py] + python -m tokenize [-e] [filename.py] + +The following options are accepted: + +.. program:: tokenize + +.. cmdoption:: -h, --help + + show this help message and exit + +.. cmdoption:: -e, --exact + + display token names using the exact type If :file:`filename.py` is specified its contents are tokenized to stdout. Otherwise, tokenization is performed on stdin. @@ -215,3 +240,29 @@ 4,10-4,11: OP ')' 4,11-4,12: NEWLINE '\n' 5,0-5,0: ENDMARKER '' + +The exact token type names can be displayed using the ``-e`` option: + +.. code-block:: sh + + $ python -m tokenize -e hello.py + 0,0-0,0: ENCODING 'utf-8' + 1,0-1,3: NAME 'def' + 1,4-1,13: NAME 'say_hello' + 1,13-1,14: LPAR '(' + 1,14-1,15: RPAR ')' + 1,15-1,16: COLON ':' + 1,16-1,17: NEWLINE '\n' + 2,0-2,4: INDENT ' ' + 2,4-2,9: NAME 'print' + 2,9-2,10: LPAR '(' + 2,10-2,25: STRING '"Hello, World!"' + 2,25-2,26: RPAR ')' + 2,26-2,27: NEWLINE '\n' + 3,0-3,1: NL '\n' + 4,0-4,0: DEDENT '' + 4,0-4,9: NAME 'say_hello' + 4,9-4,10: LPAR '(' + 4,10-4,11: RPAR ')' + 4,11-4,12: NEWLINE '\n' + 5,0-5,0: ENDMARKER '' diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -567,11 +567,12 @@ from test import support from tokenize import (tokenize, _tokenize, untokenize, NUMBER, NAME, OP, - STRING, ENDMARKER, tok_name, detect_encoding, + STRING, ENDMARKER, ENCODING, tok_name, detect_encoding, open as tokenize_open) from io import BytesIO from unittest import TestCase import os, sys, glob +import token def dump_tokens(s): """Print out the tokens in s in a table format. @@ -922,6 +923,78 @@ self.assertTrue(encoding_used, encoding) + def assertExactTypeEqual(self, opstr, *optypes): + tokens = list(tokenize(BytesIO(opstr.encode('utf-8')).readline)) + num_optypes = len(optypes) + self.assertEqual(len(tokens), 2 + num_optypes) + self.assertEqual(token.tok_name[tokens[0].exact_type], + token.tok_name[ENCODING]) + for i in range(num_optypes): + self.assertEqual(token.tok_name[tokens[i + 1].exact_type], + token.tok_name[optypes[i]]) + self.assertEqual(token.tok_name[tokens[1 + num_optypes].exact_type], + token.tok_name[token.ENDMARKER]) + + def test_exact_type(self): + self.assertExactTypeEqual('()', token.LPAR, token.RPAR) + self.assertExactTypeEqual('[]', token.LSQB, token.RSQB) + self.assertExactTypeEqual(':', token.COLON) + self.assertExactTypeEqual(',', token.COMMA) + self.assertExactTypeEqual(';', token.SEMI) + self.assertExactTypeEqual('+', token.PLUS) + self.assertExactTypeEqual('-', token.MINUS) + self.assertExactTypeEqual('*', token.STAR) + self.assertExactTypeEqual('/', token.SLASH) + self.assertExactTypeEqual('|', token.VBAR) + self.assertExactTypeEqual('&', token.AMPER) + self.assertExactTypeEqual('<', token.LESS) + self.assertExactTypeEqual('>', token.GREATER) + self.assertExactTypeEqual('=', token.EQUAL) + self.assertExactTypeEqual('.', token.DOT) + self.assertExactTypeEqual('%', token.PERCENT) + self.assertExactTypeEqual('{}', token.LBRACE, token.RBRACE) + self.assertExactTypeEqual('==', token.EQEQUAL) + self.assertExactTypeEqual('!=', token.NOTEQUAL) + self.assertExactTypeEqual('<=', token.LESSEQUAL) + self.assertExactTypeEqual('>=', token.GREATEREQUAL) + self.assertExactTypeEqual('~', token.TILDE) + self.assertExactTypeEqual('^', token.CIRCUMFLEX) + self.assertExactTypeEqual('<<', token.LEFTSHIFT) + self.assertExactTypeEqual('>>', token.RIGHTSHIFT) + self.assertExactTypeEqual('**', token.DOUBLESTAR) + self.assertExactTypeEqual('+=', token.PLUSEQUAL) + self.assertExactTypeEqual('-=', token.MINEQUAL) + self.assertExactTypeEqual('*=', token.STAREQUAL) + self.assertExactTypeEqual('/=', token.SLASHEQUAL) + self.assertExactTypeEqual('%=', token.PERCENTEQUAL) + self.assertExactTypeEqual('&=', token.AMPEREQUAL) + self.assertExactTypeEqual('|=', token.VBAREQUAL) + self.assertExactTypeEqual('^=', token.CIRCUMFLEXEQUAL) + self.assertExactTypeEqual('^=', token.CIRCUMFLEXEQUAL) + self.assertExactTypeEqual('<<=', token.LEFTSHIFTEQUAL) + self.assertExactTypeEqual('>>=', token.RIGHTSHIFTEQUAL) + self.assertExactTypeEqual('**=', token.DOUBLESTAREQUAL) + self.assertExactTypeEqual('//', token.DOUBLESLASH) + self.assertExactTypeEqual('//=', token.DOUBLESLASHEQUAL) + self.assertExactTypeEqual('@', token.AT) + + self.assertExactTypeEqual('a**2+b**2==c**2', + NAME, token.DOUBLESTAR, NUMBER, + token.PLUS, + NAME, token.DOUBLESTAR, NUMBER, + token.EQEQUAL, + NAME, token.DOUBLESTAR, NUMBER) + self.assertExactTypeEqual('{1, 2, 3}', + token.LBRACE, + token.NUMBER, token.COMMA, + token.NUMBER, token.COMMA, + token.NUMBER, + token.RBRACE) + self.assertExactTypeEqual('^(x & 0x1)', + token.CIRCUMFLEX, + token.LPAR, + token.NAME, token.AMPER, token.NUMBER, + token.RPAR) __test__ = {"doctests" : doctests, 'decistmt': decistmt} diff --git a/Lib/tokenize.py b/Lib/tokenize.py --- a/Lib/tokenize.py +++ b/Lib/tokenize.py @@ -45,6 +45,51 @@ ENCODING = N_TOKENS + 2 tok_name[ENCODING] = 'ENCODING' N_TOKENS += 3 +EXACT_TOKEN_TYPES = { + '(': LPAR, + ')': RPAR, + '[': LSQB, + ']': RSQB, + ':': COLON, + ',': COMMA, + ';': SEMI, + '+': PLUS, + '-': MINUS, + '*': STAR, + '/': SLASH, + '|': VBAR, + '&': AMPER, + '<': LESS, + '>': GREATER, + '=': EQUAL, + '.': DOT, + '%': PERCENT, + '{': LBRACE, + '}': RBRACE, + '==': EQEQUAL, + '!=': NOTEQUAL, + '<=': LESSEQUAL, + '>=': GREATEREQUAL, + '~': TILDE, + '^': CIRCUMFLEX, + '<<': LEFTSHIFT, + '>>': RIGHTSHIFT, + '**': DOUBLESTAR, + '+=': PLUSEQUAL, + '-=': MINEQUAL, + '*=': STAREQUAL, + '/=': SLASHEQUAL, + '%=': PERCENTEQUAL, + '&=': AMPEREQUAL, + '|=': VBAREQUAL, + '^=': CIRCUMFLEXEQUAL, + '<<=': LEFTSHIFTEQUAL, + '>>=': RIGHTSHIFTEQUAL, + '**=': DOUBLESTAREQUAL, + '//': DOUBLESLASH, + '//=': DOUBLESLASHEQUAL, + '@': AT +} class TokenInfo(collections.namedtuple('TokenInfo', 'type string start end line')): def __repr__(self): @@ -52,6 +97,13 @@ return ('TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r)' % self._replace(type=annotated_type)) + @property + def exact_type(self): + if self.type == OP and self.string in EXACT_TOKEN_TYPES: + return EXACT_TOKEN_TYPES[self.string] + else: + return self.type + def group(*choices): return '(' + '|'.join(choices) + ')' def any(*choices): return group(*choices) + '*' def maybe(*choices): return group(*choices) + '?' @@ -549,6 +601,8 @@ parser.add_argument(dest='filename', nargs='?', metavar='filename.py', help='the file to tokenize; defaults to stdin') + parser.add_argument('-e', '--exact', dest='exact', action='store_true', + help='display token names using the exact type') args = parser.parse_args() try: @@ -563,9 +617,12 @@ # Output the tokenization for token in tokens: + token_type = token.type + if args.exact: + token_type = token.exact_type token_range = "%d,%d-%d,%d:" % (token.start + token.end) print("%-20s%-15s%-15r" % - (token_range, tok_name[token.type], token.string)) + (token_range, tok_name[token_type], token.string)) except IndentationError as err: line, column = err.args[1][1:3] error(err.args[0], filename, (line, column)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -450,6 +450,9 @@ Library ------- +- Issue #2134: A new attribute that specifies the exact type of token.OP + tokens has been added to tokenize.TokenInfo. + - Issue #13722: Avoid silencing ImportErrors when initializing the codecs registry. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 08:11:10 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 19 Jan 2012 08:11:10 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312705=3A_Raise_Syn?= =?utf8?q?taxError_when_compiling_multiple_statements_as_single?= Message-ID: http://hg.python.org/cpython/rev/2bd7f40108b4 changeset: 74520:2bd7f40108b4 user: Meador Inge date: Thu Jan 19 01:08:41 2012 -0600 summary: Issue #12705: Raise SyntaxError when compiling multiple statements as single interactive statement files: Include/errcode.h | 1 + Lib/test/test_compile.py | 28 ++++++++++++++++++++++++++++ Misc/NEWS | 3 +++ Parser/parsetok.c | 17 +++++++++++++++++ Python/pythonrun.c | 3 +++ 5 files changed, 52 insertions(+), 0 deletions(-) diff --git a/Include/errcode.h b/Include/errcode.h --- a/Include/errcode.h +++ b/Include/errcode.h @@ -30,6 +30,7 @@ #define E_EOLS 24 /* EOL in single-quoted string */ #define E_LINECONT 25 /* Unexpected characters after a line continuation */ #define E_IDENTIFIER 26 /* Invalid characters in identifier */ +#define E_BADSINGLE 27 /* Ill-formed single statement input */ #ifdef __cplusplus } diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -6,6 +6,12 @@ class TestSpecifics(unittest.TestCase): + def compile_single(self, source): + compile(source, "", "single") + + def assertInvalidSingle(self, source): + self.assertRaises(SyntaxError, self.compile_single, source) + def test_no_ending_newline(self): compile("hi", "", "exec") compile("hi\r", "", "exec") @@ -442,6 +448,28 @@ if isinstance(obj, types.CodeType): self.assertIs(obj.co_filename, c.co_filename) + def test_single_statement(self): + self.compile_single("1 + 2") + self.compile_single("\n1 + 2") + self.compile_single("1 + 2\n") + self.compile_single("1 + 2\n\n") + self.compile_single("1 + 2\t\t\n") + self.compile_single("1 + 2\t\t\n ") + self.compile_single("1 + 2 # one plus two") + self.compile_single("1; 2") + self.compile_single("import sys; sys") + self.compile_single("def f():\n pass") + self.compile_single("while False:\n pass") + self.compile_single("if x:\n f(x)") + self.compile_single("if x:\n f(x)\nelse:\n g(x)") + self.compile_single("class T:\n pass") + + def test_bad_single_statement(self): + self.assertInvalidSingle('1\n2') + self.assertInvalidSingle('def f(): pass') + self.assertInvalidSingle('a = 13\nb = 187') + self.assertInvalidSingle('del x\ndel y') + self.assertInvalidSingle('f()\ng()') def test_main(): support.run_unittest(TestSpecifics) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #12705: A SyntaxError exception is now raised when attempting to + compile multiple statements as a single interactive statement. + - Fix the builtin module initialization code to store the init function for future reinitialization. diff --git a/Parser/parsetok.c b/Parser/parsetok.c --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -224,6 +224,23 @@ if (err_ret->error == E_DONE) { n = ps->p_tree; ps->p_tree = NULL; + + /* Check that the source for a single input statement really + is a single statement by looking at what is left in the + buffer after parsing. Trailing whitespace and comments + are OK. */ + if (start == single_input) { + char *cur = tok->cur; + char c = *tok->cur; + + while (c == ' ' || c == '\t' || c == '\n' || c == '\014') + c = *++cur; + + if (c && c != '#') { + err_ret->error = E_BADSINGLE; + n = NULL; + } + } } else n = NULL; diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -2129,6 +2129,9 @@ case E_IDENTIFIER: msg = "invalid character in identifier"; break; + case E_BADSINGLE: + msg = "multiple statements found while compiling a single statement"; + break; default: fprintf(stderr, "error=%d\n", err->error); msg = "unknown parsing error"; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 11:32:51 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 11:32:51 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExOTQ4?= =?utf8?q?=3A_clarify_modules_search_path?= Message-ID: http://hg.python.org/cpython/rev/d01208ba482f changeset: 74521:d01208ba482f branch: 2.7 parent: 74516:75baef657770 user: Sandro Tosi date: Thu Jan 19 11:28:15 2012 +0100 summary: Issue #11948: clarify modules search path files: Doc/tutorial/modules.rst | 32 +++++++++++++-------------- 1 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -155,24 +155,22 @@ .. index:: triple: module; search; path -When a module named :mod:`spam` is imported, the interpreter searches for a -file named :file:`spam.py` in the directory containing the input script and -then in the list of directories specified by the environment variable -:envvar:`PYTHONPATH`. This has the same syntax as the shell variable -:envvar:`PATH`, that is, a list of directory names. When :envvar:`PYTHONPATH` -is not set, or when the file is not found there, the search continues in an -installation-dependent default path; on Unix, this is usually -:file:`.:/usr/local/lib/python`. +When a module named :mod:`spam` is imported, the interpreter first searches for +a built-in module with that name. If not found, it then searches for a file +named :file:`spam.py` in a list of directories given by the variable +:data:`sys.path`. :data:`sys.path` is initialized from these locations: -Actually, modules are searched in the list of directories given by the variable -``sys.path`` which is initialized from the directory containing the input script -(or the current directory), :envvar:`PYTHONPATH` and the installation- dependent -default. This allows Python programs that know what they're doing to modify or -replace the module search path. Note that because the directory containing the -script being run is on the search path, it is important that the script not have -the same name as a standard module, or Python will attempt to load the script as -a module when that module is imported. This will generally be an error. See -section :ref:`tut-standardmodules` for more information. +* the directory containing the input script (or the current directory). +* :envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the + shell variable :envvar:`PATH`). +* the installation-dependent default. + +After initialization, Python programs can modify :data:`sys.path`. The +directory containing the script being run is placed at the beginning of the +search path, ahead of the standard library path. This means that scripts in that +directory will be loaded instead of modules of the same name in the library +directory. This is an error unless the replacement is intended. See section +:ref:`tut-standardmodules` for more information. "Compiled" Python files -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 11:32:52 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 11:32:52 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzExOTQ4?= =?utf8?q?=3A_clarify_modules_search_path?= Message-ID: http://hg.python.org/cpython/rev/6d663db63705 changeset: 74522:6d663db63705 branch: 3.2 parent: 74517:dfd74d752b0e user: Sandro Tosi date: Thu Jan 19 11:29:26 2012 +0100 summary: Issue #11948: clarify modules search path files: Doc/tutorial/modules.rst | 32 +++++++++++++-------------- 1 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -159,24 +159,22 @@ .. index:: triple: module; search; path -When a module named :mod:`spam` is imported, the interpreter searches for a -file named :file:`spam.py` in the directory containing the input script and -then in the list of directories specified by the environment variable -:envvar:`PYTHONPATH`. This has the same syntax as the shell variable -:envvar:`PATH`, that is, a list of directory names. When :envvar:`PYTHONPATH` -is not set, or when the file is not found there, the search continues in an -installation-dependent default path; on Unix, this is usually -:file:`.:/usr/local/lib/python`. +When a module named :mod:`spam` is imported, the interpreter first searches for +a built-in module with that name. If not found, it then searches for a file +named :file:`spam.py` in a list of directories given by the variable +:data:`sys.path`. :data:`sys.path` is initialized from these locations: -Actually, modules are searched in the list of directories given by the variable -``sys.path`` which is initialized from the directory containing the input script -(or the current directory), :envvar:`PYTHONPATH` and the installation- dependent -default. This allows Python programs that know what they're doing to modify or -replace the module search path. Note that because the directory containing the -script being run is on the search path, it is important that the script not have -the same name as a standard module, or Python will attempt to load the script as -a module when that module is imported. This will generally be an error. See -section :ref:`tut-standardmodules` for more information. +* the directory containing the input script (or the current directory). +* :envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the + shell variable :envvar:`PATH`). +* the installation-dependent default. + +After initialization, Python programs can modify :data:`sys.path`. The +directory containing the script being run is placed at the beginning of the +search path, ahead of the standard library path. This means that scripts in that +directory will be loaded instead of modules of the same name in the library +directory. This is an error unless the replacement is intended. See section +:ref:`tut-standardmodules` for more information. .. % Do we need stuff on zip files etc. ? DUBOIS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 11:32:52 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 11:32:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2311948=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/93769b8ff40b changeset: 74523:93769b8ff40b parent: 74520:2bd7f40108b4 parent: 74522:6d663db63705 user: Sandro Tosi date: Thu Jan 19 11:29:48 2012 +0100 summary: Issue #11948: merge with 3.2 files: Doc/tutorial/modules.rst | 32 +++++++++++++-------------- 1 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -159,24 +159,22 @@ .. index:: triple: module; search; path -When a module named :mod:`spam` is imported, the interpreter searches for a -file named :file:`spam.py` in the directory containing the input script and -then in the list of directories specified by the environment variable -:envvar:`PYTHONPATH`. This has the same syntax as the shell variable -:envvar:`PATH`, that is, a list of directory names. When :envvar:`PYTHONPATH` -is not set, or when the file is not found there, the search continues in an -installation-dependent default path; on Unix, this is usually -:file:`.:/usr/local/lib/python`. +When a module named :mod:`spam` is imported, the interpreter first searches for +a built-in module with that name. If not found, it then searches for a file +named :file:`spam.py` in a list of directories given by the variable +:data:`sys.path`. :data:`sys.path` is initialized from these locations: -Actually, modules are searched in the list of directories given by the variable -``sys.path`` which is initialized from the directory containing the input script -(or the current directory), :envvar:`PYTHONPATH` and the installation- dependent -default. This allows Python programs that know what they're doing to modify or -replace the module search path. Note that because the directory containing the -script being run is on the search path, it is important that the script not have -the same name as a standard module, or Python will attempt to load the script as -a module when that module is imported. This will generally be an error. See -section :ref:`tut-standardmodules` for more information. +* the directory containing the input script (or the current directory). +* :envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the + shell variable :envvar:`PATH`). +* the installation-dependent default. + +After initialization, Python programs can modify :data:`sys.path`. The +directory containing the script being run is placed at the beginning of the +search path, ahead of the standard library path. This means that scripts in that +directory will be loaded instead of modules of the same name in the library +directory. This is an error unless the replacement is intended. See section +:ref:`tut-standardmodules` for more information. .. % Do we need stuff on zip files etc. ? DUBOIS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 14:48:23 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 19 Jan 2012 14:48:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_only_check_this_when_parsin?= =?utf8?q?g_python?= Message-ID: http://hg.python.org/cpython/rev/24198f86d523 changeset: 74524:24198f86d523 user: Benjamin Peterson date: Thu Jan 19 08:48:11 2012 -0500 summary: only check this when parsing python files: Parser/parsetok.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Parser/parsetok.c b/Parser/parsetok.c --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -225,6 +225,7 @@ n = ps->p_tree; ps->p_tree = NULL; +#ifndef PGEN /* Check that the source for a single input statement really is a single statement by looking at what is left in the buffer after parsing. Trailing whitespace and comments @@ -241,6 +242,7 @@ n = NULL; } } +#endif } else n = NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 14:48:24 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 19 Jan 2012 14:48:24 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_don=27t_leak_node?= Message-ID: http://hg.python.org/cpython/rev/053fbceaf789 changeset: 74525:053fbceaf789 user: Benjamin Peterson date: Thu Jan 19 08:48:18 2012 -0500 summary: don't leak node files: Parser/parsetok.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Parser/parsetok.c b/Parser/parsetok.c --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -239,6 +239,7 @@ if (c && c != '#') { err_ret->error = E_BADSINGLE; + PyNode_Free(n); n = NULL; } } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 22:03:31 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 22:03:31 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNjA1?= =?utf8?q?=3A_add_documentation_for_nargs=3Dargparse=2EREMAINDER?= Message-ID: http://hg.python.org/cpython/rev/35665f6f3674 changeset: 74526:35665f6f3674 branch: 2.7 parent: 74521:d01208ba482f user: Sandro Tosi date: Thu Jan 19 21:59:34 2012 +0100 summary: Issue #13605: add documentation for nargs=argparse.REMAINDER files: Doc/library/argparse.rst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -838,6 +838,17 @@ usage: PROG [-h] foo [foo ...] PROG: error: too few arguments +* ``argparse.REMAINDER``. All the remaining command-line arguments + are gathered into a lits. This is commonly useful for command line + utilities that dispatch to other command line utilities. + + >>> parser = argparse.ArgumentParser(prog='PROG') + >>> parser.add_argument('--foo') + >>> parser.add_argument('command') + >>> parser.add_argument('args', nargs=argparse.REMAINDER) + >>> print parser.parse_args('--foo B XX YY ZZ'.split()) + Namespace(args=['YY', 'ZZ'], command='XX', foo='B') + If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument will be consumed and a single item (not a list) will be produced. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 22:03:38 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 22:03:38 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313605=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/6b4cec0719a3 changeset: 74528:6b4cec0719a3 parent: 74525:053fbceaf789 parent: 74527:6f3d55f5a31e user: Sandro Tosi date: Thu Jan 19 22:00:21 2012 +0100 summary: Issue #13605: merge with 3.2 files: Doc/library/argparse.rst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -859,6 +859,17 @@ usage: PROG [-h] foo [foo ...] PROG: error: too few arguments +* ``argparse.REMAINDER``. All the remaining command-line arguments + are gathered into a lits. This is commonly useful for command line + utilities that dispatch to other command line utilities. + + >>> parser = argparse.ArgumentParser(prog='PROG') + >>> parser.add_argument('--foo') + >>> parser.add_argument('command') + >>> parser.add_argument('args', nargs=argparse.REMAINDER) + >>> print parser.parse_args('--foo B XX YY ZZ'.split()) + Namespace(args=['YY', 'ZZ'], command='XX', foo='B') + If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument will be consumed and a single item (not a list) will be produced. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 22:03:32 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 22:03:32 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjA1?= =?utf8?q?=3A_add_documentation_for_nargs=3Dargparse=2EREMAINDER?= Message-ID: http://hg.python.org/cpython/rev/6f3d55f5a31e changeset: 74527:6f3d55f5a31e branch: 3.2 parent: 74522:6d663db63705 user: Sandro Tosi date: Thu Jan 19 21:59:55 2012 +0100 summary: Issue #13605: add documentation for nargs=argparse.REMAINDER files: Doc/library/argparse.rst | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -840,6 +840,17 @@ usage: PROG [-h] foo [foo ...] PROG: error: too few arguments +* ``argparse.REMAINDER``. All the remaining command-line arguments + are gathered into a lits. This is commonly useful for command line + utilities that dispatch to other command line utilities. + + >>> parser = argparse.ArgumentParser(prog='PROG') + >>> parser.add_argument('--foo') + >>> parser.add_argument('command') + >>> parser.add_argument('args', nargs=argparse.REMAINDER) + >>> print parser.parse_args('--foo B XX YY ZZ'.split()) + Namespace(args=['YY', 'ZZ'], command='XX', foo='B') + If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument will be consumed and a single item (not a list) will be produced. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 22:26:25 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 22:26:25 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzNjA1?= =?utf8?q?=3A_more_meaningful_example_+_fixes?= Message-ID: http://hg.python.org/cpython/rev/1b481e76cd16 changeset: 74529:1b481e76cd16 branch: 2.7 parent: 74526:35665f6f3674 user: Sandro Tosi date: Thu Jan 19 22:22:35 2012 +0100 summary: Issue #13605: more meaningful example + fixes files: Doc/library/argparse.rst | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -838,16 +838,16 @@ usage: PROG [-h] foo [foo ...] PROG: error: too few arguments -* ``argparse.REMAINDER``. All the remaining command-line arguments - are gathered into a lits. This is commonly useful for command line - utilities that dispatch to other command line utilities. +* ``argparse.REMAINDER``. All the remaining command-line arguments are gathered + into a list. This is commonly useful for command line utilities that dispatch + to other command line utilities. >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo') >>> parser.add_argument('command') >>> parser.add_argument('args', nargs=argparse.REMAINDER) - >>> print parser.parse_args('--foo B XX YY ZZ'.split()) - Namespace(args=['YY', 'ZZ'], command='XX', foo='B') + >>> print parser.parse_args('--foo B cmd --arg1 XX ZZ'.split()) + Namespace(args=['--arg1', 'XX', 'ZZ'], command='cmd', foo='B') If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 22:26:28 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 22:26:28 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNjA1?= =?utf8?q?=3A_more_meaningful_example_+_fixes?= Message-ID: http://hg.python.org/cpython/rev/d6e53d1f46eb changeset: 74530:d6e53d1f46eb branch: 3.2 parent: 74527:6f3d55f5a31e user: Sandro Tosi date: Thu Jan 19 22:23:00 2012 +0100 summary: Issue #13605: more meaningful example + fixes files: Doc/library/argparse.rst | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -840,16 +840,16 @@ usage: PROG [-h] foo [foo ...] PROG: error: too few arguments -* ``argparse.REMAINDER``. All the remaining command-line arguments - are gathered into a lits. This is commonly useful for command line - utilities that dispatch to other command line utilities. +* ``argparse.REMAINDER``. All the remaining command-line arguments are gathered + into a list. This is commonly useful for command line utilities that dispatch + to other command line utilities. >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo') >>> parser.add_argument('command') >>> parser.add_argument('args', nargs=argparse.REMAINDER) - >>> print parser.parse_args('--foo B XX YY ZZ'.split()) - Namespace(args=['YY', 'ZZ'], command='XX', foo='B') + >>> print parser.parse_args('--foo B cmd --arg1 XX ZZ'.split()) + Namespace(args=['--arg1', 'XX', 'ZZ'], command='cmd', foo='B') If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 19 22:26:30 2012 From: python-checkins at python.org (sandro.tosi) Date: Thu, 19 Jan 2012 22:26:30 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313605=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/4c3271527794 changeset: 74531:4c3271527794 parent: 74528:6b4cec0719a3 parent: 74530:d6e53d1f46eb user: Sandro Tosi date: Thu Jan 19 22:23:17 2012 +0100 summary: Issue #13605: merge with 3.2 files: Doc/library/argparse.rst | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -859,16 +859,16 @@ usage: PROG [-h] foo [foo ...] PROG: error: too few arguments -* ``argparse.REMAINDER``. All the remaining command-line arguments - are gathered into a lits. This is commonly useful for command line - utilities that dispatch to other command line utilities. +* ``argparse.REMAINDER``. All the remaining command-line arguments are gathered + into a list. This is commonly useful for command line utilities that dispatch + to other command line utilities. >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo') >>> parser.add_argument('command') >>> parser.add_argument('args', nargs=argparse.REMAINDER) - >>> print parser.parse_args('--foo B XX YY ZZ'.split()) - Namespace(args=['YY', 'ZZ'], command='XX', foo='B') + >>> print parser.parse_args('--foo B cmd --arg1 XX ZZ'.split()) + Namespace(args=['--arg1', 'XX', 'ZZ'], command='cmd', foo='B') If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line argument -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Thu Jan 19 22:07:27 2012 From: tjreedy at udel.edu (Terry Reedy) Date: Thu, 19 Jan 2012 16:07:27 -0500 Subject: [Python-checkins] cpython (2.7): Issue #13605: add documentation for nargs=argparse.REMAINDER In-Reply-To: References: Message-ID: <4F18860F.7030909@udel.edu> typo On 1/19/2012 4:03 PM, sandro.tosi wrote: > http://hg.python.org/cpython/rev/35665f6f3674 > changeset: 74526:35665f6f3674 > branch: 2.7 > parent: 74521:d01208ba482f > user: Sandro Tosi > date: Thu Jan 19 21:59:34 2012 +0100 > summary: > Issue #13605: add documentation for nargs=argparse.REMAINDER > > +* ``argparse.REMAINDER``. All the remaining command-line arguments > + are gathered into a lits. This is commonly useful for command line lits .> list From python-checkins at python.org Thu Jan 19 23:48:31 2012 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 19 Jan 2012 23:48:31 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_check_after_comments=2C_too?= =?utf8?b?ICgjMTM4MzIp?= Message-ID: http://hg.python.org/cpython/rev/00c4efbf57c3 changeset: 74532:00c4efbf57c3 user: Benjamin Peterson date: Thu Jan 19 17:46:13 2012 -0500 summary: check after comments, too (#13832) files: Lib/test/test_compile.py | 2 ++ Parser/parsetok.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -470,6 +470,8 @@ self.assertInvalidSingle('a = 13\nb = 187') self.assertInvalidSingle('del x\ndel y') self.assertInvalidSingle('f()\ng()') + self.assertInvalidSingle('f()\n# blah\nblah()') + self.assertInvalidSingle('f()\nxy # blah\nblah()') def test_main(): support.run_unittest(TestSpecifics) diff --git a/Parser/parsetok.c b/Parser/parsetok.c --- a/Parser/parsetok.c +++ b/Parser/parsetok.c @@ -234,13 +234,23 @@ char *cur = tok->cur; char c = *tok->cur; - while (c == ' ' || c == '\t' || c == '\n' || c == '\014') - c = *++cur; + for (;;) { + while (c == ' ' || c == '\t' || c == '\n' || c == '\014') + c = *++cur; - if (c && c != '#') { - err_ret->error = E_BADSINGLE; - PyNode_Free(n); - n = NULL; + if (!c) + break; + + if (c != '#') { + err_ret->error = E_BADSINGLE; + PyNode_Free(n); + n = NULL; + break; + } + + /* Suck up comment. */ + while (c && c != '\n') + c = *++cur; } } #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 00:13:45 2012 From: python-checkins at python.org (terry.reedy) Date: Fri, 20 Jan 2012 00:13:45 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_=2313763_Clarify_=27hg=27_?= =?utf8?q?usage=2E?= Message-ID: http://hg.python.org/devguide/rev/081106c142ec changeset: 484:081106c142ec parent: 479:5d4a90e568ed user: Terry Jan Reedy date: Thu Jan 19 18:11:09 2012 -0500 summary: #13763 Clarify 'hg' usage. files: setup.rst | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -14,11 +14,11 @@ Version Control Setup --------------------- -CPython is developed using `Mercurial `_ -(commonly abbreviated hg, after the program name). -It is easily available for common Unix systems by way of the standard package -manager; under Windows, you might want to use the `TortoiseHg -`_ graphical client. +CPython is developed using `Mercurial `_. The Mercurial +command line program is named ``hg``; this is also used to refer to Mercurial +itself. Mercurial is easily available for common Unix systems by way of the +standard package manager; under Windows, you might want to use the +`TortoiseHg `_ graphical client. .. _checkout: -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 20 00:13:48 2012 From: python-checkins at python.org (terry.reedy) Date: Fri, 20 Jan 2012 00:13:48 +0100 Subject: [Python-checkins] =?utf8?q?devguide_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/devguide/rev/68ba0bef5913 changeset: 485:68ba0bef5913 parent: 484:081106c142ec parent: 483:1a25c29fb571 user: Terry Jan Reedy date: Thu Jan 19 18:13:17 2012 -0500 summary: Merge files: conf.py | 2 +- faq.rst | 10 +++++++--- setup.rst | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/conf.py b/conf.py --- a/conf.py +++ b/conf.py @@ -43,7 +43,7 @@ # General information about the project. project = u'Python Developer\'s Guide' -copyright = u'2011, Python Software Foundation' +copyright = u'2011-2012, Python Software Foundation' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/faq.rst b/faq.rst --- a/faq.rst +++ b/faq.rst @@ -16,12 +16,14 @@ Where should I ask general Python questions? -------------------------------------------- -General Python questions should still go to `python-list`_ or `python-tutor`_ -or similar resources, such as StackOverflow_ or ``#python`` on IRC. +General Python questions should still go to `python-list`_ or `tutor`_ +or similar resources, such as StackOverflow_ or the ``#python`` IRC channel +on Freenode_. .. _python-list: http://mail.python.org/mailman/listinfo/python-list -.. _python-tutor: http://mail.python.org/mailman/listinfo/python-tutor +.. _tutor: http://mail.python.org/mailman/listinfo/tutor .. _StackOverflow: http://stackoverflow.com/ +.. _Freenode: http://freenode.net/ Where should I suggest new features and language changes? @@ -48,6 +50,8 @@ The `Python Mentors`_ program is specifically about encouraging developers and others that would like to contribute to Python development in general, rather than necessarily being focused on one particular issue. +Some core developers are also available on the ``#python-dev`` IRC channel on +Freenode_. .. _Python Mentors: http://pythonmentors.com diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -198,46 +198,46 @@ every rule. ``Doc`` - ??? The official documentation. This is what http://docs.python.org/ uses. + The official documentation. This is what http://docs.python.org/ uses. To build the docs, see ``Doc/README.txt``. ``Grammar`` - ??? Contains the :abbr:`EBNF (Extended Backus?Naur Form)` grammar file for + Contains the :abbr:`EBNF (Extended Backus-Naur Form)` grammar file for Python. ``Include`` - ??? Contains all interpreter-wide header files. + Contains all interpreter-wide header files. ``Lib`` - ??? The part of the standard library implemented in pure Python. + The part of the standard library implemented in pure Python. ``Mac`` - ??? Mac-specific code (e.g., using IDLE as an OS X application). + Mac-specific code (e.g., using IDLE as an OS X application). ``Misc`` - ??? Things that do not belong elsewhere. Typically this is varying kinds of + Things that do not belong elsewhere. Typically this is varying kinds of developer-specific documentation. ``Modules`` - ??? The part of the standard library (plus some other code) that is implemented + The part of the standard library (plus some other code) that is implemented in C. ``Objects`` - ??? Code for all built-in types. + Code for all built-in types. ``PC`` - ??? Windows-specific code along with build files for VC 6, 7, & 8 along with + Windows-specific code along with build files for VC 6, 7, & 8 along with OS/2. ``PCbuild`` - ??? Build files for VC 9 and newer. + Build files for VC 9 and newer. ``Parser`` - ??? Code related to the parser. The definition of the AST nodes is also kept + Code related to the parser. The definition of the AST nodes is also kept here. ``Python`` - ??? The code that makes up the CPython interpreter. This includes the compiler, + The code that makes up the CPython interpreter. This includes the compiler, eval loop and various built-in modules. ``Tools`` -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Fri Jan 20 02:04:44 2012 From: python-checkins at python.org (eric.smith) Date: Fri, 20 Jan 2012 02:04:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Improve_exception_text=2E_C?= =?utf8?q?loses_issue_13811=2E?= Message-ID: http://hg.python.org/cpython/rev/5c33ebb50702 changeset: 74533:5c33ebb50702 user: Eric V. Smith date: Thu Jan 19 20:04:28 2012 -0500 summary: Improve exception text. Closes issue 13811. files: Python/formatter_unicode.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -241,8 +241,8 @@ /* Finally, parse the type field. */ if (end-pos > 1) { - /* More than one char remain, invalid conversion spec. */ - PyErr_Format(PyExc_ValueError, "Invalid conversion specification"); + /* More than one char remain, invalid format specifier. */ + PyErr_Format(PyExc_ValueError, "Invalid format specifier"); return 0; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 02:22:49 2012 From: python-checkins at python.org (victor.stinner) Date: Fri, 20 Jan 2012 02:22:49 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2310278=3A_Be_more_e?= =?utf8?q?xplicit_in_tests_than_wallclock=28=29_is_monotonic_=28cannot?= Message-ID: http://hg.python.org/cpython/rev/8502a9236c2e changeset: 74534:8502a9236c2e user: Victor Stinner date: Fri Jan 20 02:24:18 2012 +0100 summary: Issue #10278: Be more explicit in tests than wallclock() is monotonic (cannot go backward) files: Lib/test/test_time.py | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -332,11 +332,16 @@ self.assertEqual(time.strftime('%Z', tt), tzname) def test_wallclock(self): - t0 = time.wallclock() + t1 = time.wallclock() + t2 = time.wallclock() + self.assertGreater(t2, t1) + + t1 = time.wallclock() time.sleep(0.1) - t1 = time.wallclock() - t = t1 - t0 - self.assertAlmostEqual(t, 0.1, delta=0.2) + t2 = time.wallclock() + self.assertGreater(t2, t1) + dt = t2 - t1 + self.assertAlmostEqual(dt, 0.1, delta=0.2) class TestLocale(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 05:28:46 2012 From: python-checkins at python.org (meador.inge) Date: Fri, 20 Jan 2012 05:28:46 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyOTQ5?= =?utf8?q?=3A_Document_the_kwonlyargcount_argument_for_the_PyCode=5FNew_C_?= =?utf8?q?API?= Message-ID: http://hg.python.org/cpython/rev/b22a35c14a91 changeset: 74535:b22a35c14a91 branch: 3.2 parent: 74530:d6e53d1f46eb user: Meador Inge date: Thu Jan 19 22:06:31 2012 -0600 summary: Issue #12949: Document the kwonlyargcount argument for the PyCode_New C API function. files: Doc/c-api/code.rst | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst --- a/Doc/c-api/code.rst +++ b/Doc/c-api/code.rst @@ -35,7 +35,7 @@ Return the number of free variables in *co*. -.. c:function:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) +.. c:function:: PyCodeObject *PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) Return a new code object. If you need a dummy code object to create a frame, use :c:func:`PyCode_NewEmpty` instead. Calling diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -418,6 +418,9 @@ Documentation ------------- +- Issue #12949: Document the kwonlyargcount argument for the PyCode_New + C API function. + - Issue #2134: The tokenize documentation has been clarified to explain why all operator and delimiter tokens are treated as token.OP tokens. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 05:28:47 2012 From: python-checkins at python.org (meador.inge) Date: Fri, 20 Jan 2012 05:28:47 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312949=3A_Document_the_kwonlyargcount_argument_for_t?= =?utf8?q?he_PyCode=5FNew_C_API?= Message-ID: http://hg.python.org/cpython/rev/218b167ff521 changeset: 74536:218b167ff521 parent: 74534:8502a9236c2e parent: 74535:b22a35c14a91 user: Meador Inge date: Thu Jan 19 22:24:55 2012 -0600 summary: Issue #12949: Document the kwonlyargcount argument for the PyCode_New C API function. files: Doc/c-api/code.rst | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst --- a/Doc/c-api/code.rst +++ b/Doc/c-api/code.rst @@ -35,7 +35,7 @@ Return the number of free variables in *co*. -.. c:function:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) +.. c:function:: PyCodeObject *PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab) Return a new code object. If you need a dummy code object to create a frame, use :c:func:`PyCode_NewEmpty` instead. Calling diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2100,6 +2100,9 @@ Documentation ------------- +- Issue #12949: Document the kwonlyargcount argument for the PyCode_New + C API function. + - Issue #13513: Fix io.IOBase documentation to correctly link to the io.IOBase.readline method instead of the readline module. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Jan 20 05:34:19 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 20 Jan 2012 05:34:19 +0100 Subject: [Python-checkins] Daily reference leaks (8502a9236c2e): sum=0 Message-ID: results for 8502a9236c2e on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogktw1oM', '-x'] From python-checkins at python.org Fri Jan 20 12:32:12 2012 From: python-checkins at python.org (vinay.sajip) Date: Fri, 20 Jan 2012 12:32:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Closes_=2313807?= =?utf8?q?=3A_Now_checks_for_sys=2Estderr_being_there_before_writing_to_it?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/b60c789c4ccd changeset: 74537:b60c789c4ccd branch: 2.7 parent: 74529:1b481e76cd16 user: Vinay Sajip date: Fri Jan 20 11:20:12 2012 +0000 summary: Closes #13807: Now checks for sys.stderr being there before writing to it. files: Lib/logging/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -794,7 +794,7 @@ You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method. """ - if raiseExceptions: + if raiseExceptions and sys.stderr: # see issue 13807 ei = sys.exc_info() try: traceback.print_exception(ei[0], ei[1], ei[2], -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 12:32:12 2012 From: python-checkins at python.org (vinay.sajip) Date: Fri, 20 Jan 2012 12:32:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E1=29=3A_Closes_=2313807?= =?utf8?q?=3A_Now_checks_for_sys=2Estderr_being_there_before_writing_to_it?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/73dad4940b88 changeset: 74538:73dad4940b88 branch: 3.1 parent: 74253:fb5707168351 user: Vinay Sajip date: Fri Jan 20 11:23:02 2012 +0000 summary: Closes #13807: Now checks for sys.stderr being there before writing to it. files: Lib/logging/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -721,7 +721,7 @@ You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method. """ - if raiseExceptions: + if raiseExceptions and sys.stderr: # see issue 13807 ei = sys.exc_info() try: traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 12:32:13 2012 From: python-checkins at python.org (vinay.sajip) Date: Fri, 20 Jan 2012 12:32:13 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4xIC0+IDMuMik6?= =?utf8?q?_Closes_=2313807=3A_Merged_fix_from_3=2E1=2E?= Message-ID: http://hg.python.org/cpython/rev/6a1a33a1fe93 changeset: 74539:6a1a33a1fe93 branch: 3.2 parent: 74535:b22a35c14a91 parent: 74538:73dad4940b88 user: Vinay Sajip date: Fri Jan 20 11:27:36 2012 +0000 summary: Closes #13807: Merged fix from 3.1. files: Lib/logging/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -881,7 +881,7 @@ You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method. """ - if raiseExceptions: + if raiseExceptions and sys.stderr: # see issue 13807 ei = sys.exc_info() try: traceback.print_exception(ei[0], ei[1], ei[2], -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 12:32:14 2012 From: python-checkins at python.org (vinay.sajip) Date: Fri, 20 Jan 2012 12:32:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Closes_=2313807=3A_Merged_fix_from_3=2E2=2E?= Message-ID: http://hg.python.org/cpython/rev/de85a9c7fe94 changeset: 74540:de85a9c7fe94 parent: 74536:218b167ff521 parent: 74539:6a1a33a1fe93 user: Vinay Sajip date: Fri Jan 20 11:31:46 2012 +0000 summary: Closes #13807: Merged fix from 3.2. files: Lib/logging/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -878,7 +878,7 @@ You could, however, replace this with a custom handler if you wish. The record which was being processed is passed in to this method. """ - if raiseExceptions: + if raiseExceptions and sys.stderr: # see issue 13807 ei = sys.exc_info() try: traceback.print_exception(ei[0], ei[1], ei[2], -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 15:56:18 2012 From: python-checkins at python.org (lukasz.langa) Date: Fri, 20 Jan 2012 15:56:18 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_=2313760=3A_picklability_te?= =?utf8?q?sts_for_configparser_exceptions?= Message-ID: http://hg.python.org/cpython/rev/e63e2471f46f changeset: 74541:e63e2471f46f user: ?ukasz Langa date: Fri Jan 20 14:57:55 2012 +0100 summary: #13760: picklability tests for configparser exceptions files: Lib/test/test_configparser.py | 145 ++++++++++++++++++++++ 1 files changed, 145 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py --- a/Lib/test/test_configparser.py +++ b/Lib/test/test_configparser.py @@ -1474,6 +1474,150 @@ """) self.assertEqual(repr(parser['section']), '') + +class ExceptionPicklingTestCase(unittest.TestCase): + """Tests for issue #13760: ConfigParser exceptions are not picklable.""" + + def test_error(self): + import pickle + e1 = configparser.Error('value') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(repr(e1), repr(e2)) + + def test_nosectionerror(self): + import pickle + e1 = configparser.NoSectionError('section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(repr(e1), repr(e2)) + + def test_nooptionerror(self): + import pickle + e1 = configparser.NoOptionError('option', 'section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_duplicatesectionerror(self): + import pickle + e1 = configparser.DuplicateSectionError('section', 'source', 123) + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_duplicateoptionerror(self): + import pickle + e1 = configparser.DuplicateOptionError('section', 'option', 'source', + 123) + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationerror(self): + import pickle + e1 = configparser.InterpolationError('option', 'section', 'msg') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationmissingoptionerror(self): + import pickle + e1 = configparser.InterpolationMissingOptionError('option', 'section', + 'rawval', 'reference') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(e1.reference, e2.reference) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationsyntaxerror(self): + import pickle + e1 = configparser.InterpolationSyntaxError('option', 'section', 'msg') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationdeptherror(self): + import pickle + e1 = configparser.InterpolationDepthError('option', 'section', + 'rawval') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_parsingerror(self): + import pickle + e1 = configparser.ParsingError('source') + e1.append(1, 'line1') + e1.append(2, 'line2') + e1.append(3, 'line3') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.errors, e2.errors) + self.assertEqual(repr(e1), repr(e2)) + e1 = configparser.ParsingError(filename='filename') + e1.append(1, 'line1') + e1.append(2, 'line2') + e1.append(3, 'line3') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.errors, e2.errors) + self.assertEqual(repr(e1), repr(e2)) + + def test_missingsectionheadererror(self): + import pickle + e1 = configparser.MissingSectionHeaderError('filename', 123, 'line') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.line, e2.line) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_main(): support.run_unittest( ConfigParserTestCase, @@ -1495,4 +1639,5 @@ ConfigParserTestCaseNonStandardDefaultSection, ReadFileTestCase, CoverageOneHundredTestCase, + ExceptionPicklingTestCase, ) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 15:56:19 2012 From: python-checkins at python.org (lukasz.langa) Date: Fri, 20 Jan 2012 15:56:19 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzNzYwOiBwaWNr?= =?utf8?q?lability_tests_for_configparser_exceptions?= Message-ID: http://hg.python.org/cpython/rev/76077971ee1f changeset: 74542:76077971ee1f branch: 3.2 parent: 74539:6a1a33a1fe93 user: ?ukasz Langa date: Fri Jan 20 15:53:10 2012 +0100 summary: #13760: picklability tests for configparser exceptions files: Lib/test/test_cfgparser.py | 145 +++++++++++++++++++++++++ 1 files changed, 145 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -1474,6 +1474,150 @@ """) self.assertEqual(repr(parser['section']), '') + +class ExceptionPicklingTestCase(unittest.TestCase): + """Tests for issue #13760: ConfigParser exceptions are not picklable.""" + + def test_error(self): + import pickle + e1 = configparser.Error('value') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(repr(e1), repr(e2)) + + def test_nosectionerror(self): + import pickle + e1 = configparser.NoSectionError('section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(repr(e1), repr(e2)) + + def test_nooptionerror(self): + import pickle + e1 = configparser.NoOptionError('option', 'section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_duplicatesectionerror(self): + import pickle + e1 = configparser.DuplicateSectionError('section', 'source', 123) + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_duplicateoptionerror(self): + import pickle + e1 = configparser.DuplicateOptionError('section', 'option', 'source', + 123) + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationerror(self): + import pickle + e1 = configparser.InterpolationError('option', 'section', 'msg') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationmissingoptionerror(self): + import pickle + e1 = configparser.InterpolationMissingOptionError('option', 'section', + 'rawval', 'reference') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(e1.reference, e2.reference) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationsyntaxerror(self): + import pickle + e1 = configparser.InterpolationSyntaxError('option', 'section', 'msg') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationdeptherror(self): + import pickle + e1 = configparser.InterpolationDepthError('option', 'section', + 'rawval') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_parsingerror(self): + import pickle + e1 = configparser.ParsingError('source') + e1.append(1, 'line1') + e1.append(2, 'line2') + e1.append(3, 'line3') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.errors, e2.errors) + self.assertEqual(repr(e1), repr(e2)) + e1 = configparser.ParsingError(filename='filename') + e1.append(1, 'line1') + e1.append(2, 'line2') + e1.append(3, 'line3') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.errors, e2.errors) + self.assertEqual(repr(e1), repr(e2)) + + def test_missingsectionheadererror(self): + import pickle + e1 = configparser.MissingSectionHeaderError('filename', 123, 'line') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.line, e2.line) + self.assertEqual(e1.source, e2.source) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_main(): support.run_unittest( ConfigParserTestCase, @@ -1495,4 +1639,5 @@ ConfigParserTestCaseNonStandardDefaultSection, ReadFileTestCase, CoverageOneHundredTestCase, + ExceptionPicklingTestCase, ) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 15:56:20 2012 From: python-checkins at python.org (lukasz.langa) Date: Fri, 20 Jan 2012 15:56:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_phony_merge_of_76077971ee1f_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/50a4af2ca654 changeset: 74543:50a4af2ca654 parent: 74541:e63e2471f46f parent: 74542:76077971ee1f user: ?ukasz Langa date: Fri Jan 20 15:55:27 2012 +0100 summary: phony merge of 76077971ee1f from 3.2 files: -- Repository URL: http://hg.python.org/cpython From meadori at gmail.com Fri Jan 20 16:02:24 2012 From: meadori at gmail.com (Meador Inge) Date: Fri, 20 Jan 2012 09:02:24 -0600 Subject: [Python-checkins] cpython (3.1): Closes #13807: Now checks for sys.stderr being there before writing to it. In-Reply-To: References: Message-ID: On Fri, Jan 20, 2012 at 5:32 AM, vinay.sajip wrote: > http://hg.python.org/cpython/rev/73dad4940b88 > changeset: ? 74538:73dad4940b88 > branch: ? ? ?3.1 I thought that the 3.1 branch is in security mode? Is this a security related fix? >From my brief scan of the changeset, it doesn't seem to be. > parent: ? ? ?74253:fb5707168351 > user: ? ? ? ?Vinay Sajip > date: ? ? ? ?Fri Jan 20 11:23:02 2012 +0000 > summary: > ?Closes #13807: Now checks for sys.stderr being there before writing to it. > > files: > ?Lib/logging/__init__.py | ?2 +- > ?1 files changed, 1 insertions(+), 1 deletions(-) > > > diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py > --- a/Lib/logging/__init__.py > +++ b/Lib/logging/__init__.py > @@ -721,7 +721,7 @@ > ? ? ? ? You could, however, replace this with a custom handler if you wish. > ? ? ? ? The record which was being processed is passed in to this method. > ? ? ? ? """ > - ? ? ? ?if raiseExceptions: > + ? ? ? ?if raiseExceptions and sys.stderr: ?# see issue 13807 > ? ? ? ? ? ? ei = sys.exc_info() > ? ? ? ? ? ? try: > ? ? ? ? ? ? ? ? traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- # Meador From python-checkins at python.org Fri Jan 20 17:01:13 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 20 Jan 2012 17:01:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_add_another_test_case?= Message-ID: http://hg.python.org/cpython/rev/3be60a4c8c63 changeset: 74544:3be60a4c8c63 user: Benjamin Peterson date: Fri Jan 20 11:01:06 2012 -0500 summary: add another test case files: Lib/test/test_compile.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -472,6 +472,7 @@ self.assertInvalidSingle('f()\ng()') self.assertInvalidSingle('f()\n# blah\nblah()') self.assertInvalidSingle('f()\nxy # blah\nblah()') + self.assertInvalidSingle('x = 5 # comment\nx = 6\n') def test_main(): support.run_unittest(TestSpecifics) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 20 17:03:13 2012 From: python-checkins at python.org (lukasz.langa) Date: Fri, 20 Jan 2012 17:03:13 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogRml4ZXMgIzEzNzYw?= =?utf8?q?=3A_picklability_of_ConfigParser_exceptions?= Message-ID: http://hg.python.org/cpython/rev/5ecf650ede7c changeset: 74545:5ecf650ede7c branch: 2.7 parent: 74537:b60c789c4ccd user: ?ukasz Langa date: Fri Jan 20 17:02:08 2012 +0100 summary: Fixes #13760: picklability of ConfigParser exceptions files: Lib/ConfigParser.py | 34 +++++++- Lib/test/test_cfgparser.py | 117 +++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletions(-) diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -134,6 +134,9 @@ def __repr__(self): return self.message + def __reduce__(self): + return self.__class__, (self.message,) + __str__ = __repr__ class NoSectionError(Error): @@ -143,6 +146,9 @@ Error.__init__(self, 'No section: %r' % (section,)) self.section = section + def __reduce__(self): + return self.__class__, (self.section,) + class DuplicateSectionError(Error): """Raised when a section is multiply-created.""" @@ -150,6 +156,9 @@ Error.__init__(self, "Section %r already exists" % section) self.section = section + def __reduce__(self): + return self.__class__, (self.section,) + class NoOptionError(Error): """A requested option was not found.""" @@ -159,6 +168,9 @@ self.option = option self.section = section + def __reduce__(self): + return self.__class__, (self.option, self.section) + class InterpolationError(Error): """Base class for interpolation-related exceptions.""" @@ -167,6 +179,9 @@ self.option = option self.section = section + def __reduce__(self): + return self.__class__, (self.option, self.section, self.message) + class InterpolationMissingOptionError(InterpolationError): """A string substitution required a setting which was not available.""" @@ -179,6 +194,11 @@ % (section, option, reference, rawval)) InterpolationError.__init__(self, option, section, msg) self.reference = reference + self._rawval = rawval + + def __reduce__(self): + return self.__class__, (self.option, self.section, self._rawval, + self.reference) class InterpolationSyntaxError(InterpolationError): """Raised when the source text into which substitutions are made @@ -194,19 +214,28 @@ "\trawval : %s\n" % (section, option, rawval)) InterpolationError.__init__(self, option, section, msg) + self._rawval = rawval + + def __reduce__(self): + return self.__class__, (self.option, self.section, self._rawval) class ParsingError(Error): """Raised when a configuration file does not follow legal syntax.""" - def __init__(self, filename): + def __init__(self, filename, _errors=[]): Error.__init__(self, 'File contains parsing errors: %s' % filename) self.filename = filename self.errors = [] + for lineno, line in _errors: + self.append(lineno, line) def append(self, lineno, line): self.errors.append((lineno, line)) self.message += '\n\t[line %2d]: %s' % (lineno, line) + def __reduce__(self): + return self.__class__, (self.filename, self.errors) + class MissingSectionHeaderError(ParsingError): """Raised when a key-value pair is found before any section header.""" @@ -219,6 +248,9 @@ self.lineno = lineno self.line = line + def __reduce__(self): + return self.__class__, (self.filename, self.lineno, self.line) + class RawConfigParser: def __init__(self, defaults=None, dict_type=_default_dict, diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -604,6 +604,122 @@ "o4 = 1\n\n") +class ExceptionPicklingTestCase(unittest.TestCase): + """Tests for issue #13760: ConfigParser exceptions are not picklable.""" + + def test_error(self): + import pickle + e1 = ConfigParser.Error('value') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(repr(e1), repr(e2)) + + def test_nosectionerror(self): + import pickle + e1 = ConfigParser.NoSectionError('section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(repr(e1), repr(e2)) + + def test_nooptionerror(self): + import pickle + e1 = ConfigParser.NoOptionError('option', 'section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_duplicatesectionerror(self): + import pickle + e1 = ConfigParser.DuplicateSectionError('section') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationerror(self): + import pickle + e1 = ConfigParser.InterpolationError('option', 'section', 'msg') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationmissingoptionerror(self): + import pickle + e1 = ConfigParser.InterpolationMissingOptionError('option', 'section', + 'rawval', 'reference') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(e1.reference, e2.reference) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationsyntaxerror(self): + import pickle + e1 = ConfigParser.InterpolationSyntaxError('option', 'section', 'msg') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_interpolationdeptherror(self): + import pickle + e1 = ConfigParser.InterpolationDepthError('option', 'section', + 'rawval') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.section, e2.section) + self.assertEqual(e1.option, e2.option) + self.assertEqual(repr(e1), repr(e2)) + + def test_parsingerror(self): + import pickle + e1 = ConfigParser.ParsingError('source') + e1.append(1, 'line1') + e1.append(2, 'line2') + e1.append(3, 'line3') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.filename, e2.filename) + self.assertEqual(e1.errors, e2.errors) + self.assertEqual(repr(e1), repr(e2)) + + def test_missingsectionheadererror(self): + import pickle + e1 = ConfigParser.MissingSectionHeaderError('filename', 123, 'line') + pickled = pickle.dumps(e1) + e2 = pickle.loads(pickled) + self.assertEqual(e1.message, e2.message) + self.assertEqual(e1.args, e2.args) + self.assertEqual(e1.line, e2.line) + self.assertEqual(e1.filename, e2.filename) + self.assertEqual(e1.lineno, e2.lineno) + self.assertEqual(repr(e1), repr(e2)) + + def test_main(): test_support.run_unittest( ConfigParserTestCase, @@ -614,6 +730,7 @@ SortedTestCase, Issue7005TestCase, TestChainMap, + ExceptionPicklingTestCase, ) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 04:43:25 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 21 Jan 2012 04:43:25 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_Issue6631_-?= =?utf8?q?_Disallow_relative_files_paths_in_urllib*=2Eopen=28=29?= Message-ID: http://hg.python.org/cpython/rev/f6008e936fbc changeset: 74546:f6008e936fbc branch: 2.7 user: Senthil Kumaran date: Sat Jan 21 11:43:02 2012 +0800 summary: Fix Issue6631 - Disallow relative files paths in urllib*.open() files: Lib/test/test_urllib.py | 3 +++ Lib/test/test_urllib2net.py | 2 ++ Lib/urllib.py | 2 ++ 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -134,6 +134,9 @@ for line in self.returned_obj.__iter__(): self.assertEqual(line, self.text) + def test_relativelocalfile(self): + self.assertRaises(ValueError,urllib.urlopen,'./' + self.pathname) + class ProxyTests(unittest.TestCase): def setUp(self): diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -126,6 +126,8 @@ finally: os.remove(TESTFN) + self.assertRaises(ValueError, urllib2.urlopen,'./relative_path/to/file') + # XXX Following test depends on machine configurations that are internal # to CNRI. Need to set up a public server with the right authentication # configuration for test purposes. diff --git a/Lib/urllib.py b/Lib/urllib.py --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -484,6 +484,8 @@ urlfile = file if file[:1] == '/': urlfile = 'file://' + file + elif file[:2] == './': + raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url) return addinfourl(open(localname, 'rb'), headers, urlfile) host, port = splitport(host) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 04:55:57 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 21 Jan 2012 04:55:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_NEWS_entry_for_?= =?utf8?q?Issue6631?= Message-ID: http://hg.python.org/cpython/rev/4366c0df2c73 changeset: 74547:4366c0df2c73 branch: 2.7 user: Senthil Kumaran date: Sat Jan 21 11:45:12 2012 +0800 summary: NEWS entry for Issue6631 files: Misc/NEWS | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -89,6 +89,8 @@ Library ------- +- Issue #6631: Disallow relative file paths in urllib urlopen methods. + - Issue #13781: Prevent gzip.GzipFile from using the dummy filename provided by file objects opened with os.fdopen(). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 04:55:58 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 21 Jan 2012 04:55:58 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix__Issue6631_?= =?utf8?q?-_Disallow_relative_file_paths_in_urllib_urlopen?= Message-ID: http://hg.python.org/cpython/rev/514994d7a9f2 changeset: 74548:514994d7a9f2 branch: 3.2 parent: 74542:76077971ee1f user: Senthil Kumaran date: Sat Jan 21 11:52:48 2012 +0800 summary: Fix Issue6631 - Disallow relative file paths in urllib urlopen files: Lib/test/test_urllib.py | 3 +++ Lib/test/test_urllib2net.py | 2 ++ Lib/urllib/request.py | 2 ++ Misc/NEWS | 2 ++ 4 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -160,6 +160,9 @@ for line in self.returned_obj: self.assertEqual(line, self.text) + def test_relativelocalfile(self): + self.assertRaises(ValueError,urllib.request.urlopen,'./' + self.pathname) + class ProxyTests(unittest.TestCase): def setUp(self): diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -125,6 +125,8 @@ finally: os.remove(TESTFN) + self.assertRaises(ValueError, urllib.request.urlopen,'./relative_path/to/file') + # XXX Following test depends on machine configurations that are internal # to CNRI. Need to set up a public server with the right authentication # configuration for test purposes. diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1781,6 +1781,8 @@ urlfile = file if file[:1] == '/': urlfile = 'file://' + file + elif file[:2] == './': + raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url) return addinfourl(open(localname, 'rb'), headers, urlfile) raise URLError('local file error', 'not on local host') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -103,6 +103,8 @@ Library ------- +- Issue #6631: Disallow relative file paths in urllib urlopen methods. + - Issue #13722: Avoid silencing ImportErrors when initializing the codecs registry. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 04:55:59 2012 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 21 Jan 2012 04:55:59 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/784f466a78e0 changeset: 74549:784f466a78e0 parent: 74544:3be60a4c8c63 parent: 74548:514994d7a9f2 user: Senthil Kumaran date: Sat Jan 21 11:55:40 2012 +0800 summary: merge from 3.2 files: Lib/test/test_urllib.py | 3 +++ Lib/test/test_urllib2net.py | 2 ++ Lib/urllib/request.py | 2 ++ Misc/NEWS | 3 +-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -160,6 +160,9 @@ for line in self.returned_obj: self.assertEqual(line, self.text) + def test_relativelocalfile(self): + self.assertRaises(ValueError,urllib.request.urlopen,'./' + self.pathname) + class ProxyTests(unittest.TestCase): def setUp(self): diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -125,6 +125,8 @@ finally: os.remove(TESTFN) + self.assertRaises(ValueError, urllib.request.urlopen,'./relative_path/to/file') + # XXX Following test depends on machine configurations that are internal # to CNRI. Need to set up a public server with the right authentication # configuration for test purposes. diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1813,6 +1813,8 @@ urlfile = file if file[:1] == '/': urlfile = 'file://' + file + elif file[:2] == './': + raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url) return addinfourl(open(localname, 'rb'), headers, urlfile) raise URLError('local file error', 'not on local host') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -453,8 +453,7 @@ Library ------- -- Issue #2134: A new attribute that specifies the exact type of token.OP - tokens has been added to tokenize.TokenInfo. +- Issue #6631: Disallow relative file paths in urllib urlopen methods. - Issue #13722: Avoid silencing ImportErrors when initializing the codecs registry. -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jan 21 05:34:01 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 21 Jan 2012 05:34:01 +0100 Subject: [Python-checkins] Daily reference leaks (3be60a4c8c63): sum=0 Message-ID: results for 3be60a4c8c63 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogFZ0wT6', '-x'] From python-checkins at python.org Sat Jan 21 06:33:41 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 21 Jan 2012 06:33:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Issue13820_as_a?= =?utf8?q?nd_with_really_became_keywords_in_2=2E6=2E?= Message-ID: http://hg.python.org/cpython/rev/c84b39c18963 changeset: 74550:c84b39c18963 branch: 2.7 parent: 74547:4366c0df2c73 user: Terry Jan Reedy date: Sat Jan 21 00:24:25 2012 -0500 summary: Issue13820 as and with really became keywords in 2.6. Original rewording by Jim Jewett files: Doc/reference/lexical_analysis.rst | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -357,12 +357,11 @@ assign a different object to it. .. versionchanged:: 2.5 - Both :keyword:`as` and :keyword:`with` are only recognized when the - ``with_statement`` future feature has been enabled. It will always be enabled in - Python 2.6. See section :ref:`with` for details. Note that using :keyword:`as` - and :keyword:`with` as identifiers will always issue a warning, even when the - ``with_statement`` future directive is not in effect. - + Using :keyword:`as` and :keyword:`with` as identifiers triggers a warning. To + use them as keywords, enable the ``with_statement`` future feature . + +.. versionchanged:: 2.6 + :keyword:`as` and :keyword:`with` are full keywords. .. _id-classes: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 06:33:42 2012 From: python-checkins at python.org (terry.reedy) Date: Sat, 21 Jan 2012 06:33:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_whitespace?= Message-ID: http://hg.python.org/cpython/rev/117d58fc6e8d changeset: 74551:117d58fc6e8d branch: 2.7 user: Terry Jan Reedy date: Sat Jan 21 00:32:23 2012 -0500 summary: whitespace files: Doc/reference/lexical_analysis.rst | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -359,10 +359,11 @@ .. versionchanged:: 2.5 Using :keyword:`as` and :keyword:`with` as identifiers triggers a warning. To use them as keywords, enable the ``with_statement`` future feature . - + .. versionchanged:: 2.6 :keyword:`as` and :keyword:`with` are full keywords. + .. _id-classes: Reserved classes of identifiers -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 08:55:49 2012 From: python-checkins at python.org (georg.brandl) Date: Sat, 21 Jan 2012 08:55:49 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_conf=2Epy_f?= =?utf8?q?or_Sphinx_1=2E0=2E?= Message-ID: http://hg.python.org/cpython/rev/9858d56c57ac changeset: 74552:9858d56c57ac branch: 2.7 user: Georg Brandl date: Sat Jan 21 08:58:22 2012 +0100 summary: Fix conf.py for Sphinx 1.0. files: Doc/conf.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -63,6 +63,9 @@ # Options for HTML output # ----------------------- +html_theme = 'default' +html_theme_options = {'collapsiblesidebar': True} + # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%b %d, %Y' @@ -83,7 +86,7 @@ } # Output an OpenSearch description file. -html_use_opensearch = 'http://docs.python.org/dev' +html_use_opensearch = 'http://docs.python.org/' # Additional static files. html_static_path = ['tools/sphinxext/static'] @@ -112,8 +115,6 @@ 'The Python/C API', _stdauthor, 'manual'), ('distutils/index', 'distutils.tex', 'Distributing Python Modules', _stdauthor, 'manual'), - ('documenting/index', 'documenting.tex', - 'Documenting Python', 'Georg Brandl', 'manual'), ('extending/index', 'extending.tex', 'Extending and Embedding Python', _stdauthor, 'manual'), ('install/index', 'install.tex', @@ -151,7 +152,7 @@ latex_appendices = ['glossary', 'about', 'license', 'copyright'] # Get LaTeX to handle Unicode correctly -latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}'} +latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}', 'utf8extra': ''} # Options for the coverage checker # -------------------------------- -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 11:03:23 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 21 Jan 2012 11:03:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_fix_typo=3B_tha?= =?utf8?q?nks_to_Justin_Watt_from_docs=40?= Message-ID: http://hg.python.org/cpython/rev/79e7c5841e66 changeset: 74553:79e7c5841e66 branch: 3.2 parent: 74548:514994d7a9f2 user: Sandro Tosi date: Sat Jan 21 10:59:37 2012 +0100 summary: fix typo; thanks to Justin Watt from docs@ files: Doc/library/unittest.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -376,7 +376,7 @@ widget = Widget('The widget') self.assertEqual(widget.size(), (50, 50), 'incorrect default size') -Note that in order to test something, we use the one of the :meth:`assert\*` +Note that in order to test something, we use one of the :meth:`assert\*` methods provided by the :class:`TestCase` base class. If the test fails, an exception will be raised, and :mod:`unittest` will identify the test case as a :dfn:`failure`. Any other exceptions will be treated as :dfn:`errors`. This -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 11:03:27 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 21 Jan 2012 11:03:27 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_fix_typo=3B_tha?= =?utf8?q?nks_to_Justin_Watt_from_docs=40?= Message-ID: http://hg.python.org/cpython/rev/686d95691c99 changeset: 74554:686d95691c99 branch: 2.7 parent: 74552:9858d56c57ac user: Sandro Tosi date: Sat Jan 21 10:59:12 2012 +0100 summary: fix typo; thanks to Justin Watt from docs@ files: Doc/library/unittest.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -352,7 +352,7 @@ widget = Widget('The widget') self.assertEqual(widget.size(), (50, 50), 'incorrect default size') -Note that in order to test something, we use the one of the :meth:`assert\*` +Note that in order to test something, we use one of the :meth:`assert\*` methods provided by the :class:`TestCase` base class. If the test fails, an exception will be raised, and :mod:`unittest` will identify the test case as a :dfn:`failure`. Any other exceptions will be treated as :dfn:`errors`. This -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 11:03:28 2012 From: python-checkins at python.org (sandro.tosi) Date: Sat, 21 Jan 2012 11:03:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/b10e3ec9bf3d changeset: 74555:b10e3ec9bf3d parent: 74549:784f466a78e0 parent: 74553:79e7c5841e66 user: Sandro Tosi date: Sat Jan 21 11:00:03 2012 +0100 summary: merge with 3.2 files: Doc/library/unittest.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -376,7 +376,7 @@ widget = Widget('The widget') self.assertEqual(widget.size(), (50, 50), 'incorrect default size') -Note that in order to test something, we use the one of the :meth:`assert\*` +Note that in order to test something, we use one of the :meth:`assert\*` methods provided by the :class:`TestCase` base class. If the test fails, an exception will be raised, and :mod:`unittest` will identify the test case as a :dfn:`failure`. Any other exceptions will be treated as :dfn:`errors`. This -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 14:49:40 2012 From: python-checkins at python.org (ezio.melotti) Date: Sat, 21 Jan 2012 14:49:40 +0100 (CET) Subject: [Python-checkins] r88933 - in tracker/instances/python-dev/html: bullet.gif button-on-bg.png header-bg2.png main.css nav-off-bg.png nav-on-bg.png page.html python-logo.gif Message-ID: <3TVgJ41ZqLzQ29@mail.python.org> Author: ezio.melotti Date: Sat Jan 21 14:49:39 2012 New Revision: 88933 Log: #433: copy a CSS and a few images to avoid dependencies with www.python.org. Added: tracker/instances/python-dev/html/bullet.gif (contents, props changed) tracker/instances/python-dev/html/button-on-bg.png (contents, props changed) tracker/instances/python-dev/html/header-bg2.png (contents, props changed) tracker/instances/python-dev/html/main.css tracker/instances/python-dev/html/nav-off-bg.png (contents, props changed) tracker/instances/python-dev/html/nav-on-bg.png (contents, props changed) tracker/instances/python-dev/html/python-logo.gif (contents, props changed) Modified: tracker/instances/python-dev/html/page.html Added: tracker/instances/python-dev/html/bullet.gif ============================================================================== Binary file. No diff available. Added: tracker/instances/python-dev/html/button-on-bg.png ============================================================================== Binary file. No diff available. Added: tracker/instances/python-dev/html/header-bg2.png ============================================================================== Binary file. No diff available. Added: tracker/instances/python-dev/html/main.css ============================================================================== --- (empty file) +++ tracker/instances/python-dev/html/main.css Sat Jan 21 14:49:39 2012 @@ -0,0 +1,1425 @@ +/* This CSS has been copied from http://www.python.org/styles/styles.css and + * affects the main style of the page in order to match www.python.org. + * The background images have been copied too, and the URLs updated. + * Some rules are probably unused and can be removed. + * For tracker-specific styles see style.css. + */ + +HTML, BODY +{ + margin: 0; + padding: 0; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 103%; + /* possibly both of these should be removed */ + color: #000; + background-color: #FFF; +} + +IMG +{ + border: 0; +} + +H1,H2,H3,H4,H5 { + font-family: Georgia, "Bitstream Vera Serif", "New York", Palatino, serif; + font-weight:normal; + line-height: 1em; +} + +H1 +{ + font-size: 160%; + color: #234764; + margin: 0.7em 0 0.7em 0; + text-decoration: none; +} + +H1 A { + color: #234764; +} + +#intro H1 { + font-size:145%; +} +H2 +{ + font-size: 140%; + + color: #366D9C; + margin: 0.7em 0 0.7em 0; +} + +H3 +{ + font-size: 135%; + font-style:italic; + color: #366D9C; + margin: 0.4em 0 0.0em 0; +} + +H4 +{ + font-size: 125%; + color: #366D9C; + margin: 0.4em 0 0.0em 0; +} + +/* Logo */ +#logoheader +{ + border: 0; + margin: 0; + padding: 1px; + z-index: 1; + background-color:#F7F7F7; + background-image: url(header-bg2.png); + background-repeat: repeat-x; + border-bottom: 1px solid #999999; + height:84px; + } + +#logo +{ + width: 211px; + height:71px; + margin-top: 10px; + margin-left: 3%; +} + + + +/* main content section */ +#content-body +{ + position: absolute; + left: 0; + top: 63px; + width: 93.9%; + z-index: 0; + font-size:75%; + margin-left:3.0%; + min-width:660px; +} + + +#body-main +{ + + padding: 0 0.55em 40px 0.0em; + line-height: 1.4em; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + margin-left: 19em; +} + +#body-main { + font-size:100%; +} + + +/* end subnav */ +/* Left Hand Navigation */ +#left-hand-navigation +{ + position: absolute; + left: 3%; + z-index: 1; + top: 110px; +} + +#menu +{ + + padding:0; + margin-bottom: 5px; + width: 16em; + font-size:75%; +} + +#menu ul +{ + list-style: none; + margin: 0; + padding: 0; + border: 0; +} + +#menu li +{ + display:inline; +} + +#menu ul.level-one a +{ + display: block; + border: 1px solid #DADADA; + padding: 2px 2px 2px 4px; + margin: 0 0 4px 1.4em; + width: 12em !important; + width /**/: 13.4em; + font-family: Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + color: #4B5A6A; + background-image: url(nav-off-bg.png); + background-position: top right; + background-repeat: no-repeat; + background-color:#F5F5F5; + text-transform: uppercase + +} + +/*\*//*/ +#menu ul.level-one a +{ + width: 13.4em !important; +} +/**/ + +#menu ul.level-one a:hover +{ + color:black; + text-decoration:underline; +} + +#menu ul.level-one a.selected +{ + background-image: url(nav-on-bg.png); + background-color: #FFFFFF; + color:black; + border-left:3px solid #FFDB4C; +} + +#menu ul.level-two li:first-child a +{ + border-top:0; +} + +#menu ul.level-two a +{ + + background-image: none; + background-color: transparent; + display: block; + border: 0; + border-top: 1px solid #DDD; + padding: 0.1em; + margin: 0 3em 0px 1.5em; + color: #3C4B7B; + background: none; + width: 11em !important; + width /**/: 11.2em; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + text-transform: none; +} + +#menu ul.level-two a:hover +{ + text-decoration: underline; + color: black; +} + + +#menu ul.level-two a:visited +{ + color: #4C3B5B; +} + +#menu ul.level-one ul.level-two a.selected +{ + background-color: #FFFFFF; + color:#000; + border-left:0; + + font-weight:bold; +} + +#menu li ul +{ + margin-bottom: 7px +} + +#menu a +{ + text-decoration: none; +} + +#menu ul.level-three a +{ + + display: block; + border: 0; + padding: 0.1em; + margin: 0 3em 0px 1.8em; + padding-left:1em; + color: #5E72A5; + background-image: none; + width: 10em !important; + width /**/: 11.4em; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 95%; +} + +#menu ul.level-three a:hover +{ + text-decoration: underline; + color: black; +} + +#menu ul.level-three li.selected a.selected +{ + + background-image: url(bullet.gif); + background-repeat: no-repeat; + background-position: center left; + color:#000; + font-weight:normal; +} + +#menu ul.level-three +{ +margin-top:5px; +} + +#left-hand-navigation h4 +{ + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 77%; + color: #4C5B6B; + padding: 0.4em 0 0 1.5em; + margin: 0.2em 0 0.3em 0; +} + +#left-hand-navigation h4 a +{ + color:#4C5B6B; + text-decoration:none; + font-weight:bold; +} + +#left-hand-navigation h4 a:hover +{ + color:black; + text-decoration:underline; +} + +#body-main a:link +{ + color: #00A; + text-decoration:none; + +} + +#body-main a:visited +{ + color: #551A8B; + text-decoration:none; +} + +#body-main ul, #body-main li { + margin-left:1em; + padding-left:0; +} + +/* Breadcrumb Trail */ +#breadcrumb +{ + vertical-align: middle; + color: #3A4969; + font-size: 110%; + margin-bottom:30px; + background-image: url(bullet.gif); + padding-left:0.9em; + background-repeat: no-repeat; + background-position: left; +} + +#breadcrumb a:link, #breadcrumb a:visited +{ + text-decoration: none; + color: #3C4B6B; +} + +#breadcrumb a:hover +{ + text-decoration: underline; + color: black; +} + +.breadcrumb-separator +{ + color:#ACC6D1; +} + +#breadcrumb-text +{ + color: #3A4969; + font-size: 0.9em; + vertical-align: middle; +} + +/* Utility Menu */ +#utility-menu +{ + position: absolute; + top: 0; + right: 4%; + height:85px; + margin:0; + padding:0; + width:400px; + z-index: 1; + font-size: 88%; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; +} + +#utility-menu a +{ + text-decoration: none; + padding: 0 0.5em 0 0.5em; + color: #436A85; +} + +#utility-menu a:hover +{ + text-decoration: underline; +} + +#utility-menu #screen-switcher +{ + display:none; /* will anybody notice? */ + position:absolute; + bottom:6px; + right:0; + margin:0; + padding:0; +} + +#screen-switcher dl { + margin:0; + padding:0; +} + +/* Search Box */ +#searchbox { + position: absolute; + white-space: nowrap; + top: 16px; + right: 0; + width: 28.1em; + vertical-align: middle; + font-weight: bold; + text-align: right; +} +#searchbox form { + display:inline; +} +#search +{ + color: #A38E60; +} + +#search .input-text +{ + margin-top: 3px; + border: 1px solid #C4CCCC; + background-color: #FFFFFF; + vertical-align: top; + font-weight:normal; + font-size: 116%; + width: 11em; +} + +#search .input-button +{ + color: #223344; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-weight: bold; + font-size: 103%; + border-top: 1px solid #C4CCCC; + border-left: 1px solid #C4CCCC; + border-bottom: 1px solid #6F7777; + border-right: 1px solid #6F7777; + background-color: #F8F7F7; + background-image: url(button-on-bg.png); + background-repeat: no-repeat; + padding: 0px 0.2em 0px 0.2em; + margin: 3px 0.4em 0px 0.4em; + vertical-align: text-top; +} + +/* Navigation Skipper */ +#skiptonav +{ + height: 1px; + width: 1px; +} + +/* Document Navigation */ +.homepage-box h4, #document-navigation h4, .externallinks h4 +{ + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 94%; + font-weight: bold; + padding: 3px 0 4px 12px; + margin-bottom:8px; + border-bottom:3px solid #FFBC29; + background-color: #F6F6F6; + text-align: left; + z-index: 0; + -moz-border-radius-topleft: 16px; +} + +#document-navigation +{ + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 98%; + text-align: left; + color: #3C4B6B; + background-color: #F7F6F0; + width: 15em; + border: 1px solid #B7BECC; + z-index: 999; + float:right; + margin: 0 12px 12px 12px; + padding-bottom: 10px; + list-style:none; + -moz-border-radius-topleft: 12px; + -moz-border-radius-bottomright: 12px; +} + +#document-navigation ul +{ + list-style: none; + display: block; + border:0; + padding: 0; + margin: 0 3em 0 1.1em; + color: #3C4B6B; + background: none; + width: auto; + font-size: 103%; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; +} + +#document-navigation a:link, #document-navigation a:visited +{ + color:#3C4B6B; + text-decoration: none; +} + +#document-navigation a:hover +{ + color: #000000; + text-decoration: underline; +} + +#document-navigation h4 a:link, #document-navigation h4 a:visited +{ + color: #FFFFFF; +} + + +#document-navigation h4 a:hover +{ + color: #FFFFFF; + +} +#document-navigation form { + margin:12px; +} +#document-navigation input { + margin-top:3px; +} +input.formbutton { + color: #223344; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-weight: bold; + font-size: 103%; + border-top: 1px solid #C4CCCC; + border-left: 1px solid #C4CCCC; + border-bottom: 1px solid #6F7777; + border-right: 1px solid #6F7777; + background-color: #F8F7F7; + vertical-align: text-top; +} +.formtextinput { + border: 1px solid #C4CCCC; + background-color: #FFFFFF; + vertical-align: top; + font-weight:normal; + font-size: 116%; +} +#id { + width:6em; +} +#document-navigation .inputbox { + width:6em; +} + +/* vote box */ +div.vote-box p { + margin: 8px 0; +} + +div.vote-box { + padding-bottom: 0!important; +} + +/* Add this so tables will correctly flow below document navigation div. */ +div#content table { + clear:right; +} + +#selecteditem +{ + padding-left: 12px; + background-image: url(bullet.gif); + background-repeat: no-repeat; + background-position: center left; +} + +#selecteditem a +{ + color: #000000; +} + +#selecteditem a:hover +{ + text-decoration:none; +} + +.group { + background-image: url(bullet.gif); + background-repeat: no-repeat; + background-position: center left; + padding-left: 12px; +} +/* subnav */ +#document-navigation ul.level-one { + padding:0; + margin:0 0 0 1.1em; + font-size:88% +} +#document-navigation ul.level-one li { + padding:0; + margin:0; +} +#document-navigation li ul +{ + margin-bottom: 7px +} +#document-navigation ul.level-one a +{ + border: 0; + border-bottom: 1px solid #DDD; + color: #3C4B6B; + width: 160px; + display: block; + padding:0; + margin:0 +} + +#document-navigation ul.level-one a:hover +{ + text-decoration: underline; + color: black; +} +#document-navigation ul.level-one a:link { + border:0; +} +#document-navigation ul.level-one a:visited { + border:0; +} +#document-navigation ul.level-one a.selected +{ + color:#000; + font-weight: bold; + border-left:0; +} +#document-navigation ul.level-two { + padding:0; + margin:0; +} +#document-navigation ul.level-two li { + padding:0; + margin:0; +} +#document-navigation ul.level-two a +{ + border: 0; + margin: 0; + padding:0 0 0 1em; + color: #5E72A5; + font-size:97%; + display: block; + width: 140px; + +} + +#document-navigation ul.level-two a:hover +{ + text-decoration: underline; + color: black; +} + +#document-navigation ul.level-two li.selected a.selected +{ + + background-image: url(bullet.gif); + background-repeat: no-repeat; + background-position: center left; + color:#444; + border:0; + font-size:100%; + font-weight:normal; + font-style: italic; +} +#document-navigation a +{ + text-decoration: none; +} + +/* Quick Links */ +ul.quicklinks +{ + margin-left: 0; + padding-left: 0; + list-style: none; + margin: 0 0 0 1.5em; + line-height: 1.2em; +} + +ul.quicklinks li +{ + padding-left: 16px; + background-image: url(bullet.gif); + background-repeat: no-repeat; + background-position: 0 50%; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 77%; +} + +ul.quicklinks a +{ + text-decoration:none; + color: #3C4B6B; +} + +ul.quicklinks a:hover +{ + text-decoration:underline; + color: #000000; +} + +#sidebar-wrapper +{ + position:relative; + width:100%; +} + +#sidebar { + font-size:9px; + float:left; + top:35px; + width:37%; + height:auto; + padding:0; + border:0; + margin:0; + text-align:left; + padding-bottom:10px; +} + +#sidebar2 { + font-size:9px; + float:left; + top:35px; + width:25%; + height:auto; + padding:0; + border:0; + margin:0; + text-align:left; + padding-bottom:10px; +} +#sidebar3 { + font-size:9px; + float:left; + top:35px; + width:37%; + border:0; + height:auto; + padding:0; + margin:0; + text-align:left; + padding-bottom:10px; +} + +.teaser { + overflow:hidden; + margin-top:5px; + border:0; + width:100%; + text-align:left; +} + +P.news +{ + padding-left:12px; + margin:0 0 5px 0; +} + +P A:link,P A:visited +{ + border-bottom:1px dashed #ccc; +} + +P.news A:link { + border-bottom: 1px dashed #21356F; +} +P.news A:visited +{ + border-bottom:1px dashed #DDD; +} + +#body-main h1.pageheading { + margin:48px 0 10px 0; +} +#body-main H2.news +{ + background-image: url(bullet.gif); + background-repeat: no-repeat; + background-position: center left; + padding-left:12px; + margin:0; + font-size:110%; + color: #3C4B6B; + font-weight:normal; + font-weight:bold; +} + +#body-main H2.news A:link, #body-main H2.news A:visited +{ + text-decoration:none; + color: #2A374B; + +} + +#body-main ul A:link,#body-main ul A:visited +{ + border-bottom:1px dashed #ccc; +} + +/* Document Navigation */ +#document-navigation h4, .homepage-box h4, .externallinks h4 +{ + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 94%; + font-weight: bold; + padding: 3px 0 4px 12px; + margin:0 0 0 0; + text-align: left; + z-index: 0; + color:#FFFFFF; + -moz-border-radius-topleft: 11px; + background-color:#376A94; + +} + +#document-navigation h4 a, .homepage-box h4 a, .externallinks h4 a +{ + background: #4C83A3; + padding: 0 2px; + color: white!important; + border: none!important; +} + +/* news specific */ +.news-section { + margin-top:15px; + min-height:40em; + _height:40em; +} +.news-section h1 { + margin:0 0 10px 0; +} +.news-section p { + padding-left:12px; + margin:0 0 2px 0; +} +.news-section .pubdate { + padding:0 0 0 12px; + margin:0 0 5px 0; + color:#696969; +} +/* homepage specific */ +#intro { + margin-top:5px; +} +#intro h1 { + margin:0 0 10px 0; +} +#intro p { + margin-top:10px +} +.content-section { + margin-top:15px; +} +.content-section h1 { + margin:0 0 10px 0; +} +.content-section p { + padding-left:12px; + margin:0 0 5px 0; +} +.content-section .pubdate { + padding:0 0 0 12px; + margin:0 0 8px 0; + color:#696969; +} +#homepage-boxes { + width: 250px; + float:right; + margin: 0 0 6px 30px; +} + +#homepage-boxes .homepage-box, .externallinks +{ + font-family: Arial, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 98%; + text-align: left; + color: #3C4B6B; + background-color: #FBFBF7; + width: 240px; + border: 1px solid #B7BECC; + z-index: 999; + float:right; + padding-bottom: 10px; + list-style:none; + margin: 6px; + -moz-border-radius-topleft: 12px; + -moz-border-radius-bottomright: 12px; + background-color: #F7F6F0; +} + +#homepage-boxes .homepage-box ul, .externallinks ul +{ + list-style: none; + display: block; + border:0; + padding: 0; + margin: 0.5em 3em 0 1.1em; + color: #3C4B6B; + background: none; + width: auto; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 103%; + margin-left:0; +} + +#homepage-boxes .homepage-box li, #content-body #body-main .externallinks li { + padding-left:15px; +} + + +#homepage-boxes .homepage-box a:link, .externallinks a:link +{ + color: #00A; + text-decoration: none; + border-width:0; + border-bottom:1px dashed #ccc; +} + +#homepage-boxes .homepage-box a:visited, .externallinks a:visited +{ + color: #551A8B; + text-decoration: none; + border-width:0; + border-bottom:1px dashed #ccc; +} + +#homepage-boxes .homepage-box a:hover, .externallinks a:hover +{ + color: #000000; + text-decoration: underline; +} + +#homepage-boxes .items, .externallinks .items { + padding-left: 12px; +} + +#homepage-boxes .homepage-box .items a:link, .externallinks .items a:link +{ + color: #33D; + border-bottom:1px dashed #CCC; +} + +#homepage-boxes .homepage-box .items a:visited, .externallinks .items a:visited +{ + color: #854ABB; + border-bottom:1px dashed #CCC; +} + +.homepage-box li.more { + text-align:right; +} +#skiptonav { + position:absolute; +} + +/* additional rest styles */ + +a.toc-backref { + color: inherit ! important; +} + +ul.auto-toc { + list-style-type: none; +} + +p.admonition-title { + color:red; +} + +pre.literal-block, pre.doctest-block { + padding: 10px; + font-size: 115%; + background-color: #E0E0FF; +} + +div.topic { + margin: 2em; +} + +p.topic-title { + font-weight: bold; +} + +div.admonition, div.attention, div.caution, div.danger, div.error, +div.hint, div.important, div.note, div.tip, div.warning { + margin: 2em; + border-style: solid; + border-color: #CCC; + border-width: thin 0 0 thin; + padding: 0 0.5em 0em 1em; +} + +div.admonition p.admonition-title, div.hint p.admonition-title, +div.important p.admonition-title, div.note p.admonition-title, +div.tip p.admonition-title { + font-weight: bold; + font-size: 110%; +} + +div.attention p.admonition-title, div.caution p.admonition-title, +div.danger p.admonition-title, div.error p.admonition-title, +div.warning p.admonition-title { + color: red; + font-weight: bold; + font-size: 110%; +} + +ol.arabic { + list-style: decimal } + +ol.loweralpha { + list-style: lower-alpha } + +ol.upperalpha { + list-style: upper-alpha } + +ol.lowerroman { + list-style: lower-roman } + +ol.upperroman { + list-style: upper-roman } + +/* used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0 } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 ! important } + +img.hspaced { + padding-left: 1em; + padding-right: 1em; } + +/* General Table Style ?? built for sigs page */ + +#sigindex { + border-collapse:collapse; + width:100%; +} + +#sigindex THEAD { + border-bottom: 2px solid #CCC; +} + +#sigindex TH { + padding: 0.5em 0.2em 0.5em 0.2em ; + text-align:left; +} + +#sigindex TD { + padding: 0.5em 0.2em 0.5em 0.2em ; + border-bottom: 1px dotted #CCC; +} + +blockquote { + margin-left:1em; + padding-left:1em; + border-left:1px solid #CCC; +} + +#sidebar-wrapper { +display:none; +} + +.more { + text-align:right; +} + +#content-body #homepage-boxes a.more { + display:block; + padding:3px 10px 0 0; + border-bottom:0; +} + +.homepage-box div { + padding: 0 15px 0 15px; +} + +/* Tweak alignment of the PyCon ad space */ +#house-ad {padding: 0 1px 0 0;} +#house-ad img {padding-left: 4px} + +#utility-menu dl { + font-size:90%; + text-align:right; + font-weight:bold; +} + +#utility-menu dd { + display:inline; + margin:0; + padding:0 0 0 8px; + font-weight:normal; +} + +#utility-menu dd a { + margin:0; + padding:0; + color:#888; +} + +#utility-menu dt { + display:inline; + margin:0; +} + +#siteinfo.homepage-box h1 { + font-size:70%; + margin:8px 0 0 0 ; + padding:0; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 103%; +} + +#siteinfo.homepage-box div div { + margin-left:0; + padding:0; +} +#footer { + margin:3em 0 0 0; + padding:1em 0 1em 0; + border-top:1px dotted #CCC; + bottom:0; + font-size:90%; + position:relative; + clear:both; +} +#footer a:visited, #footer a:link { + color:#666; + display:inline; +} +#footer a:hover { + color:#333; + display:inline; +} +#footer #credits { + position:absolute; + top:0; + right:0; + margin:1em 0 0 0; +} +#footer #copyright { + text-align: center; + margin: 0; + padding: 0; +} +ul#iconbar li +{ + display: inline; + } + + +#searchbox a.reference, #searchbox span.reference { +position:absolute; +top:2.9em; +right:8.3em; +font-size:85%; +color:#339; +text-decoration:none; +font-weight:normal; +} + +#searchbox a.reference { + border-bottom:1px dotted #CCC; +} + +iframe { + margin-top:20px; +} + +#content { + min-height:500px; + _height:500px; + font-size:115%; +} + +#content p, #content li { + line-height: 1.5; +} + +/* For Meeting Minutes */ +.action { + color:#B00; +} + +/* For Meeting Minutes */ +.followup { + color: #00A; +} + +/* For Meeting Minutes */ +.progress { + color: #090; +} + +/* For Meeting Minutes */ +.minutes-title { + text-align: center; + font-family: Georgia, "Bitstream Vera Serif", "New York", Palatino, serif; + font-size: 160%; + font-weight: bold; + line-height: 120%; + color: #234764; + margin-bottom: 1.0em; +} + +#body-main .success p a { + display:inline; + } + +#body-main .success p { + margin:4px 8px; + } + +/* For PEP header blocks */ +.rfc2822 th.field-name { + text-align: right; + padding-right: 0.5em; +} + +/* For field lists */ +th.field-name { + text-align: left; + padding-right: 0.5em; +} + +#applications h5 { + margin:0; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + font-size: 103%; + margin: 0 0 0.2em 1em; + font-weight:bold; +} + +#content-body #applications h5 a:visited, +#content-body #applications h5 a:link { + color:#444; + border:0; +} + +#applications p { + font-size: 85%; + width:100%; + margin: 0 0 0.5em 0.5em; + font-family: Arial, Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; + padding:0; +} + +.diff-header { + font-weight: bold; +} + +.diff-title { + background-color: #C0C0C0; +} + +.diff-added { + background-color: #E0FFE0; + vertical-align: sub; +} + +.diff-removed { + background-color: #FFFFE0; + vertical-align: sub; +} + +.diff-added span { + background-color: #80FF80; +} + +.diff-removed span { + background-color: #FFFF80; +} + +/* + * This is a set of styles for the embedding of videos such as you see on + * youtube.com and such. The www.python.org/docs/av/5minutes/ page is + * collecting these and you'll see them used in the videoframe.html file + * there. + */ + +.videoframes { + padding: 0; + border-collapse: collapse; +} + +.videoframes .title { + /* Size and Placement */ + margin: 0; + padding: 3px 6px 2px 6px; + width: 668px; + + /* Background and Color */ + background: #3775a9; /* Python Blue */ + color: white; + -moz-background-clip: -moz-initial; + -moz-background-origin: -moz-initial; + -moz-background-inline-policy: -moz-initial; + + /* Typeography */ + font-family: Verdana, sans-serif; + font-size: 120%; + font-size-adjust: none; + font-stretch: normal; + font-style: normal; + font-variant: normal; + font-weight: normal; + line-height: 1.3; + text-align: left; + text-decoration: none; +} + +.videoframes .author { + /* Size and Placement */ + width: 668px; + padding: 2px 6px 1px 6px; + margin: 0; + + /* Background and Color */ + background-color: #e0e0e0; + background-repeat: repeat-x; + color: #000000; + -moz-background-clip: -moz-initial; + -moz-background-origin: -moz-initial; + -moz-background-inline-policy: -moz-initial; + + /* Typeography */ + font-family: Verdana, sans-serif; + font-size: 100%; + font-size-adjust: none; + font-stretch: normal; + font-style: normal; + font-variant: normal; + font-weight: normal; + line-height: 1.3; + text-align: left; +} + +.videoframes .abstract { + /* Size and Placement */ + width: 654px; + padding: 2px 6px 4px 20px; + margin: 0; + + font-style: italic; + background-color: #e0e0e0; +} + +.videoframes .viewscreen { + /* Size and Placement */ + width: 640px; + padding: 4px 20px 4px 20px; + margin: 0; + + /* Background and Color */ + background-color: #e0e0e0; +} + +.videoframes .followup { + /* Size and Placement */ + width: 640px; + margin: 0 0 30px 0; + + font-size: 105%; + text-align: center; + color: black; +} + +.last, .with-subtitle { + margin-bottom: 0 ! important; +} + +div.sidebar { + margin-left: 1em; + border: 1px solid #999999; + padding: 1em; + background-color: #F7F7F7; + width: 40%; + float: right; + clear: right; +} + +p.sidebar-title { + font-family: sans-serif; + font-weight: bold; + font-size: larger; + text-align: center; + margin-top: 0; + margin-bottom: 10px; +} + +p.sidebar-title a:link, p.sidebar-title A:visited +{ + border-bottom: none; +} + +p.sidebar-subtitle { + font-family: sans-serif; + font-weight: bold; + margin-top: 0; + text-align: center; +} + +.clear-right h2 { + clear: right; +} + +.align-right { + margin-left: 1em; +} Added: tracker/instances/python-dev/html/nav-off-bg.png ============================================================================== Binary file. No diff available. Added: tracker/instances/python-dev/html/nav-on-bg.png ============================================================================== Binary file. No diff available. Modified: tracker/instances/python-dev/html/page.html ============================================================================== --- tracker/instances/python-dev/html/page.html (original) +++ tracker/instances/python-dev/html/page.html Sat Jan 21 14:49:39 2012 @@ -4,7 +4,7 @@ title goes here - +

    -

    Added: tracker/instances/python-dev/html/python-logo.gif ============================================================================== Binary file. No diff available. From python-checkins at python.org Sat Jan 21 15:41:39 2012 From: python-checkins at python.org (ezio.melotti) Date: Sat, 21 Jan 2012 15:41:39 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Move_a_space=2E?= Message-ID: http://hg.python.org/cpython/rev/91cbac92a665 changeset: 74556:91cbac92a665 branch: 2.7 parent: 74554:686d95691c99 user: Ezio Melotti date: Sat Jan 21 16:40:03 2012 +0200 summary: Move a space. files: Doc/library/functions.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -910,8 +910,8 @@ *end*. The *file* argument must be an object with a ``write(string)`` method; if it - is not present or ``None``, :data:`sys.stdout` will be used. Output buffering - is determined by *file*. Use ``file.flush()`` to ensure, for instance, + is not present or ``None``, :data:`sys.stdout` will be used. Output buffering + is determined by *file*. Use ``file.flush()`` to ensure, for instance, immediate appearance on a screen. .. note:: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 15:49:55 2012 From: python-checkins at python.org (victor.stinner) Date: Sat, 21 Jan 2012 15:49:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313706=3A_Support_n?= =?utf8?q?on-ASCII_fill_characters?= Message-ID: http://hg.python.org/cpython/rev/231c6042c40c changeset: 74557:231c6042c40c parent: 74555:b10e3ec9bf3d user: Victor Stinner date: Sat Jan 21 15:50:49 2012 +0100 summary: Issue #13706: Support non-ASCII fill characters files: Lib/test/test_format.py | 20 +++++++++++++++ Python/formatter_unicode.c | 34 ++++++++++++++----------- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -263,6 +263,26 @@ else: raise TestFailed('"%*d"%(maxsize, -127) should fail') + def test_non_ascii(self): + self.assertEqual(format("abc", "\u2007<5"), "abc\u2007\u2007") + self.assertEqual(format(123, "\u2007<5"), "123\u2007\u2007") + self.assertEqual(format(12.3, "\u2007<6"), "12.3\u2007\u2007") + self.assertEqual(format(0j, "\u2007<4"), "0j\u2007\u2007") + self.assertEqual(format(1+2j, "\u2007<8"), "(1+2j)\u2007\u2007") + + self.assertEqual(format("abc", "\u2007>5"), "\u2007\u2007abc") + self.assertEqual(format(123, "\u2007>5"), "\u2007\u2007123") + self.assertEqual(format(12.3, "\u2007>6"), "\u2007\u200712.3") + self.assertEqual(format(1+2j, "\u2007>8"), "\u2007\u2007(1+2j)") + self.assertEqual(format(0j, "\u2007>4"), "\u2007\u20070j") + + self.assertEqual(format("abc", "\u2007^5"), "\u2007abc\u2007") + self.assertEqual(format(123, "\u2007^5"), "\u2007123\u2007") + self.assertEqual(format(12.3, "\u2007^6"), "\u200712.3\u2007") + self.assertEqual(format(1+2j, "\u2007^8"), "\u2007(1+2j)\u2007") + self.assertEqual(format(0j, "\u2007^4"), "\u20070j\u2007") + + def test_main(): support.run_unittest(FormatTest) diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -274,12 +274,8 @@ } } - if (format->fill_char > 127 || format->align > 127 || - format->sign > 127) { - PyErr_SetString(PyExc_ValueError, "fill character too large"); - return 0; - } - + assert (format->align <= 127); + assert (format->sign <= 127); return 1; } @@ -563,10 +559,7 @@ Py_ssize_t t; for (t = 0; t < spec->n_prefix; t++) { Py_UCS4 c = PyUnicode_READ(kind, data, pos + t); - if (c > 127) { - PyErr_SetString(PyExc_SystemError, "prefix not ASCII"); - return -1; - } + assert (c <= 127); PyUnicode_WRITE(kind, data, pos + t, Py_TOUPPER(c)); } } @@ -722,6 +715,9 @@ calc_padding(len, format->width, format->align, &lpad, &rpad, &total); + if (lpad != 0 || rpad != 0) + maxchar = Py_MAX(maxchar, format->fill_char); + /* allocate the resulting string */ result = PyUnicode_New(total, maxchar); if (result == NULL) @@ -791,21 +787,18 @@ /* taken from unicodeobject.c formatchar() */ /* Integer input truncated to a character */ -/* XXX: won't work for int */ x = PyLong_AsLong(value); if (x == -1 && PyErr_Occurred()) goto done; if (x < 0 || x > 0x10ffff) { PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000) " - "(wide Python build)"); + "%c arg not in range(0x110000)"); goto done; } tmp = PyUnicode_FromOrdinal(x); inumeric_chars = 0; n_digits = 1; - if (x > maxchar) - maxchar = x; + maxchar = Py_MAX(maxchar, x); /* As a sort-of hack, we tell calc_number_widths that we only have "remainder" characters. calc_number_widths thinks @@ -882,6 +875,9 @@ n_total = calc_number_widths(&spec, n_prefix, sign_char, tmp, inumeric_chars, inumeric_chars + n_digits, n_remainder, 0, &locale, format); + if (spec.n_lpadding || spec.n_spadding || spec.n_rpadding) + maxchar = Py_MAX(maxchar, format->fill_char); + /* Allocate the memory. */ result = PyUnicode_New(n_total, maxchar); if (!result) @@ -1020,6 +1016,9 @@ index + n_digits, n_remainder, has_decimal, &locale, format); + if (spec.n_lpadding || spec.n_spadding || spec.n_rpadding) + maxchar = Py_MAX(maxchar, format->fill_char); + /* Allocate the memory. */ result = PyUnicode_New(n_total, maxchar); if (result == NULL) @@ -1219,6 +1218,11 @@ calc_padding(n_re_total + n_im_total + 1 + add_parens * 2, format->width, format->align, &lpad, &rpad, &total); + if (re_spec.n_lpadding || re_spec.n_spadding || re_spec.n_rpadding + || im_spec.n_lpadding || im_spec.n_spadding || im_spec.n_rpadding + || lpad || rpad) + maxchar = Py_MAX(maxchar, format->fill_char); + result = PyUnicode_New(total, maxchar); if (result == NULL) goto done; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 20:30:14 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 21 Jan 2012 20:30:14 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEyOTIy?= =?utf8?q?=3A_fix_the_TextIOBase_documentation_to_include_a_description_of?= Message-ID: http://hg.python.org/cpython/rev/03e61104f7a2 changeset: 74558:03e61104f7a2 branch: 3.2 parent: 74553:79e7c5841e66 user: Antoine Pitrou date: Sat Jan 21 20:20:49 2012 +0100 summary: Issue #12922: fix the TextIOBase documentation to include a description of seek() and tell() methods. files: Doc/library/io.rst | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -704,6 +704,32 @@ Read until newline or EOF and return a single ``str``. If the stream is already at EOF, an empty string is returned. + .. method:: seek(offset, whence=SEEK_SET) + + Change the stream position to the given *offset*. Behaviour depends + on the *whence* parameter: + + * :data:`SEEK_SET` or ``0``: seek from the start of the stream + (the default); *offset* must either be a number returned by + :meth:`TextIOBase.tell`, or zero. Any other *offset* value + produces undefined behaviour. + * :data:`SEEK_CUR` or ``1``: "seek" to the current position; + *offset* must be zero, which is a no-operation (all other values + are unsupported). + * :data:`SEEK_END` or ``2``: seek to the end of the stream; + *offset* must be zero (all other values are unsupported). + + Return the new absolute position as an opaque number. + + .. versionadded:: 3.1 + The ``SEEK_*`` constants. + + .. method:: tell() + + Return the current stream position as an opaque number. The number + does not usually represent a number of bytes in the underlying + binary storage. + .. method:: write(s) Write the string *s* to the stream and return the number of characters -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 20:30:15 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 21 Jan 2012 20:30:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2312922=3A_fix_the_TextIOBase_documentation_to_includ?= =?utf8?q?e_a_description_of?= Message-ID: http://hg.python.org/cpython/rev/f7e5abfb31ea changeset: 74559:f7e5abfb31ea parent: 74557:231c6042c40c parent: 74558:03e61104f7a2 user: Antoine Pitrou date: Sat Jan 21 20:22:40 2012 +0100 summary: Issue #12922: fix the TextIOBase documentation to include a description of seek() and tell() methods. files: Doc/library/io.rst | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -713,6 +713,32 @@ Read until newline or EOF and return a single ``str``. If the stream is already at EOF, an empty string is returned. + .. method:: seek(offset, whence=SEEK_SET) + + Change the stream position to the given *offset*. Behaviour depends + on the *whence* parameter: + + * :data:`SEEK_SET` or ``0``: seek from the start of the stream + (the default); *offset* must either be a number returned by + :meth:`TextIOBase.tell`, or zero. Any other *offset* value + produces undefined behaviour. + * :data:`SEEK_CUR` or ``1``: "seek" to the current position; + *offset* must be zero, which is a no-operation (all other values + are unsupported). + * :data:`SEEK_END` or ``2``: seek to the end of the stream; + *offset* must be zero (all other values are unsupported). + + Return the new absolute position as an opaque number. + + .. versionadded:: 3.1 + The ``SEEK_*`` constants. + + .. method:: tell() + + Return the current stream position as an opaque number. The number + does not usually represent a number of bytes in the underlying + binary storage. + .. method:: write(s) Write the string *s* to the stream and return the number of characters -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 20:30:16 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 21 Jan 2012 20:30:16 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyOTIy?= =?utf8?q?=3A_fix_the_TextIOBase_documentation_to_include_a_description_of?= Message-ID: http://hg.python.org/cpython/rev/fcf4d547bed8 changeset: 74560:fcf4d547bed8 branch: 2.7 parent: 74556:91cbac92a665 user: Antoine Pitrou date: Sat Jan 21 20:27:59 2012 +0100 summary: Issue #12922: fix the TextIOBase documentation to include a description of seek() and tell() methods. files: Doc/library/io.rst | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -701,6 +701,32 @@ Read until newline or EOF and return a single ``unicode``. If the stream is already at EOF, an empty string is returned. + .. method:: seek(offset, whence=SEEK_SET) + + Change the stream position to the given *offset*. Behaviour depends + on the *whence* parameter: + + * :data:`SEEK_SET` or ``0``: seek from the start of the stream + (the default); *offset* must either be a number returned by + :meth:`TextIOBase.tell`, or zero. Any other *offset* value + produces undefined behaviour. + * :data:`SEEK_CUR` or ``1``: "seek" to the current position; + *offset* must be zero, which is a no-operation (all other values + are unsupported). + * :data:`SEEK_END` or ``2``: seek to the end of the stream; + *offset* must be zero (all other values are unsupported). + + Return the new absolute position as an opaque number. + + .. versionadded:: 2.7 + The ``SEEK_*`` constants. + + .. method:: tell() + + Return the current stream position as an opaque number. The number + does not usually represent a number of bytes in the underlying + binary storage. + .. method:: write(s) Write the :class:`unicode` string *s* to the stream and return the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 21:51:43 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 21 Jan 2012 21:51:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Avoid_the_compi?= =?utf8?q?ler_warning_about_the_unused_return_value=2E?= Message-ID: http://hg.python.org/cpython/rev/d01fecadf3ea changeset: 74561:d01fecadf3ea branch: 3.2 parent: 74558:03e61104f7a2 user: Gregory P. Smith date: Sat Jan 21 12:31:25 2012 -0800 summary: Avoid the compiler warning about the unused return value. files: Modules/_posixsubprocess.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -51,7 +51,7 @@ PyObject *preexec_fn, PyObject *preexec_fn_args_tuple) { - int i, saved_errno, fd_num; + int i, saved_errno, fd_num, unused; PyObject *result; const char* err_msg = ""; /* Buffer large enough to hold a hex integer. We can't malloc. */ @@ -189,22 +189,25 @@ error: saved_errno = errno; /* Report the posix error to our parent process. */ + /* We ignore all write() return values as the total size of our writes is + * less than PIPEBUF and we cannot do anything about an error anyways. */ if (saved_errno) { char *cur; - write(errpipe_write, "OSError:", 8); + unused = write(errpipe_write, "OSError:", 8); cur = hex_errno + sizeof(hex_errno); while (saved_errno != 0 && cur > hex_errno) { *--cur = "0123456789ABCDEF"[saved_errno % 16]; saved_errno /= 16; } - write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur); - write(errpipe_write, ":", 1); + unused = write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur); + unused = write(errpipe_write, ":", 1); /* We can't call strerror(saved_errno). It is not async signal safe. * The parent process will look the error message up. */ } else { - write(errpipe_write, "RuntimeError:0:", 15); - write(errpipe_write, err_msg, strlen(err_msg)); + unused = write(errpipe_write, "RuntimeError:0:", 15); + unused = write(errpipe_write, err_msg, strlen(err_msg)); } + if (unused) return; /* silly? yes! avoids gcc compiler warning. */ } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 21:51:44 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 21 Jan 2012 21:51:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Avoid_the_compiler_warning_about_the_unused_return_value=2E?= Message-ID: http://hg.python.org/cpython/rev/bd9cf92cfa97 changeset: 74562:bd9cf92cfa97 parent: 74559:f7e5abfb31ea parent: 74561:d01fecadf3ea user: Gregory P. Smith date: Sat Jan 21 12:51:30 2012 -0800 summary: Avoid the compiler warning about the unused return value. files: Modules/_posixsubprocess.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -53,7 +53,7 @@ PyObject *preexec_fn, PyObject *preexec_fn_args_tuple) { - int i, saved_errno, fd_num; + int i, saved_errno, fd_num, unused; PyObject *result; const char* err_msg = ""; /* Buffer large enough to hold a hex integer. We can't malloc. */ @@ -191,22 +191,25 @@ error: saved_errno = errno; /* Report the posix error to our parent process. */ + /* We ignore all write() return values as the total size of our writes is + * less than PIPEBUF and we cannot do anything about an error anyways. */ if (saved_errno) { char *cur; - write(errpipe_write, "OSError:", 8); + unused = write(errpipe_write, "OSError:", 8); cur = hex_errno + sizeof(hex_errno); while (saved_errno != 0 && cur > hex_errno) { *--cur = "0123456789ABCDEF"[saved_errno % 16]; saved_errno /= 16; } - write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur); - write(errpipe_write, ":", 1); + unused = write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur); + unused = write(errpipe_write, ":", 1); /* We can't call strerror(saved_errno). It is not async signal safe. * The parent process will look the error message up. */ } else { - write(errpipe_write, "RuntimeError:0:", 15); - write(errpipe_write, err_msg, strlen(err_msg)); + unused = write(errpipe_write, "RuntimeError:0:", 15); + unused = write(errpipe_write, err_msg, strlen(err_msg)); } + if (unused) return; /* silly? yes! avoids gcc compiler warning. */ } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 23:39:41 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 21 Jan 2012 23:39:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fixes_issue_=23?= =?utf8?q?8052=3A_The_posix_subprocess_module=27s_close=5Ffds_behavior_was?= Message-ID: http://hg.python.org/cpython/rev/61aa484a3e54 changeset: 74563:61aa484a3e54 branch: 3.2 parent: 74561:d01fecadf3ea user: Gregory P. Smith date: Sat Jan 21 14:01:08 2012 -0800 summary: Fixes issue #8052: The posix subprocess module's close_fds behavior was suboptimal by closing all possible file descriptors rather than just the open ones in the child process before exec(). It now closes only the open fds when it is possible to safely determine what those are. files: Lib/test/test_subprocess.py | 18 + Modules/_posixsubprocess.c | 293 +++++++++++++++++++++-- configure | 2 +- configure.in | 2 +- pyconfig.h.in | 3 + 5 files changed, 281 insertions(+), 37 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1295,6 +1295,11 @@ self.addCleanup(os.close, fds[1]) open_fds = set(fds) + # add a bunch more fds + for _ in range(9): + fd = os.open("/dev/null", os.O_RDONLY) + self.addCleanup(os.close, fd) + open_fds.add(fd) p = subprocess.Popen([sys.executable, fd_status], stdout=subprocess.PIPE, close_fds=False) @@ -1313,6 +1318,19 @@ "Some fds were left open") self.assertIn(1, remaining_fds, "Subprocess failed") + # Keep some of the fd's we opened open in the subprocess. + # This tests _posixsubprocess.c's proper handling of fds_to_keep. + fds_to_keep = set(open_fds.pop() for _ in range(8)) + p = subprocess.Popen([sys.executable, fd_status], + stdout=subprocess.PIPE, close_fds=True, + pass_fds=()) + output, ignored = p.communicate() + remaining_fds = set(map(int, output.split(b','))) + + self.assertFalse(remaining_fds & fds_to_keep & open_fds, + "Some fds not in pass_fds were left open") + self.assertIn(1, remaining_fds, "Subprocess failed") + # Mac OS X Tiger (10.4) has a kernel bug: sometimes, the file # descriptor of a pipe closed in the parent process is valid in the # child process according to fstat(), but the mode of the file diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -5,7 +5,26 @@ #endif #include #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SYSCALL_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#if defined(sun) && !defined(HAVE_DIRFD) +/* Some versions of Solaris lack dirfd(). */ +# define DIRFD(dirp) ((dirp)->dd_fd) +# define HAVE_DIRFD +#else +# define DIRFD(dirp) (dirfd(dirp)) +#endif + +#define LINUX_SOLARIS_FD_DIR "/proc/self/fd" +#define BSD_OSX_FD_DIR "/dev/fd" #define POSIX_CALL(call) if ((call) == -1) goto error @@ -26,6 +45,233 @@ } +/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ +static int _pos_int_from_ascii(char *name) +{ + int num = 0; + while (*name >= '0' && *name <= '9') { + num = num * 10 + (*name - '0'); + ++name; + } + if (*name) + return -1; /* Non digit found, not a number. */ + return num; +} + + +/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ +static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) +{ + Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); + long prev_fd = -1; + for (seq_idx = 0; seq_idx < seq_len; ++seq_idx) { + PyObject* py_fd = PySequence_Fast_GET_ITEM(fd_sequence, seq_idx); + long iter_fd = PyLong_AsLong(py_fd); + if (iter_fd < 0 || iter_fd < prev_fd || iter_fd > INT_MAX) { + /* Negative, overflow, not a Long, unsorted, too big for a fd. */ + return 1; + } + } + return 0; +} + + +/* Is fd found in the sorted Python Sequence? */ +static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) +{ + /* Binary search. */ + Py_ssize_t search_min = 0; + Py_ssize_t search_max = PySequence_Length(fd_sequence) - 1; + if (search_max < 0) + return 0; + do { + long middle = (search_min + search_max) / 2; + long middle_fd = PyLong_AsLong( + PySequence_Fast_GET_ITEM(fd_sequence, middle)); + if (fd == middle_fd) + return 1; + if (fd > middle_fd) + search_min = middle + 1; + else + search_max = middle - 1; + } while (search_min <= search_max); + return 0; +} + + +/* Close all file descriptors in the range start_fd inclusive to + * end_fd exclusive except for those in py_fds_to_keep. If the + * range defined by [start_fd, end_fd) is large this will take a + * long time as it calls close() on EVERY possible fd. + */ +static void _close_fds_by_brute_force(int start_fd, int end_fd, + PyObject *py_fds_to_keep) +{ + Py_ssize_t num_fds_to_keep = PySequence_Length(py_fds_to_keep); + Py_ssize_t keep_seq_idx; + int fd_num; + /* As py_fds_to_keep is sorted we can loop through the list closing + * fds inbetween any in the keep list falling within our range. */ + for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { + PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, + keep_seq_idx); + int keep_fd = PyLong_AsLong(py_keep_fd); + if (keep_fd < start_fd) + continue; + for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { + while (close(fd_num) < 0 && errno == EINTR); + } + start_fd = keep_fd + 1; + } + if (start_fd <= end_fd) { + for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { + while (close(fd_num) < 0 && errno == EINTR); + } + } +} + + +#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H) +/* It doesn't matter if d_name has room for NAME_MAX chars; we're using this + * only to read a directory of short file descriptor number names. The kernel + * will return an error if we didn't give it enough space. Highly Unlikely. + * This structure is very old and stable: It will not change unless the kernel + * chooses to break compatibility with all existing binaries. Highly Unlikely. + */ +struct linux_dirent { + unsigned long d_ino; /* Inode number */ + unsigned long d_off; /* Offset to next linux_dirent */ + unsigned short d_reclen; /* Length of this linux_dirent */ + char d_name[256]; /* Filename (null-terminated) */ +}; + +/* Close all open file descriptors in the range start_fd inclusive to end_fd + * exclusive. Do not close any in the sorted py_fds_to_keep list. + * + * This version is async signal safe as it does not make any unsafe C library + * calls, malloc calls or handle any locks. It is _unfortunate_ to be forced + * to resort to making a kernel system call directly but this is the ONLY api + * available that does no harm. opendir/readdir/closedir perform memory + * allocation and locking so while they usually work they are not guaranteed + * to (especially if you have replaced your malloc implementation). A version + * of this function that uses those can be found in the _maybe_unsafe variant. + * + * This is Linux specific because that is all I am ready to test it on. It + * should be easy to add OS specific dirent or dirent64 structures and modify + * it with some cpp #define magic to work on other OSes as well if you want. + */ +static void _close_open_fd_range_safe(int start_fd, int end_fd, + PyObject* py_fds_to_keep) +{ + int fd_dir_fd; + if (start_fd >= end_fd) + return; + fd_dir_fd = open(LINUX_SOLARIS_FD_DIR, O_RDONLY | O_CLOEXEC, 0); + /* Not trying to open the BSD_OSX path as this is currently Linux only. */ + if (fd_dir_fd == -1) { + /* No way to get a list of open fds. */ + _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); + return; + } else { + char buffer[sizeof(struct linux_dirent)]; + int bytes; + while ((bytes = syscall(SYS_getdents, fd_dir_fd, + (struct linux_dirent *)buffer, + sizeof(buffer))) > 0) { + struct linux_dirent *entry; + int offset; + for (offset = 0; offset < bytes; offset += entry->d_reclen) { + int fd; + entry = (struct linux_dirent *)(buffer + offset); + if ((fd = _pos_int_from_ascii(entry->d_name)) < 0) + continue; /* Not a number. */ + if (fd != fd_dir_fd && fd >= start_fd && fd < end_fd && + !_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { + while (close(fd) < 0 && errno == EINTR); + } + } + } + close(fd_dir_fd); + } +} + +#define _close_open_fd_range _close_open_fd_range_safe + +#else /* NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */ + + +/* Close all open file descriptors in the range start_fd inclusive to end_fd + * exclusive. Do not close any in the sorted py_fds_to_keep list. + * + * This function violates the strict use of async signal safe functions. :( + * It calls opendir(), readdir64() and closedir(). Of these, the one most + * likely to ever cause a problem is opendir() as it performs an internal + * malloc(). Practically this should not be a problem. The Java VM makes the + * same calls between fork and exec in its own UNIXProcess_md.c implementation. + * + * readdir_r() is not used because it provides no benefit. It is typically + * implemented as readdir() followed by memcpy(). See also: + * http://womble.decadent.org.uk/readdir_r-advisory.html + */ +static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, + PyObject* py_fds_to_keep) +{ + DIR *proc_fd_dir; +#ifndef HAVE_DIRFD + while (_is_fd_in_sorted_fd_sequence(start_fd, py_fds_to_keep) && + (start_fd < end_fd)) { + ++start_fd; + } + if (start_fd >= end_fd) + return; + /* Close our lowest fd before we call opendir so that it is likely to + * reuse that fd otherwise we might close opendir's file descriptor in + * our loop. This trick assumes that fd's are allocated on a lowest + * available basis. */ + while (close(start_fd) < 0 && errno == EINTR); + ++start_fd; +#endif + if (start_fd >= end_fd) + return; + + proc_fd_dir = opendir(BSD_OSX_FD_DIR); + if (!proc_fd_dir) + proc_fd_dir = opendir(LINUX_SOLARIS_FD_DIR); + if (!proc_fd_dir) { + /* No way to get a list of open fds. */ + _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); + } else { + struct dirent64 *dir_entry; +#ifdef HAVE_DIRFD + int fd_used_by_opendir = DIRFD(proc_fd_dir); +#else + int fd_used_by_opendir = start_fd - 1; +#endif + errno = 0; + /* readdir64 is used to work around Solaris 9 bug 6395699. */ + while ((dir_entry = readdir64(proc_fd_dir))) { + int fd; + if ((fd = _pos_int_from_ascii(dir_entry->d_name)) < 0) + continue; /* Not a number. */ + if (fd != fd_used_by_opendir && fd >= start_fd && fd < end_fd && + !_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { + while (close(fd) < 0 && errno == EINTR); + } + errno = 0; + } + if (errno) { + /* readdir error, revert behavior. Highly Unlikely. */ + _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); + } + closedir(proc_fd_dir); + } +} + +#define _close_open_fd_range _close_open_fd_range_maybe_unsafe + +#endif /* else NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */ + + /* * This function is code executed in the child process immediately after fork * to set things up and call exec(). @@ -46,12 +292,12 @@ int errread, int errwrite, int errpipe_read, int errpipe_write, int close_fds, int restore_signals, - int call_setsid, Py_ssize_t num_fds_to_keep, + int call_setsid, PyObject *py_fds_to_keep, PyObject *preexec_fn, PyObject *preexec_fn_args_tuple) { - int i, saved_errno, fd_num, unused; + int i, saved_errno, unused; PyObject *result; const char* err_msg = ""; /* Buffer large enough to hold a hex integer. We can't malloc. */ @@ -113,33 +359,8 @@ POSIX_CALL(close(errwrite)); } - /* close() is intentionally not checked for errors here as we are closing */ - /* a large range of fds, some of which may be invalid. */ - if (close_fds) { - Py_ssize_t keep_seq_idx; - int start_fd = 3; - for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { - PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, - keep_seq_idx); - int keep_fd = PyLong_AsLong(py_keep_fd); - if (keep_fd < 0) { /* Negative number, overflow or not a Long. */ - err_msg = "bad value in fds_to_keep."; - errno = 0; /* We don't want to report an OSError. */ - goto error; - } - if (keep_fd < start_fd) - continue; - for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { - close(fd_num); - } - start_fd = keep_fd + 1; - } - if (start_fd <= max_fd) { - for (fd_num = start_fd; fd_num < max_fd; ++fd_num) { - close(fd_num); - } - } - } + if (close_fds) + _close_open_fd_range(3, max_fd, py_fds_to_keep); if (cwd) POSIX_CALL(chdir(cwd)); @@ -227,7 +448,7 @@ pid_t pid; int need_to_reenable_gc = 0; char *const *exec_array, *const *argv = NULL, *const *envp = NULL; - Py_ssize_t arg_num, num_fds_to_keep; + Py_ssize_t arg_num; if (!PyArg_ParseTuple( args, "OOOOOOiiiiiiiiiiO:fork_exec", @@ -243,9 +464,12 @@ PyErr_SetString(PyExc_ValueError, "errpipe_write must be >= 3"); return NULL; } - num_fds_to_keep = PySequence_Length(py_fds_to_keep); - if (num_fds_to_keep < 0) { - PyErr_SetString(PyExc_ValueError, "bad fds_to_keep"); + if (PySequence_Length(py_fds_to_keep) < 0) { + PyErr_SetString(PyExc_ValueError, "cannot get length of fds_to_keep"); + return NULL; + } + if (_sanity_check_python_fd_sequence(py_fds_to_keep)) { + PyErr_SetString(PyExc_ValueError, "bad value(s) in fds_to_keep"); return NULL; } @@ -348,8 +572,7 @@ p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, close_fds, restore_signals, call_setsid, - num_fds_to_keep, py_fds_to_keep, - preexec_fn, preexec_fn_args_tuple); + py_fds_to_keep, preexec_fn, preexec_fn_args_tuple); _exit(255); return NULL; /* Dead code to avoid a potential compiler warning. */ } diff --git a/configure b/configure --- a/configure +++ b/configure @@ -6165,7 +6165,7 @@ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ -sys/termio.h sys/time.h \ +sys/syscall.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h spawn.h util.h diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -1341,7 +1341,7 @@ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ -sys/termio.h sys/time.h \ +sys/syscall.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h spawn.h util.h) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -789,6 +789,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCALL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TERMIO_H -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 23:39:42 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 21 Jan 2012 23:39:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fixes_issue_=238052=3A_The_posix_subprocess_module=27s_close?= =?utf8?q?=5Ffds_behavior_was?= Message-ID: http://hg.python.org/cpython/rev/8879874d66a2 changeset: 74564:8879874d66a2 parent: 74562:bd9cf92cfa97 parent: 74563:61aa484a3e54 user: Gregory P. Smith date: Sat Jan 21 14:39:29 2012 -0800 summary: Fixes issue #8052: The posix subprocess module's close_fds behavior was suboptimal by closing all possible file descriptors rather than just the open ones in the child process before exec(). It now closes only the open fds when it is possible to safely determine what those are. files: Lib/test/test_subprocess.py | 18 + Modules/_posixsubprocess.c | 293 +++++++++++++++++++++-- configure | 2 +- configure.in | 2 +- pyconfig.h.in | 3 + 5 files changed, 281 insertions(+), 37 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1392,6 +1392,11 @@ self.addCleanup(os.close, fds[1]) open_fds = set(fds) + # add a bunch more fds + for _ in range(9): + fd = os.open("/dev/null", os.O_RDONLY) + self.addCleanup(os.close, fd) + open_fds.add(fd) p = subprocess.Popen([sys.executable, fd_status], stdout=subprocess.PIPE, close_fds=False) @@ -1410,6 +1415,19 @@ "Some fds were left open") self.assertIn(1, remaining_fds, "Subprocess failed") + # Keep some of the fd's we opened open in the subprocess. + # This tests _posixsubprocess.c's proper handling of fds_to_keep. + fds_to_keep = set(open_fds.pop() for _ in range(8)) + p = subprocess.Popen([sys.executable, fd_status], + stdout=subprocess.PIPE, close_fds=True, + pass_fds=()) + output, ignored = p.communicate() + remaining_fds = set(map(int, output.split(b','))) + + self.assertFalse(remaining_fds & fds_to_keep & open_fds, + "Some fds not in pass_fds were left open") + self.assertIn(1, remaining_fds, "Subprocess failed") + # Mac OS X Tiger (10.4) has a kernel bug: sometimes, the file # descriptor of a pipe closed in the parent process is valid in the # child process according to fstat(), but the mode of the file diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -5,7 +5,26 @@ #endif #include #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SYSCALL_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#if defined(sun) && !defined(HAVE_DIRFD) +/* Some versions of Solaris lack dirfd(). */ +# define DIRFD(dirp) ((dirp)->dd_fd) +# define HAVE_DIRFD +#else +# define DIRFD(dirp) (dirfd(dirp)) +#endif + +#define LINUX_SOLARIS_FD_DIR "/proc/self/fd" +#define BSD_OSX_FD_DIR "/dev/fd" #define POSIX_CALL(call) if ((call) == -1) goto error @@ -28,6 +47,233 @@ } +/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ +static int _pos_int_from_ascii(char *name) +{ + int num = 0; + while (*name >= '0' && *name <= '9') { + num = num * 10 + (*name - '0'); + ++name; + } + if (*name) + return -1; /* Non digit found, not a number. */ + return num; +} + + +/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ +static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) +{ + Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); + long prev_fd = -1; + for (seq_idx = 0; seq_idx < seq_len; ++seq_idx) { + PyObject* py_fd = PySequence_Fast_GET_ITEM(fd_sequence, seq_idx); + long iter_fd = PyLong_AsLong(py_fd); + if (iter_fd < 0 || iter_fd < prev_fd || iter_fd > INT_MAX) { + /* Negative, overflow, not a Long, unsorted, too big for a fd. */ + return 1; + } + } + return 0; +} + + +/* Is fd found in the sorted Python Sequence? */ +static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) +{ + /* Binary search. */ + Py_ssize_t search_min = 0; + Py_ssize_t search_max = PySequence_Length(fd_sequence) - 1; + if (search_max < 0) + return 0; + do { + long middle = (search_min + search_max) / 2; + long middle_fd = PyLong_AsLong( + PySequence_Fast_GET_ITEM(fd_sequence, middle)); + if (fd == middle_fd) + return 1; + if (fd > middle_fd) + search_min = middle + 1; + else + search_max = middle - 1; + } while (search_min <= search_max); + return 0; +} + + +/* Close all file descriptors in the range start_fd inclusive to + * end_fd exclusive except for those in py_fds_to_keep. If the + * range defined by [start_fd, end_fd) is large this will take a + * long time as it calls close() on EVERY possible fd. + */ +static void _close_fds_by_brute_force(int start_fd, int end_fd, + PyObject *py_fds_to_keep) +{ + Py_ssize_t num_fds_to_keep = PySequence_Length(py_fds_to_keep); + Py_ssize_t keep_seq_idx; + int fd_num; + /* As py_fds_to_keep is sorted we can loop through the list closing + * fds inbetween any in the keep list falling within our range. */ + for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { + PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, + keep_seq_idx); + int keep_fd = PyLong_AsLong(py_keep_fd); + if (keep_fd < start_fd) + continue; + for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { + while (close(fd_num) < 0 && errno == EINTR); + } + start_fd = keep_fd + 1; + } + if (start_fd <= end_fd) { + for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { + while (close(fd_num) < 0 && errno == EINTR); + } + } +} + + +#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H) +/* It doesn't matter if d_name has room for NAME_MAX chars; we're using this + * only to read a directory of short file descriptor number names. The kernel + * will return an error if we didn't give it enough space. Highly Unlikely. + * This structure is very old and stable: It will not change unless the kernel + * chooses to break compatibility with all existing binaries. Highly Unlikely. + */ +struct linux_dirent { + unsigned long d_ino; /* Inode number */ + unsigned long d_off; /* Offset to next linux_dirent */ + unsigned short d_reclen; /* Length of this linux_dirent */ + char d_name[256]; /* Filename (null-terminated) */ +}; + +/* Close all open file descriptors in the range start_fd inclusive to end_fd + * exclusive. Do not close any in the sorted py_fds_to_keep list. + * + * This version is async signal safe as it does not make any unsafe C library + * calls, malloc calls or handle any locks. It is _unfortunate_ to be forced + * to resort to making a kernel system call directly but this is the ONLY api + * available that does no harm. opendir/readdir/closedir perform memory + * allocation and locking so while they usually work they are not guaranteed + * to (especially if you have replaced your malloc implementation). A version + * of this function that uses those can be found in the _maybe_unsafe variant. + * + * This is Linux specific because that is all I am ready to test it on. It + * should be easy to add OS specific dirent or dirent64 structures and modify + * it with some cpp #define magic to work on other OSes as well if you want. + */ +static void _close_open_fd_range_safe(int start_fd, int end_fd, + PyObject* py_fds_to_keep) +{ + int fd_dir_fd; + if (start_fd >= end_fd) + return; + fd_dir_fd = open(LINUX_SOLARIS_FD_DIR, O_RDONLY | O_CLOEXEC, 0); + /* Not trying to open the BSD_OSX path as this is currently Linux only. */ + if (fd_dir_fd == -1) { + /* No way to get a list of open fds. */ + _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); + return; + } else { + char buffer[sizeof(struct linux_dirent)]; + int bytes; + while ((bytes = syscall(SYS_getdents, fd_dir_fd, + (struct linux_dirent *)buffer, + sizeof(buffer))) > 0) { + struct linux_dirent *entry; + int offset; + for (offset = 0; offset < bytes; offset += entry->d_reclen) { + int fd; + entry = (struct linux_dirent *)(buffer + offset); + if ((fd = _pos_int_from_ascii(entry->d_name)) < 0) + continue; /* Not a number. */ + if (fd != fd_dir_fd && fd >= start_fd && fd < end_fd && + !_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { + while (close(fd) < 0 && errno == EINTR); + } + } + } + close(fd_dir_fd); + } +} + +#define _close_open_fd_range _close_open_fd_range_safe + +#else /* NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */ + + +/* Close all open file descriptors in the range start_fd inclusive to end_fd + * exclusive. Do not close any in the sorted py_fds_to_keep list. + * + * This function violates the strict use of async signal safe functions. :( + * It calls opendir(), readdir64() and closedir(). Of these, the one most + * likely to ever cause a problem is opendir() as it performs an internal + * malloc(). Practically this should not be a problem. The Java VM makes the + * same calls between fork and exec in its own UNIXProcess_md.c implementation. + * + * readdir_r() is not used because it provides no benefit. It is typically + * implemented as readdir() followed by memcpy(). See also: + * http://womble.decadent.org.uk/readdir_r-advisory.html + */ +static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, + PyObject* py_fds_to_keep) +{ + DIR *proc_fd_dir; +#ifndef HAVE_DIRFD + while (_is_fd_in_sorted_fd_sequence(start_fd, py_fds_to_keep) && + (start_fd < end_fd)) { + ++start_fd; + } + if (start_fd >= end_fd) + return; + /* Close our lowest fd before we call opendir so that it is likely to + * reuse that fd otherwise we might close opendir's file descriptor in + * our loop. This trick assumes that fd's are allocated on a lowest + * available basis. */ + while (close(start_fd) < 0 && errno == EINTR); + ++start_fd; +#endif + if (start_fd >= end_fd) + return; + + proc_fd_dir = opendir(BSD_OSX_FD_DIR); + if (!proc_fd_dir) + proc_fd_dir = opendir(LINUX_SOLARIS_FD_DIR); + if (!proc_fd_dir) { + /* No way to get a list of open fds. */ + _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); + } else { + struct dirent64 *dir_entry; +#ifdef HAVE_DIRFD + int fd_used_by_opendir = DIRFD(proc_fd_dir); +#else + int fd_used_by_opendir = start_fd - 1; +#endif + errno = 0; + /* readdir64 is used to work around Solaris 9 bug 6395699. */ + while ((dir_entry = readdir64(proc_fd_dir))) { + int fd; + if ((fd = _pos_int_from_ascii(dir_entry->d_name)) < 0) + continue; /* Not a number. */ + if (fd != fd_used_by_opendir && fd >= start_fd && fd < end_fd && + !_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { + while (close(fd) < 0 && errno == EINTR); + } + errno = 0; + } + if (errno) { + /* readdir error, revert behavior. Highly Unlikely. */ + _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); + } + closedir(proc_fd_dir); + } +} + +#define _close_open_fd_range _close_open_fd_range_maybe_unsafe + +#endif /* else NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */ + + /* * This function is code executed in the child process immediately after fork * to set things up and call exec(). @@ -48,12 +294,12 @@ int errread, int errwrite, int errpipe_read, int errpipe_write, int close_fds, int restore_signals, - int call_setsid, Py_ssize_t num_fds_to_keep, + int call_setsid, PyObject *py_fds_to_keep, PyObject *preexec_fn, PyObject *preexec_fn_args_tuple) { - int i, saved_errno, fd_num, unused; + int i, saved_errno, unused; PyObject *result; const char* err_msg = ""; /* Buffer large enough to hold a hex integer. We can't malloc. */ @@ -115,33 +361,8 @@ POSIX_CALL(close(errwrite)); } - /* close() is intentionally not checked for errors here as we are closing */ - /* a large range of fds, some of which may be invalid. */ - if (close_fds) { - Py_ssize_t keep_seq_idx; - int start_fd = 3; - for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { - PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, - keep_seq_idx); - int keep_fd = PyLong_AsLong(py_keep_fd); - if (keep_fd < 0) { /* Negative number, overflow or not a Long. */ - err_msg = "bad value in fds_to_keep."; - errno = 0; /* We don't want to report an OSError. */ - goto error; - } - if (keep_fd < start_fd) - continue; - for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { - close(fd_num); - } - start_fd = keep_fd + 1; - } - if (start_fd <= max_fd) { - for (fd_num = start_fd; fd_num < max_fd; ++fd_num) { - close(fd_num); - } - } - } + if (close_fds) + _close_open_fd_range(3, max_fd, py_fds_to_keep); if (cwd) POSIX_CALL(chdir(cwd)); @@ -229,7 +450,7 @@ pid_t pid; int need_to_reenable_gc = 0; char *const *exec_array, *const *argv = NULL, *const *envp = NULL; - Py_ssize_t arg_num, num_fds_to_keep; + Py_ssize_t arg_num; if (!PyArg_ParseTuple( args, "OOOOOOiiiiiiiiiiO:fork_exec", @@ -245,9 +466,12 @@ PyErr_SetString(PyExc_ValueError, "errpipe_write must be >= 3"); return NULL; } - num_fds_to_keep = PySequence_Length(py_fds_to_keep); - if (num_fds_to_keep < 0) { - PyErr_SetString(PyExc_ValueError, "bad fds_to_keep"); + if (PySequence_Length(py_fds_to_keep) < 0) { + PyErr_SetString(PyExc_ValueError, "cannot get length of fds_to_keep"); + return NULL; + } + if (_sanity_check_python_fd_sequence(py_fds_to_keep)) { + PyErr_SetString(PyExc_ValueError, "bad value(s) in fds_to_keep"); return NULL; } @@ -353,8 +577,7 @@ p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, close_fds, restore_signals, call_setsid, - num_fds_to_keep, py_fds_to_keep, - preexec_fn, preexec_fn_args_tuple); + py_fds_to_keep, preexec_fn, preexec_fn_args_tuple); _exit(255); return NULL; /* Dead code to avoid a potential compiler warning. */ } diff --git a/configure b/configure --- a/configure +++ b/configure @@ -6147,7 +6147,7 @@ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ -sys/stat.h sys/termio.h sys/time.h \ +sys/stat.h sys/syscall.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h spawn.h util.h diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -1337,7 +1337,7 @@ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ -sys/stat.h sys/termio.h sys/time.h \ +sys/stat.h sys/syscall.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h spawn.h util.h) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -948,6 +948,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCALL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TERMIO_H -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 23:51:04 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 21 Jan 2012 23:51:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Add_a_Misc/NEWS?= =?utf8?q?_entry_for_issue_8052=2E?= Message-ID: http://hg.python.org/cpython/rev/780992c9afea changeset: 74565:780992c9afea branch: 3.2 parent: 74563:61aa484a3e54 user: Gregory P. Smith date: Sat Jan 21 14:50:11 2012 -0800 summary: Add a Misc/NEWS entry for issue 8052. files: Misc/NEWS | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,11 @@ - Fix the builtin module initialization code to store the init function for future reinitialization. +- Issue #8052: The posix subprocess module would take a long time closing + all possible file descriptors in the child process rather than just open + file descriptors. It now closes only the open fds if possible for the + default close_fds=True behavior. + - Issue #13629: Renumber the tokens in token.h so that they match the indexes into _PyParser_TokenNames. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 21 23:51:05 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 21 Jan 2012 23:51:05 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_A_Misc/NEWS_entry_for_issue_8052=2E?= Message-ID: http://hg.python.org/cpython/rev/1f0a01dc723c changeset: 74566:1f0a01dc723c parent: 74564:8879874d66a2 parent: 74565:780992c9afea user: Gregory P. Smith date: Sat Jan 21 14:50:56 2012 -0800 summary: A Misc/NEWS entry for issue 8052. files: Misc/NEWS | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -16,6 +16,11 @@ - Fix the builtin module initialization code to store the init function for future reinitialization. +- Issue #8052: The posix subprocess module would take a long time closing + all possible file descriptors in the child process rather than just open + file descriptors. It now closes only the open fds if possible for the + default close_fds=True behavior. + - Issue #13629: Renumber the tokens in token.h so that they match the indexes into _PyParser_TokenNames. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 00:21:19 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 00:21:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Bugfix_for_issu?= =?utf8?q?e_=238052_fix_on_*BSD_variants=2E?= Message-ID: http://hg.python.org/cpython/rev/d0acd8169c2a changeset: 74567:d0acd8169c2a branch: 3.2 parent: 74565:780992c9afea user: Gregory P. Smith date: Sat Jan 21 15:16:17 2012 -0800 summary: Bugfix for issue #8052 fix on *BSD variants. Many lack readdir64, use readdir. Only use readdir64 on solaris where it is required to work around a solaris bug. files: Modules/_posixsubprocess.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -15,12 +15,17 @@ #include #endif -#if defined(sun) && !defined(HAVE_DIRFD) +#if defined(sun) +/* readdir64 is used to work around Solaris 9 bug 6395699. */ +# define readdir readdir64 +# define dirent dirent64 +# if !defined(HAVE_DIRFD) /* Some versions of Solaris lack dirfd(). */ -# define DIRFD(dirp) ((dirp)->dd_fd) -# define HAVE_DIRFD -#else -# define DIRFD(dirp) (dirfd(dirp)) +# define DIRFD(dirp) ((dirp)->dd_fd) +# define HAVE_DIRFD +# else +# define DIRFD(dirp) (dirfd(dirp)) +# endif #endif #define LINUX_SOLARIS_FD_DIR "/proc/self/fd" @@ -204,7 +209,7 @@ * exclusive. Do not close any in the sorted py_fds_to_keep list. * * This function violates the strict use of async signal safe functions. :( - * It calls opendir(), readdir64() and closedir(). Of these, the one most + * It calls opendir(), readdir() and closedir(). Of these, the one most * likely to ever cause a problem is opendir() as it performs an internal * malloc(). Practically this should not be a problem. The Java VM makes the * same calls between fork and exec in its own UNIXProcess_md.c implementation. @@ -241,15 +246,14 @@ /* No way to get a list of open fds. */ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); } else { - struct dirent64 *dir_entry; + struct dirent *dir_entry; #ifdef HAVE_DIRFD int fd_used_by_opendir = DIRFD(proc_fd_dir); #else int fd_used_by_opendir = start_fd - 1; #endif errno = 0; - /* readdir64 is used to work around Solaris 9 bug 6395699. */ - while ((dir_entry = readdir64(proc_fd_dir))) { + while ((dir_entry = readdir(proc_fd_dir))) { int fd; if ((fd = _pos_int_from_ascii(dir_entry->d_name)) < 0) continue; /* Not a number. */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 00:21:28 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 00:21:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Another_issue_?= =?utf8?q?=238052_bugfix_=28related_to_previous_commit=29=2E?= Message-ID: http://hg.python.org/cpython/rev/5be3dadd2eef changeset: 74568:5be3dadd2eef branch: 3.2 user: Gregory P. Smith date: Sat Jan 21 15:19:11 2012 -0800 summary: Another issue #8052 bugfix (related to previous commit). "oops" while rearranging the #defines. files: Modules/_posixsubprocess.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -21,10 +21,8 @@ # define dirent dirent64 # if !defined(HAVE_DIRFD) /* Some versions of Solaris lack dirfd(). */ -# define DIRFD(dirp) ((dirp)->dd_fd) +# define dirfd(dirp) ((dirp)->dd_fd) # define HAVE_DIRFD -# else -# define DIRFD(dirp) (dirfd(dirp)) # endif #endif @@ -248,7 +246,7 @@ } else { struct dirent *dir_entry; #ifdef HAVE_DIRFD - int fd_used_by_opendir = DIRFD(proc_fd_dir); + int fd_used_by_opendir = dirfd(proc_fd_dir); #else int fd_used_by_opendir = start_fd - 1; #endif -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 00:21:31 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 00:21:31 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_bugfix_for_issue_8052_fixes_on_*BSD_platforms=2E?= Message-ID: http://hg.python.org/cpython/rev/e52d81e0c750 changeset: 74569:e52d81e0c750 parent: 74566:1f0a01dc723c parent: 74567:d0acd8169c2a user: Gregory P. Smith date: Sat Jan 21 15:20:08 2012 -0800 summary: bugfix for issue 8052 fixes on *BSD platforms. files: Modules/_posixsubprocess.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -15,12 +15,17 @@ #include #endif -#if defined(sun) && !defined(HAVE_DIRFD) +#if defined(sun) +/* readdir64 is used to work around Solaris 9 bug 6395699. */ +# define readdir readdir64 +# define dirent dirent64 +# if !defined(HAVE_DIRFD) /* Some versions of Solaris lack dirfd(). */ -# define DIRFD(dirp) ((dirp)->dd_fd) -# define HAVE_DIRFD -#else -# define DIRFD(dirp) (dirfd(dirp)) +# define DIRFD(dirp) ((dirp)->dd_fd) +# define HAVE_DIRFD +# else +# define DIRFD(dirp) (dirfd(dirp)) +# endif #endif #define LINUX_SOLARIS_FD_DIR "/proc/self/fd" @@ -206,7 +211,7 @@ * exclusive. Do not close any in the sorted py_fds_to_keep list. * * This function violates the strict use of async signal safe functions. :( - * It calls opendir(), readdir64() and closedir(). Of these, the one most + * It calls opendir(), readdir() and closedir(). Of these, the one most * likely to ever cause a problem is opendir() as it performs an internal * malloc(). Practically this should not be a problem. The Java VM makes the * same calls between fork and exec in its own UNIXProcess_md.c implementation. @@ -243,15 +248,14 @@ /* No way to get a list of open fds. */ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); } else { - struct dirent64 *dir_entry; + struct dirent *dir_entry; #ifdef HAVE_DIRFD int fd_used_by_opendir = DIRFD(proc_fd_dir); #else int fd_used_by_opendir = start_fd - 1; #endif errno = 0; - /* readdir64 is used to work around Solaris 9 bug 6395699. */ - while ((dir_entry = readdir64(proc_fd_dir))) { + while ((dir_entry = readdir(proc_fd_dir))) { int fd; if ((fd = _pos_int_from_ascii(dir_entry->d_name)) < 0) continue; /* Not a number. */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 00:21:32 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 00:21:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_bugfix_for_*BSD_platforms=2E_=28oops_messed_up_=23define=29?= Message-ID: http://hg.python.org/cpython/rev/665b748ee4c1 changeset: 74570:665b748ee4c1 parent: 74569:e52d81e0c750 parent: 74568:5be3dadd2eef user: Gregory P. Smith date: Sat Jan 21 15:20:37 2012 -0800 summary: bugfix for *BSD platforms. (oops messed up #define) files: Modules/_posixsubprocess.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -21,10 +21,8 @@ # define dirent dirent64 # if !defined(HAVE_DIRFD) /* Some versions of Solaris lack dirfd(). */ -# define DIRFD(dirp) ((dirp)->dd_fd) +# define dirfd(dirp) ((dirp)->dd_fd) # define HAVE_DIRFD -# else -# define DIRFD(dirp) (dirfd(dirp)) # endif #endif @@ -250,7 +248,7 @@ } else { struct dirent *dir_entry; #ifdef HAVE_DIRFD - int fd_used_by_opendir = DIRFD(proc_fd_dir); + int fd_used_by_opendir = dirfd(proc_fd_dir); #else int fd_used_by_opendir = start_fd - 1; #endif -- Repository URL: http://hg.python.org/cpython From benjamin at python.org Sun Jan 22 01:21:52 2012 From: benjamin at python.org (Benjamin Peterson) Date: Sat, 21 Jan 2012 19:21:52 -0500 Subject: [Python-checkins] cpython (3.2): Fixes issue #8052: The posix subprocess module's close_fds behavior was In-Reply-To: References: Message-ID: 2012/1/21 gregory.p.smith : ... > +/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ Is no libc call important? > +static int _pos_int_from_ascii(char *name) To be consistent with the rest of posixmodule.c, "static int" should be on a different line from the signature. This also applies to all other function declarations added by this. > +{ > + ? ?int num = 0; > + ? ?while (*name >= '0' && *name <= '9') { > + ? ? ? ?num = num * 10 + (*name - '0'); > + ? ? ? ?++name; > + ? ?} > + ? ?if (*name) > + ? ? ? ?return -1; ?/* Non digit found, not a number. */ > + ? ?return num; > +} > + > + > +/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ > +static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) > +{ > + ? ?Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); PySequence_Length can fail. > + ? ?long prev_fd = -1; > + ? ?for (seq_idx = 0; seq_idx < seq_len; ++seq_idx) { > + ? ? ? ?PyObject* py_fd = PySequence_Fast_GET_ITEM(fd_sequence, seq_idx); > + ? ? ? ?long iter_fd = PyLong_AsLong(py_fd); > + ? ? ? ?if (iter_fd < 0 || iter_fd < prev_fd || iter_fd > INT_MAX) { > + ? ? ? ? ? ?/* Negative, overflow, not a Long, unsorted, too big for a fd. */ > + ? ? ? ? ? ?return 1; > + ? ? ? ?} > + ? ?} > + ? ?return 0; > +} > + > + > +/* Is fd found in the sorted Python Sequence? */ > +static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) > +{ > + ? ?/* Binary search. */ > + ? ?Py_ssize_t search_min = 0; > + ? ?Py_ssize_t search_max = PySequence_Length(fd_sequence) - 1; > + ? ?if (search_max < 0) > + ? ? ? ?return 0; > + ? ?do { > + ? ? ? ?long middle = (search_min + search_max) / 2; > + ? ? ? ?long middle_fd = PyLong_AsLong( > + ? ? ? ? ? ? ? ?PySequence_Fast_GET_ITEM(fd_sequence, middle)); No check for error? > + ? ? ? ?if (fd == middle_fd) > + ? ? ? ? ? ?return 1; > + ? ? ? ?if (fd > middle_fd) > + ? ? ? ? ? ?search_min = middle + 1; > + ? ? ? ?else > + ? ? ? ? ? ?search_max = middle - 1; > + ? ?} while (search_min <= search_max); > + ? ?return 0; > +} > + > + > +/* Close all file descriptors in the range start_fd inclusive to > + * end_fd exclusive except for those in py_fds_to_keep. ?If the > + * range defined by [start_fd, end_fd) is large this will take a > + * long time as it calls close() on EVERY possible fd. > + */ > +static void _close_fds_by_brute_force(int start_fd, int end_fd, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PyObject *py_fds_to_keep) > +{ > + ? ?Py_ssize_t num_fds_to_keep = PySequence_Length(py_fds_to_keep); > + ? ?Py_ssize_t keep_seq_idx; > + ? ?int fd_num; > + ? ?/* As py_fds_to_keep is sorted we can loop through the list closing > + ? ? * fds inbetween any in the keep list falling within our range. */ > + ? ?for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { > + ? ? ? ?PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?keep_seq_idx); > + ? ? ? ?int keep_fd = PyLong_AsLong(py_keep_fd); > + ? ? ? ?if (keep_fd < start_fd) > + ? ? ? ? ? ?continue; > + ? ? ? ?for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { > + ? ? ? ? ? ?while (close(fd_num) < 0 && errno == EINTR); > + ? ? ? ?} > + ? ? ? ?start_fd = keep_fd + 1; > + ? ?} > + ? ?if (start_fd <= end_fd) { > + ? ? ? ?for (fd_num = start_fd; fd_num < end_fd; ++fd_num) { > + ? ? ? ? ? ?while (close(fd_num) < 0 && errno == EINTR); > + ? ? ? ?} > + ? ?} > +} > + > + > +#if defined(__linux__) && defined(HAVE_SYS_SYSCALL_H) > +/* It doesn't matter if d_name has room for NAME_MAX chars; we're using this > + * only to read a directory of short file descriptor number names. ?The kernel > + * will return an error if we didn't give it enough space. ?Highly Unlikely. > + * This structure is very old and stable: It will not change unless the kernel > + * chooses to break compatibility with all existing binaries. ?Highly Unlikely. > + */ > +struct linux_dirent { > + ? unsigned long ?d_ino; ? ? ? ?/* Inode number */ > + ? unsigned long ?d_off; ? ? ? ?/* Offset to next linux_dirent */ > + ? unsigned short d_reclen; ? ? /* Length of this linux_dirent */ > + ? char ? ? ? ? ? d_name[256]; ?/* Filename (null-terminated) */ > +}; > + > +/* Close all open file descriptors in the range start_fd inclusive to end_fd > + * exclusive. Do not close any in the sorted py_fds_to_keep list. > + * > + * This version is async signal safe as it does not make any unsafe C library > + * calls, malloc calls or handle any locks. ?It is _unfortunate_ to be forced > + * to resort to making a kernel system call directly but this is the ONLY api > + * available that does no harm. ?opendir/readdir/closedir perform memory > + * allocation and locking so while they usually work they are not guaranteed > + * to (especially if you have replaced your malloc implementation). ?A version > + * of this function that uses those can be found in the _maybe_unsafe variant. > + * > + * This is Linux specific because that is all I am ready to test it on. ?It > + * should be easy to add OS specific dirent or dirent64 structures and modify > + * it with some cpp #define magic to work on other OSes as well if you want. > + */ > +static void _close_open_fd_range_safe(int start_fd, int end_fd, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PyObject* py_fds_to_keep) > +{ > + ? ?int fd_dir_fd; > + ? ?if (start_fd >= end_fd) > + ? ? ? ?return; > + ? ?fd_dir_fd = open(LINUX_SOLARIS_FD_DIR, O_RDONLY | O_CLOEXEC, 0); > + ? ?/* Not trying to open the BSD_OSX path as this is currently Linux only. */ > + ? ?if (fd_dir_fd == -1) { > + ? ? ? ?/* No way to get a list of open fds. */ > + ? ? ? ?_close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); > + ? ? ? ?return; > + ? ?} else { > + ? ? ? ?char buffer[sizeof(struct linux_dirent)]; > + ? ? ? ?int bytes; > + ? ? ? ?while ((bytes = syscall(SYS_getdents, fd_dir_fd, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(struct linux_dirent *)buffer, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?sizeof(buffer))) > 0) { > + ? ? ? ? ? ?struct linux_dirent *entry; > + ? ? ? ? ? ?int offset; > + ? ? ? ? ? ?for (offset = 0; offset < bytes; offset += entry->d_reclen) { > + ? ? ? ? ? ? ? ?int fd; > + ? ? ? ? ? ? ? ?entry = (struct linux_dirent *)(buffer + offset); > + ? ? ? ? ? ? ? ?if ((fd = _pos_int_from_ascii(entry->d_name)) < 0) > + ? ? ? ? ? ? ? ? ? ?continue; ?/* Not a number. */ > + ? ? ? ? ? ? ? ?if (fd != fd_dir_fd && fd >= start_fd && fd < end_fd && > + ? ? ? ? ? ? ? ? ? ?!_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { > + ? ? ? ? ? ? ? ? ? ?while (close(fd) < 0 && errno == EINTR); > + ? ? ? ? ? ? ? ?} > + ? ? ? ? ? ?} > + ? ? ? ?} > + ? ? ? ?close(fd_dir_fd); > + ? ?} > +} > + > +#define _close_open_fd_range _close_open_fd_range_safe > + > +#else ?/* NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */ > + > + > +/* Close all open file descriptors in the range start_fd inclusive to end_fd > + * exclusive. Do not close any in the sorted py_fds_to_keep list. > + * > + * This function violates the strict use of async signal safe functions. :( > + * It calls opendir(), readdir64() and closedir(). ?Of these, the one most > + * likely to ever cause a problem is opendir() as it performs an internal > + * malloc(). ?Practically this should not be a problem. ?The Java VM makes the > + * same calls between fork and exec in its own UNIXProcess_md.c implementation. > + * > + * readdir_r() is not used because it provides no benefit. ?It is typically > + * implemented as readdir() followed by memcpy(). ?See also: > + * ? http://womble.decadent.org.uk/readdir_r-advisory.html > + */ > +static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PyObject* py_fds_to_keep) > +{ > + ? ?DIR *proc_fd_dir; > +#ifndef HAVE_DIRFD > + ? ?while (_is_fd_in_sorted_fd_sequence(start_fd, py_fds_to_keep) && > + ? ? ? ? ? (start_fd < end_fd)) { > + ? ? ? ?++start_fd; > + ? ?} > + ? ?if (start_fd >= end_fd) > + ? ? ? ?return; > + ? ?/* Close our lowest fd before we call opendir so that it is likely to > + ? ? * reuse that fd otherwise we might close opendir's file descriptor in > + ? ? * our loop. ?This trick assumes that fd's are allocated on a lowest > + ? ? * available basis. */ > + ? ?while (close(start_fd) < 0 && errno == EINTR); > + ? ?++start_fd; > +#endif > + ? ?if (start_fd >= end_fd) > + ? ? ? ?return; > + > + ? ?proc_fd_dir = opendir(BSD_OSX_FD_DIR); > + ? ?if (!proc_fd_dir) > + ? ? ? ?proc_fd_dir = opendir(LINUX_SOLARIS_FD_DIR); > + ? ?if (!proc_fd_dir) { > + ? ? ? ?/* No way to get a list of open fds. */ > + ? ? ? ?_close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); > + ? ?} else { > + ? ? ? ?struct dirent64 *dir_entry; > +#ifdef HAVE_DIRFD > + ? ? ? ?int fd_used_by_opendir = DIRFD(proc_fd_dir); > +#else > + ? ? ? ?int fd_used_by_opendir = start_fd - 1; > +#endif > + ? ? ? ?errno = 0; > + ? ? ? ?/* readdir64 is used to work around Solaris 9 bug 6395699. */ > + ? ? ? ?while ((dir_entry = readdir64(proc_fd_dir))) { > + ? ? ? ? ? ?int fd; > + ? ? ? ? ? ?if ((fd = _pos_int_from_ascii(dir_entry->d_name)) < 0) > + ? ? ? ? ? ? ? ?continue; ?/* Not a number. */ > + ? ? ? ? ? ?if (fd != fd_used_by_opendir && fd >= start_fd && fd < end_fd && > + ? ? ? ? ? ? ? ?!_is_fd_in_sorted_fd_sequence(fd, py_fds_to_keep)) { > + ? ? ? ? ? ? ? ?while (close(fd) < 0 && errno == EINTR); > + ? ? ? ? ? ?} > + ? ? ? ? ? ?errno = 0; > + ? ? ? ?} > + ? ? ? ?if (errno) { > + ? ? ? ? ? ?/* readdir error, revert behavior. Highly Unlikely. */ > + ? ? ? ? ? ?_close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); > + ? ? ? ?} > + ? ? ? ?closedir(proc_fd_dir); > + ? ?} > +} > + > +#define _close_open_fd_range _close_open_fd_range_maybe_unsafe > + > +#endif ?/* else NOT (defined(__linux__) && defined(HAVE_SYS_SYSCALL_H)) */ > + > + > ?/* > ?* This function is code executed in the child process immediately after fork > ?* to set things up and call exec(). > @@ -46,12 +292,12 @@ > ? ? ? ? ? ? ? ? ? ? ? ?int errread, int errwrite, > ? ? ? ? ? ? ? ? ? ? ? ?int errpipe_read, int errpipe_write, > ? ? ? ? ? ? ? ? ? ? ? ?int close_fds, int restore_signals, > - ? ? ? ? ? ? ? ? ? ? ? int call_setsid, Py_ssize_t num_fds_to_keep, > + ? ? ? ? ? ? ? ? ? ? ? int call_setsid, > ? ? ? ? ? ? ? ? ? ? ? ?PyObject *py_fds_to_keep, > ? ? ? ? ? ? ? ? ? ? ? ?PyObject *preexec_fn, > ? ? ? ? ? ? ? ? ? ? ? ?PyObject *preexec_fn_args_tuple) > ?{ > - ? ?int i, saved_errno, fd_num, unused; > + ? ?int i, saved_errno, unused; > ? ? PyObject *result; > ? ? const char* err_msg = ""; > ? ? /* Buffer large enough to hold a hex integer. ?We can't malloc. */ > @@ -113,33 +359,8 @@ > ? ? ? ? POSIX_CALL(close(errwrite)); > ? ? } > > - ? ?/* close() is intentionally not checked for errors here as we are closing */ > - ? ?/* a large range of fds, some of which may be invalid. */ > - ? ?if (close_fds) { > - ? ? ? ?Py_ssize_t keep_seq_idx; > - ? ? ? ?int start_fd = 3; > - ? ? ? ?for (keep_seq_idx = 0; keep_seq_idx < num_fds_to_keep; ++keep_seq_idx) { > - ? ? ? ? ? ?PyObject* py_keep_fd = PySequence_Fast_GET_ITEM(py_fds_to_keep, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?keep_seq_idx); > - ? ? ? ? ? ?int keep_fd = PyLong_AsLong(py_keep_fd); > - ? ? ? ? ? ?if (keep_fd < 0) { ?/* Negative number, overflow or not a Long. */ > - ? ? ? ? ? ? ? ?err_msg = "bad value in fds_to_keep."; > - ? ? ? ? ? ? ? ?errno = 0; ?/* We don't want to report an OSError. */ > - ? ? ? ? ? ? ? ?goto error; > - ? ? ? ? ? ?} > - ? ? ? ? ? ?if (keep_fd < start_fd) > - ? ? ? ? ? ? ? ?continue; > - ? ? ? ? ? ?for (fd_num = start_fd; fd_num < keep_fd; ++fd_num) { > - ? ? ? ? ? ? ? ?close(fd_num); > - ? ? ? ? ? ?} > - ? ? ? ? ? ?start_fd = keep_fd + 1; > - ? ? ? ?} > - ? ? ? ?if (start_fd <= max_fd) { > - ? ? ? ? ? ?for (fd_num = start_fd; fd_num < max_fd; ++fd_num) { > - ? ? ? ? ? ? ? ?close(fd_num); > - ? ? ? ? ? ?} > - ? ? ? ?} > - ? ?} > + ? ?if (close_fds) > + ? ? ? ?_close_open_fd_range(3, max_fd, py_fds_to_keep); > > ? ? if (cwd) > ? ? ? ? POSIX_CALL(chdir(cwd)); > @@ -227,7 +448,7 @@ > ? ? pid_t pid; > ? ? int need_to_reenable_gc = 0; > ? ? char *const *exec_array, *const *argv = NULL, *const *envp = NULL; > - ? ?Py_ssize_t arg_num, num_fds_to_keep; > + ? ?Py_ssize_t arg_num; > > ? ? if (!PyArg_ParseTuple( > ? ? ? ? ? ? args, "OOOOOOiiiiiiiiiiO:fork_exec", > @@ -243,9 +464,12 @@ > ? ? ? ? PyErr_SetString(PyExc_ValueError, "errpipe_write must be >= 3"); > ? ? ? ? return NULL; > ? ? } > - ? ?num_fds_to_keep = PySequence_Length(py_fds_to_keep); > - ? ?if (num_fds_to_keep < 0) { > - ? ? ? ?PyErr_SetString(PyExc_ValueError, "bad fds_to_keep"); > + ? ?if (PySequence_Length(py_fds_to_keep) < 0) { > + ? ? ? ?PyErr_SetString(PyExc_ValueError, "cannot get length of fds_to_keep"); > + ? ? ? ?return NULL; > + ? ?} > + ? ?if (_sanity_check_python_fd_sequence(py_fds_to_keep)) { > + ? ? ? ?PyErr_SetString(PyExc_ValueError, "bad value(s) in fds_to_keep"); > ? ? ? ? return NULL; > ? ? } > > @@ -348,8 +572,7 @@ > ? ? ? ? ? ? ? ? ? ?p2cread, p2cwrite, c2pread, c2pwrite, > ? ? ? ? ? ? ? ? ? ?errread, errwrite, errpipe_read, errpipe_write, > ? ? ? ? ? ? ? ? ? ?close_fds, restore_signals, call_setsid, > - ? ? ? ? ? ? ? ? ? num_fds_to_keep, py_fds_to_keep, > - ? ? ? ? ? ? ? ? ? preexec_fn, preexec_fn_args_tuple); > + ? ? ? ? ? ? ? ? ? py_fds_to_keep, preexec_fn, preexec_fn_args_tuple); > ? ? ? ? _exit(255); > ? ? ? ? return NULL; ?/* Dead code to avoid a potential compiler warning. */ > ? ? } > diff --git a/configure b/configure > --- a/configure > +++ b/configure > @@ -6165,7 +6165,7 @@ > ?sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ > ?sys/lock.h sys/mkdev.h sys/modem.h \ > ?sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ > -sys/termio.h sys/time.h \ > +sys/syscall.h sys/termio.h sys/time.h \ > ?sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ > ?sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ > ?bluetooth/bluetooth.h linux/tipc.h spawn.h util.h > diff --git a/configure.in b/configure.in > --- a/configure.in > +++ b/configure.in > @@ -1341,7 +1341,7 @@ > ?sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ > ?sys/lock.h sys/mkdev.h sys/modem.h \ > ?sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ > -sys/termio.h sys/time.h \ > +sys/syscall.h sys/termio.h sys/time.h \ > ?sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ > ?sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ > ?bluetooth/bluetooth.h linux/tipc.h spawn.h util.h) > diff --git a/pyconfig.h.in b/pyconfig.h.in > --- a/pyconfig.h.in > +++ b/pyconfig.h.in > @@ -789,6 +789,9 @@ > ?/* Define to 1 if you have the header file. */ > ?#undef HAVE_SYS_STAT_H > > +/* Define to 1 if you have the header file. */ > +#undef HAVE_SYS_SYSCALL_H > + > ?/* Define to 1 if you have the header file. */ > ?#undef HAVE_SYS_TERMIO_H -- Regards, Benjamin From python-checkins at python.org Sun Jan 22 03:22:07 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 03:22:07 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Improve_the_tes?= =?utf8?q?t_for_dirfd=28=29=2C_some_systems_=23define_it_rather_than_have?= Message-ID: http://hg.python.org/cpython/rev/07bea5e8ad5f changeset: 74571:07bea5e8ad5f branch: 3.2 parent: 74568:5be3dadd2eef user: Gregory P. Smith date: Sat Jan 21 18:20:15 2012 -0800 summary: Improve the test for dirfd(), some systems #define it rather than have an actual function. files: configure | 126 ++++++++++++++++++++----------------- configure.in | 8 ++- pyconfig.h.in | 2 +- 3 files changed, 76 insertions(+), 60 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -2248,63 +2248,6 @@ } # ac_fn_c_check_func -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member - # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR @@ -2350,6 +2293,63 @@ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -9410,7 +9410,7 @@ # checks for library functions for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \ + clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \ @@ -9435,6 +9435,16 @@ done +ac_fn_c_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include + #include +" +if test "x$ac_cv_have_decl_dirfd" = xyes; then : + +$as_echo "#define HAVE_DIRFD 1" >>confdefs.h + +fi + + # For some functions, having a definition is not sufficient, since # we want to take their address. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chroot" >&5 diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2587,7 +2587,7 @@ # checks for library functions AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid dirfd execv fchmod fchown fork fpathconf ftime ftruncate \ + clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ initgroups kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \ @@ -2601,6 +2601,12 @@ truncate uname unsetenv utimes waitpid wait3 wait4 \ wcscoll wcsftime wcsxfrm _getpty) +AC_CHECK_DECL(dirfd, + AC_DEFINE(HAVE_DIRFD, 1, + Define if you have the 'dirfd' function or macro.), , + [#include + #include ]) + # For some functions, having a definition is not sufficient, since # we want to take their address. AC_MSG_CHECKING(for chroot) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -178,7 +178,7 @@ */ #undef HAVE_DIRENT_H -/* Define to 1 if you have the `dirfd' function. */ +/* Define if you have the 'dirfd' function or macro. */ #undef HAVE_DIRFD /* Define to 1 if you have the header file. */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 03:22:08 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 03:22:08 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Improve_the_test_for_dirfd=28=29=2E__Some_systems_=23define_?= =?utf8?q?it_rather_than?= Message-ID: http://hg.python.org/cpython/rev/ea5a6edb0de7 changeset: 74572:ea5a6edb0de7 parent: 74570:665b748ee4c1 parent: 74571:07bea5e8ad5f user: Gregory P. Smith date: Sat Jan 21 18:21:56 2012 -0800 summary: Improve the test for dirfd(). Some systems #define it rather than have it as a library function. files: configure | 126 ++++++++++++++++++++----------------- configure.in | 8 ++- pyconfig.h.in | 2 +- 3 files changed, 76 insertions(+), 60 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -2242,63 +2242,6 @@ } # ac_fn_c_check_func -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member - # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR @@ -2344,6 +2287,63 @@ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -9396,7 +9396,7 @@ # checks for library functions for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid dirfd execv faccessat fchmod fchmodat fchown fchownat \ + clock confstr ctermid execv faccessat fchmod fchmodat fchown fchownat \ fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \ futimens futimes gai_strerror \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ @@ -9429,6 +9429,16 @@ done +ac_fn_c_check_decl "$LINENO" "dirfd" "ac_cv_have_decl_dirfd" "#include + #include +" +if test "x$ac_cv_have_decl_dirfd" = xyes; then : + +$as_echo "#define HAVE_DIRFD 1" >>confdefs.h + +fi + + # For some functions, having a definition is not sufficient, since # we want to take their address. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for chroot" >&5 diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -2562,7 +2562,7 @@ # checks for library functions AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \ - clock confstr ctermid dirfd execv faccessat fchmod fchmodat fchown fchownat \ + clock confstr ctermid execv faccessat fchmod fchmodat fchown fchownat \ fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \ futimens futimes gai_strerror \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ @@ -2584,6 +2584,12 @@ truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \ wcscoll wcsftime wcsxfrm writev _getpty) +AC_CHECK_DECL(dirfd, + AC_DEFINE(HAVE_DIRFD, 1, + Define if you have the 'dirfd' function or macro.), , + [#include + #include ]) + # For some functions, having a definition is not sufficient, since # we want to take their address. AC_MSG_CHECKING(for chroot) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -181,7 +181,7 @@ */ #undef HAVE_DIRENT_H -/* Define to 1 if you have the `dirfd' function. */ +/* Define if you have the 'dirfd' function or macro. */ #undef HAVE_DIRFD /* Define to 1 if you have the header file. */ -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Jan 22 05:34:06 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 22 Jan 2012 05:34:06 +0100 Subject: [Python-checkins] Daily reference leaks (ea5a6edb0de7): sum=0 Message-ID: results for ea5a6edb0de7 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogzAyugf', '-x'] From python-checkins at python.org Sun Jan 22 06:06:33 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 06:06:33 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_FreeBSD=2C_?= =?utf8?q?NetBSD_and_OpenBSD_behavior_of_the_issue_=238052_fix=2E?= Message-ID: http://hg.python.org/cpython/rev/754c2eb0a92c changeset: 74573:754c2eb0a92c branch: 3.2 parent: 74571:07bea5e8ad5f user: Gregory P. Smith date: Sat Jan 21 21:01:24 2012 -0800 summary: Fix FreeBSD, NetBSD and OpenBSD behavior of the issue #8052 fix. files: Modules/_posixsubprocess.c | 56 +++++++++++++++++++++---- 1 files changed, 47 insertions(+), 9 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -8,6 +8,9 @@ #ifdef HAVE_SYS_TYPES_H #include #endif +#if defined(HAVE_SYS_STAT_H) && defined(__FreeBSD__) +#include +#endif #ifdef HAVE_SYS_SYSCALL_H #include #endif @@ -26,8 +29,11 @@ # endif #endif -#define LINUX_SOLARIS_FD_DIR "/proc/self/fd" -#define BSD_OSX_FD_DIR "/dev/fd" +#if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) +# define FD_DIR "/dev/fd" +#else +# define FD_DIR "/proc/self/fd" +#endif #define POSIX_CALL(call) if ((call) == -1) goto error @@ -62,6 +68,28 @@ } +#if defined(__FreeBSD__) +/* When /dev/fd isn't mounted it is often a static directory populated + * with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD and OpenBSD. + * NetBSD and OpenBSD have a /proc fs available (though not necessarily + * mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs + * that properly supports /dev/fd. + */ +static int _is_fdescfs_mounted_on_dev_fd() +{ + struct stat dev_stat; + struct stat dev_fd_stat; + if (stat("/dev", &dev_stat) != 0) + return 0; + if (stat(FD_DIR, &dev_fd_stat) != 0) + return 0; + if (dev_stat.st_dev == dev_fd_stat.st_dev) + return 0; /* / == /dev == /dev/fd means it is static. #fail */ + return 1; +} +#endif + + /* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) { @@ -169,8 +197,7 @@ int fd_dir_fd; if (start_fd >= end_fd) return; - fd_dir_fd = open(LINUX_SOLARIS_FD_DIR, O_RDONLY | O_CLOEXEC, 0); - /* Not trying to open the BSD_OSX path as this is currently Linux only. */ + fd_dir_fd = open(FD_DIR, O_RDONLY | O_CLOEXEC, 0); if (fd_dir_fd == -1) { /* No way to get a list of open fds. */ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); @@ -237,9 +264,12 @@ if (start_fd >= end_fd) return; - proc_fd_dir = opendir(BSD_OSX_FD_DIR); - if (!proc_fd_dir) - proc_fd_dir = opendir(LINUX_SOLARIS_FD_DIR); +#if defined(__FreeBSD__) + if (!_is_fdescfs_mounted_on_dev_fd()) + proc_fd_dir = NULL; + else +#endif + proc_fd_dir = opendir(FD_DIR); if (!proc_fd_dir) { /* No way to get a list of open fds. */ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); @@ -361,8 +391,16 @@ POSIX_CALL(close(errwrite)); } - if (close_fds) - _close_open_fd_range(3, max_fd, py_fds_to_keep); + if (close_fds) { + int local_max_fd = max_fd; +#if defined(__NetBSD__) + local_max_fd = fcntl(0, F_MAXFD); + if (local_max_fd < 0) + local_max_fd = max_fd; +#endif + /* TODO HP-UX could use pstat_getproc() if anyone cares about it. */ + _close_open_fd_range(3, local_max_fd, py_fds_to_keep); + } if (cwd) POSIX_CALL(chdir(cwd)); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 06:06:34 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 06:06:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_FreeBSD=2C_NetBSD_and_OpenBSD_behavior_of_the_issue_=238?= =?utf8?q?052_fix=2E?= Message-ID: http://hg.python.org/cpython/rev/7d4658a8de96 changeset: 74574:7d4658a8de96 parent: 74572:ea5a6edb0de7 parent: 74573:754c2eb0a92c user: Gregory P. Smith date: Sat Jan 21 21:06:22 2012 -0800 summary: Fix FreeBSD, NetBSD and OpenBSD behavior of the issue #8052 fix. files: Modules/_posixsubprocess.c | 56 +++++++++++++++++++++---- 1 files changed, 47 insertions(+), 9 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -8,6 +8,9 @@ #ifdef HAVE_SYS_TYPES_H #include #endif +#if defined(HAVE_SYS_STAT_H) && defined(__FreeBSD__) +#include +#endif #ifdef HAVE_SYS_SYSCALL_H #include #endif @@ -26,8 +29,11 @@ # endif #endif -#define LINUX_SOLARIS_FD_DIR "/proc/self/fd" -#define BSD_OSX_FD_DIR "/dev/fd" +#if defined(__FreeBSD__) || (defined(__APPLE__) && defined(__MACH__)) +# define FD_DIR "/dev/fd" +#else +# define FD_DIR "/proc/self/fd" +#endif #define POSIX_CALL(call) if ((call) == -1) goto error @@ -64,6 +70,28 @@ } +#if defined(__FreeBSD__) +/* When /dev/fd isn't mounted it is often a static directory populated + * with 0 1 2 or entries for 0 .. 63 on FreeBSD, NetBSD and OpenBSD. + * NetBSD and OpenBSD have a /proc fs available (though not necessarily + * mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs + * that properly supports /dev/fd. + */ +static int _is_fdescfs_mounted_on_dev_fd() +{ + struct stat dev_stat; + struct stat dev_fd_stat; + if (stat("/dev", &dev_stat) != 0) + return 0; + if (stat(FD_DIR, &dev_fd_stat) != 0) + return 0; + if (dev_stat.st_dev == dev_fd_stat.st_dev) + return 0; /* / == /dev == /dev/fd means it is static. #fail */ + return 1; +} +#endif + + /* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) { @@ -171,8 +199,7 @@ int fd_dir_fd; if (start_fd >= end_fd) return; - fd_dir_fd = open(LINUX_SOLARIS_FD_DIR, O_RDONLY | O_CLOEXEC, 0); - /* Not trying to open the BSD_OSX path as this is currently Linux only. */ + fd_dir_fd = open(FD_DIR, O_RDONLY | O_CLOEXEC, 0); if (fd_dir_fd == -1) { /* No way to get a list of open fds. */ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); @@ -239,9 +266,12 @@ if (start_fd >= end_fd) return; - proc_fd_dir = opendir(BSD_OSX_FD_DIR); - if (!proc_fd_dir) - proc_fd_dir = opendir(LINUX_SOLARIS_FD_DIR); +#if defined(__FreeBSD__) + if (!_is_fdescfs_mounted_on_dev_fd()) + proc_fd_dir = NULL; + else +#endif + proc_fd_dir = opendir(FD_DIR); if (!proc_fd_dir) { /* No way to get a list of open fds. */ _close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep); @@ -363,8 +393,16 @@ POSIX_CALL(close(errwrite)); } - if (close_fds) - _close_open_fd_range(3, max_fd, py_fds_to_keep); + if (close_fds) { + int local_max_fd = max_fd; +#if defined(__NetBSD__) + local_max_fd = fcntl(0, F_MAXFD); + if (local_max_fd < 0) + local_max_fd = max_fd; +#endif + /* TODO HP-UX could use pstat_getproc() if anyone cares about it. */ + _close_open_fd_range(3, local_max_fd, py_fds_to_keep); + } if (cwd) POSIX_CALL(chdir(cwd)); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 07:06:20 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 07:06:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_a_unittest_?= =?utf8?q?error_seen_on_NetBSD_5=2E?= Message-ID: http://hg.python.org/cpython/rev/6b436e31e1de changeset: 74575:6b436e31e1de branch: 3.2 parent: 74573:754c2eb0a92c user: Gregory P. Smith date: Sat Jan 21 22:05:10 2012 -0800 summary: Fix a unittest error seen on NetBSD 5. files: Lib/test/test_subprocess.py | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1273,8 +1273,18 @@ self.addCleanup(p1.wait) self.addCleanup(p2.wait) - self.addCleanup(p1.terminate) - self.addCleanup(p2.terminate) + def kill_p1(): + try: + p1.terminate() + except ProcessLookupError: + pass + def kill_p2(): + try: + p2.terminate() + except ProcessLookupError: + pass + self.addCleanup(kill_p1) + self.addCleanup(kill_p2) p1.stdin.write(data) p1.stdin.close() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 07:06:22 2012 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 22 Jan 2012 07:06:22 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_a_unittest_error_seen_on_NetBSD_5=2E?= Message-ID: http://hg.python.org/cpython/rev/337f68382871 changeset: 74576:337f68382871 parent: 74574:7d4658a8de96 parent: 74575:6b436e31e1de user: Gregory P. Smith date: Sat Jan 21 22:06:09 2012 -0800 summary: Fix a unittest error seen on NetBSD 5. files: Lib/test/test_subprocess.py | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -1370,8 +1370,18 @@ self.addCleanup(p1.wait) self.addCleanup(p2.wait) - self.addCleanup(p1.terminate) - self.addCleanup(p2.terminate) + def kill_p1(): + try: + p1.terminate() + except ProcessLookupError: + pass + def kill_p2(): + try: + p2.terminate() + except ProcessLookupError: + pass + self.addCleanup(kill_p1) + self.addCleanup(kill_p2) p1.stdin.write(data) p1.stdin.close() -- Repository URL: http://hg.python.org/cpython From greg at krypto.org Sun Jan 22 10:08:13 2012 From: greg at krypto.org (Gregory P. Smith) Date: Sun, 22 Jan 2012 01:08:13 -0800 Subject: [Python-checkins] cpython (3.2): Fixes issue #8052: The posix subprocess module's close_fds behavior was In-Reply-To: References: Message-ID: On Sat, Jan 21, 2012 at 4:21 PM, Benjamin Peterson wrote: > 2012/1/21 gregory.p.smith : > ... >> +/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ > > Is no libc call important? Yes. strtol() is not on the async signal safe C library function list. > >> +static int _pos_int_from_ascii(char *name) > > To be consistent with the rest of posixmodule.c, "static int" should > be on a different line from the signature. This also applies to all > other function declarations added by this. Python C style as a whole, yes. This file already has a mix of same line vs two line declarations, I added these following the style of the functions immediately surrounding them. Want a style fixup on the whole file? > >> +{ >> + ? ?int num = 0; >> + ? ?while (*name >= '0' && *name <= '9') { >> + ? ? ? ?num = num * 10 + (*name - '0'); >> + ? ? ? ?++name; >> + ? ?} >> + ? ?if (*name) >> + ? ? ? ?return -1; ?/* Non digit found, not a number. */ >> + ? ?return num; >> +} >> + >> + >> +/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ >> +static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) >> +{ >> + ? ?Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); > > PySequence_Length can fail. It has already been checked not to by the only entry point into the code in this file. > >> + ? ?long prev_fd = -1; >> + ? ?for (seq_idx = 0; seq_idx < seq_len; ++seq_idx) { >> + ? ? ? ?PyObject* py_fd = PySequence_Fast_GET_ITEM(fd_sequence, seq_idx); >> + ? ? ? ?long iter_fd = PyLong_AsLong(py_fd); >> + ? ? ? ?if (iter_fd < 0 || iter_fd < prev_fd || iter_fd > INT_MAX) { >> + ? ? ? ? ? ?/* Negative, overflow, not a Long, unsorted, too big for a fd. */ >> + ? ? ? ? ? ?return 1; >> + ? ? ? ?} >> + ? ?} >> + ? ?return 0; >> +} >> + >> + >> +/* Is fd found in the sorted Python Sequence? */ >> +static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) >> +{ >> + ? ?/* Binary search. */ >> + ? ?Py_ssize_t search_min = 0; >> + ? ?Py_ssize_t search_max = PySequence_Length(fd_sequence) - 1; >> + ? ?if (search_max < 0) >> + ? ? ? ?return 0; >> + ? ?do { >> + ? ? ? ?long middle = (search_min + search_max) / 2; >> + ? ? ? ?long middle_fd = PyLong_AsLong( >> + ? ? ? ? ? ? ? ?PySequence_Fast_GET_ITEM(fd_sequence, middle)); > > No check for error? _sanity_check_python_fd_sequence() already checked the entire list to guarantee that there would not be any such error. >> + ? ? ? ?if (fd == middle_fd) >> + ? ? ? ? ? ?return 1; >> + ? ? ? ?if (fd > middle_fd) >> + ? ? ? ? ? ?search_min = middle + 1; >> + ? ? ? ?else >> + ? ? ? ? ? ?search_max = middle - 1; >> + ? ?} while (search_min <= search_max); >> + ? ?return 0; >> +} In general this is an extension module that is best viewed as a whole including its existing comments rather than as a diff. It contains code that will look "odd" in a diff because much of it executes in a path where not much is allowed (post fork, pre exec) and no useful way of responding to an error is possible so it attempts to pre-check for any possible errors up front so that later code that is unable to handle errors cannot possibly fail. -gps From python-checkins at python.org Sun Jan 22 12:19:21 2012 From: python-checkins at python.org (sandro.tosi) Date: Sun, 22 Jan 2012 12:19:21 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313835=3A_fixes_to_?= =?utf8?q?What=27s_new_3=2E3=3B_patch_by_July_Tikhonov?= Message-ID: http://hg.python.org/cpython/rev/8a38bbf92048 changeset: 74577:8a38bbf92048 user: Sandro Tosi date: Sun Jan 22 12:16:04 2012 +0100 summary: Issue #13835: fixes to What's new 3.3; patch by July Tikhonov files: Doc/whatsnew/3.3.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -284,7 +284,7 @@ * Equality comparisons on :func:`range` objects now return a result reflecting the equality of the underlying sequences generated by those range objects. - (:issue:`13021`) + (:issue:`13201`) * The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()`` methods of :class:`bytes` and :class:`bytearray` objects now accept an @@ -807,8 +807,8 @@ * The :mod:`packaging` module replaces the :mod:`distutils` module * The ``unicode_internal`` codec has been deprecated because of the - :pep:`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-le``), or UTF-32 - (``utf-32-le`` or ``utf-32-le``) + :pep:`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 + (``utf-32-le`` or ``utf-32-be``) * :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP.mlsd` * :func:`platform.popen`: use the :mod:`subprocess` module. Check especially -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 17:24:37 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 22 Jan 2012 17:24:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_use_the_static_identifier_a?= =?utf8?q?pi_for_looking_up_special_methods?= Message-ID: http://hg.python.org/cpython/rev/7d96679c5d46 changeset: 74578:7d96679c5d46 user: Benjamin Peterson date: Sun Jan 22 11:24:29 2012 -0500 summary: use the static identifier api for looking up special methods I had to move the static identifier code from unicodeobject.h to object.h in order for this to work. files: Include/object.h | 31 ++++- Include/unicodeobject.h | 29 --- Modules/mathmodule.c | 12 +- Objects/abstract.c | 16 +- Objects/complexobject.c | 4 +- Objects/dictobject.c | 6 +- Objects/enumobject.c | 4 +- Objects/object.c | 8 +- Objects/typeobject.c | 208 +++++++++++++-------------- Python/ceval.c | 15 +- Python/sysmodule.c | 6 +- 11 files changed, 164 insertions(+), 175 deletions(-) diff --git a/Include/object.h b/Include/object.h --- a/Include/object.h +++ b/Include/object.h @@ -117,6 +117,35 @@ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) +/********************* String Literals ****************************************/ +/* This structure helps managing static strings. The basic usage goes like this: + Instead of doing + + r = PyObject_CallMethod(o, "foo", "args", ...); + + do + + _Py_IDENTIFIER(foo); + ... + r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); + + PyId_foo is a static variable, either on block level or file level. On first + usage, the string "foo" is interned, and the structures are linked. On interpreter + shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). + + Alternatively, _Py_static_string allows to choose the variable name. + _PyUnicode_FromId returns a borrowed reference to the interned string. + _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. +*/ +typedef struct _Py_Identifier { + struct _Py_Identifier *next; + const char* string; + PyObject *object; +} _Py_Identifier; + +#define _Py_static_string(varname, value) static _Py_Identifier varname = { 0, value, 0 } +#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) + /* Type objects contain a string containing the type name (to help somewhat in debugging), the allocation parameters (see PyObject_New() and @@ -448,7 +477,7 @@ PyObject *, PyObject *); #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **); +PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, _Py_Identifier *); PyAPI_FUNC(PyTypeObject *) _PyType_CalculateMetaclass(PyTypeObject *, PyObject *); #endif PyAPI_FUNC(unsigned int) PyType_ClearCache(void); diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2120,35 +2120,6 @@ int check_content); #endif -/********************* String Literals ****************************************/ -/* This structure helps managing static strings. The basic usage goes like this: - Instead of doing - - r = PyObject_CallMethod(o, "foo", "args", ...); - - do - - _Py_IDENTIFIER(foo); - ... - r = _PyObject_CallMethodId(o, &PyId_foo, "args", ...); - - PyId_foo is a static variable, either on block level or file level. On first - usage, the string "foo" is interned, and the structures are linked. On interpreter - shutdown, all strings are released (through _PyUnicode_ClearStaticStrings). - - Alternatively, _Py_static_string allows to choose the variable name. - _PyUnicode_FromId returns a borrowed reference to the interned string. - _PyObject_{Get,Set,Has}AttrId are __getattr__ versions using _Py_Identifier*. -*/ -typedef struct _Py_Identifier { - struct _Py_Identifier *next; - const char* string; - PyObject *object; -} _Py_Identifier; - -#define _Py_static_string(varname, value) static _Py_Identifier varname = { 0, value, 0 } -#define _Py_IDENTIFIER(varname) _Py_static_string(PyId_##varname, #varname) - /* Return an interned Unicode object for an Identifier; may fail if there is no memory.*/ PyAPI_FUNC(PyObject*) _PyUnicode_FromId(_Py_Identifier*); /* Clear all static strings. */ diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -887,10 +887,10 @@ "atanh(x)\n\nReturn the hyperbolic arc tangent (measured in radians) of x.") static PyObject * math_ceil(PyObject *self, PyObject *number) { - static PyObject *ceil_str = NULL; + _Py_IDENTIFIER(__ceil__); PyObject *method, *result; - method = _PyObject_LookupSpecial(number, "__ceil__", &ceil_str); + method = _PyObject_LookupSpecial(number, &PyId___ceil__); if (method == NULL) { if (PyErr_Occurred()) return NULL; @@ -925,10 +925,10 @@ "fabs(x)\n\nReturn the absolute value of the float x.") static PyObject * math_floor(PyObject *self, PyObject *number) { - static PyObject *floor_str = NULL; + _Py_IDENTIFIER(__floor__); PyObject *method, *result; - method = _PyObject_LookupSpecial(number, "__floor__", &floor_str); + method = _PyObject_LookupSpecial(number, &PyId___floor__); if (method == NULL) { if (PyErr_Occurred()) return NULL; @@ -1462,7 +1462,7 @@ static PyObject * math_trunc(PyObject *self, PyObject *number) { - static PyObject *trunc_str = NULL; + _Py_IDENTIFIER(__trunc__); PyObject *trunc, *result; if (Py_TYPE(number)->tp_dict == NULL) { @@ -1470,7 +1470,7 @@ return NULL; } - trunc = _PyObject_LookupSpecial(number, "__trunc__", &trunc_str); + trunc = _PyObject_LookupSpecial(number, &PyId___trunc__); if (trunc == NULL) { if (!PyErr_Occurred()) PyErr_Format(PyExc_TypeError, diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -74,7 +74,7 @@ Py_ssize_t _PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue) { - static PyObject *hintstrobj = NULL; + _Py_IDENTIFIER(__length_hint__); PyObject *ro, *hintmeth; Py_ssize_t rv; @@ -89,7 +89,7 @@ } /* try o.__length_hint__() */ - hintmeth = _PyObject_LookupSpecial(o, "__length_hint__", &hintstrobj); + hintmeth = _PyObject_LookupSpecial(o, &PyId___length_hint__); if (hintmeth == NULL) { if (PyErr_Occurred()) return -1; @@ -697,7 +697,7 @@ PyObject *meth; PyObject *empty = NULL; PyObject *result = NULL; - static PyObject *format_cache = NULL; + _Py_IDENTIFIER(__format__); /* If no format_spec is provided, use an empty string */ if (format_spec == NULL) { @@ -706,7 +706,7 @@ } /* Find the (unbound!) __format__ method (a borrowed reference) */ - meth = _PyObject_LookupSpecial(obj, "__format__", &format_cache); + meth = _PyObject_LookupSpecial(obj, &PyId___format__); if (meth == NULL) { if (!PyErr_Occurred()) PyErr_Format(PyExc_TypeError, @@ -2571,7 +2571,7 @@ int PyObject_IsInstance(PyObject *inst, PyObject *cls) { - static PyObject *name = NULL; + _Py_IDENTIFIER(__instancecheck__); PyObject *checker; /* Quick test for an exact match */ @@ -2597,7 +2597,7 @@ return r; } - checker = _PyObject_LookupSpecial(cls, "__instancecheck__", &name); + checker = _PyObject_LookupSpecial(cls, &PyId___instancecheck__); if (checker != NULL) { PyObject *res; int ok = -1; @@ -2640,7 +2640,7 @@ int PyObject_IsSubclass(PyObject *derived, PyObject *cls) { - static PyObject *name = NULL; + _Py_IDENTIFIER(__subclasscheck__); PyObject *checker; if (PyTuple_Check(cls)) { @@ -2662,7 +2662,7 @@ return r; } - checker = _PyObject_LookupSpecial(cls, "__subclasscheck__", &name); + checker = _PyObject_LookupSpecial(cls, &PyId___subclasscheck__); if (checker != NULL) { PyObject *res; int ok = -1; diff --git a/Objects/complexobject.c b/Objects/complexobject.c --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -265,9 +265,9 @@ static PyObject * try_complex_special_method(PyObject *op) { PyObject *f; - static PyObject *complexstr; + _Py_IDENTIFIER(__complex__); - f = _PyObject_LookupSpecial(op, "__complex__", &complexstr); + f = _PyObject_LookupSpecial(op, &PyId___complex__); if (f) { PyObject *res = PyObject_CallFunctionObjArgs(f, NULL); Py_DECREF(f); diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1142,10 +1142,8 @@ if (!PyDict_CheckExact(mp)) { /* Look up __missing__ method if we're a subclass. */ PyObject *missing, *res; - static PyObject *missing_str = NULL; - missing = _PyObject_LookupSpecial((PyObject *)mp, - "__missing__", - &missing_str); + _Py_IDENTIFIER(__missing__); + missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__); if (missing != NULL) { res = PyObject_CallFunctionObjArgs(missing, key, NULL); diff --git a/Objects/enumobject.c b/Objects/enumobject.c --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -224,8 +224,8 @@ { Py_ssize_t n; PyObject *seq, *reversed_meth; - static PyObject *reversed_cache = NULL; reversedobject *ro; + _Py_IDENTIFIER(__reversed__); if (type == &PyReversed_Type && !_PyArg_NoKeywords("reversed()", kwds)) return NULL; @@ -233,7 +233,7 @@ if (!PyArg_UnpackTuple(args, "reversed", 1, 1, &seq) ) return NULL; - reversed_meth = _PyObject_LookupSpecial(seq, "__reversed__", &reversed_cache); + reversed_meth = _PyObject_LookupSpecial(seq, &PyId___reversed__); if (reversed_meth != NULL) { PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL); Py_DECREF(reversed_meth); diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -470,7 +470,7 @@ PyObject_Bytes(PyObject *v) { PyObject *result, *func; - static PyObject *bytesstring = NULL; + _Py_IDENTIFIER(__bytes__); if (v == NULL) return PyBytes_FromString(""); @@ -480,7 +480,7 @@ return v; } - func = _PyObject_LookupSpecial(v, "__bytes__", &bytesstring); + func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { result = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); @@ -1298,8 +1298,8 @@ _dir_object(PyObject *obj) { PyObject *result, *sorted; - static PyObject *dir_str = NULL; - PyObject *dirfunc = _PyObject_LookupSpecial(obj, "__dir__", &dir_str); + _Py_IDENTIFIER(__dir__); + PyObject *dirfunc = _PyObject_LookupSpecial(obj, &PyId___dir__); assert(obj); if (dirfunc == NULL) { diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1157,16 +1157,14 @@ */ static PyObject * -lookup_maybe(PyObject *self, char *attrstr, PyObject **attrobj) -{ - PyObject *res; - - if (*attrobj == NULL) { - *attrobj = PyUnicode_InternFromString(attrstr); - if (*attrobj == NULL) - return NULL; - } - res = _PyType_Lookup(Py_TYPE(self), *attrobj); +lookup_maybe(PyObject *self, _Py_Identifier *attrid) +{ + PyObject *attr, *res; + + attr = _PyUnicode_FromId(attrid); + if (attr == NULL) + return NULL; + res = _PyType_Lookup(Py_TYPE(self), attr); if (res != NULL) { descrgetfunc f; if ((f = Py_TYPE(res)->tp_descr_get) == NULL) @@ -1178,18 +1176,18 @@ } static PyObject * -lookup_method(PyObject *self, char *attrstr, PyObject **attrobj) -{ - PyObject *res = lookup_maybe(self, attrstr, attrobj); +lookup_method(PyObject *self, _Py_Identifier *attrid) +{ + PyObject *res = lookup_maybe(self, attrid); if (res == NULL && !PyErr_Occurred()) - PyErr_SetObject(PyExc_AttributeError, *attrobj); + PyErr_SetObject(PyExc_AttributeError, attrid->object); return res; } PyObject * -_PyObject_LookupSpecial(PyObject *self, char *attrstr, PyObject **attrobj) -{ - return lookup_maybe(self, attrstr, attrobj); +_PyObject_LookupSpecial(PyObject *self, _Py_Identifier *attrid) +{ + return lookup_maybe(self, attrid); } /* A variation of PyObject_CallMethod that uses lookup_method() @@ -1197,17 +1195,17 @@ as lookup_method to cache the interned name string object. */ static PyObject * -call_method(PyObject *o, char *name, PyObject **nameobj, char *format, ...) +call_method(PyObject *o, _Py_Identifier *nameid, char *format, ...) { va_list va; PyObject *args, *func = 0, *retval; va_start(va, format); - func = lookup_maybe(o, name, nameobj); + func = lookup_maybe(o, nameid); if (func == NULL) { va_end(va); if (!PyErr_Occurred()) - PyErr_SetObject(PyExc_AttributeError, *nameobj); + PyErr_SetObject(PyExc_AttributeError, nameid->object); return NULL; } @@ -1233,13 +1231,13 @@ /* Clone of call_method() that returns NotImplemented when the lookup fails. */ static PyObject * -call_maybe(PyObject *o, char *name, PyObject **nameobj, char *format, ...) +call_maybe(PyObject *o, _Py_Identifier *nameid, char *format, ...) { va_list va; PyObject *args, *func = 0, *retval; va_start(va, format); - func = lookup_maybe(o, name, nameobj); + func = lookup_maybe(o, nameid); if (func == NULL) { va_end(va); if (!PyErr_Occurred()) @@ -1565,9 +1563,9 @@ result = mro_implementation(type); } else { - static PyObject *mro_str; + _Py_IDENTIFIER(mro); checkit = 1; - mro = lookup_method((PyObject *)type, "mro", &mro_str); + mro = lookup_method((PyObject *)type, &PyId_mro); if (mro == NULL) return -1; result = PyObject_CallObject(mro, NULL); @@ -4819,16 +4817,16 @@ static PyObject * \ FUNCNAME(PyObject *self) \ { \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, "()"); \ + _Py_static_string(id, OPSTR); \ + return call_method(self, &id, "()"); \ } #define SLOT1(FUNCNAME, OPSTR, ARG1TYPE, ARGCODES) \ static PyObject * \ FUNCNAME(PyObject *self, ARG1TYPE arg1) \ { \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, "(" ARGCODES ")", arg1); \ + _Py_static_string(id, OPSTR); \ + return call_method(self, &id, "(" ARGCODES ")", arg1); \ } /* Boolean helper for SLOT1BINFULL(). @@ -4870,7 +4868,8 @@ static PyObject * \ FUNCNAME(PyObject *self, PyObject *other) \ { \ - static PyObject *cache_str, *rcache_str; \ + _Py_static_string(op_id, OPSTR); \ + _Py_static_string(rop_id, ROPSTR); \ int do_other = Py_TYPE(self) != Py_TYPE(other) && \ Py_TYPE(other)->tp_as_number != NULL && \ Py_TYPE(other)->tp_as_number->SLOTNAME == TESTFUNC; \ @@ -4880,23 +4879,20 @@ if (do_other && \ PyType_IsSubtype(Py_TYPE(other), Py_TYPE(self)) && \ method_is_overloaded(self, other, ROPSTR)) { \ - r = call_maybe( \ - other, ROPSTR, &rcache_str, "(O)", self); \ + r = call_maybe(other, &rop_id, "(O)", self); \ if (r != Py_NotImplemented) \ return r; \ Py_DECREF(r); \ do_other = 0; \ } \ - r = call_maybe( \ - self, OPSTR, &cache_str, "(O)", other); \ + r = call_maybe(self, &op_id, "(O)", other); \ if (r != Py_NotImplemented || \ Py_TYPE(other) == Py_TYPE(self)) \ return r; \ Py_DECREF(r); \ } \ if (do_other) { \ - return call_maybe( \ - other, ROPSTR, &rcache_str, "(O)", self); \ + return call_maybe(other, &rop_id, "(O)", self); \ } \ Py_RETURN_NOTIMPLEMENTED; \ } @@ -4908,16 +4904,15 @@ static PyObject * \ FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \ { \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, \ - "(" ARGCODES ")", arg1, arg2); \ + _Py_static_string(id, #OPSTR); \ + return call_method(self, &id, "(" ARGCODES ")", arg1, arg2); \ } static Py_ssize_t slot_sq_length(PyObject *self) { - static PyObject *len_str; - PyObject *res = call_method(self, "__len__", &len_str, "()"); + _Py_IDENTIFIER(__len__); + PyObject *res = call_method(self, &PyId___len__, "()"); Py_ssize_t len; if (res == NULL) @@ -4982,14 +4977,13 @@ slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value) { PyObject *res; - static PyObject *delitem_str, *setitem_str; + _Py_IDENTIFIER(__delitem__); + _Py_IDENTIFIER(__setitem__); if (value == NULL) - res = call_method(self, "__delitem__", &delitem_str, - "(n)", index); + res = call_method(self, &PyId___delitem__, "(n)", index); else - res = call_method(self, "__setitem__", &setitem_str, - "(nO)", index, value); + res = call_method(self, &PyId___setitem__, "(nO)", index, value); if (res == NULL) return -1; Py_DECREF(res); @@ -5001,10 +4995,9 @@ { PyObject *func, *res, *args; int result = -1; - - static PyObject *contains_str; - - func = lookup_maybe(self, "__contains__", &contains_str); + _Py_IDENTIFIER(__contains__); + + func = lookup_maybe(self, &PyId___contains__); if (func != NULL) { args = PyTuple_Pack(1, value); if (args == NULL) @@ -5035,14 +5028,14 @@ slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value) { PyObject *res; - static PyObject *delitem_str, *setitem_str; + _Py_IDENTIFIER(__delitem__); + _Py_IDENTIFIER(__setitem__); if (value == NULL) - res = call_method(self, "__delitem__", &delitem_str, - "(O)", key); + res = call_method(self, &PyId___delitem__, "(O)", key); else - res = call_method(self, "__setitem__", &setitem_str, - "(OO)", key, value); + res = call_method(self, &PyId___setitem__, "(OO)", key, value); + if (res == NULL) return -1; Py_DECREF(res); @@ -5063,7 +5056,7 @@ static PyObject * slot_nb_power(PyObject *self, PyObject *other, PyObject *modulus) { - static PyObject *pow_str; + _Py_IDENTIFIER(__pow__); if (modulus == Py_None) return slot_nb_power_binary(self, other); @@ -5072,8 +5065,7 @@ slot_nb_power, so check before calling self.__pow__. */ if (Py_TYPE(self)->tp_as_number != NULL && Py_TYPE(self)->tp_as_number->nb_power == slot_nb_power) { - return call_method(self, "__pow__", &pow_str, - "(OO)", other, modulus); + return call_method(self, &PyId___pow__, "(OO)", other, modulus); } Py_RETURN_NOTIMPLEMENTED; } @@ -5086,15 +5078,16 @@ slot_nb_bool(PyObject *self) { PyObject *func, *args; - static PyObject *bool_str, *len_str; int result = -1; int using_len = 0; - - func = lookup_maybe(self, "__bool__", &bool_str); + _Py_IDENTIFIER(__len__); + _Py_IDENTIFIER(__bool__); + + func = lookup_maybe(self, &PyId___bool__); if (func == NULL) { if (PyErr_Occurred()) return -1; - func = lookup_maybe(self, "__len__", &len_str); + func = lookup_maybe(self, &PyId___len__); if (func == NULL) return PyErr_Occurred() ? -1 : 1; using_len = 1; @@ -5129,8 +5122,8 @@ static PyObject * slot_nb_index(PyObject *self) { - static PyObject *index_str; - return call_method(self, "__index__", &index_str, "()"); + _Py_IDENTIFIER(__index__); + return call_method(self, &PyId___index__, "()"); } @@ -5151,8 +5144,8 @@ static PyObject * slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2) { - static PyObject *cache_str; - return call_method(self, "__ipow__", &cache_str, "(" "O" ")", arg1); + _Py_IDENTIFIER(__ipow__); + return call_method(self, &PyId___ipow__, "(" "O" ")", arg1); } SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *, "O") SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *, "O") @@ -5169,9 +5162,9 @@ slot_tp_repr(PyObject *self) { PyObject *func, *res; - static PyObject *repr_str; - - func = lookup_method(self, "__repr__", &repr_str); + _Py_IDENTIFIER(__repr__); + + func = lookup_method(self, &PyId___repr__); if (func != NULL) { res = PyEval_CallObject(func, NULL); Py_DECREF(func); @@ -5186,9 +5179,9 @@ slot_tp_str(PyObject *self) { PyObject *func, *res; - static PyObject *str_str; - - func = lookup_method(self, "__str__", &str_str); + _Py_IDENTIFIER(__str__); + + func = lookup_method(self, &PyId___str__); if (func != NULL) { res = PyEval_CallObject(func, NULL); Py_DECREF(func); @@ -5217,10 +5210,10 @@ slot_tp_hash(PyObject *self) { PyObject *func, *res; - static PyObject *hash_str; Py_ssize_t h; - - func = lookup_method(self, "__hash__", &hash_str); + _Py_IDENTIFIER(__hash__); + + func = lookup_method(self, &PyId___hash__); if (func == Py_None) { Py_DECREF(func); @@ -5264,8 +5257,8 @@ static PyObject * slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds) { - static PyObject *call_str; - PyObject *meth = lookup_method(self, "__call__", &call_str); + _Py_IDENTIFIER(__call__); + PyObject *meth = lookup_method(self, &PyId___call__); PyObject *res; if (meth == NULL) @@ -5291,9 +5284,8 @@ static PyObject * slot_tp_getattro(PyObject *self, PyObject *name) { - static PyObject *getattribute_str = NULL; - return call_method(self, "__getattribute__", &getattribute_str, - "(O)", name); + _Py_IDENTIFIER(__getattribute__); + return call_method(self, &PyId___getattribute__, "(O)", name); } static PyObject * @@ -5373,36 +5365,34 @@ slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value) { PyObject *res; - static PyObject *delattr_str, *setattr_str; + _Py_IDENTIFIER(__delattr__); + _Py_IDENTIFIER(__setattr__); if (value == NULL) - res = call_method(self, "__delattr__", &delattr_str, - "(O)", name); + res = call_method(self, &PyId___delattr__, "(O)", name); else - res = call_method(self, "__setattr__", &setattr_str, - "(OO)", name, value); + res = call_method(self, &PyId___setattr__, "(OO)", name, value); if (res == NULL) return -1; Py_DECREF(res); return 0; } -static char *name_op[] = { - "__lt__", - "__le__", - "__eq__", - "__ne__", - "__gt__", - "__ge__", +static _Py_Identifier name_op[] = { + {0, "__lt__", 0}, + {0, "__le__", 0}, + {0, "__eq__", 0}, + {0, "__ne__", 0}, + {0, "__gt__", 0}, + {0, "__ge__", 0} }; static PyObject * slot_tp_richcompare(PyObject *self, PyObject *other, int op) { PyObject *func, *args, *res; - static PyObject *op_str[6]; - - func = lookup_method(self, name_op[op], &op_str[op]); + + func = lookup_method(self, &name_op[op]); if (func == NULL) { PyErr_Clear(); Py_RETURN_NOTIMPLEMENTED; @@ -5422,9 +5412,10 @@ slot_tp_iter(PyObject *self) { PyObject *func, *res; - static PyObject *iter_str, *getitem_str; - - func = lookup_method(self, "__iter__", &iter_str); + _Py_IDENTIFIER(__iter__); + _Py_IDENTIFIER(__getitem__); + + func = lookup_method(self, &PyId___iter__); if (func != NULL) { PyObject *args; args = res = PyTuple_New(0); @@ -5436,7 +5427,7 @@ return res; } PyErr_Clear(); - func = lookup_method(self, "__getitem__", &getitem_str); + func = lookup_method(self, &PyId___getitem__); if (func == NULL) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not iterable", @@ -5450,8 +5441,8 @@ static PyObject * slot_tp_iternext(PyObject *self) { - static PyObject *next_str; - return call_method(self, "__next__", &next_str, "()"); + _Py_IDENTIFIER(__next__); + return call_method(self, &PyId___next__, "()"); } static PyObject * @@ -5485,14 +5476,13 @@ slot_tp_descr_set(PyObject *self, PyObject *target, PyObject *value) { PyObject *res; - static PyObject *del_str, *set_str; + _Py_IDENTIFIER(__delete__); + _Py_IDENTIFIER(__set__); if (value == NULL) - res = call_method(self, "__delete__", &del_str, - "(O)", target); + res = call_method(self, &PyId___delete__, "(O)", target); else - res = call_method(self, "__set__", &set_str, - "(OO)", target, value); + res = call_method(self, &PyId___set__, "(OO)", target, value); if (res == NULL) return -1; Py_DECREF(res); @@ -5502,8 +5492,8 @@ static int slot_tp_init(PyObject *self, PyObject *args, PyObject *kwds) { - static PyObject *init_str; - PyObject *meth = lookup_method(self, "__init__", &init_str); + _Py_IDENTIFIER(__init__); + PyObject *meth = lookup_method(self, &PyId___init__); PyObject *res; if (meth == NULL) @@ -5560,7 +5550,7 @@ static void slot_tp_del(PyObject *self) { - static PyObject *del_str = NULL; + _Py_IDENTIFIER(__del__); PyObject *del, *res; PyObject *error_type, *error_value, *error_traceback; @@ -5572,7 +5562,7 @@ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ - del = lookup_maybe(self, "__del__", &del_str); + del = lookup_maybe(self, &PyId___del__); if (del != NULL) { res = PyEval_CallObject(del, NULL); if (res == NULL) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -138,7 +138,7 @@ static void format_exc_unbound(PyCodeObject *co, int oparg); static PyObject * unicode_concatenate(PyObject *, PyObject *, PyFrameObject *, unsigned char *); -static PyObject * special_lookup(PyObject *, char *, PyObject **); +static PyObject * special_lookup(PyObject *, _Py_Identifier *); #define NAME_ERROR_MSG \ "name '%.200s' is not defined" @@ -2540,13 +2540,14 @@ TARGET(SETUP_WITH) { - static PyObject *exit, *enter; + _Py_IDENTIFIER(__exit__); + _Py_IDENTIFIER(__enter__); w = TOP(); - x = special_lookup(w, "__exit__", &exit); + x = special_lookup(w, &PyId___exit__); if (!x) break; SET_TOP(x); - u = special_lookup(w, "__enter__", &enter); + u = special_lookup(w, &PyId___enter__); Py_DECREF(w); if (!u) { x = NULL; @@ -3440,12 +3441,12 @@ static PyObject * -special_lookup(PyObject *o, char *meth, PyObject **cache) +special_lookup(PyObject *o, _Py_Identifier *id) { PyObject *res; - res = _PyObject_LookupSpecial(o, meth, cache); + res = _PyObject_LookupSpecial(o, id); if (res == NULL && !PyErr_Occurred()) { - PyErr_SetObject(PyExc_AttributeError, *cache); + PyErr_SetObject(PyExc_AttributeError, id->object); return NULL; } return res; diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -814,10 +814,11 @@ sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) { PyObject *res = NULL; - static PyObject *str__sizeof__ = NULL, *gc_head_size = NULL; + static PyObject *gc_head_size = NULL; static char *kwlist[] = {"object", "default", 0}; PyObject *o, *dflt = NULL; PyObject *method; + _Py_IDENTIFIER(__sizeof__); if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof", kwlist, &o, &dflt)) @@ -834,8 +835,7 @@ if (PyType_Ready(Py_TYPE(o)) < 0) return NULL; - method = _PyObject_LookupSpecial(o, "__sizeof__", - &str__sizeof__); + method = _PyObject_LookupSpecial(o, &PyId___sizeof__); if (method == NULL) { if (!PyErr_Occurred()) PyErr_Format(PyExc_TypeError, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 20:30:00 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 22 Jan 2012 20:30:00 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Fix_silly_suggestion=2E?= Message-ID: http://hg.python.org/devguide/rev/34693b7c81b1 changeset: 486:34693b7c81b1 user: Georg Brandl date: Sun Jan 22 20:29:54 2012 +0100 summary: Fix silly suggestion. files: setup.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -132,9 +132,10 @@ (e.g. on OS X by default), in order to avoid conflicts with the ``Python`` directory. There is normally no need to install your built copy of Python! The interpreter will realize where it is being run from -and thus use the files found in the working copy. If you are worried -you might accidentally install your working copy build, you can add -``--prefix=/dev/null`` to the configuration step. +and thus use the files found in the working copy. If you are worried +you might accidentally install your working copy build, you should probably +use an account for developing that doesn't have write permissions on +``/usr/local`` anyway. .. _issue tracker: http://bugs.python.org -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sun Jan 22 20:35:05 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 22 Jan 2012 20:35:05 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Okay=2C_so_apparently_on_O?= =?utf8?q?SX_/usr/local_is_world-writable=2E?= Message-ID: http://hg.python.org/devguide/rev/31ab284dae1f changeset: 487:31ab284dae1f user: Georg Brandl date: Sun Jan 22 20:34:59 2012 +0100 summary: Okay, so apparently on OSX /usr/local is world-writable. files: setup.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -133,9 +133,8 @@ directory. There is normally no need to install your built copy of Python! The interpreter will realize where it is being run from and thus use the files found in the working copy. If you are worried -you might accidentally install your working copy build, you should probably -use an account for developing that doesn't have write permissions on -``/usr/local`` anyway. +you might accidentally install your working copy build, you can add +``--prefix=/tmp/python`` to the configuration step. .. _issue tracker: http://bugs.python.org -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Sun Jan 22 21:31:46 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 22 Jan 2012 21:31:46 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogRml4ICMxMzgzNDog?= =?utf8?q?strip=28=29_strips_leading_and_trailing_whitespace=2E?= Message-ID: http://hg.python.org/cpython/rev/960d93deb8c2 changeset: 74579:960d93deb8c2 branch: 3.2 parent: 74575:6b436e31e1de user: Georg Brandl date: Sun Jan 22 21:31:21 2012 +0100 summary: Fix #13834: strip() strips leading and trailing whitespace. files: Objects/bytesobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1437,7 +1437,7 @@ "B.strip([bytes]) -> bytes\n\ \n\ Strip leading and trailing bytes contained in the argument.\n\ -If the argument is omitted, strip trailing ASCII whitespace."); +If the argument is omitted, strip leading and trailing ASCII whitespace."); static PyObject * bytes_strip(PyBytesObject *self, PyObject *args) { -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 22 21:31:47 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 22 Jan 2012 21:31:47 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/f13af83967a0 changeset: 74580:f13af83967a0 parent: 74578:7d96679c5d46 parent: 74579:960d93deb8c2 user: Georg Brandl date: Sun Jan 22 21:31:39 2012 +0100 summary: merge with 3.2 files: Objects/bytesobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1426,7 +1426,7 @@ "B.strip([bytes]) -> bytes\n\ \n\ Strip leading and trailing bytes contained in the argument.\n\ -If the argument is omitted, strip trailing ASCII whitespace."); +If the argument is omitted, strip leading and trailing ASCII whitespace."); static PyObject * bytes_strip(PyBytesObject *self, PyObject *args) { -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jan 23 05:32:38 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 23 Jan 2012 05:32:38 +0100 Subject: [Python-checkins] Daily reference leaks (f13af83967a0): sum=0 Message-ID: results for f13af83967a0 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog9jkxS6', '-x'] From python-checkins at python.org Mon Jan 23 17:31:47 2012 From: python-checkins at python.org (lukasz.langa) Date: Mon, 23 Jan 2012 17:31:47 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogRml4ZXMgIzQ2ODYu?= =?utf8?q?_Reverts_redundant_picklability_code_from_r74544=2E?= Message-ID: http://hg.python.org/cpython/rev/8e091e36fc80 changeset: 74581:8e091e36fc80 branch: 2.7 parent: 74560:fcf4d547bed8 user: ?ukasz Langa date: Mon Jan 23 17:30:53 2012 +0100 summary: Fixes #4686. Reverts redundant picklability code from r74544. files: Lib/ConfigParser.py | 42 +++++++------------------------- 1 files changed, 9 insertions(+), 33 deletions(-) diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -134,9 +134,6 @@ def __repr__(self): return self.message - def __reduce__(self): - return self.__class__, (self.message,) - __str__ = __repr__ class NoSectionError(Error): @@ -145,9 +142,7 @@ def __init__(self, section): Error.__init__(self, 'No section: %r' % (section,)) self.section = section - - def __reduce__(self): - return self.__class__, (self.section,) + self.args = (section, ) class DuplicateSectionError(Error): """Raised when a section is multiply-created.""" @@ -155,9 +150,7 @@ def __init__(self, section): Error.__init__(self, "Section %r already exists" % section) self.section = section - - def __reduce__(self): - return self.__class__, (self.section,) + self.args = (section, ) class NoOptionError(Error): """A requested option was not found.""" @@ -167,9 +160,7 @@ (option, section)) self.option = option self.section = section - - def __reduce__(self): - return self.__class__, (self.option, self.section) + self.args = (option, section) class InterpolationError(Error): """Base class for interpolation-related exceptions.""" @@ -178,9 +169,7 @@ Error.__init__(self, msg) self.option = option self.section = section - - def __reduce__(self): - return self.__class__, (self.option, self.section, self.message) + self.args = (option, section, msg) class InterpolationMissingOptionError(InterpolationError): """A string substitution required a setting which was not available.""" @@ -194,11 +183,7 @@ % (section, option, reference, rawval)) InterpolationError.__init__(self, option, section, msg) self.reference = reference - self._rawval = rawval - - def __reduce__(self): - return self.__class__, (self.option, self.section, self._rawval, - self.reference) + self.args = (option, section, rawval, reference) class InterpolationSyntaxError(InterpolationError): """Raised when the source text into which substitutions are made @@ -214,28 +199,21 @@ "\trawval : %s\n" % (section, option, rawval)) InterpolationError.__init__(self, option, section, msg) - self._rawval = rawval - - def __reduce__(self): - return self.__class__, (self.option, self.section, self._rawval) + self.args = (option, section, rawval) class ParsingError(Error): """Raised when a configuration file does not follow legal syntax.""" - def __init__(self, filename, _errors=[]): + def __init__(self, filename): Error.__init__(self, 'File contains parsing errors: %s' % filename) self.filename = filename self.errors = [] - for lineno, line in _errors: - self.append(lineno, line) + self.args = (filename, ) def append(self, lineno, line): self.errors.append((lineno, line)) self.message += '\n\t[line %2d]: %s' % (lineno, line) - def __reduce__(self): - return self.__class__, (self.filename, self.errors) - class MissingSectionHeaderError(ParsingError): """Raised when a key-value pair is found before any section header.""" @@ -247,9 +225,7 @@ self.filename = filename self.lineno = lineno self.line = line - - def __reduce__(self): - return self.__class__, (self.filename, self.lineno, self.line) + self.args = (filename, lineno, line) class RawConfigParser: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 23 20:21:53 2012 From: python-checkins at python.org (georg.brandl) Date: Mon, 23 Jan 2012 20:21:53 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzODE2OiBmaXgg?= =?utf8?q?two_minor_style_issues=2E_Thanks_to_Justin_Wehnes_for_the_patch?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/a72ca8b23cdf changeset: 74582:a72ca8b23cdf branch: 3.2 parent: 74579:960d93deb8c2 user: Georg Brandl date: Mon Jan 23 20:19:33 2012 +0100 summary: #13816: fix two minor style issues. Thanks to Justin Wehnes for the patch. files: Doc/library/functools.rst | 2 +- Doc/library/stdtypes.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -20,7 +20,7 @@ .. function:: cmp_to_key(func) - Transform an old-style comparison function to a key-function. Used with + Transform an old-style comparison function to a key function. Used with tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -873,7 +873,7 @@ | ``s * n, n * s`` | *n* shallow copies of *s* | \(2) | | | concatenated | | +------------------+--------------------------------+----------+ -| ``s[i]`` | *i*'th item of *s*, origin 0 | \(3) | +| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) | +------------------+--------------------------------+----------+ | ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) | +------------------+--------------------------------+----------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 23 20:21:54 2012 From: python-checkins at python.org (georg.brandl) Date: Mon, 23 Jan 2012 20:21:54 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_from_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/a378922691e5 changeset: 74583:a378922691e5 parent: 74580:f13af83967a0 parent: 74582:a72ca8b23cdf user: Georg Brandl date: Mon Jan 23 20:19:46 2012 +0100 summary: merge from 3.2 files: Doc/library/functools.rst | 2 +- Doc/library/stdtypes.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -20,7 +20,7 @@ .. function:: cmp_to_key(func) - Transform an old-style comparison function to a key-function. Used with + Transform an old-style comparison function to a key function. Used with tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -877,7 +877,7 @@ | ``s * n, n * s`` | *n* shallow copies of *s* | \(2) | | | concatenated | | +------------------+--------------------------------+----------+ -| ``s[i]`` | *i*'th item of *s*, origin 0 | \(3) | +| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) | +------------------+--------------------------------+----------+ | ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) | +------------------+--------------------------------+----------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 23 20:21:55 2012 From: python-checkins at python.org (georg.brandl) Date: Mon, 23 Jan 2012 20:21:55 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzEzODE2OiBmaXgg?= =?utf8?q?two_minor_style_issues=2E_Thanks_to_Justin_Wehnes_for_the_patch?= =?utf8?q?=2E?= Message-ID: http://hg.python.org/cpython/rev/f4f9ab2fd51b changeset: 74584:f4f9ab2fd51b branch: 2.7 parent: 74581:8e091e36fc80 user: Georg Brandl date: Mon Jan 23 20:19:33 2012 +0100 summary: #13816: fix two minor style issues. Thanks to Justin Wehnes for the patch. files: Doc/library/functools.rst | 2 +- Doc/library/stdtypes.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -22,7 +22,7 @@ .. function:: cmp_to_key(func) - Transform an old-style comparison function to a key-function. Used with + Transform an old-style comparison function to a key function. Used with tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -730,7 +730,7 @@ | ``s * n, n * s`` | *n* shallow copies of *s* | \(2) | | | concatenated | | +------------------+--------------------------------+----------+ -| ``s[i]`` | *i*'th item of *s*, origin 0 | \(3) | +| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) | +------------------+--------------------------------+----------+ | ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) | +------------------+--------------------------------+----------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 23 22:42:41 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 23 Jan 2012 22:42:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_compilation_warnings_?= =?utf8?q?=28seen_on_win32_buildbot=29?= Message-ID: http://hg.python.org/cpython/rev/04b565d912c2 changeset: 74585:04b565d912c2 parent: 74583:a378922691e5 user: Amaury Forgeot d'Arc date: Mon Jan 23 22:42:19 2012 +0100 summary: Fix compilation warnings (seen on win32 buildbot) files: Python/formatter_unicode.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -682,7 +682,7 @@ Py_ssize_t pos; Py_ssize_t len = PyUnicode_GET_LENGTH(value); PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; /* sign is not allowed on strings */ if (format->sign != '\0') { @@ -749,7 +749,7 @@ IntOrLongToString tostring) { PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; PyObject *tmp = NULL; Py_ssize_t inumeric_chars; Py_UCS4 sign_char = '\0'; @@ -926,7 +926,7 @@ NumberFieldWidths spec; int flags = 0; PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; Py_UCS4 sign_char = '\0'; int float_type; /* Used to see if we have a nan, inf, or regular float. */ PyObject *unicode_tmp = NULL; @@ -1070,7 +1070,7 @@ NumberFieldWidths im_spec; int flags = 0; PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; int rkind; void *rdata; Py_ssize_t index; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 23 23:21:03 2012 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 23 Jan 2012 23:21:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Silence_last_compilation_wa?= =?utf8?q?rning=2E?= Message-ID: http://hg.python.org/cpython/rev/728cfc671d15 changeset: 74586:728cfc671d15 user: Amaury Forgeot d'Arc date: Mon Jan 23 23:20:43 2012 +0100 summary: Silence last compilation warning. files: Python/formatter_unicode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -798,7 +798,7 @@ tmp = PyUnicode_FromOrdinal(x); inumeric_chars = 0; n_digits = 1; - maxchar = Py_MAX(maxchar, x); + maxchar = Py_MAX(maxchar, (Py_UCS4)x); /* As a sort-of hack, we tell calc_number_widths that we only have "remainder" characters. calc_number_widths thinks -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 23 23:47:05 2012 From: python-checkins at python.org (victor.stinner) Date: Mon, 23 Jan 2012 23:47:05 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2310278=3A_wallclock?= =?utf8?q?=28=29_cannot_go_backward=2C_but_two_consecutive_calls?= Message-ID: http://hg.python.org/cpython/rev/fb0f4fe8123e changeset: 74587:fb0f4fe8123e user: Victor Stinner date: Mon Jan 23 23:48:41 2012 +0100 summary: Issue #10278: wallclock() cannot go backward, but two consecutive calls may return the same time. files: Lib/test/test_time.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -334,7 +334,7 @@ def test_wallclock(self): t1 = time.wallclock() t2 = time.wallclock() - self.assertGreater(t2, t1) + self.assertGreaterEqual(t2, t1) t1 = time.wallclock() time.sleep(0.1) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 01:13:09 2012 From: python-checkins at python.org (victor.stinner) Date: Tue, 24 Jan 2012 01:13:09 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Sort_functions_in_the_doc_o?= =?utf8?q?f_the_time_module?= Message-ID: http://hg.python.org/cpython/rev/dfd05348331c changeset: 74588:dfd05348331c user: Victor Stinner date: Tue Jan 24 01:12:54 2012 +0100 summary: Sort functions in the doc of the time module Move wallclock() at the end. files: Doc/library/time.rst | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -183,19 +183,6 @@ .. versionadded:: 3.3 -.. function:: wallclock() - - .. index:: - single: Wallclock - single: benchmarking - - Return the current time in fractions of a second to the system's best ability. - Use this when the most accurate representation of wall-clock is required, i.e. - when "processor time" is inappropriate. The reference point of the returned - value is undefined so only the difference of consecutive calls is valid. - - .. versionadded: 3.3 - .. function:: ctime([secs]) Convert a time expressed in seconds since the epoch to a string representing @@ -550,6 +537,20 @@ ('EET', 'EEST') +.. function:: wallclock() + + .. index:: + single: Wallclock + single: benchmarking + + Return the current time in fractions of a second to the system's best ability. + Use this when the most accurate representation of wall-clock is required, i.e. + when "processor time" is inappropriate. The reference point of the returned + value is undefined so only the difference of consecutive calls is valid. + + .. versionadded: 3.3 + + .. seealso:: Module :mod:`datetime` -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jan 24 05:31:28 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 24 Jan 2012 05:31:28 +0100 Subject: [Python-checkins] Daily reference leaks (dfd05348331c): sum=0 Message-ID: results for dfd05348331c on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogcf6uwx', '-x'] From python-checkins at python.org Tue Jan 24 09:13:48 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 24 Jan 2012 09:13:48 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzNzcy?= =?utf8?q?=3A_In_os=2Esymlink=28=29_under_Windows=2C_do_not_try_to_guess_t?= =?utf8?q?he_link?= Message-ID: http://hg.python.org/cpython/rev/839fa289e226 changeset: 74589:839fa289e226 branch: 3.2 parent: 74582:a72ca8b23cdf user: Antoine Pitrou date: Tue Jan 24 08:59:28 2012 +0100 summary: Issue #13772: In os.symlink() under Windows, do not try to guess the link target's type (file or directory). The detection was buggy and made the call non-atomic (therefore prone to race conditions). files: Doc/library/os.rst | 9 +++------ Lib/test/test_os.py | 9 +++++++-- Misc/NEWS | 4 ++++ Modules/posixmodule.c | 11 ----------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1429,11 +1429,9 @@ *target_is_directory*, which defaults to ``False``. On Windows, a symlink represents a file or a directory, and does not morph to - the target dynamically. For this reason, when creating a symlink on Windows, - if the target is not already present, the symlink will default to being a - file symlink. If *target_is_directory* is set to ``True``, the symlink will - be created as a directory symlink. This parameter is ignored if the target - exists (and the symlink is created with the same type as the target). + the target dynamically. If *target_is_directory* is set to ``True``, the + symlink will be created as a directory symlink, otherwise as a file symlink + (the default). Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink` will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0. @@ -1446,7 +1444,6 @@ administrator level. Either obtaining the privilege or running your application as an administrator are ways to successfully create symlinks. - :exc:`OSError` is raised when the function is called by an unprivileged user. diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -476,7 +476,12 @@ f.write("I'm " + path + " and proud of it. Blame test_os.\n") f.close() if support.can_symlink(): - os.symlink(os.path.abspath(t2_path), link_path) + if os.name == 'nt': + def symlink_to_dir(src, dest): + os.symlink(src, dest, True) + else: + symlink_to_dir = os.symlink + symlink_to_dir(os.path.abspath(t2_path), link_path) sub2_tree = (sub2_path, ["link"], ["tmp3"]) else: sub2_tree = (sub2_path, [], ["tmp3"]) @@ -1106,7 +1111,7 @@ os.remove(self.missing_link) def test_directory_link(self): - os.symlink(self.dirlink_target, self.dirlink) + os.symlink(self.dirlink_target, self.dirlink, True) self.assertTrue(os.path.exists(self.dirlink)) self.assertTrue(os.path.isdir(self.dirlink)) self.assertTrue(os.path.islink(self.dirlink)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -108,6 +108,10 @@ Library ------- +- Issue #13772: In os.symlink() under Windows, do not try to guess the link + target's type (file or directory). The detection was buggy and made the + call non-atomic (therefore prone to race conditions). + - Issue #6631: Disallow relative file paths in urllib urlopen methods. - Issue #13722: Avoid silencing ImportErrors when initializing the codecs diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5330,7 +5330,6 @@ PyObject *src, *dest; int target_is_directory = 0; DWORD res; - WIN32_FILE_ATTRIBUTE_DATA src_info; if (!check_CreateSymbolicLinkW()) { @@ -5351,16 +5350,6 @@ return NULL; } - /* if src is a directory, ensure target_is_directory==1 */ - if( - GetFileAttributesExW( - PyUnicode_AsUnicode(src), GetFileExInfoStandard, &src_info - )) - { - target_is_directory = target_is_directory || - (src_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); - } - Py_BEGIN_ALLOW_THREADS res = Py_CreateSymbolicLinkW( PyUnicode_AsUnicode(dest), -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 09:13:49 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 24 Jan 2012 09:13:49 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313772=3A_In_os=2Esymlink=28=29_under_Windows=2C_do_?= =?utf8?q?not_try_to_guess_the_link?= Message-ID: http://hg.python.org/cpython/rev/a7406565ef1c changeset: 74590:a7406565ef1c parent: 74588:dfd05348331c parent: 74589:839fa289e226 user: Antoine Pitrou date: Tue Jan 24 09:05:18 2012 +0100 summary: Issue #13772: In os.symlink() under Windows, do not try to guess the link target's type (file or directory). The detection was buggy and made the call non-atomic (therefore prone to race conditions). files: Doc/library/os.rst | 9 +++------ Lib/test/test_os.py | 9 +++++++-- Misc/NEWS | 4 ++++ Modules/posixmodule.c | 11 ----------- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2085,11 +2085,9 @@ *target_is_directory*, which defaults to ``False``. On Windows, a symlink represents a file or a directory, and does not morph to - the target dynamically. For this reason, when creating a symlink on Windows, - if the target is not already present, the symlink will default to being a - file symlink. If *target_is_directory* is set to ``True``, the symlink will - be created as a directory symlink. This parameter is ignored if the target - exists (and the symlink is created with the same type as the target). + the target dynamically. If *target_is_directory* is set to ``True``, the + symlink will be created as a directory symlink, otherwise as a file symlink + (the default). Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink` will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0. @@ -2102,7 +2100,6 @@ administrator level. Either obtaining the privilege or running your application as an administrator are ways to successfully create symlinks. - :exc:`OSError` is raised when the function is called by an unprivileged user. diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -500,7 +500,12 @@ f.write("I'm " + path + " and proud of it. Blame test_os.\n") f.close() if support.can_symlink(): - os.symlink(os.path.abspath(t2_path), link_path) + if os.name == 'nt': + def symlink_to_dir(src, dest): + os.symlink(src, dest, True) + else: + symlink_to_dir = os.symlink + symlink_to_dir(os.path.abspath(t2_path), link_path) sub2_tree = (sub2_path, ["link"], ["tmp3"]) else: sub2_tree = (sub2_path, [], ["tmp3"]) @@ -1131,7 +1136,7 @@ os.remove(self.missing_link) def test_directory_link(self): - os.symlink(self.dirlink_target, self.dirlink) + os.symlink(self.dirlink_target, self.dirlink, True) self.assertTrue(os.path.exists(self.dirlink)) self.assertTrue(os.path.isdir(self.dirlink)) self.assertTrue(os.path.islink(self.dirlink)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -458,6 +458,10 @@ Library ------- +- Issue #13772: In os.symlink() under Windows, do not try to guess the link + target's type (file or directory). The detection was buggy and made the + call non-atomic (therefore prone to race conditions). + - Issue #6631: Disallow relative file paths in urllib urlopen methods. - Issue #13722: Avoid silencing ImportErrors when initializing the codecs diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6551,7 +6551,6 @@ wchar_t *wsrc, *wdest; int target_is_directory = 0; DWORD res; - WIN32_FILE_ATTRIBUTE_DATA src_info; if (!check_CreateSymbolicLinkW()) { @@ -6581,16 +6580,6 @@ if (wsrc == NULL) goto error; - /* if src is a directory, ensure target_is_directory==1 */ - if( - GetFileAttributesExW( - wsrc, GetFileExInfoStandard, &src_info - )) - { - target_is_directory = target_is_directory || - (src_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); - } - Py_BEGIN_ALLOW_THREADS res = Py_CreateSymbolicLinkW(wdest, wsrc, target_is_directory); Py_END_ALLOW_THREADS -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 15:07:21 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 24 Jan 2012 15:07:21 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_fix_declaration?= =?utf8?q?_style?= Message-ID: http://hg.python.org/cpython/rev/308f4af9548e changeset: 74591:308f4af9548e branch: 3.2 parent: 74579:960d93deb8c2 user: Benjamin Peterson date: Sun Jan 22 20:04:46 2012 -0500 summary: fix declaration style files: Modules/_posixsubprocess.c | 55 ++++++++++++++----------- 1 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -43,7 +43,8 @@ /* Given the gc module call gc.enable() and return 0 on success. */ -static int _enable_gc(PyObject *gc_module) +static int +_enable_gc(PyObject *gc_module) { PyObject *result; result = PyObject_CallMethod(gc_module, "enable", NULL); @@ -55,7 +56,8 @@ /* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ -static int _pos_int_from_ascii(char *name) +static int +_pos_int_from_ascii(char *name) { int num = 0; while (*name >= '0' && *name <= '9') { @@ -75,7 +77,8 @@ * mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs * that properly supports /dev/fd. */ -static int _is_fdescfs_mounted_on_dev_fd() +static int +_is_fdescfs_mounted_on_dev_fd() { struct stat dev_stat; struct stat dev_fd_stat; @@ -91,7 +94,8 @@ /* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ -static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) +static int +_sanity_check_python_fd_sequence(PyObject *fd_sequence) { Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); long prev_fd = -1; @@ -108,7 +112,8 @@ /* Is fd found in the sorted Python Sequence? */ -static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) +static int +_is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) { /* Binary search. */ Py_ssize_t search_min = 0; @@ -135,8 +140,8 @@ * range defined by [start_fd, end_fd) is large this will take a * long time as it calls close() on EVERY possible fd. */ -static void _close_fds_by_brute_force(int start_fd, int end_fd, - PyObject *py_fds_to_keep) +static void +_close_fds_by_brute_force(int start_fd, int end_fd, PyObject *py_fds_to_keep) { Py_ssize_t num_fds_to_keep = PySequence_Length(py_fds_to_keep); Py_ssize_t keep_seq_idx; @@ -191,8 +196,8 @@ * should be easy to add OS specific dirent or dirent64 structures and modify * it with some cpp #define magic to work on other OSes as well if you want. */ -static void _close_open_fd_range_safe(int start_fd, int end_fd, - PyObject* py_fds_to_keep) +static void +_close_open_fd_range_safe(int start_fd, int end_fd, PyObject* py_fds_to_keep) { int fd_dir_fd; if (start_fd >= end_fd) @@ -243,8 +248,9 @@ * implemented as readdir() followed by memcpy(). See also: * http://womble.decadent.org.uk/readdir_r-advisory.html */ -static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, - PyObject* py_fds_to_keep) +static void +_close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, + PyObject* py_fds_to_keep) { DIR *proc_fd_dir; #ifndef HAVE_DIRFD @@ -315,19 +321,20 @@ * This restriction is documented at * http://www.opengroup.org/onlinepubs/009695399/functions/fork.html. */ -static void child_exec(char *const exec_array[], - char *const argv[], - char *const envp[], - const char *cwd, - int p2cread, int p2cwrite, - int c2pread, int c2pwrite, - int errread, int errwrite, - int errpipe_read, int errpipe_write, - int close_fds, int restore_signals, - int call_setsid, - PyObject *py_fds_to_keep, - PyObject *preexec_fn, - PyObject *preexec_fn_args_tuple) +static void +child_exec(char *const exec_array[], + char *const argv[], + char *const envp[], + const char *cwd, + int p2cread, int p2cwrite, + int c2pread, int c2pwrite, + int errread, int errwrite, + int errpipe_read, int errpipe_write, + int close_fds, int restore_signals, + int call_setsid, + PyObject *py_fds_to_keep, + PyObject *preexec_fn, + PyObject *preexec_fn_args_tuple) { int i, saved_errno, unused; PyObject *result; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 15:07:22 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 24 Jan 2012 15:07:22 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/d90f943b0c92 changeset: 74592:d90f943b0c92 parent: 74580:f13af83967a0 parent: 74591:308f4af9548e user: Benjamin Peterson date: Sun Jan 22 20:04:58 2012 -0500 summary: merge 3.2 files: Modules/_posixsubprocess.c | 55 ++++++++++++++----------- 1 files changed, 31 insertions(+), 24 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -43,7 +43,8 @@ /* Given the gc module call gc.enable() and return 0 on success. */ -static int _enable_gc(PyObject *gc_module) +static int +_enable_gc(PyObject *gc_module) { PyObject *result; _Py_IDENTIFIER(enable); @@ -57,7 +58,8 @@ /* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */ -static int _pos_int_from_ascii(char *name) +static int +_pos_int_from_ascii(char *name) { int num = 0; while (*name >= '0' && *name <= '9') { @@ -77,7 +79,8 @@ * mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs * that properly supports /dev/fd. */ -static int _is_fdescfs_mounted_on_dev_fd() +static int +_is_fdescfs_mounted_on_dev_fd() { struct stat dev_stat; struct stat dev_fd_stat; @@ -93,7 +96,8 @@ /* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */ -static int _sanity_check_python_fd_sequence(PyObject *fd_sequence) +static int +_sanity_check_python_fd_sequence(PyObject *fd_sequence) { Py_ssize_t seq_idx, seq_len = PySequence_Length(fd_sequence); long prev_fd = -1; @@ -110,7 +114,8 @@ /* Is fd found in the sorted Python Sequence? */ -static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) +static int +_is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence) { /* Binary search. */ Py_ssize_t search_min = 0; @@ -137,8 +142,8 @@ * range defined by [start_fd, end_fd) is large this will take a * long time as it calls close() on EVERY possible fd. */ -static void _close_fds_by_brute_force(int start_fd, int end_fd, - PyObject *py_fds_to_keep) +static void +_close_fds_by_brute_force(int start_fd, int end_fd, PyObject *py_fds_to_keep) { Py_ssize_t num_fds_to_keep = PySequence_Length(py_fds_to_keep); Py_ssize_t keep_seq_idx; @@ -193,8 +198,8 @@ * should be easy to add OS specific dirent or dirent64 structures and modify * it with some cpp #define magic to work on other OSes as well if you want. */ -static void _close_open_fd_range_safe(int start_fd, int end_fd, - PyObject* py_fds_to_keep) +static void +_close_open_fd_range_safe(int start_fd, int end_fd, PyObject* py_fds_to_keep) { int fd_dir_fd; if (start_fd >= end_fd) @@ -245,8 +250,9 @@ * implemented as readdir() followed by memcpy(). See also: * http://womble.decadent.org.uk/readdir_r-advisory.html */ -static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, - PyObject* py_fds_to_keep) +static void +_close_open_fd_range_maybe_unsafe(int start_fd, int end_fd, + PyObject* py_fds_to_keep) { DIR *proc_fd_dir; #ifndef HAVE_DIRFD @@ -317,19 +323,20 @@ * This restriction is documented at * http://www.opengroup.org/onlinepubs/009695399/functions/fork.html. */ -static void child_exec(char *const exec_array[], - char *const argv[], - char *const envp[], - const char *cwd, - int p2cread, int p2cwrite, - int c2pread, int c2pwrite, - int errread, int errwrite, - int errpipe_read, int errpipe_write, - int close_fds, int restore_signals, - int call_setsid, - PyObject *py_fds_to_keep, - PyObject *preexec_fn, - PyObject *preexec_fn_args_tuple) +static void +child_exec(char *const exec_array[], + char *const argv[], + char *const envp[], + const char *cwd, + int p2cread, int p2cwrite, + int c2pread, int c2pwrite, + int errread, int errwrite, + int errpipe_read, int errpipe_write, + int close_fds, int restore_signals, + int call_setsid, + PyObject *py_fds_to_keep, + PyObject *preexec_fn, + PyObject *preexec_fn_args_tuple) { int i, saved_errno, unused; PyObject *result; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 15:07:23 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 24 Jan 2012 15:07:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/38c066ca4966 changeset: 74593:38c066ca4966 parent: 74592:d90f943b0c92 parent: 74590:a7406565ef1c user: Benjamin Peterson date: Tue Jan 24 09:06:45 2012 -0500 summary: merge heads files: Doc/library/functools.rst | 2 +- Doc/library/os.rst | 9 ++----- Doc/library/stdtypes.rst | 2 +- Doc/library/time.rst | 27 +++++++++++++------------ Lib/test/test_os.py | 9 ++++++- Lib/test/test_time.py | 2 +- Misc/NEWS | 4 +++ Modules/posixmodule.c | 11 ---------- Python/formatter_unicode.c | 10 ++++---- 9 files changed, 36 insertions(+), 40 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -20,7 +20,7 @@ .. function:: cmp_to_key(func) - Transform an old-style comparison function to a key-function. Used with + Transform an old-style comparison function to a key function. Used with tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2085,11 +2085,9 @@ *target_is_directory*, which defaults to ``False``. On Windows, a symlink represents a file or a directory, and does not morph to - the target dynamically. For this reason, when creating a symlink on Windows, - if the target is not already present, the symlink will default to being a - file symlink. If *target_is_directory* is set to ``True``, the symlink will - be created as a directory symlink. This parameter is ignored if the target - exists (and the symlink is created with the same type as the target). + the target dynamically. If *target_is_directory* is set to ``True``, the + symlink will be created as a directory symlink, otherwise as a file symlink + (the default). Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink` will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0. @@ -2102,7 +2100,6 @@ administrator level. Either obtaining the privilege or running your application as an administrator are ways to successfully create symlinks. - :exc:`OSError` is raised when the function is called by an unprivileged user. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -877,7 +877,7 @@ | ``s * n, n * s`` | *n* shallow copies of *s* | \(2) | | | concatenated | | +------------------+--------------------------------+----------+ -| ``s[i]`` | *i*'th item of *s*, origin 0 | \(3) | +| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) | +------------------+--------------------------------+----------+ | ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) | +------------------+--------------------------------+----------+ diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -183,19 +183,6 @@ .. versionadded:: 3.3 -.. function:: wallclock() - - .. index:: - single: Wallclock - single: benchmarking - - Return the current time in fractions of a second to the system's best ability. - Use this when the most accurate representation of wall-clock is required, i.e. - when "processor time" is inappropriate. The reference point of the returned - value is undefined so only the difference of consecutive calls is valid. - - .. versionadded: 3.3 - .. function:: ctime([secs]) Convert a time expressed in seconds since the epoch to a string representing @@ -550,6 +537,20 @@ ('EET', 'EEST') +.. function:: wallclock() + + .. index:: + single: Wallclock + single: benchmarking + + Return the current time in fractions of a second to the system's best ability. + Use this when the most accurate representation of wall-clock is required, i.e. + when "processor time" is inappropriate. The reference point of the returned + value is undefined so only the difference of consecutive calls is valid. + + .. versionadded: 3.3 + + .. seealso:: Module :mod:`datetime` diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -500,7 +500,12 @@ f.write("I'm " + path + " and proud of it. Blame test_os.\n") f.close() if support.can_symlink(): - os.symlink(os.path.abspath(t2_path), link_path) + if os.name == 'nt': + def symlink_to_dir(src, dest): + os.symlink(src, dest, True) + else: + symlink_to_dir = os.symlink + symlink_to_dir(os.path.abspath(t2_path), link_path) sub2_tree = (sub2_path, ["link"], ["tmp3"]) else: sub2_tree = (sub2_path, [], ["tmp3"]) @@ -1131,7 +1136,7 @@ os.remove(self.missing_link) def test_directory_link(self): - os.symlink(self.dirlink_target, self.dirlink) + os.symlink(self.dirlink_target, self.dirlink, True) self.assertTrue(os.path.exists(self.dirlink)) self.assertTrue(os.path.isdir(self.dirlink)) self.assertTrue(os.path.islink(self.dirlink)) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -334,7 +334,7 @@ def test_wallclock(self): t1 = time.wallclock() t2 = time.wallclock() - self.assertGreater(t2, t1) + self.assertGreaterEqual(t2, t1) t1 = time.wallclock() time.sleep(0.1) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -458,6 +458,10 @@ Library ------- +- Issue #13772: In os.symlink() under Windows, do not try to guess the link + target's type (file or directory). The detection was buggy and made the + call non-atomic (therefore prone to race conditions). + - Issue #6631: Disallow relative file paths in urllib urlopen methods. - Issue #13722: Avoid silencing ImportErrors when initializing the codecs diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6551,7 +6551,6 @@ wchar_t *wsrc, *wdest; int target_is_directory = 0; DWORD res; - WIN32_FILE_ATTRIBUTE_DATA src_info; if (!check_CreateSymbolicLinkW()) { @@ -6581,16 +6580,6 @@ if (wsrc == NULL) goto error; - /* if src is a directory, ensure target_is_directory==1 */ - if( - GetFileAttributesExW( - wsrc, GetFileExInfoStandard, &src_info - )) - { - target_is_directory = target_is_directory || - (src_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); - } - Py_BEGIN_ALLOW_THREADS res = Py_CreateSymbolicLinkW(wdest, wsrc, target_is_directory); Py_END_ALLOW_THREADS diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c --- a/Python/formatter_unicode.c +++ b/Python/formatter_unicode.c @@ -682,7 +682,7 @@ Py_ssize_t pos; Py_ssize_t len = PyUnicode_GET_LENGTH(value); PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; /* sign is not allowed on strings */ if (format->sign != '\0') { @@ -749,7 +749,7 @@ IntOrLongToString tostring) { PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; PyObject *tmp = NULL; Py_ssize_t inumeric_chars; Py_UCS4 sign_char = '\0'; @@ -798,7 +798,7 @@ tmp = PyUnicode_FromOrdinal(x); inumeric_chars = 0; n_digits = 1; - maxchar = Py_MAX(maxchar, x); + maxchar = Py_MAX(maxchar, (Py_UCS4)x); /* As a sort-of hack, we tell calc_number_widths that we only have "remainder" characters. calc_number_widths thinks @@ -926,7 +926,7 @@ NumberFieldWidths spec; int flags = 0; PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; Py_UCS4 sign_char = '\0'; int float_type; /* Used to see if we have a nan, inf, or regular float. */ PyObject *unicode_tmp = NULL; @@ -1070,7 +1070,7 @@ NumberFieldWidths im_spec; int flags = 0; PyObject *result = NULL; - int maxchar = 127; + Py_UCS4 maxchar = 127; int rkind; void *rdata; Py_ssize_t index; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 15:07:24 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 24 Jan 2012 15:07:24 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/f7d3a754bc02 changeset: 74594:f7d3a754bc02 branch: 3.2 parent: 74591:308f4af9548e parent: 74589:839fa289e226 user: Benjamin Peterson date: Tue Jan 24 09:07:06 2012 -0500 summary: merge heads files: Doc/library/functools.rst | 2 +- Doc/library/os.rst | 9 +++------ Doc/library/stdtypes.rst | 2 +- Lib/test/test_os.py | 9 +++++++-- Misc/NEWS | 4 ++++ Modules/posixmodule.c | 11 ----------- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -20,7 +20,7 @@ .. function:: cmp_to_key(func) - Transform an old-style comparison function to a key-function. Used with + Transform an old-style comparison function to a key function. Used with tools that accept key functions (such as :func:`sorted`, :func:`min`, :func:`max`, :func:`heapq.nlargest`, :func:`heapq.nsmallest`, :func:`itertools.groupby`). This function is primarily used as a transition diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1429,11 +1429,9 @@ *target_is_directory*, which defaults to ``False``. On Windows, a symlink represents a file or a directory, and does not morph to - the target dynamically. For this reason, when creating a symlink on Windows, - if the target is not already present, the symlink will default to being a - file symlink. If *target_is_directory* is set to ``True``, the symlink will - be created as a directory symlink. This parameter is ignored if the target - exists (and the symlink is created with the same type as the target). + the target dynamically. If *target_is_directory* is set to ``True``, the + symlink will be created as a directory symlink, otherwise as a file symlink + (the default). Symbolic link support was introduced in Windows 6.0 (Vista). :func:`symlink` will raise a :exc:`NotImplementedError` on Windows versions earlier than 6.0. @@ -1446,7 +1444,6 @@ administrator level. Either obtaining the privilege or running your application as an administrator are ways to successfully create symlinks. - :exc:`OSError` is raised when the function is called by an unprivileged user. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -873,7 +873,7 @@ | ``s * n, n * s`` | *n* shallow copies of *s* | \(2) | | | concatenated | | +------------------+--------------------------------+----------+ -| ``s[i]`` | *i*'th item of *s*, origin 0 | \(3) | +| ``s[i]`` | *i*\ th item of *s*, origin 0 | \(3) | +------------------+--------------------------------+----------+ | ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) | +------------------+--------------------------------+----------+ diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -476,7 +476,12 @@ f.write("I'm " + path + " and proud of it. Blame test_os.\n") f.close() if support.can_symlink(): - os.symlink(os.path.abspath(t2_path), link_path) + if os.name == 'nt': + def symlink_to_dir(src, dest): + os.symlink(src, dest, True) + else: + symlink_to_dir = os.symlink + symlink_to_dir(os.path.abspath(t2_path), link_path) sub2_tree = (sub2_path, ["link"], ["tmp3"]) else: sub2_tree = (sub2_path, [], ["tmp3"]) @@ -1106,7 +1111,7 @@ os.remove(self.missing_link) def test_directory_link(self): - os.symlink(self.dirlink_target, self.dirlink) + os.symlink(self.dirlink_target, self.dirlink, True) self.assertTrue(os.path.exists(self.dirlink)) self.assertTrue(os.path.isdir(self.dirlink)) self.assertTrue(os.path.islink(self.dirlink)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -108,6 +108,10 @@ Library ------- +- Issue #13772: In os.symlink() under Windows, do not try to guess the link + target's type (file or directory). The detection was buggy and made the + call non-atomic (therefore prone to race conditions). + - Issue #6631: Disallow relative file paths in urllib urlopen methods. - Issue #13722: Avoid silencing ImportErrors when initializing the codecs diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5330,7 +5330,6 @@ PyObject *src, *dest; int target_is_directory = 0; DWORD res; - WIN32_FILE_ATTRIBUTE_DATA src_info; if (!check_CreateSymbolicLinkW()) { @@ -5351,16 +5350,6 @@ return NULL; } - /* if src is a directory, ensure target_is_directory==1 */ - if( - GetFileAttributesExW( - PyUnicode_AsUnicode(src), GetFileExInfoStandard, &src_info - )) - { - target_is_directory = target_is_directory || - (src_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); - } - Py_BEGIN_ALLOW_THREADS res = Py_CreateSymbolicLinkW( PyUnicode_AsUnicode(dest), -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 15:07:24 2012 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 24 Jan 2012 15:07:24 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/75a3d35309cf changeset: 74595:75a3d35309cf parent: 74593:38c066ca4966 parent: 74594:f7d3a754bc02 user: Benjamin Peterson date: Tue Jan 24 09:07:15 2012 -0500 summary: merge 3.2 files: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 17:54:33 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 24 Jan 2012 17:54:33 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzExMjM1?= =?utf8?q?=3A_Fix_OverflowError_when_trying_to_import_a_source_file_whose?= Message-ID: http://hg.python.org/cpython/rev/a2f3d6986bfa changeset: 74596:a2f3d6986bfa branch: 3.2 parent: 74594:f7d3a754bc02 user: Antoine Pitrou date: Tue Jan 24 17:44:06 2012 +0100 summary: Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. files: Lib/importlib/test/source/test_file_loader.py | 17 ++++++++++ Lib/test/test_import.py | 12 +++++++ Misc/NEWS | 3 + Python/import.c | 11 ++---- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -128,6 +128,23 @@ pycache = os.path.dirname(imp.cache_from_source(file_path)) shutil.rmtree(pycache) + def test_timestamp_overflow(self): + # When a modification timestamp is larger than 2**32, it should be + # truncated rather than raise an OverflowError. + with source_util.create_modules('_temp') as mapping: + source = mapping['_temp'] + compiled = imp.cache_from_source(source) + with open(source, 'w') as f: + f.write("x = 5") + os.utime(source, (2 ** 33, 2 ** 33)) + loader = _bootstrap._SourceFileLoader('_temp', mapping['_temp']) + mod = loader.load_module('_temp') + # Sanity checks. + self.assertEqual(mod.__cached__, compiled) + self.assertEqual(mod.x, 5) + # The pyc file was created. + os.stat(compiled) + class BadBytecodeTest(unittest.TestCase): diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -310,6 +310,18 @@ """)) script_helper.assert_python_ok(testfn) + def test_timestamp_overflow(self): + # A modification timestamp larger than 2**32 should not be a problem + # when importing a module (issue #11235). + source = TESTFN + ".py" + compiled = imp.cache_from_source(source) + with open(source, 'w') as f: + pass + os.utime(source, (2 ** 33, 2 ** 33)) + __import__(TESTFN) + # The pyc file was created. + os.stat(compiled) + class PycRewritingTests(unittest.TestCase): # Test that the `co_filename` attribute on code objects always points diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #11235: Fix OverflowError when trying to import a source file whose + modification time doesn't fit in a 32-bit timestamp. + - Fix the builtin module initialization code to store the init function for future reinitialization. diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -1304,14 +1304,11 @@ } #if SIZEOF_TIME_T > 4 /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. This will be fine until sometime in the year 2038, - when a 4-byte signed time_t will overflow. + in 4 bytes. Since the code only does an equality comparison, + ordering is not important and we can safely ignore the higher bits + (collisions are extremely unlikely). */ - if (st.st_mtime >> 32) { - PyErr_SetString(PyExc_OverflowError, - "modification time overflows a 4 byte field"); - return NULL; - } + st.st_mtime &= 0xFFFFFFFF; #endif cpathname = make_compiled_pathname( pathname, buf, (size_t)MAXPATHLEN + 1, !Py_OptimizeFlag); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 17:54:34 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 24 Jan 2012 17:54:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2311235=3A_Fix_OverflowError_when_trying_to_import_a_?= =?utf8?q?source_file_whose?= Message-ID: http://hg.python.org/cpython/rev/cb13d8cff050 changeset: 74597:cb13d8cff050 parent: 74595:75a3d35309cf parent: 74596:a2f3d6986bfa user: Antoine Pitrou date: Tue Jan 24 17:45:50 2012 +0100 summary: Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. files: Lib/importlib/test/source/test_file_loader.py | 17 ++++++++++ Lib/test/test_import.py | 12 +++++++ Misc/NEWS | 3 + Python/import.c | 11 ++---- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -123,6 +123,23 @@ pycache = os.path.dirname(imp.cache_from_source(file_path)) shutil.rmtree(pycache) + def test_timestamp_overflow(self): + # When a modification timestamp is larger than 2**32, it should be + # truncated rather than raise an OverflowError. + with source_util.create_modules('_temp') as mapping: + source = mapping['_temp'] + compiled = imp.cache_from_source(source) + with open(source, 'w') as f: + f.write("x = 5") + os.utime(source, (2 ** 33, 2 ** 33)) + loader = _bootstrap._SourceFileLoader('_temp', mapping['_temp']) + mod = loader.load_module('_temp') + # Sanity checks. + self.assertEqual(mod.__cached__, compiled) + self.assertEqual(mod.x, 5) + # The pyc file was created. + os.stat(compiled) + class BadBytecodeTest(unittest.TestCase): diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -306,6 +306,18 @@ """)) script_helper.assert_python_ok(testfn) + def test_timestamp_overflow(self): + # A modification timestamp larger than 2**32 should not be a problem + # when importing a module (issue #11235). + source = TESTFN + ".py" + compiled = imp.cache_from_source(source) + with open(source, 'w') as f: + pass + os.utime(source, (2 ** 33, 2 ** 33)) + __import__(TESTFN) + # The pyc file was created. + os.stat(compiled) + class PycRewritingTests(unittest.TestCase): # Test that the `co_filename` attribute on code objects always points diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #11235: Fix OverflowError when trying to import a source file whose + modification time doesn't fit in a 32-bit timestamp. + - Issue #12705: A SyntaxError exception is now raised when attempting to compile multiple statements as a single interactive statement. diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -1478,14 +1478,11 @@ } #if SIZEOF_TIME_T > 4 /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. This will be fine until sometime in the year 2038, - when a 4-byte signed time_t will overflow. + in 4 bytes. Since the code only does an equality comparison, + ordering is not important and we can safely ignore the higher bits + (collisions are extremely unlikely). */ - if (st.st_mtime >> 32) { - PyErr_SetString(PyExc_OverflowError, - "modification time overflows a 4 byte field"); - goto error; - } + st.st_mtime &= 0xFFFFFFFF; #endif if (PyUnicode_READY(pathname) < 0) return NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 17:54:36 2012 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 24 Jan 2012 17:54:36 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExMjM1?= =?utf8?q?=3A_Fix_OverflowError_when_trying_to_import_a_source_file_whose?= Message-ID: http://hg.python.org/cpython/rev/0499eed74126 changeset: 74598:0499eed74126 branch: 2.7 parent: 74584:f4f9ab2fd51b user: Antoine Pitrou date: Tue Jan 24 17:44:06 2012 +0100 summary: Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. files: Lib/test/test_import.py | 13 +++++++++++++ Misc/NEWS | 3 +++ Python/import.c | 11 ++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -277,6 +277,19 @@ finally: os.rmdir(source) + def test_timestamp_overflow(self): + # A modification timestamp larger than 2**32 should not be a problem + # when importing a module (issue #11235). + source = TESTFN + ".py" + self.addCleanup(remove_files, TESTFN) + compiled = source + ('c' if __debug__ else 'o') + with open(source, 'w') as f: + pass + os.utime(source, (2 ** 33, 2 ** 33)) + __import__(TESTFN) + # The pyc file was created. + os.stat(compiled) + class PycRewritingTests(unittest.TestCase): # Test that the `co_filename` attribute on code objects always points diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,9 @@ Core and Builtins ----------------- +- Issue #11235: Fix OverflowError when trying to import a source file whose + modification time doesn't fit in a 32-bit timestamp. + - Issue #11638: Unicode strings in 'name' and 'version' no longer cause UnicodeDecodeErrors. diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -981,14 +981,11 @@ } #if SIZEOF_TIME_T > 4 /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. This will be fine until sometime in the year 2038, - when a 4-byte signed time_t will overflow. + in 4 bytes. Since the code only does an equality comparison, + ordering is not important and we can safely ignore the higher bits + (collisions are extremely unlikely). */ - if (st.st_mtime >> 32) { - PyErr_SetString(PyExc_OverflowError, - "modification time overflows a 4 byte field"); - return NULL; - } + st.st_mtime &= 0xFFFFFFFF; #endif cpathname = make_compiled_pathname(pathname, buf, (size_t)MAXPATHLEN + 1); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 24 18:58:05 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 18:58:05 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Mention_Tools/scripts/run?= =?utf8?q?=5Ftests=2Epy=2E?= Message-ID: http://hg.python.org/devguide/rev/bc071f69b30b changeset: 488:bc071f69b30b user: Brett Cannon date: Tue Jan 24 12:57:43 2012 -0500 summary: Mention Tools/scripts/run_tests.py. files: runtests.rst | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/runtests.rst b/runtests.rst --- a/runtests.rst +++ b/runtests.rst @@ -52,16 +52,20 @@ The various extra flags passed to Python cause it to be much stricter about various things (the ``-Wd`` flag should be ``-W error`` at some point, but the -test -suite has not reached a point where all warnings have been dealt with and so we -cannot guarantee that a bug-free Python will properly complete a test run with -``-W error``). The ``-r`` flag to the test runner causes it to run tests in a -more random order which helps to check that the various tests do not interfere +test suite has not reached a point where all warnings have been dealt with and +so we cannot guarantee that a bug-free Python will properly complete a test run +with ``-W error``). The ``-r`` flag to the test runner causes it to run tests in +a more random order which helps to check that the various tests do not interfere with each other. The ``-w`` flag causes failing tests to be run again to see if the failures are transient or consistent. The ``-uall`` flag allows the use of all available resources so as to not skip tests requiring, e.g., Internet access. +You can also execute the ``Tools/scripts/run_tests.py`` script as found in a +CPython checkout. The script tries to balance speed with thoroughness. But if +you want the most thorough tests you should use the stenuous approach shown +above. + Writing ------- -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 24 18:58:08 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 18:58:08 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Use_-j0_to_maximimze_paral?= =?utf8?q?lel_execution=2E?= Message-ID: http://hg.python.org/devguide/rev/a34e4a6b89dc changeset: 489:a34e4a6b89dc user: Brett Cannon date: Tue Jan 24 12:58:01 2012 -0500 summary: Use -j0 to maximimze parallel execution. files: runtests.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/runtests.rst b/runtests.rst --- a/runtests.rst +++ b/runtests.rst @@ -41,7 +41,7 @@ If you have a multi-core or multi-CPU machine, you can enable parallel testing using several Python processes so as to speed up things:: - ./python -m test -j2 + ./python -m test -j0 .. _strenuous_testing: -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 24 19:59:07 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 19:59:07 +0100 Subject: [Python-checkins] =?utf8?q?devinabox=3A_Various_fixes_to_make_dev?= =?utf8?q?inabox_run_again=2E?= Message-ID: http://hg.python.org/devinabox/rev/4cec355506f9 changeset: 37:4cec355506f9 user: Brett Cannon date: Tue Jan 24 13:58:22 2012 -0500 summary: Various fixes to make devinabox run again. files: make_a_box.py | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/make_a_box.py b/make_a_box.py --- a/make_a_box.py +++ b/make_a_box.py @@ -82,9 +82,14 @@ """Location of the repository.""" raise NotImplementedError + @property + def directory(self): + return os.path.basename(self.url) + def create(self): """Clone an Hg repository to 'directory'.""" - subprocess.check_call(['hg', 'clone', self.url, self.directory]) + cmd = ['hg', 'clone', self.url] + subprocess.check_call(cmd) class SvnProvider(Provider): @@ -130,7 +135,6 @@ """Clone of coverage.py (WARNING: building takes a while)""" url = 'https://brettsky at bitbucket.org/ned/coveragepy' - directory = 'coveragepy' size = 133 # Includes the coverage report docs = os.path.join('coverage_report', 'index.html') @@ -144,7 +148,7 @@ print('No CPython executable found') sys.exit(1) print('Running coverage ...') - regrtest_path = os.path.join(CPython.directory, 'Lib', 'test', + regrtest_path = os.path.join('cpython', 'Lib', 'test', 'regrtest.py') try: subprocess.check_call([executable, self.directory, 'run', '--pylib', @@ -158,7 +162,7 @@ '"*/test/*,*/tests/*"', '-d', 'coverage_report']) # ``make distclean`` as you don't want to distribute your own build print('Cleaning up the CPython build ...') - with change_cwd(CPython.directory): + with change_cwd('cpython'): subprocess.check_call(['make', 'distclean']) @@ -216,14 +220,13 @@ self._create_tortoisehg() -class PEPs(SvnProvider): +class PEPs(HgProvider): """Checkout of the Python Enhancement Proposals (for PEPs 7 & 8)""" - url = 'http://svn.python.org/projects/peps/trunk/' - directory = 'peps' + url = 'http://hg.python.org/peps' size = 20 - docs = os.path.join(directory, 'pep-0000.html') + docs = os.path.join('peps', 'pep-0000.html') def build(self): """Build the PEPs.""" @@ -238,18 +241,21 @@ size = 4 url = 'http://hg.python.org/devguide' - directory = 'devguide' - docs = os.path.join(directory, '_build', 'html', 'index.html') + docs = os.path.join('devguide', '_build', 'html', 'index.html') def build(self): """Build the devguide using Sphinx from CPython's docs.""" # Grab Sphinx from cpython/Doc/tools/ - tools_directory = os.path.join(CPython.directory, 'Doc', 'tools') + tools_directory = os.path.join('cpython', 'Doc', 'tools') + sphinx_build_path = os.path.abspath(os.path.join(tools_directory, 'sphinx-build.py')) orig_pythonpath = os.environ.get('PYTHONPATH') os.environ['PYTHONPATH'] = os.path.abspath(tools_directory) + sphinxbuild_env = "SPHINXBUILD='python {}'".format(sphinx_build_path) try: with change_cwd(self.directory): - subprocess.check_call(['make', 'html']) + subprocess.check_call(' '.join(['make', 'html', + sphinxbuild_env]), + shell=True) finally: if orig_pythonpath: os.environ['PYTHONPATH'] = orig_pythonpath @@ -262,9 +268,8 @@ """Clone of CPython (and requisite tools to build the documentation)""" url = 'http://hg.python.org/cpython' - directory = 'cpython' size = 330 # Only docs are built - docs = os.path.join(directory, 'Doc', 'build', 'html', 'index.html') + docs = os.path.join('cpython', 'Doc', 'build', 'html', 'index.html') def create(self): """Clone CPython and get the necessary tools to build the @@ -291,7 +296,7 @@ all_providers = (CPython, Devguide, PEPs, CoveragePy, Mercurial, VisualCPPExpress) print(__doc__) - print('Please choose what to provide [y/n]:\n') + print('Please choose what to provide [answer y/n]:\n') desired_providers = [] for provider in all_providers: docstring = provider.__doc__#.replace('\n', ' ') -- Repository URL: http://hg.python.org/devinabox From python-checkins at python.org Tue Jan 24 20:01:59 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 20:01:59 +0100 Subject: [Python-checkins] =?utf8?q?devinabox=3A_People_should_be_reading_?= =?utf8?q?the_dev_guid_and_using_Tools/scripts/run=5Ftests=2Epy=2E?= Message-ID: http://hg.python.org/devinabox/rev/bbd2884126cc changeset: 38:bbd2884126cc user: Brett Cannon date: Tue Jan 24 14:00:05 2012 -0500 summary: People should be reading the dev guid and using Tools/scripts/run_tests.py. files: run_all_tests.py | 24 ------------------------ 1 files changed, 0 insertions(+), 24 deletions(-) diff --git a/run_all_tests.py b/run_all_tests.py deleted file mode 100755 --- a/run_all_tests.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -"""Run CPython's test suite in the most rigorous way possible.""" -import multiprocessing -import shutil -import subprocess -import sys -import build_cpython - - -def main(): - cmd = build_cpython.main() - if cmd is None: - print('CPython is not built') - sys.exit(1) - try: - subprocess.call([cmd, '-W', 'default', '-bb', '-E', '-m', 'test', '-r', - '-w', '-u', 'all', '-j', - str(multiprocessing.cpu_count())]) - finally: - shutil.rmtree('build') - - -if __name__ == '__main__': - main() -- Repository URL: http://hg.python.org/devinabox From python-checkins at python.org Tue Jan 24 20:01:59 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 20:01:59 +0100 Subject: [Python-checkins] =?utf8?q?devinabox=3A_Install_to_/tmp/cpython_s?= =?utf8?q?o_people_can_test_installation_issues=2E?= Message-ID: http://hg.python.org/devinabox/rev/d3bc278f0471 changeset: 39:d3bc278f0471 user: Brett Cannon date: Tue Jan 24 14:01:54 2012 -0500 summary: Install to /tmp/cpython so people can test installation issues. files: build_cpython.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/build_cpython.py b/build_cpython.py --- a/build_cpython.py +++ b/build_cpython.py @@ -36,7 +36,7 @@ if os.path.isfile('Makefile'): print('Makefile already exists; skipping ./configure') else: - subprocess.check_call(['./configure', '--prefix=/dev/null', + subprocess.check_call(['./configure', '--prefix=/tmp/cpython', '--with-pydebug']) make_cmd = ['make', '-s', '-j', str(multiprocessing.cpu_count())] subprocess.call(make_cmd) -- Repository URL: http://hg.python.org/devinabox From python-checkins at python.org Tue Jan 24 20:04:58 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 20:04:58 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Add_a_note_that_-j0_is_a_3?= =?utf8?q?=2E3_feature=2E?= Message-ID: http://hg.python.org/devguide/rev/051873f59622 changeset: 490:051873f59622 user: Brett Cannon date: Tue Jan 24 14:04:54 2012 -0500 summary: Add a note that -j0 is a 3.3 feature. files: runtests.rst | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/runtests.rst b/runtests.rst --- a/runtests.rst +++ b/runtests.rst @@ -43,6 +43,9 @@ ./python -m test -j0 +If you are running a version of Python prior to 3.3 you must specify the number +of processes to run simultaneously (e.g. ``-j2``). + .. _strenuous_testing: Finally, if you want to run tests under a more strenuous set of settings, you -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Tue Jan 24 20:46:08 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 24 Jan 2012 20:46:08 +0100 Subject: [Python-checkins] =?utf8?q?devinabox=3A_Clean_up_arguments_for_bu?= =?utf8?q?ilding_the_devguide=2E?= Message-ID: http://hg.python.org/devinabox/rev/f890f17df293 changeset: 40:f890f17df293 user: Brett Cannon date: Tue Jan 24 14:46:03 2012 -0500 summary: Clean up arguments for building the devguide. files: make_a_box.py | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/make_a_box.py b/make_a_box.py --- a/make_a_box.py +++ b/make_a_box.py @@ -247,18 +247,20 @@ """Build the devguide using Sphinx from CPython's docs.""" # Grab Sphinx from cpython/Doc/tools/ tools_directory = os.path.join('cpython', 'Doc', 'tools') - sphinx_build_path = os.path.abspath(os.path.join(tools_directory, 'sphinx-build.py')) + sphinx_build_path = os.path.join(tools_directory, 'sphinx-build.py') + sphinx_build_path = os.path.abspath(sphinx_build_path) orig_pythonpath = os.environ.get('PYTHONPATH') os.environ['PYTHONPATH'] = os.path.abspath(tools_directory) - sphinxbuild_env = "SPHINXBUILD='python {}'".format(sphinx_build_path) + orig_sphinxbuild = os.environ.get('SPHINXBUILD') + os.environ['SPHINXBUILD'] = 'python {}'.format(sphinx_build_path) try: with change_cwd(self.directory): - subprocess.check_call(' '.join(['make', 'html', - sphinxbuild_env]), - shell=True) + subprocess.check_call(['make', 'html']) finally: if orig_pythonpath: os.environ['PYTHONPATH'] = orig_pythonpath + if orig_sphinxbuild: + os.environ['SPHINXBUILD'] = orig_sphinxbuild index_path = os.path.join(self.directory, '_build', 'html', 'index.html') -- Repository URL: http://hg.python.org/devinabox From python-checkins at python.org Tue Jan 24 21:05:54 2012 From: python-checkins at python.org (florent.xicluna) Date: Tue, 24 Jan 2012 21:05:54 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyNTAx?= =?utf8?q?=3A_merge_the_discordant_NEWS_entries=2E?= Message-ID: http://hg.python.org/cpython/rev/62bd0553693f changeset: 74599:62bd0553693f branch: 2.7 user: Florent Xicluna date: Tue Jan 24 21:05:10 2012 +0100 summary: Issue #12501: merge the discordant NEWS entries. files: Misc/NEWS | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -25,8 +25,6 @@ - Issue #13333: The UTF-7 decoder now accepts lone surrogates (the encoder already accepts them). -- Remove Py3k warning for callable. - - Issue #10519: Avoid unnecessary recursive function calls in setobject.c. @@ -73,8 +71,8 @@ deallocator calls one of the methods on the type (e.g. when subclassing IOBase). Diagnosis and patch by Davide Rizzo. -- Issue #12501: Adjust callable() warning: callable() is only not supported in - Python 3.1. callable() is again supported in Python 3.2. +- Issue #12501: Remove Py3k warning for callable. callable() is supported + again in Python 3.2. - Issue #9611, #9015: FileIO.read(), FileIO.readinto(), FileIO.write() and os.write() clamp the length to INT_MAX on Windows. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 01:37:40 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 01:37:40 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Make_test_work_?= =?utf8?q?under_32-bit_systems=2C_and_when_invoked_through?= Message-ID: http://hg.python.org/cpython/rev/5f7ad3c26677 changeset: 74600:5f7ad3c26677 branch: 2.7 user: Antoine Pitrou date: Wed Jan 25 01:35:26 2012 +0100 summary: Make test work under 32-bit systems, and when invoked through Lib/test/regrtest.py (rather than `-m test.regrtest`) files: Lib/test/test_import.py | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -280,15 +280,22 @@ def test_timestamp_overflow(self): # A modification timestamp larger than 2**32 should not be a problem # when importing a module (issue #11235). - source = TESTFN + ".py" - self.addCleanup(remove_files, TESTFN) - compiled = source + ('c' if __debug__ else 'o') - with open(source, 'w') as f: - pass - os.utime(source, (2 ** 33, 2 ** 33)) - __import__(TESTFN) - # The pyc file was created. - os.stat(compiled) + sys.path.insert(0, os.curdir) + try: + source = TESTFN + ".py" + compiled = source + ('c' if __debug__ else 'o') + with open(source, 'w') as f: + pass + try: + os.utime(source, (2 ** 33, 2 ** 33)) + except OverflowError: + self.skipTest("cannot set modification time to large integer") + __import__(TESTFN) + # The pyc file was created. + os.stat(compiled) + finally: + del sys.path[0] + remove_files(TESTFN) class PycRewritingTests(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 02:51:55 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 02:51:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Skip_test_failu?= =?utf8?q?re_under_OpenIndiana?= Message-ID: http://hg.python.org/cpython/rev/dd1b4fc2d736 changeset: 74601:dd1b4fc2d736 branch: 2.7 user: Antoine Pitrou date: Wed Jan 25 02:49:47 2012 +0100 summary: Skip test failure under OpenIndiana files: Lib/test/test_import.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -1,3 +1,4 @@ +import errno import imp import marshal import os @@ -290,6 +291,10 @@ os.utime(source, (2 ** 33, 2 ** 33)) except OverflowError: self.skipTest("cannot set modification time to large integer") + except OSError as e: + if e.errno != getattr(errno, 'EOVERFLOW', None): + raise + self.skipTest("cannot set modification time to large integer ({})".format(e)) __import__(TESTFN) # The pyc file was created. os.stat(compiled) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 03:03:42 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 03:03:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Make_test_work_?= =?utf8?q?under_32-bit_systems=2C_and_when_invoked_through?= Message-ID: http://hg.python.org/cpython/rev/365d0e387179 changeset: 74602:365d0e387179 branch: 3.2 parent: 74596:a2f3d6986bfa user: Antoine Pitrou date: Wed Jan 25 01:35:26 2012 +0100 summary: Make test work under 32-bit systems, and when invoked through Lib/test/regrtest.py (rather than `-m test.regrtest`) files: Lib/test/test_import.py | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -313,14 +313,22 @@ def test_timestamp_overflow(self): # A modification timestamp larger than 2**32 should not be a problem # when importing a module (issue #11235). - source = TESTFN + ".py" - compiled = imp.cache_from_source(source) - with open(source, 'w') as f: - pass - os.utime(source, (2 ** 33, 2 ** 33)) - __import__(TESTFN) - # The pyc file was created. - os.stat(compiled) + sys.path.insert(0, os.curdir) + try: + source = TESTFN + ".py" + compiled = imp.cache_from_source(source) + with open(source, 'w') as f: + pass + try: + os.utime(source, (2 ** 33, 2 ** 33)) + except OverflowError: + self.skipTest("cannot set modification time to large integer") + __import__(TESTFN) + # The pyc file was created. + os.stat(compiled) + finally: + del sys.path[0] + remove_files(TESTFN) class PycRewritingTests(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 03:03:43 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 03:03:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Port_remaining_?= =?utf8?q?test_fixes=2C_and_fix_test=5Fimportlib_too=2E?= Message-ID: http://hg.python.org/cpython/rev/37ac757a9145 changeset: 74603:37ac757a9145 branch: 3.2 user: Antoine Pitrou date: Wed Jan 25 03:00:57 2012 +0100 summary: Port remaining test fixes, and fix test_importlib too. files: Lib/importlib/test/source/test_file_loader.py | 10 +++++++++- Lib/test/test_import.py | 5 +++++ 2 files changed, 14 insertions(+), 1 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -4,6 +4,7 @@ from .. import util from . import util as source_util +import errno import imp import marshal import os @@ -136,7 +137,14 @@ compiled = imp.cache_from_source(source) with open(source, 'w') as f: f.write("x = 5") - os.utime(source, (2 ** 33, 2 ** 33)) + try: + os.utime(source, (2 ** 33, 2 ** 33)) + except OverflowError: + self.skipTest("cannot set modification time to large integer") + except OSError as e: + if e.errno != getattr(errno, 'EOVERFLOW', None): + raise + self.skipTest("cannot set modification time to large integer ({})".format(e)) loader = _bootstrap._SourceFileLoader('_temp', mapping['_temp']) mod = loader.load_module('_temp') # Sanity checks. diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -11,6 +11,7 @@ import sys import unittest import textwrap +import errno from test.support import ( EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython, @@ -323,6 +324,10 @@ os.utime(source, (2 ** 33, 2 ** 33)) except OverflowError: self.skipTest("cannot set modification time to large integer") + except OSError as e: + if e.errno != getattr(errno, 'EOVERFLOW', None): + raise + self.skipTest("cannot set modification time to large integer ({})".format(e)) __import__(TESTFN) # The pyc file was created. os.stat(compiled) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 03:03:44 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 03:03:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Port_remaining_test_fixes=2C_and_fix_test=5Fimportlib_too=2E?= Message-ID: http://hg.python.org/cpython/rev/454d1c52f3e0 changeset: 74604:454d1c52f3e0 parent: 74597:cb13d8cff050 parent: 74603:37ac757a9145 user: Antoine Pitrou date: Wed Jan 25 03:01:34 2012 +0100 summary: Port remaining test fixes, and fix test_importlib too. files: Lib/importlib/test/source/test_file_loader.py | 10 +++- Lib/test/test_import.py | 29 +++++++-- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -4,6 +4,7 @@ from .. import util from . import util as source_util +import errno import imp import marshal import os @@ -131,7 +132,14 @@ compiled = imp.cache_from_source(source) with open(source, 'w') as f: f.write("x = 5") - os.utime(source, (2 ** 33, 2 ** 33)) + try: + os.utime(source, (2 ** 33, 2 ** 33)) + except OverflowError: + self.skipTest("cannot set modification time to large integer") + except OSError as e: + if e.errno != getattr(errno, 'EOVERFLOW', None): + raise + self.skipTest("cannot set modification time to large integer ({})".format(e)) loader = _bootstrap._SourceFileLoader('_temp', mapping['_temp']) mod = loader.load_module('_temp') # Sanity checks. diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -11,6 +11,7 @@ import sys import unittest import textwrap +import errno from test.support import ( EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython, @@ -309,14 +310,26 @@ def test_timestamp_overflow(self): # A modification timestamp larger than 2**32 should not be a problem # when importing a module (issue #11235). - source = TESTFN + ".py" - compiled = imp.cache_from_source(source) - with open(source, 'w') as f: - pass - os.utime(source, (2 ** 33, 2 ** 33)) - __import__(TESTFN) - # The pyc file was created. - os.stat(compiled) + sys.path.insert(0, os.curdir) + try: + source = TESTFN + ".py" + compiled = imp.cache_from_source(source) + with open(source, 'w') as f: + pass + try: + os.utime(source, (2 ** 33, 2 ** 33)) + except OverflowError: + self.skipTest("cannot set modification time to large integer") + except OSError as e: + if e.errno != getattr(errno, 'EOVERFLOW', None): + raise + self.skipTest("cannot set modification time to large integer ({})".format(e)) + __import__(TESTFN) + # The pyc file was created. + os.stat(compiled) + finally: + del sys.path[0] + remove_files(TESTFN) class PycRewritingTests(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 03:41:52 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 03:41:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Make_guard_more?= =?utf8?q?_dynamic_=28apparently_the_size_of_a_filesystem_timestamp_may_va?= =?utf8?q?ry?= Message-ID: http://hg.python.org/cpython/rev/0bec943f6778 changeset: 74605:0bec943f6778 branch: 2.7 parent: 74601:dd1b4fc2d736 user: Antoine Pitrou date: Wed Jan 25 03:31:39 2012 +0100 summary: Make guard more dynamic (apparently the size of a filesystem timestamp may vary under Windows). files: Python/import.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -979,14 +979,14 @@ pathname); return NULL; } -#if SIZEOF_TIME_T > 4 - /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. Since the code only does an equality comparison, - ordering is not important and we can safely ignore the higher bits - (collisions are extremely unlikely). - */ - st.st_mtime &= 0xFFFFFFFF; -#endif + if (sizeof st.st_mtime > 4) { + /* Python's .pyc timestamp handling presumes that the timestamp fits + in 4 bytes. Since the code only does an equality comparison, + ordering is not important and we can safely ignore the higher bits + (collisions are extremely unlikely). + */ + st.st_mtime &= 0xFFFFFFFF; + } cpathname = make_compiled_pathname(pathname, buf, (size_t)MAXPATHLEN + 1); if (cpathname != NULL && -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Wed Jan 25 05:33:22 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 25 Jan 2012 05:33:22 +0100 Subject: [Python-checkins] Daily reference leaks (454d1c52f3e0): sum=0 Message-ID: results for 454d1c52f3e0 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogqi1hOf', '-x'] From python-checkins at python.org Wed Jan 25 07:44:44 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 25 Jan 2012 07:44:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_redundant_resource_c?= =?utf8?q?heck_in_test=5Fsocket=2E?= Message-ID: http://hg.python.org/cpython/rev/050080c13610 changeset: 74606:050080c13610 parent: 74604:454d1c52f3e0 user: Nadeem Vawda date: Wed Jan 25 06:48:47 2012 +0200 summary: Remove redundant resource check in test_socket. files: Lib/test/test_socket.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1168,7 +1168,6 @@ @unittest.skipUnless(support.is_resource_enabled('network'), 'network is not enabled') def test_idna(self): - support.requires('network') # these should all be successful socket.gethostbyname('?????????.python.org') socket.gethostbyname_ex('?????????.python.org') -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 07:44:45 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 25 Jan 2012 07:44:45 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2312804=3A_Fix_test_?= =?utf8?q?failures_on_systems_without_internet_access=2E?= Message-ID: http://hg.python.org/cpython/rev/585d3664da89 changeset: 74607:585d3664da89 user: Nadeem Vawda date: Wed Jan 25 08:02:05 2012 +0200 summary: Issue #12804: Fix test failures on systems without internet access. files: Lib/test/test_socket.py | 6 ++++++ Lib/test/test_urllib2net.py | 13 +++++++------ Misc/NEWS | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1168,6 +1168,12 @@ @unittest.skipUnless(support.is_resource_enabled('network'), 'network is not enabled') def test_idna(self): + # Check for internet access before running test (issue #12804). + try: + socket.gethostbyname('python.org') + except socket.gaierror as e: + if e.errno == socket.EAI_NODATA: + self.skipTest('internet access required for this test') # these should all be successful socket.gethostbyname('?????????.python.org') socket.gethostbyname_ex('?????????.python.org') diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py --- a/Lib/test/test_urllib2net.py +++ b/Lib/test/test_urllib2net.py @@ -83,12 +83,13 @@ def test_close(self): # calling .close() on urllib2's response objects should close the # underlying socket - - response = _urlopen_with_retry("http://www.python.org/") - sock = response.fp - self.assertTrue(not sock.closed) - response.close() - self.assertTrue(sock.closed) + url = "http://www.python.org/" + with support.transient_internet(url): + response = _urlopen_with_retry(url) + sock = response.fp + self.assertTrue(not sock.closed) + response.close() + self.assertTrue(sock.closed) class OtherNetworkTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #12804: Fix test_socket and test_urllib2net failures when running tests + on a system without internet access. + - Issue #13772: In os.symlink() under Windows, do not try to guess the link target's type (file or directory). The detection was buggy and made the call non-atomic (therefore prone to race conditions). -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 09:56:32 2012 From: python-checkins at python.org (terry.reedy) Date: Wed, 25 Jan 2012 09:56:32 +0100 Subject: [Python-checkins] =?utf8?q?devguide=3A_Add_mising_=27r=27=2E?= Message-ID: http://hg.python.org/devguide/rev/8c9c8f6b92c2 changeset: 491:8c9c8f6b92c2 user: Terry Jan Reedy date: Wed Jan 25 03:56:11 2012 -0500 summary: Add mising 'r'. files: runtests.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/runtests.rst b/runtests.rst --- a/runtests.rst +++ b/runtests.rst @@ -66,7 +66,7 @@ You can also execute the ``Tools/scripts/run_tests.py`` script as found in a CPython checkout. The script tries to balance speed with thoroughness. But if -you want the most thorough tests you should use the stenuous approach shown +you want the most thorough tests you should use the strenuous approach shown above. -- Repository URL: http://hg.python.org/devguide From python-checkins at python.org Wed Jan 25 14:41:30 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 14:41:30 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Temporary_debug?= =?utf8?q?_for_Windows_buildbots=2E?= Message-ID: http://hg.python.org/cpython/rev/ae37ae1cace8 changeset: 74608:ae37ae1cace8 branch: 2.7 parent: 74605:0bec943f6778 user: Antoine Pitrou date: Wed Jan 25 14:39:21 2012 +0100 summary: Temporary debug for Windows buildbots. files: Python/import.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -907,6 +907,11 @@ } /* Now write the true mtime */ fseek(fp, 4L, 0); + if (mtime >= LONG_MAX) { + fprintf(stderr, "** mtime=%ld > %ld (%ld, %ld)\n", mtime, LONG_MAX, sizeof(time_t), sizeof(srcstat->st_mtime)); + assert(0); + /* can't get here */ + } assert(mtime < LONG_MAX); PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); fflush(fp); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 15:00:08 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 15:00:08 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_temporary_d?= =?utf8?q?ebug_output_=28so=2C_time=5Ft_is_8_bytes_on_some_Windows_builds?= =?utf8?q?=29?= Message-ID: http://hg.python.org/cpython/rev/33743c478d44 changeset: 74609:33743c478d44 branch: 2.7 user: Antoine Pitrou date: Wed Jan 25 14:57:56 2012 +0100 summary: Fix temporary debug output (so, time_t is 8 bytes on some Windows builds) files: Python/import.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -908,7 +908,7 @@ /* Now write the true mtime */ fseek(fp, 4L, 0); if (mtime >= LONG_MAX) { - fprintf(stderr, "** mtime=%ld > %ld (%ld, %ld)\n", mtime, LONG_MAX, sizeof(time_t), sizeof(srcstat->st_mtime)); + fprintf(stderr, "** sizes=(%ld, %ld), mtime=%I64d >= %ld\n", sizeof(time_t), sizeof(srcstat->st_mtime), mtime, LONG_MAX); assert(0); /* can't get here */ } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 15:40:43 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 15:40:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Remove_debug_ou?= =?utf8?q?tput=2C_fix_assert_=28hopefully=29_and_exercise_signedness_issue?= =?utf8?q?s_a?= Message-ID: http://hg.python.org/cpython/rev/e8a525de2bac changeset: 74610:e8a525de2bac branch: 2.7 user: Antoine Pitrou date: Wed Jan 25 15:38:32 2012 +0100 summary: Remove debug output, fix assert (hopefully) and exercise signedness issues a bit more. files: Lib/test/test_import.py | 2 +- Python/import.c | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -288,7 +288,7 @@ with open(source, 'w') as f: pass try: - os.utime(source, (2 ** 33, 2 ** 33)) + os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5)) except OverflowError: self.skipTest("cannot set modification time to large integer") except OSError as e: diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -905,14 +905,9 @@ (void) unlink(cpathname); return; } - /* Now write the true mtime */ + /* Now write the true mtime (as a 32-bit field) */ fseek(fp, 4L, 0); - if (mtime >= LONG_MAX) { - fprintf(stderr, "** sizes=(%ld, %ld), mtime=%I64d >= %ld\n", sizeof(time_t), sizeof(srcstat->st_mtime), mtime, LONG_MAX); - assert(0); - /* can't get here */ - } - assert(mtime < LONG_MAX); + assert(mtime <= 0xFFFFFFFF); PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); fflush(fp); fclose(fp); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 18:09:22 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 18:09:22 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Port_import_fix?= =?utf8?q?es_from_2=2E7=2E?= Message-ID: http://hg.python.org/cpython/rev/c79d0a7ac79d changeset: 74611:c79d0a7ac79d branch: 3.2 parent: 74603:37ac757a9145 user: Antoine Pitrou date: Wed Jan 25 18:01:45 2012 +0100 summary: Port import fixes from 2.7. files: Lib/importlib/test/source/test_file_loader.py | 2 +- Lib/test/test_import.py | 2 +- Python/import.c | 20 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -138,7 +138,7 @@ with open(source, 'w') as f: f.write("x = 5") try: - os.utime(source, (2 ** 33, 2 ** 33)) + os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5)) except OverflowError: self.skipTest("cannot set modification time to large integer") except OSError as e: diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -321,7 +321,7 @@ with open(source, 'w') as f: pass try: - os.utime(source, (2 ** 33, 2 ** 33)) + os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5)) except OverflowError: self.skipTest("cannot set modification time to large integer") except OSError as e: diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -1226,9 +1226,9 @@ (void) unlink(cpathname); return; } - /* Now write the true mtime */ + /* Now write the true mtime (as a 32-bit field) */ fseek(fp, 4L, 0); - assert(mtime < LONG_MAX); + assert(mtime <= 0xFFFFFFFF); PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); fflush(fp); fclose(fp); @@ -1302,14 +1302,14 @@ pathname); return NULL; } -#if SIZEOF_TIME_T > 4 - /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. Since the code only does an equality comparison, - ordering is not important and we can safely ignore the higher bits - (collisions are extremely unlikely). - */ - st.st_mtime &= 0xFFFFFFFF; -#endif + if (sizeof st.st_mtime > 4) { + /* Python's .pyc timestamp handling presumes that the timestamp fits + in 4 bytes. Since the code only does an equality comparison, + ordering is not important and we can safely ignore the higher bits + (collisions are extremely unlikely). + */ + st.st_mtime &= 0xFFFFFFFF; + } cpathname = make_compiled_pathname( pathname, buf, (size_t)MAXPATHLEN + 1, !Py_OptimizeFlag); if (cpathname != NULL && -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 18:09:22 2012 From: python-checkins at python.org (antoine.pitrou) Date: Wed, 25 Jan 2012 18:09:22 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Port_import_fixes_from_2=2E7=2E?= Message-ID: http://hg.python.org/cpython/rev/2b62348a1c03 changeset: 74612:2b62348a1c03 parent: 74607:585d3664da89 parent: 74611:c79d0a7ac79d user: Antoine Pitrou date: Wed Jan 25 18:06:07 2012 +0100 summary: Port import fixes from 2.7. files: Lib/importlib/test/source/test_file_loader.py | 2 +- Lib/test/test_import.py | 2 +- Python/import.c | 20 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -133,7 +133,7 @@ with open(source, 'w') as f: f.write("x = 5") try: - os.utime(source, (2 ** 33, 2 ** 33)) + os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5)) except OverflowError: self.skipTest("cannot set modification time to large integer") except OSError as e: diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -317,7 +317,7 @@ with open(source, 'w') as f: pass try: - os.utime(source, (2 ** 33, 2 ** 33)) + os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5)) except OverflowError: self.skipTest("cannot set modification time to large integer") except OSError as e: diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -1343,9 +1343,9 @@ PyMarshal_WriteLongToFile(0L, fp, Py_MARSHAL_VERSION); PyMarshal_WriteObjectToFile((PyObject *)co, fp, Py_MARSHAL_VERSION); fflush(fp); - /* Now write the true mtime and size */ + /* Now write the true mtime and size (as 32-bit fields) */ fseek(fp, 4L, 0); - assert(mtime < LONG_MAX); + assert(mtime <= 0xFFFFFFFF); PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); PyMarshal_WriteLongToFile(size, fp, Py_MARSHAL_VERSION); if (fflush(fp) != 0 || ferror(fp)) { @@ -1476,14 +1476,14 @@ pathname); goto error; } -#if SIZEOF_TIME_T > 4 - /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. Since the code only does an equality comparison, - ordering is not important and we can safely ignore the higher bits - (collisions are extremely unlikely). - */ - st.st_mtime &= 0xFFFFFFFF; -#endif + if (sizeof st.st_mtime > 4) { + /* Python's .pyc timestamp handling presumes that the timestamp fits + in 4 bytes. Since the code only does an equality comparison, + ordering is not important and we can safely ignore the higher bits + (collisions are extremely unlikely). + */ + st.st_mtime &= 0xFFFFFFFF; + } if (PyUnicode_READY(pathname) < 0) return NULL; cpathname = make_compiled_pathname(pathname, !Py_OptimizeFlag); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 18:50:24 2012 From: python-checkins at python.org (vinay.sajip) Date: Wed, 25 Jan 2012 18:50:24 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Closes_=2313859?= =?utf8?q?=3A_Replaced_reference_to_StandardError_with_reference_to_Except?= =?utf8?q?ion=2E?= Message-ID: http://hg.python.org/cpython/rev/e506848d6381 changeset: 74613:e506848d6381 branch: 3.2 parent: 74611:c79d0a7ac79d user: Vinay Sajip date: Wed Jan 25 17:41:13 2012 +0000 summary: Closes #13859: Replaced reference to StandardError with reference to Exception. Thanks to Matt Joiner for spotting this and submitting a patch. files: Lib/logging/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -294,7 +294,7 @@ # for an example try: self.processName = mp.current_process().name - except StandardError: + except Exception: pass if logProcesses and hasattr(os, 'getpid'): self.process = os.getpid() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 18:50:25 2012 From: python-checkins at python.org (vinay.sajip) Date: Wed, 25 Jan 2012 18:50:25 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Closes_=2313859=3A_Merged_fix_from_3=2E2_-_thanks_to_Matt_Jo?= =?utf8?q?iner_for_spotting_this?= Message-ID: http://hg.python.org/cpython/rev/fec45282dc28 changeset: 74614:fec45282dc28 parent: 74612:2b62348a1c03 parent: 74613:e506848d6381 user: Vinay Sajip date: Wed Jan 25 17:49:45 2012 +0000 summary: Closes #13859: Merged fix from 3.2 - thanks to Matt Joiner for spotting this and the patch. files: Lib/logging/__init__.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2001-2011 by Vinay Sajip. All Rights Reserved. +# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, @@ -288,7 +288,7 @@ # for an example try: self.processName = mp.current_process().name - except StandardError: #pragma: no cover + except Exception: #pragma: no cover pass if logProcesses and hasattr(os, 'getpid'): self.process = os.getpid() -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:25:24 2012 From: python-checkins at python.org (nadeem.vawda) Date: Wed, 25 Jan 2012 22:25:24 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313862=3A_Relax_zli?= =?utf8?q?b_version_test_to_avoid_spurious_failures=2E?= Message-ID: http://hg.python.org/cpython/rev/a5f8611ce81d changeset: 74615:a5f8611ce81d user: Nadeem Vawda date: Wed Jan 25 23:16:50 2012 +0200 summary: Issue #13862: Relax zlib version test to avoid spurious failures. files: Lib/test/test_zlib.py | 12 ++++++------ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -16,12 +16,12 @@ class VersionTestCase(unittest.TestCase): def test_library_version(self): - # On the build system, ZLIB_RUNTIME_VERSION should match ZLIB_VERSION. - # ZLIB_RUNTIME_VERSION is the actual library version while ZLIB_VERSION - # is the version from the header file. On the build system, the headers - # should match with the library exactly. At runtime, only the first - # digit is required to match. - self.assertEqual(zlib.ZLIB_RUNTIME_VERSION, zlib.ZLIB_VERSION) + # Test that the major version of the actual library in use matches the + # major version that we were compiled against. We can't guarantee that + # the minor versions will match (even on the machine on which the module + # was compiled), and the API is stable between minor versions, so + # testing only the major verions avoids spurious failures. + self.assertEqual(zlib.ZLIB_RUNTIME_VERSION[0], zlib.ZLIB_VERSION[0]) class ChecksumTestCase(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time + minor versions not matching. + - Issue #12804: Fix test_socket and test_urllib2net failures when running tests on a system without internet access. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:32:57 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:32:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_say_bitwise_=28?= =?utf8?q?because_I_have_no_idea_what_a_bit-string_is=29?= Message-ID: http://hg.python.org/cpython/rev/3e55733fc534 changeset: 74616:3e55733fc534 branch: 3.2 parent: 74613:e506848d6381 user: Benjamin Peterson date: Wed Jan 25 16:29:03 2012 -0500 summary: say bitwise (because I have no idea what a bit-string is) files: Doc/library/stdtypes.rst | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -379,12 +379,12 @@ .. _bitstring-ops: -Bit-string Operations on Integer Types +Bitwise Operations on Integer Types -------------------------------------- .. index:: triple: operations on; integer; types - pair: bit-string; operations + pair: bitwise; operations pair: shifting; operations pair: masking; operations operator: ^ @@ -392,15 +392,15 @@ operator: << operator: >> -Integers support additional operations that make sense only for bit-strings. -Negative numbers are treated as their 2's complement value (this assumes a -sufficiently large number of bits that no overflow occurs during the operation). +Bitwise operations only make sense only for integers. Negative numbers are +treated as their 2's complement value (this assumes a sufficiently large number +of bits that no overflow occurs during the operation). The priorities of the binary bitwise operations are all lower than the numeric operations and higher than the comparisons; the unary operation ``~`` has the same priority as the other unary numeric operations (``+`` and ``-``). -This table lists the bit-string operations sorted in ascending priority +This table lists the bitwise operations sorted in ascending priority (operations in the same box have the same priority): +------------+--------------------------------+----------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:32:58 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:32:58 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_kill_extra_word?= Message-ID: http://hg.python.org/cpython/rev/2790c3ff475b changeset: 74617:2790c3ff475b branch: 3.2 user: Benjamin Peterson date: Wed Jan 25 16:30:18 2012 -0500 summary: kill extra word files: Doc/library/stdtypes.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -392,9 +392,9 @@ operator: << operator: >> -Bitwise operations only make sense only for integers. Negative numbers are -treated as their 2's complement value (this assumes a sufficiently large number -of bits that no overflow occurs during the operation). +Bitwise operations only make sense for integers. Negative numbers are treated +as their 2's complement value (this assumes a sufficiently large number of bits +that no overflow occurs during the operation). The priorities of the binary bitwise operations are all lower than the numeric operations and higher than the comparisons; the unary operation ``~`` has the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:33:01 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:33:01 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_say_bitwise_=28?= =?utf8?q?because_I_have_no_idea_what_a_bit-string_is=29?= Message-ID: http://hg.python.org/cpython/rev/6af7eb71cd49 changeset: 74618:6af7eb71cd49 branch: 2.7 parent: 74610:e8a525de2bac user: Benjamin Peterson date: Wed Jan 25 16:29:03 2012 -0500 summary: say bitwise (because I have no idea what a bit-string is) files: Doc/library/stdtypes.rst | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -401,12 +401,12 @@ .. _bitstring-ops: -Bit-string Operations on Integer Types +Bitwise Operations on Integer Types -------------------------------------- .. index:: triple: operations on; integer; types - pair: bit-string; operations + pair: bitwise; operations pair: shifting; operations pair: masking; operations operator: ^ @@ -414,16 +414,20 @@ operator: << operator: >> -Plain and long integer types support additional operations that make sense only -for bit-strings. Negative numbers are treated as their 2's complement value -(for long integers, this assumes a sufficiently large number of bits that no -overflow occurs during the operation). +Bitwise operations only make sense only for integers. Negative numbers are +treated as their 2's complement value (this assumes a sufficiently large number +of bits that no overflow occurs during the operation). The priorities of the binary bitwise operations are all lower than the numeric operations and higher than the comparisons; the unary operation ``~`` has the same priority as the other unary numeric operations (``+`` and ``-``). +<<<<<<< local This table lists the bit-string operations sorted in ascending priority: +======= +This table lists the bitwise operations sorted in ascending priority +(operations in the same box have the same priority): +>>>>>>> other +------------+--------------------------------+----------+ | Operation | Result | Notes | -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:33:02 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:33:02 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_kill_extra_word?= Message-ID: http://hg.python.org/cpython/rev/ed6d9249da0c changeset: 74619:ed6d9249da0c branch: 2.7 user: Benjamin Peterson date: Wed Jan 25 16:30:18 2012 -0500 summary: kill extra word files: Doc/library/stdtypes.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -414,9 +414,9 @@ operator: << operator: >> -Bitwise operations only make sense only for integers. Negative numbers are -treated as their 2's complement value (this assumes a sufficiently large number -of bits that no overflow occurs during the operation). +Bitwise operations only make sense for integers. Negative numbers are treated +as their 2's complement value (this assumes a sufficiently large number of bits +that no overflow occurs during the operation). The priorities of the binary bitwise operations are all lower than the numeric operations and higher than the comparisons; the unary operation ``~`` has the -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:33:03 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:33:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/e17a28b631a8 changeset: 74620:e17a28b631a8 parent: 74614:fec45282dc28 parent: 74617:2790c3ff475b user: Benjamin Peterson date: Wed Jan 25 16:31:56 2012 -0500 summary: merge 3.2 files: Doc/library/stdtypes.rst | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -383,12 +383,12 @@ .. _bitstring-ops: -Bit-string Operations on Integer Types +Bitwise Operations on Integer Types -------------------------------------- .. index:: triple: operations on; integer; types - pair: bit-string; operations + pair: bitwise; operations pair: shifting; operations pair: masking; operations operator: ^ @@ -396,15 +396,15 @@ operator: << operator: >> -Integers support additional operations that make sense only for bit-strings. -Negative numbers are treated as their 2's complement value (this assumes a -sufficiently large number of bits that no overflow occurs during the operation). +Bitwise operations only make sense for integers. Negative numbers are treated +as their 2's complement value (this assumes a sufficiently large number of bits +that no overflow occurs during the operation). The priorities of the binary bitwise operations are all lower than the numeric operations and higher than the comparisons; the unary operation ``~`` has the same priority as the other unary numeric operations (``+`` and ``-``). -This table lists the bit-string operations sorted in ascending priority +This table lists the bitwise operations sorted in ascending priority (operations in the same box have the same priority): +------------+--------------------------------+----------+ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:33:04 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:33:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/2701a2bb19c5 changeset: 74621:2701a2bb19c5 parent: 74620:e17a28b631a8 parent: 74615:a5f8611ce81d user: Benjamin Peterson date: Wed Jan 25 16:32:36 2012 -0500 summary: merge heads files: Lib/test/test_zlib.py | 12 ++++++------ Misc/NEWS | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -16,12 +16,12 @@ class VersionTestCase(unittest.TestCase): def test_library_version(self): - # On the build system, ZLIB_RUNTIME_VERSION should match ZLIB_VERSION. - # ZLIB_RUNTIME_VERSION is the actual library version while ZLIB_VERSION - # is the version from the header file. On the build system, the headers - # should match with the library exactly. At runtime, only the first - # digit is required to match. - self.assertEqual(zlib.ZLIB_RUNTIME_VERSION, zlib.ZLIB_VERSION) + # Test that the major version of the actual library in use matches the + # major version that we were compiled against. We can't guarantee that + # the minor versions will match (even on the machine on which the module + # was compiled), and the API is stable between minor versions, so + # testing only the major verions avoids spurious failures. + self.assertEqual(zlib.ZLIB_RUNTIME_VERSION[0], zlib.ZLIB_VERSION[0]) class ChecksumTestCase(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time + minor versions not matching. + - Issue #12804: Fix test_socket and test_urllib2net failures when running tests on a system without internet access. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:36:52 2012 From: python-checkins at python.org (georg.brandl) Date: Wed, 25 Jan 2012 22:36:52 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzEzODUyOiBzb21l?= =?utf8?q?_small_doc_fixes=2E?= Message-ID: http://hg.python.org/cpython/rev/e2b98a332070 changeset: 74622:e2b98a332070 branch: 2.7 parent: 74619:ed6d9249da0c user: Georg Brandl date: Wed Jan 25 22:36:25 2012 +0100 summary: #13852: some small doc fixes. files: Doc/library/functools.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -1,8 +1,8 @@ -:mod:`functools` --- Higher order functions and operations on callable objects +:mod:`functools` --- Higher-order functions and operations on callable objects ============================================================================== .. module:: functools - :synopsis: Higher order functions and operations on callable objects. + :synopsis: Higher-order functions and operations on callable objects. .. moduleauthor:: Peter Harris .. moduleauthor:: Raymond Hettinger .. moduleauthor:: Nick Coghlan @@ -29,7 +29,7 @@ tool for programs being converted to Python 3 where comparison functions are no longer supported. - A compare function is any callable that accept two arguments, compares them, + A comparison function is any callable that accept two arguments, compares them, and returns a negative number for less-than, zero for equality, or a positive number for greater-than. A key function is a callable that accepts one argument and returns another value that indicates the position in the desired -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:36:54 2012 From: python-checkins at python.org (georg.brandl) Date: Wed, 25 Jan 2012 22:36:54 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzODUyOiBzb21l?= =?utf8?q?_small_doc_fixes=2E?= Message-ID: http://hg.python.org/cpython/rev/5b8800012e88 changeset: 74623:5b8800012e88 branch: 3.2 parent: 74617:2790c3ff475b user: Georg Brandl date: Wed Jan 25 22:36:25 2012 +0100 summary: #13852: some small doc fixes. files: Doc/library/functools.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -1,8 +1,8 @@ -:mod:`functools` --- Higher order functions and operations on callable objects +:mod:`functools` --- Higher-order functions and operations on callable objects ============================================================================== .. module:: functools - :synopsis: Higher order functions and operations on callable objects. + :synopsis: Higher-order functions and operations on callable objects. .. moduleauthor:: Peter Harris .. moduleauthor:: Raymond Hettinger .. moduleauthor:: Nick Coghlan @@ -27,7 +27,7 @@ tool for programs being converted from Python 2 which supported the use of comparison functions. - A compare function is any callable that accept two arguments, compares them, + A comparison function is any callable that accept two arguments, compares them, and returns a negative number for less-than, zero for equality, or a positive number for greater-than. A key function is a callable that accepts one argument and returns another value indicating the position in the desired -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:36:55 2012 From: python-checkins at python.org (georg.brandl) Date: Wed, 25 Jan 2012 22:36:55 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/e68ddfc193d5 changeset: 74624:e68ddfc193d5 parent: 74621:2701a2bb19c5 parent: 74623:5b8800012e88 user: Georg Brandl date: Wed Jan 25 22:36:43 2012 +0100 summary: merge with 3.2 files: Doc/library/functools.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -1,8 +1,8 @@ -:mod:`functools` --- Higher order functions and operations on callable objects +:mod:`functools` --- Higher-order functions and operations on callable objects ============================================================================== .. module:: functools - :synopsis: Higher order functions and operations on callable objects. + :synopsis: Higher-order functions and operations on callable objects. .. moduleauthor:: Peter Harris .. moduleauthor:: Raymond Hettinger .. moduleauthor:: Nick Coghlan @@ -27,7 +27,7 @@ tool for programs being converted from Python 2 which supported the use of comparison functions. - A compare function is any callable that accept two arguments, compares them, + A comparison function is any callable that accept two arguments, compares them, and returns a negative number for less-than, zero for equality, or a positive number for greater-than. A key function is a callable that accepts one argument and returns another value indicating the position in the desired -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:44:04 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:44:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_forgot_to_resol?= =?utf8?q?ve_this_conflict=2E=2E=2E?= Message-ID: http://hg.python.org/cpython/rev/9133d956b3ce changeset: 74625:9133d956b3ce branch: 2.7 parent: 74619:ed6d9249da0c user: Benjamin Peterson date: Wed Jan 25 16:43:26 2012 -0500 summary: forgot to resolve this conflict... files: Doc/library/stdtypes.rst | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -422,12 +422,8 @@ operations and higher than the comparisons; the unary operation ``~`` has the same priority as the other unary numeric operations (``+`` and ``-``). -<<<<<<< local -This table lists the bit-string operations sorted in ascending priority: -======= This table lists the bitwise operations sorted in ascending priority (operations in the same box have the same priority): ->>>>>>> other +------------+--------------------------------+----------+ | Operation | Result | Notes | -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Wed Jan 25 22:44:05 2012 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 25 Jan 2012 22:44:05 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf8?q?_merge_heads?= Message-ID: http://hg.python.org/cpython/rev/232c7d73b09d changeset: 74626:232c7d73b09d branch: 2.7 parent: 74625:9133d956b3ce parent: 74622:e2b98a332070 user: Benjamin Peterson date: Wed Jan 25 16:43:54 2012 -0500 summary: merge heads files: Doc/library/functools.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -1,8 +1,8 @@ -:mod:`functools` --- Higher order functions and operations on callable objects +:mod:`functools` --- Higher-order functions and operations on callable objects ============================================================================== .. module:: functools - :synopsis: Higher order functions and operations on callable objects. + :synopsis: Higher-order functions and operations on callable objects. .. moduleauthor:: Peter Harris .. moduleauthor:: Raymond Hettinger .. moduleauthor:: Nick Coghlan @@ -29,7 +29,7 @@ tool for programs being converted to Python 3 where comparison functions are no longer supported. - A compare function is any callable that accept two arguments, compares them, + A comparison function is any callable that accept two arguments, compares them, and returns a negative number for less-than, zero for equality, or a positive number for greater-than. A key function is a callable that accepts one argument and returns another value that indicates the position in the desired -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 26 00:36:17 2012 From: python-checkins at python.org (victor.stinner) Date: Thu, 26 Jan 2012 00:36:17 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Remove_now_useless_arbitrar?= =?utf8?q?y_limit_of_module_name_length?= Message-ID: http://hg.python.org/cpython/rev/e12b8d3a3d03 changeset: 74627:e12b8d3a3d03 parent: 74624:e68ddfc193d5 user: Victor Stinner date: Thu Jan 26 00:31:49 2012 +0100 summary: Remove now useless arbitrary limit of module name length files: Python/import.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -2052,12 +2052,6 @@ if (p_loader != NULL) *p_loader = NULL; - if (PyUnicode_GET_LENGTH(name) > MAXPATHLEN) { - PyErr_SetString(PyExc_OverflowError, - "module name is too long"); - return NULL; - } - /* sys.meta_path import hook */ if (p_loader != NULL) { _Py_IDENTIFIER(find_module); -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Thu Jan 26 05:32:49 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 26 Jan 2012 05:32:49 +0100 Subject: [Python-checkins] Daily reference leaks (e12b8d3a3d03): sum=0 Message-ID: results for e12b8d3a3d03 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflog0qmJgz', '-x'] From python-checkins at python.org Thu Jan 26 09:15:46 2012 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 26 Jan 2012 09:15:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Issue_13870=3A_?= =?utf8?q?Fix_out_of_date_comment=2E?= Message-ID: http://hg.python.org/cpython/rev/f7283825effa changeset: 74628:f7283825effa branch: 3.2 parent: 74623:5b8800012e88 user: Raymond Hettinger date: Thu Jan 26 00:14:16 2012 -0800 summary: Issue 13870: Fix out of date comment. files: Lib/collections.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/collections.py b/Lib/collections.py --- a/Lib/collections.py +++ b/Lib/collections.py @@ -33,7 +33,7 @@ # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # The sentinel is in self.__hardroot with a weakref proxy in self.__root. - # The prev/next links are weakref proxies (to prevent circular references). + # The prev links are weakref proxies (to prevent circular references). # Individual links are kept alive by the hard reference in self.__map. # Those hard references disappear when a key is deleted from an OrderedDict. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 26 09:15:46 2012 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 26 Jan 2012 09:15:46 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/d2cf8a34ddf9 changeset: 74629:d2cf8a34ddf9 parent: 74627:e12b8d3a3d03 parent: 74628:f7283825effa user: Raymond Hettinger date: Thu Jan 26 00:15:07 2012 -0800 summary: Merge files: Lib/collections/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -34,7 +34,7 @@ # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # The sentinel is in self.__hardroot with a weakref proxy in self.__root. - # The prev/next links are weakref proxies (to prevent circular references). + # The prev links are weakref proxies (to prevent circular references). # Individual links are kept alive by the hard reference in self.__map. # Those hard references disappear when a key is deleted from an OrderedDict. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 26 14:58:34 2012 From: python-checkins at python.org (brett.cannon) Date: Thu, 26 Jan 2012 14:58:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Move_some_code_from_importl?= =?utf8?q?ib=2E=5F=5Finit=5F=5F_to_importlib=2E=5Fbootstrap_that?= Message-ID: http://hg.python.org/cpython/rev/7d8f016784cd changeset: 74630:7d8f016784cd parent: 74624:e68ddfc193d5 user: Brett Cannon date: Wed Jan 25 18:58:03 2012 -0500 summary: Move some code from importlib.__init__ to importlib._bootstrap that does not need to be exposed from C code for bootstrapping reasons. files: Lib/importlib/__init__.py | 43 ++------- Lib/importlib/_bootstrap.py | 39 ++++++++- Lib/importlib/abc.py | 4 +- Lib/importlib/test/source/test_abc_loader.py | 8 +- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -26,8 +26,15 @@ import re import tokenize +# To simplify imports in test code +_w_long = _bootstrap._w_long +_r_long = _bootstrap._r_long + + # Bootstrap help ##################################################### +# TODO: Expose from import.c, else handle encode/decode as _os.environ returns +# bytes. def _case_ok(directory, check): """Check if the directory contains something matching 'check'. @@ -36,37 +43,13 @@ """ if 'PYTHONCASEOK' in os.environ: return True - elif check in os.listdir(directory if directory else os.getcwd()): + if not directory: + directory = os.getcwd() + if check in os.listdir(directory): return True return False - -def _w_long(x): - """Convert a 32-bit integer to little-endian. - - XXX Temporary until marshal's long functions are exposed. - - """ - x = int(x) - int_bytes = [] - int_bytes.append(x & 0xFF) - int_bytes.append((x >> 8) & 0xFF) - int_bytes.append((x >> 16) & 0xFF) - int_bytes.append((x >> 24) & 0xFF) - return bytearray(int_bytes) - - -def _r_long(int_bytes): - """Convert 4 bytes in little-endian to an integer. - - XXX Temporary until marshal's long function are exposed. - - """ - x = int_bytes[0] - x |= int_bytes[1] << 8 - x |= int_bytes[2] << 16 - x |= int_bytes[3] << 24 - return x +_bootstrap._case_ok = _case_ok # Required built-in modules. @@ -94,10 +77,6 @@ # For os.path.join replacement; pull from Include/osdefs.h:SEP . _bootstrap.path_sep = sep -_bootstrap._case_ok = _case_ok -marshal._w_long = _w_long -marshal._r_long = _r_long - # Public API ######################################################### diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -18,6 +18,37 @@ # Bootstrap-related code ###################################################### +# TODO: Expose from marshal +def _w_long(x): + """Convert a 32-bit integer to little-endian. + + XXX Temporary until marshal's long functions are exposed. + + """ + x = int(x) + int_bytes = [] + int_bytes.append(x & 0xFF) + int_bytes.append((x >> 8) & 0xFF) + int_bytes.append((x >> 16) & 0xFF) + int_bytes.append((x >> 24) & 0xFF) + return bytearray(int_bytes) + + +# TODO: Expose from marshal +def _r_long(int_bytes): + """Convert 4 bytes in little-endian to an integer. + + XXX Temporary until marshal's long function are exposed. + + """ + x = int_bytes[0] + x |= int_bytes[1] << 8 + x |= int_bytes[2] << 16 + x |= int_bytes[3] << 24 + return x + + + # XXX Could also expose Modules/getpath.c:joinpath() def _path_join(*args): """Replacement for os.path.join.""" @@ -353,14 +384,14 @@ except KeyError: pass else: - if marshal._r_long(raw_timestamp) != source_mtime: + if _r_long(raw_timestamp) != source_mtime: raise ImportError("bytecode is stale for {}".format(fullname)) try: source_size = source_stats['size'] & 0xFFFFFFFF except KeyError: pass else: - if marshal._r_long(raw_size) != source_size: + if _r_long(raw_size) != source_size: raise ImportError("bytecode is stale for {}".format(fullname)) # Can't return the code object as errors from marshal loading need to # propagate even when source is available. @@ -472,8 +503,8 @@ # their own cached file format, this block of code will most likely # throw an exception. data = bytearray(imp.get_magic()) - data.extend(marshal._w_long(source_mtime)) - data.extend(marshal._w_long(len(source_bytes))) + data.extend(_w_long(source_mtime)) + data.extend(_w_long(len(source_bytes))) data.extend(marshal.dumps(code_object)) try: self.set_data(bytecode_path, data) diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -260,7 +260,7 @@ raw_timestamp = data[4:8] if len(raw_timestamp) < 4: raise EOFError("bad timestamp in {}".format(fullname)) - pyc_timestamp = marshal._r_long(raw_timestamp) + pyc_timestamp = _bootstrap._r_long(raw_timestamp) bytecode = data[8:] # Verify that the magic number is valid. if imp.get_magic() != magic: @@ -292,7 +292,7 @@ # Generate bytecode and write it out. if not sys.dont_write_bytecode: data = bytearray(imp.get_magic()) - data.extend(marshal._w_long(source_timestamp)) + data.extend(_bootstrap._w_long(source_timestamp)) data.extend(marshal.dumps(code_object)) self.write_bytecode(fullname, data) return code_object diff --git a/Lib/importlib/test/source/test_abc_loader.py b/Lib/importlib/test/source/test_abc_loader.py --- a/Lib/importlib/test/source/test_abc_loader.py +++ b/Lib/importlib/test/source/test_abc_loader.py @@ -42,8 +42,8 @@ self.bytecode_path = imp.cache_from_source(self.path) self.source_size = len(self.source) data = bytearray(magic) - data.extend(marshal._w_long(self.source_mtime)) - data.extend(marshal._w_long(self.source_size)) + data.extend(importlib._w_long(self.source_mtime)) + data.extend(importlib._w_long(self.source_size)) code_object = compile(self.source, self.path, 'exec', dont_inherit=True) data.extend(marshal.dumps(code_object)) @@ -658,8 +658,8 @@ if bytecode_written: self.assertIn(self.cached, self.loader.written) data = bytearray(imp.get_magic()) - data.extend(marshal._w_long(self.loader.source_mtime)) - data.extend(marshal._w_long(self.loader.source_size)) + data.extend(importlib._w_long(self.loader.source_mtime)) + data.extend(importlib._w_long(self.loader.source_size)) data.extend(marshal.dumps(code_object)) self.assertEqual(self.loader.written[self.cached], bytes(data)) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 26 14:58:35 2012 From: python-checkins at python.org (brett.cannon) Date: Thu, 26 Jan 2012 14:58:35 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/93075fb1360a changeset: 74631:93075fb1360a parent: 74629:d2cf8a34ddf9 parent: 74630:7d8f016784cd user: Brett Cannon date: Thu Jan 26 08:58:19 2012 -0500 summary: Merge files: Lib/importlib/__init__.py | 43 ++------- Lib/importlib/_bootstrap.py | 39 ++++++++- Lib/importlib/abc.py | 4 +- Lib/importlib/test/source/test_abc_loader.py | 8 +- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -26,8 +26,15 @@ import re import tokenize +# To simplify imports in test code +_w_long = _bootstrap._w_long +_r_long = _bootstrap._r_long + + # Bootstrap help ##################################################### +# TODO: Expose from import.c, else handle encode/decode as _os.environ returns +# bytes. def _case_ok(directory, check): """Check if the directory contains something matching 'check'. @@ -36,37 +43,13 @@ """ if 'PYTHONCASEOK' in os.environ: return True - elif check in os.listdir(directory if directory else os.getcwd()): + if not directory: + directory = os.getcwd() + if check in os.listdir(directory): return True return False - -def _w_long(x): - """Convert a 32-bit integer to little-endian. - - XXX Temporary until marshal's long functions are exposed. - - """ - x = int(x) - int_bytes = [] - int_bytes.append(x & 0xFF) - int_bytes.append((x >> 8) & 0xFF) - int_bytes.append((x >> 16) & 0xFF) - int_bytes.append((x >> 24) & 0xFF) - return bytearray(int_bytes) - - -def _r_long(int_bytes): - """Convert 4 bytes in little-endian to an integer. - - XXX Temporary until marshal's long function are exposed. - - """ - x = int_bytes[0] - x |= int_bytes[1] << 8 - x |= int_bytes[2] << 16 - x |= int_bytes[3] << 24 - return x +_bootstrap._case_ok = _case_ok # Required built-in modules. @@ -94,10 +77,6 @@ # For os.path.join replacement; pull from Include/osdefs.h:SEP . _bootstrap.path_sep = sep -_bootstrap._case_ok = _case_ok -marshal._w_long = _w_long -marshal._r_long = _r_long - # Public API ######################################################### diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -18,6 +18,37 @@ # Bootstrap-related code ###################################################### +# TODO: Expose from marshal +def _w_long(x): + """Convert a 32-bit integer to little-endian. + + XXX Temporary until marshal's long functions are exposed. + + """ + x = int(x) + int_bytes = [] + int_bytes.append(x & 0xFF) + int_bytes.append((x >> 8) & 0xFF) + int_bytes.append((x >> 16) & 0xFF) + int_bytes.append((x >> 24) & 0xFF) + return bytearray(int_bytes) + + +# TODO: Expose from marshal +def _r_long(int_bytes): + """Convert 4 bytes in little-endian to an integer. + + XXX Temporary until marshal's long function are exposed. + + """ + x = int_bytes[0] + x |= int_bytes[1] << 8 + x |= int_bytes[2] << 16 + x |= int_bytes[3] << 24 + return x + + + # XXX Could also expose Modules/getpath.c:joinpath() def _path_join(*args): """Replacement for os.path.join.""" @@ -353,14 +384,14 @@ except KeyError: pass else: - if marshal._r_long(raw_timestamp) != source_mtime: + if _r_long(raw_timestamp) != source_mtime: raise ImportError("bytecode is stale for {}".format(fullname)) try: source_size = source_stats['size'] & 0xFFFFFFFF except KeyError: pass else: - if marshal._r_long(raw_size) != source_size: + if _r_long(raw_size) != source_size: raise ImportError("bytecode is stale for {}".format(fullname)) # Can't return the code object as errors from marshal loading need to # propagate even when source is available. @@ -472,8 +503,8 @@ # their own cached file format, this block of code will most likely # throw an exception. data = bytearray(imp.get_magic()) - data.extend(marshal._w_long(source_mtime)) - data.extend(marshal._w_long(len(source_bytes))) + data.extend(_w_long(source_mtime)) + data.extend(_w_long(len(source_bytes))) data.extend(marshal.dumps(code_object)) try: self.set_data(bytecode_path, data) diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py --- a/Lib/importlib/abc.py +++ b/Lib/importlib/abc.py @@ -260,7 +260,7 @@ raw_timestamp = data[4:8] if len(raw_timestamp) < 4: raise EOFError("bad timestamp in {}".format(fullname)) - pyc_timestamp = marshal._r_long(raw_timestamp) + pyc_timestamp = _bootstrap._r_long(raw_timestamp) bytecode = data[8:] # Verify that the magic number is valid. if imp.get_magic() != magic: @@ -292,7 +292,7 @@ # Generate bytecode and write it out. if not sys.dont_write_bytecode: data = bytearray(imp.get_magic()) - data.extend(marshal._w_long(source_timestamp)) + data.extend(_bootstrap._w_long(source_timestamp)) data.extend(marshal.dumps(code_object)) self.write_bytecode(fullname, data) return code_object diff --git a/Lib/importlib/test/source/test_abc_loader.py b/Lib/importlib/test/source/test_abc_loader.py --- a/Lib/importlib/test/source/test_abc_loader.py +++ b/Lib/importlib/test/source/test_abc_loader.py @@ -42,8 +42,8 @@ self.bytecode_path = imp.cache_from_source(self.path) self.source_size = len(self.source) data = bytearray(magic) - data.extend(marshal._w_long(self.source_mtime)) - data.extend(marshal._w_long(self.source_size)) + data.extend(importlib._w_long(self.source_mtime)) + data.extend(importlib._w_long(self.source_size)) code_object = compile(self.source, self.path, 'exec', dont_inherit=True) data.extend(marshal.dumps(code_object)) @@ -658,8 +658,8 @@ if bytecode_written: self.assertIn(self.cached, self.loader.written) data = bytearray(imp.get_magic()) - data.extend(marshal._w_long(self.loader.source_mtime)) - data.extend(marshal._w_long(self.loader.source_size)) + data.extend(importlib._w_long(self.loader.source_mtime)) + data.extend(importlib._w_long(self.loader.source_size)) data.extend(marshal.dumps(code_object)) self.assertEqual(self.loader.written[self.cached], bytes(data)) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 26 15:49:35 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 26 Jan 2012 15:49:35 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_-_Issue_=231384?= =?utf8?q?0=3A_Fix_ctypes=2Ecreate=5Fstring=5Fbuffer_exception_message_and?= =?utf8?q?_docs=2E?= Message-ID: http://hg.python.org/cpython/rev/be9d02536a81 changeset: 74632:be9d02536a81 branch: 3.2 parent: 74628:f7283825effa user: Meador Inge date: Thu Jan 26 08:44:00 2012 -0600 summary: - Issue #13840: Fix ctypes.create_string_buffer exception message and docs. files: Doc/library/ctypes.rst | 4 ---- Misc/NEWS | 3 +++ Modules/_ctypes/_ctypes.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1815,8 +1815,6 @@ termination character. An integer can be passed as second argument which allows to specify the size of the array if the length of the bytes should not be used. - If the first parameter is a string, it is converted into a bytes object - according to ctypes conversion rules. .. function:: create_unicode_buffer(init_or_size, size=None) @@ -1833,8 +1831,6 @@ allows to specify the size of the array if the length of the string should not be used. - If the first parameter is a bytes object, it is converted into an unicode string - according to ctypes conversion rules. .. function:: DllCanUnloadNow() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -402,6 +402,9 @@ Extension Modules ----------------- +- Issue #13840: The error message produced by ctypes.create_string_buffer + when given a Unicode string has been fixed. + - Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1096,7 +1096,7 @@ if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, - "str/bytes expected instead of %s instance", + "bytes expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Thu Jan 26 15:49:36 2012 From: python-checkins at python.org (meador.inge) Date: Thu, 26 Jan 2012 15:49:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_-_Issue_=2313840=3A_Fix_ctypes=2Ecreate=5Fstring=5Fbuffer_ex?= =?utf8?q?ception_message_and_docs=2E?= Message-ID: http://hg.python.org/cpython/rev/52f68c95e025 changeset: 74633:52f68c95e025 parent: 74631:93075fb1360a parent: 74632:be9d02536a81 user: Meador Inge date: Thu Jan 26 08:47:27 2012 -0600 summary: - Issue #13840: Fix ctypes.create_string_buffer exception message and docs. files: Doc/library/ctypes.rst | 4 ---- Misc/NEWS | 3 +++ Modules/_ctypes/_ctypes.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1823,8 +1823,6 @@ termination character. An integer can be passed as second argument which allows to specify the size of the array if the length of the bytes should not be used. - If the first parameter is a string, it is converted into a bytes object - according to ctypes conversion rules. .. function:: create_unicode_buffer(init_or_size, size=None) @@ -1841,8 +1839,6 @@ allows to specify the size of the array if the length of the string should not be used. - If the first parameter is a bytes object, it is converted into an unicode string - according to ctypes conversion rules. .. function:: DllCanUnloadNow() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1837,6 +1837,9 @@ Extension Modules ----------------- +- Issue #13840: The error message produced by ctypes.create_string_buffer + when given a Unicode string has been fixed. + - Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1096,7 +1096,7 @@ if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, - "str/bytes expected instead of %s instance", + "bytes expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:08:50 2012 From: python-checkins at python.org (victor.stinner) Date: Fri, 27 Jan 2012 00:08:50 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313847=3A_time=2Elo?= =?utf8?q?caltime=28=29_and_time=2Egmtime=28=29_now_raise_an_OSError_inste?= =?utf8?q?ad?= Message-ID: http://hg.python.org/cpython/rev/9ee4a104e33d changeset: 74634:9ee4a104e33d user: Victor Stinner date: Fri Jan 27 00:08:48 2012 +0100 summary: Issue #13847: time.localtime() and time.gmtime() now raise an OSError instead of ValueError on failure. time.ctime() and time.asctime() now raises an OSError if localtime() failed. files: Lib/test/test_time.py | 15 +++ Misc/NEWS | 4 + Modules/timemodule.c | 114 ++++++++++++++++------------- 3 files changed, 81 insertions(+), 52 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -343,6 +343,21 @@ dt = t2 - t1 self.assertAlmostEqual(dt, 0.1, delta=0.2) + def test_localtime_failure(self): + # Issue #13847: check for localtime() failure + invalid_time_t = 2**60 + try: + time.localtime(invalid_time_t) + except ValueError as err: + if str(err) == "timestamp out of range for platform time_t": + self.skipTest("need 64-bit time_t") + else: + raise + except OSError: + pass + self.assertRaises(OSError, time.localtime, invalid_time_t) + self.assertRaises(OSError, time.gmtime, invalid_time_t) + self.assertRaises(OSError, time.ctime, invalid_time_t) class TestLocale(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,10 @@ Library ------- +- Issue #13847: time.localtime() and time.gmtime() now raise an OSError instead + of ValueError on failure. time.ctime() and time.asctime() now raises an + OSError if localtime() failed. + - Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time minor versions not matching. diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -247,55 +247,53 @@ return v; } -static PyObject * -time_convert(double when, struct tm * (*function)(const time_t *)) -{ - struct tm *p; - time_t whent = _PyTime_DoubleToTimet(when); - - if (whent == (time_t)-1 && PyErr_Occurred()) - return NULL; - errno = 0; - p = function(&whent); - if (p == NULL) { -#ifdef EINVAL - if (errno == 0) - errno = EINVAL; -#endif - return PyErr_SetFromErrno(PyExc_ValueError); - } - return tmtotuple(p); -} - /* Parse arg tuple that can contain an optional float-or-None value; format needs to be "|O:name". Returns non-zero on success (parallels PyArg_ParseTuple). */ static int -parse_time_double_args(PyObject *args, char *format, double *pwhen) +parse_time_t_args(PyObject *args, char *format, time_t *pwhen) { PyObject *ot = NULL; + time_t whent; if (!PyArg_ParseTuple(args, format, &ot)) return 0; - if (ot == NULL || ot == Py_None) - *pwhen = floattime(); + if (ot == NULL || ot == Py_None) { + whent = time(NULL); + } else { - double when = PyFloat_AsDouble(ot); + double d = PyFloat_AsDouble(ot); if (PyErr_Occurred()) return 0; - *pwhen = when; + whent = _PyTime_DoubleToTimet(d); + if (whent == (time_t)-1 && PyErr_Occurred()) + return 0; } + *pwhen = whent; return 1; } static PyObject * time_gmtime(PyObject *self, PyObject *args) { - double when; - if (!parse_time_double_args(args, "|O:gmtime", &when)) + time_t when; + struct tm buf, *local; + + if (!parse_time_t_args(args, "|O:gmtime", &when)) return NULL; - return time_convert(when, gmtime); + + errno = 0; + local = gmtime(&when); + if (local == NULL) { +#ifdef EINVAL + if (errno == 0) + errno = EINVAL; +#endif + return PyErr_SetFromErrno(PyExc_OSError); + } + buf = *local; + return tmtotuple(&buf); } PyDoc_STRVAR(gmtime_doc, @@ -305,13 +303,37 @@ Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.\n\ GMT). When 'seconds' is not passed in, convert the current time instead."); +static int +pylocaltime(time_t *timep, struct tm *result) +{ + struct tm *local; + + assert (timep != NULL); + local = localtime(timep); + if (local == NULL) { + /* unconvertible time */ +#ifdef EINVAL + if (errno == 0) + errno = EINVAL; +#endif + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + *result = *local; + return 0; +} + static PyObject * time_localtime(PyObject *self, PyObject *args) { - double when; - if (!parse_time_double_args(args, "|O:localtime", &when)) + time_t when; + struct tm buf; + + if (!parse_time_t_args(args, "|O:localtime", &when)) return NULL; - return time_convert(when, localtime); + if (pylocaltime(&when, &buf) == 1) + return NULL; + return tmtotuple(&buf); } PyDoc_STRVAR(localtime_doc, @@ -462,7 +484,8 @@ if (tup == NULL) { time_t tt = time(NULL); - buf = *localtime(&tt); + if (pylocaltime(&tt, &buf) == -1) + return NULL; } else if (!gettmarg(tup, &buf) || !checktm(&buf)) return NULL; @@ -627,7 +650,9 @@ return NULL; if (tup == NULL) { time_t tt = time(NULL); - buf = *localtime(&tt); + if (pylocaltime(&tt, &buf) == -1) + return NULL; + } else if (!gettmarg(tup, &buf) || !checktm(&buf)) return NULL; return _asctime(&buf); @@ -643,28 +668,13 @@ static PyObject * time_ctime(PyObject *self, PyObject *args) { - PyObject *ot = NULL; time_t tt; - struct tm *timeptr; - - if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot)) + struct tm buf; + if (!parse_time_t_args(args, "|O:ctime", &tt)) return NULL; - if (ot == NULL || ot == Py_None) - tt = time(NULL); - else { - double dt = PyFloat_AsDouble(ot); - if (PyErr_Occurred()) - return NULL; - tt = _PyTime_DoubleToTimet(dt); - if (tt == (time_t)-1 && PyErr_Occurred()) - return NULL; - } - timeptr = localtime(&tt); - if (timeptr == NULL) { - PyErr_SetString(PyExc_ValueError, "unconvertible time"); + if (pylocaltime(&tt, &buf) == -1) return NULL; - } - return _asctime(timeptr); + return _asctime(&buf); } PyDoc_STRVAR(ctime_doc, -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:37:13 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 00:37:13 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODgz?= =?utf8?q?=3A_Document_all_platforms_PYTHONCASEOK_works_on=2E?= Message-ID: http://hg.python.org/cpython/rev/524795e8abe1 changeset: 74635:524795e8abe1 branch: 3.2 parent: 74623:5b8800012e88 user: Brett Cannon date: Thu Jan 26 18:29:06 2012 -0500 summary: Issue #13883: Document all platforms PYTHONCASEOK works on. files: Doc/using/cmdline.rst | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -448,7 +448,7 @@ .. envvar:: PYTHONCASEOK If this is set, Python ignores case in :keyword:`import` statements. This - only works on Windows. + only works on Windows, OS X, and OS/2. .. envvar:: PYTHONDONTWRITEBYTECODE diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -432,6 +432,8 @@ Documentation ------------- +- Issue #13883: PYTHONCASEOK also used on OS X and OS/2. + - Issue #12949: Document the kwonlyargcount argument for the PyCode_New C API function. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:37:14 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 00:37:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313883=3A_PYTHONCASEOK_also_works_with_OS_X=2E?= Message-ID: http://hg.python.org/cpython/rev/0f00010c88f0 changeset: 74636:0f00010c88f0 parent: 74630:7d8f016784cd parent: 74635:524795e8abe1 user: Brett Cannon date: Thu Jan 26 18:30:52 2012 -0500 summary: Issue #13883: PYTHONCASEOK also works with OS X. files: Doc/using/cmdline.rst | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -450,7 +450,7 @@ .. envvar:: PYTHONCASEOK If this is set, Python ignores case in :keyword:`import` statements. This - only works on Windows. + only works on Windows and OS X. .. envvar:: PYTHONDONTWRITEBYTECODE diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2117,6 +2117,8 @@ Documentation ------------- +- Issue #13883: PYTHONCASEOK also works on OS X. + - Issue #12949: Document the kwonlyargcount argument for the PyCode_New C API function. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:37:16 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 00:37:16 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzODgz?= =?utf8?q?=3A_Document_all_platforms_PYTHONCASEOK_works_on=2E?= Message-ID: http://hg.python.org/cpython/rev/f18662285248 changeset: 74637:f18662285248 branch: 2.7 parent: 74626:232c7d73b09d user: Brett Cannon date: Thu Jan 26 18:32:24 2012 -0500 summary: Issue #13883: Document all platforms PYTHONCASEOK works on. files: Doc/using/cmdline.rst | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -512,7 +512,7 @@ .. envvar:: PYTHONCASEOK If this is set, Python ignores case in :keyword:`import` statements. This - only works on Windows. + only works on Windows, OS X, OS/2, and RiscOS. .. envvar:: PYTHONDONTWRITEBYTECODE diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -498,6 +498,8 @@ Documentation ------------- +- Issue #13883: PYTHONCASEOK also works on OS X, OS/2, and RiscOS. + - Issue #2134: The tokenize documentation has been clarified to explain why all operator and delimiter tokens are treated as token.OP tokens. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:37:17 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 00:37:17 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4yIC0+IDMuMik6?= =?utf8?q?_merge?= Message-ID: http://hg.python.org/cpython/rev/90368391f0f9 changeset: 74639:90368391f0f9 branch: 3.2 parent: 74632:be9d02536a81 parent: 74635:524795e8abe1 user: Brett Cannon date: Thu Jan 26 18:36:08 2012 -0500 summary: merge files: Doc/using/cmdline.rst | 2 +- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -448,7 +448,7 @@ .. envvar:: PYTHONCASEOK If this is set, Python ignores case in :keyword:`import` statements. This - only works on Windows. + only works on Windows, OS X, and OS/2. .. envvar:: PYTHONDONTWRITEBYTECODE diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -435,6 +435,8 @@ Documentation ------------- +- Issue #13883: PYTHONCASEOK also used on OS X and OS/2. + - Issue #12949: Document the kwonlyargcount argument for the PyCode_New C API function. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:37:17 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 00:37:17 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/dc3de15b43db changeset: 74638:dc3de15b43db parent: 74636:0f00010c88f0 parent: 74634:9ee4a104e33d user: Brett Cannon date: Thu Jan 26 18:34:34 2012 -0500 summary: Merge files: Doc/library/ctypes.rst | 4 - Lib/collections/__init__.py | 2 +- Lib/test/test_time.py | 15 +++ Misc/NEWS | 7 + Modules/_ctypes/_ctypes.c | 2 +- Modules/timemodule.c | 114 +++++++++++++---------- Python/import.c | 6 - 7 files changed, 86 insertions(+), 64 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1823,8 +1823,6 @@ termination character. An integer can be passed as second argument which allows to specify the size of the array if the length of the bytes should not be used. - If the first parameter is a string, it is converted into a bytes object - according to ctypes conversion rules. .. function:: create_unicode_buffer(init_or_size, size=None) @@ -1841,8 +1839,6 @@ allows to specify the size of the array if the length of the string should not be used. - If the first parameter is a bytes object, it is converted into an unicode string - according to ctypes conversion rules. .. function:: DllCanUnloadNow() diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -34,7 +34,7 @@ # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # The sentinel is in self.__hardroot with a weakref proxy in self.__root. - # The prev/next links are weakref proxies (to prevent circular references). + # The prev links are weakref proxies (to prevent circular references). # Individual links are kept alive by the hard reference in self.__map. # Those hard references disappear when a key is deleted from an OrderedDict. diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -343,6 +343,21 @@ dt = t2 - t1 self.assertAlmostEqual(dt, 0.1, delta=0.2) + def test_localtime_failure(self): + # Issue #13847: check for localtime() failure + invalid_time_t = 2**60 + try: + time.localtime(invalid_time_t) + except ValueError as err: + if str(err) == "timestamp out of range for platform time_t": + self.skipTest("need 64-bit time_t") + else: + raise + except OSError: + pass + self.assertRaises(OSError, time.localtime, invalid_time_t) + self.assertRaises(OSError, time.gmtime, invalid_time_t) + self.assertRaises(OSError, time.ctime, invalid_time_t) class TestLocale(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,10 @@ Library ------- +- Issue #13847: time.localtime() and time.gmtime() now raise an OSError instead + of ValueError on failure. time.ctime() and time.asctime() now raises an + OSError if localtime() failed. + - Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time minor versions not matching. @@ -1837,6 +1841,9 @@ Extension Modules ----------------- +- Issue #13840: The error message produced by ctypes.create_string_buffer + when given a Unicode string has been fixed. + - Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1096,7 +1096,7 @@ if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, - "str/bytes expected instead of %s instance", + "bytes expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -247,55 +247,53 @@ return v; } -static PyObject * -time_convert(double when, struct tm * (*function)(const time_t *)) -{ - struct tm *p; - time_t whent = _PyTime_DoubleToTimet(when); - - if (whent == (time_t)-1 && PyErr_Occurred()) - return NULL; - errno = 0; - p = function(&whent); - if (p == NULL) { -#ifdef EINVAL - if (errno == 0) - errno = EINVAL; -#endif - return PyErr_SetFromErrno(PyExc_ValueError); - } - return tmtotuple(p); -} - /* Parse arg tuple that can contain an optional float-or-None value; format needs to be "|O:name". Returns non-zero on success (parallels PyArg_ParseTuple). */ static int -parse_time_double_args(PyObject *args, char *format, double *pwhen) +parse_time_t_args(PyObject *args, char *format, time_t *pwhen) { PyObject *ot = NULL; + time_t whent; if (!PyArg_ParseTuple(args, format, &ot)) return 0; - if (ot == NULL || ot == Py_None) - *pwhen = floattime(); + if (ot == NULL || ot == Py_None) { + whent = time(NULL); + } else { - double when = PyFloat_AsDouble(ot); + double d = PyFloat_AsDouble(ot); if (PyErr_Occurred()) return 0; - *pwhen = when; + whent = _PyTime_DoubleToTimet(d); + if (whent == (time_t)-1 && PyErr_Occurred()) + return 0; } + *pwhen = whent; return 1; } static PyObject * time_gmtime(PyObject *self, PyObject *args) { - double when; - if (!parse_time_double_args(args, "|O:gmtime", &when)) + time_t when; + struct tm buf, *local; + + if (!parse_time_t_args(args, "|O:gmtime", &when)) return NULL; - return time_convert(when, gmtime); + + errno = 0; + local = gmtime(&when); + if (local == NULL) { +#ifdef EINVAL + if (errno == 0) + errno = EINVAL; +#endif + return PyErr_SetFromErrno(PyExc_OSError); + } + buf = *local; + return tmtotuple(&buf); } PyDoc_STRVAR(gmtime_doc, @@ -305,13 +303,37 @@ Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.\n\ GMT). When 'seconds' is not passed in, convert the current time instead."); +static int +pylocaltime(time_t *timep, struct tm *result) +{ + struct tm *local; + + assert (timep != NULL); + local = localtime(timep); + if (local == NULL) { + /* unconvertible time */ +#ifdef EINVAL + if (errno == 0) + errno = EINVAL; +#endif + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + *result = *local; + return 0; +} + static PyObject * time_localtime(PyObject *self, PyObject *args) { - double when; - if (!parse_time_double_args(args, "|O:localtime", &when)) + time_t when; + struct tm buf; + + if (!parse_time_t_args(args, "|O:localtime", &when)) return NULL; - return time_convert(when, localtime); + if (pylocaltime(&when, &buf) == 1) + return NULL; + return tmtotuple(&buf); } PyDoc_STRVAR(localtime_doc, @@ -462,7 +484,8 @@ if (tup == NULL) { time_t tt = time(NULL); - buf = *localtime(&tt); + if (pylocaltime(&tt, &buf) == -1) + return NULL; } else if (!gettmarg(tup, &buf) || !checktm(&buf)) return NULL; @@ -627,7 +650,9 @@ return NULL; if (tup == NULL) { time_t tt = time(NULL); - buf = *localtime(&tt); + if (pylocaltime(&tt, &buf) == -1) + return NULL; + } else if (!gettmarg(tup, &buf) || !checktm(&buf)) return NULL; return _asctime(&buf); @@ -643,28 +668,13 @@ static PyObject * time_ctime(PyObject *self, PyObject *args) { - PyObject *ot = NULL; time_t tt; - struct tm *timeptr; - - if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot)) + struct tm buf; + if (!parse_time_t_args(args, "|O:ctime", &tt)) return NULL; - if (ot == NULL || ot == Py_None) - tt = time(NULL); - else { - double dt = PyFloat_AsDouble(ot); - if (PyErr_Occurred()) - return NULL; - tt = _PyTime_DoubleToTimet(dt); - if (tt == (time_t)-1 && PyErr_Occurred()) - return NULL; - } - timeptr = localtime(&tt); - if (timeptr == NULL) { - PyErr_SetString(PyExc_ValueError, "unconvertible time"); + if (pylocaltime(&tt, &buf) == -1) return NULL; - } - return _asctime(timeptr); + return _asctime(&buf); } PyDoc_STRVAR(ctime_doc, diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -2052,12 +2052,6 @@ if (p_loader != NULL) *p_loader = NULL; - if (PyUnicode_GET_LENGTH(name) > MAXPATHLEN) { - PyErr_SetString(PyExc_OverflowError, - "module name is too long"); - return NULL; - } - /* sys.meta_path import hook */ if (p_loader != NULL) { _Py_IDENTIFIER(find_module); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:39:22 2012 From: python-checkins at python.org (victor.stinner) Date: Fri, 27 Jan 2012 00:39:22 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313847=3A_time=2Ecl?= =?utf8?q?ock=28=29_now_raises_a_RuntimeError_if_the_processor_time_used?= Message-ID: http://hg.python.org/cpython/rev/94b7eb09d0b3 changeset: 74640:94b7eb09d0b3 parent: 74638:dc3de15b43db user: Victor Stinner date: Fri Jan 27 00:38:48 2012 +0100 summary: Issue #13847: time.clock() now raises a RuntimeError if the processor time used is not available or its value cannot be represented files: Misc/NEWS | 3 +- Modules/timemodule.c | 38 ++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -463,7 +463,8 @@ - Issue #13847: time.localtime() and time.gmtime() now raise an OSError instead of ValueError on failure. time.ctime() and time.asctime() now raises an - OSError if localtime() failed. + OSError if localtime() failed. time.clock() now raises a RuntimeError if the + processor time used is not available or its value cannot be represented - Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time minor versions not matching. diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -62,6 +62,31 @@ Return the current time in seconds since the Epoch.\n\ Fractions of a second may be present if the system clock provides them."); +#if defined(HAVE_CLOCK) + +#ifndef CLOCKS_PER_SEC +#ifdef CLK_TCK +#define CLOCKS_PER_SEC CLK_TCK +#else +#define CLOCKS_PER_SEC 1000000 +#endif +#endif + +static PyObject * +pyclock(void) +{ + clock_t value; + value = clock(); + if (value == (clock_t)-1) { + PyErr_SetString(PyExc_RuntimeError, + "the processor time used is not available " + "or its value cannot be represented"); + return NULL; + } + return PyFloat_FromDouble((double)value / CLOCKS_PER_SEC); +} +#endif /* HAVE_CLOCK */ + #if defined(MS_WINDOWS) && !defined(__BORLANDC__) /* Win32 has better clock replacement; we have our own version, due to Mark Hammond and Tim Peters */ @@ -79,8 +104,7 @@ if (!QueryPerformanceFrequency(&freq) || freq.QuadPart == 0) { /* Unlikely to happen - this works on all intel machines at least! Revert to clock() */ - return PyFloat_FromDouble(((double)clock()) / - CLOCKS_PER_SEC); + return pyclock(); } divisor = (double)freq.QuadPart; } @@ -91,18 +115,10 @@ #elif defined(HAVE_CLOCK) -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#else -#define CLOCKS_PER_SEC 1000000 -#endif -#endif - static PyObject * time_clock(PyObject *self, PyObject *unused) { - return PyFloat_FromDouble(((double)clock()) / CLOCKS_PER_SEC); + return pyclock(); } #endif /* HAVE_CLOCK */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 00:50:32 2012 From: python-checkins at python.org (victor.stinner) Date: Fri, 27 Jan 2012 00:50:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313847=3A_Fix_test?= =?utf8?q?=5Fmktime=28=29=2C_time=2Elocaltime=28=29_now_raises_OSError?= Message-ID: http://hg.python.org/cpython/rev/516d42a6e518 changeset: 74641:516d42a6e518 user: Victor Stinner date: Fri Jan 27 00:50:33 2012 +0100 summary: Issue #13847: Fix test_mktime(), time.localtime() now raises OSError files: Lib/test/test_time.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -309,7 +309,7 @@ for t in (-2, -1, 0, 1): try: tt = time.localtime(t) - except (OverflowError, ValueError): + except (OverflowError, OSError): pass else: self.assertEqual(time.mktime(tt), t) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 01:03:28 2012 From: python-checkins at python.org (victor.stinner) Date: Fri, 27 Jan 2012 01:03:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313847=3A_Make_test?= =?utf8?q?=5Flocaltime=5Ffailure=28=29_more_robust?= Message-ID: http://hg.python.org/cpython/rev/856f0864437a changeset: 74642:856f0864437a user: Victor Stinner date: Fri Jan 27 01:03:25 2012 +0100 summary: Issue #13847: Make test_localtime_failure() more robust Skip the test if we are unable to find an invalid time_t value. files: Lib/test/test_time.py | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -345,16 +345,21 @@ def test_localtime_failure(self): # Issue #13847: check for localtime() failure - invalid_time_t = 2**60 - try: - time.localtime(invalid_time_t) - except ValueError as err: - if str(err) == "timestamp out of range for platform time_t": - self.skipTest("need 64-bit time_t") - else: - raise - except OSError: - pass + invalid_time_t = None + for time_t in (-1, 2**30, 2**33, 2**60): + try: + time.localtime(time_t) + except ValueError as err: + if str(err) == "timestamp out of range for platform time_t": + self.skipTest("need 64-bit time_t") + else: + raise + except OSError: + invalid_time_t = time_t + break + if invalid_time_t is None: + self.skipTest("unable to find an invalid time_t value") + self.assertRaises(OSError, time.localtime, invalid_time_t) self.assertRaises(OSError, time.gmtime, invalid_time_t) self.assertRaises(OSError, time.ctime, invalid_time_t) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 01:09:51 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 01:09:51 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Relocate_importlib=2E=5Fcas?= =?utf8?q?e=5Fok_to_importlib=2E=5Fbootstrap=2E?= Message-ID: http://hg.python.org/cpython/rev/ecf4a7bb8807 changeset: 74643:ecf4a7bb8807 parent: 74638:dc3de15b43db user: Brett Cannon date: Thu Jan 26 19:03:52 2012 -0500 summary: Relocate importlib._case_ok to importlib._bootstrap. This required updating the code to use posix instead of os. This is all being done to make bootstrapping easier to removing dependencies that are kept in importlib.__init__ and thus outside of the single file to bootstrap from. files: Lib/importlib/__init__.py | 19 ----------------- Lib/importlib/_bootstrap.py | 27 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/Lib/importlib/__init__.py b/Lib/importlib/__init__.py --- a/Lib/importlib/__init__.py +++ b/Lib/importlib/__init__.py @@ -33,25 +33,6 @@ # Bootstrap help ##################################################### -# TODO: Expose from import.c, else handle encode/decode as _os.environ returns -# bytes. -def _case_ok(directory, check): - """Check if the directory contains something matching 'check'. - - No check is done if the file/directory exists or not. - - """ - if 'PYTHONCASEOK' in os.environ: - return True - if not directory: - directory = os.getcwd() - if check in os.listdir(directory): - return True - return False - -_bootstrap._case_ok = _case_ok - - # Required built-in modules. try: import posix as _os diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -18,6 +18,33 @@ # Bootstrap-related code ###################################################### +# TODO: when not on any of these platforms, replace _case_ok() w/ +# ``lambda x,y: True``. +CASE_OK_PLATFORMS = 'win', 'cygwin', 'darwin' + +def _case_ok(directory, check): + """Check if the directory contains something matching 'check' + case-sensitively when running on Windows or OS X. + + If running on Window or OS X and PYTHONCASEOK is a defined environment + variable then no case-sensitive check is performed. No check is done to see + if what is being checked for exists, so if the platform is not Windows or + OS X then assume the case is fine. + + """ + if (any(map(sys.platform.startswith, CASE_OK_PLATFORMS)) and + b'PYTHONCASEOK' not in _os.environ): + if not directory: + directory = '.' + if check in _os.listdir(directory): + return True + else: + return False + else: + return True + + + # TODO: Expose from marshal def _w_long(x): """Convert a 32-bit integer to little-endian. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 01:09:52 2012 From: python-checkins at python.org (brett.cannon) Date: Fri, 27 Jan 2012 01:09:52 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/082eea3fc9bc changeset: 74644:082eea3fc9bc parent: 74643:ecf4a7bb8807 parent: 74642:856f0864437a user: Brett Cannon date: Thu Jan 26 19:09:44 2012 -0500 summary: Merge files: Lib/test/test_time.py | 27 +++++++++++++-------- Misc/NEWS | 3 +- Modules/timemodule.c | 38 ++++++++++++++++++++++-------- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -309,7 +309,7 @@ for t in (-2, -1, 0, 1): try: tt = time.localtime(t) - except (OverflowError, ValueError): + except (OverflowError, OSError): pass else: self.assertEqual(time.mktime(tt), t) @@ -345,16 +345,21 @@ def test_localtime_failure(self): # Issue #13847: check for localtime() failure - invalid_time_t = 2**60 - try: - time.localtime(invalid_time_t) - except ValueError as err: - if str(err) == "timestamp out of range for platform time_t": - self.skipTest("need 64-bit time_t") - else: - raise - except OSError: - pass + invalid_time_t = None + for time_t in (-1, 2**30, 2**33, 2**60): + try: + time.localtime(time_t) + except ValueError as err: + if str(err) == "timestamp out of range for platform time_t": + self.skipTest("need 64-bit time_t") + else: + raise + except OSError: + invalid_time_t = time_t + break + if invalid_time_t is None: + self.skipTest("unable to find an invalid time_t value") + self.assertRaises(OSError, time.localtime, invalid_time_t) self.assertRaises(OSError, time.gmtime, invalid_time_t) self.assertRaises(OSError, time.ctime, invalid_time_t) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -463,7 +463,8 @@ - Issue #13847: time.localtime() and time.gmtime() now raise an OSError instead of ValueError on failure. time.ctime() and time.asctime() now raises an - OSError if localtime() failed. + OSError if localtime() failed. time.clock() now raises a RuntimeError if the + processor time used is not available or its value cannot be represented - Issue #13862: Fix spurious failure in test_zlib due to runtime/compile time minor versions not matching. diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -62,6 +62,31 @@ Return the current time in seconds since the Epoch.\n\ Fractions of a second may be present if the system clock provides them."); +#if defined(HAVE_CLOCK) + +#ifndef CLOCKS_PER_SEC +#ifdef CLK_TCK +#define CLOCKS_PER_SEC CLK_TCK +#else +#define CLOCKS_PER_SEC 1000000 +#endif +#endif + +static PyObject * +pyclock(void) +{ + clock_t value; + value = clock(); + if (value == (clock_t)-1) { + PyErr_SetString(PyExc_RuntimeError, + "the processor time used is not available " + "or its value cannot be represented"); + return NULL; + } + return PyFloat_FromDouble((double)value / CLOCKS_PER_SEC); +} +#endif /* HAVE_CLOCK */ + #if defined(MS_WINDOWS) && !defined(__BORLANDC__) /* Win32 has better clock replacement; we have our own version, due to Mark Hammond and Tim Peters */ @@ -79,8 +104,7 @@ if (!QueryPerformanceFrequency(&freq) || freq.QuadPart == 0) { /* Unlikely to happen - this works on all intel machines at least! Revert to clock() */ - return PyFloat_FromDouble(((double)clock()) / - CLOCKS_PER_SEC); + return pyclock(); } divisor = (double)freq.QuadPart; } @@ -91,18 +115,10 @@ #elif defined(HAVE_CLOCK) -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#else -#define CLOCKS_PER_SEC 1000000 -#endif -#endif - static PyObject * time_clock(PyObject *self, PyObject *unused) { - return PyFloat_FromDouble(((double)clock()) / CLOCKS_PER_SEC); + return pyclock(); } #endif /* HAVE_CLOCK */ -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Fri Jan 27 05:32:26 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 27 Jan 2012 05:32:26 +0100 Subject: [Python-checkins] Daily reference leaks (082eea3fc9bc): sum=0 Message-ID: results for 082eea3fc9bc on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogxesYJK', '-x'] From python-checkins at python.org Fri Jan 27 09:49:21 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 09:49:21 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi42KTogSXNzdWUgIzEzODg1?= =?utf8?q?=3A_CVE-2011-3389=3A_the_=5Fssl_module_would_always_disable_the_?= =?utf8?q?CBC_IV?= Message-ID: http://hg.python.org/cpython/rev/9a4131ada792 changeset: 74645:9a4131ada792 branch: 2.6 parent: 73245:62fa61f2ee7d user: Antoine Pitrou date: Fri Jan 27 09:42:45 2012 +0100 summary: Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. files: Misc/NEWS | 3 +++ Modules/_ssl.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC + IV attack countermeasure. + What's New in Python 2.6.7? =========================== diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -357,7 +357,8 @@ } /* ssl compatibility */ - SSL_CTX_set_options(self->ctx, SSL_OP_ALL); + SSL_CTX_set_options(self->ctx, + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); verification_mode = SSL_VERIFY_NONE; if (certreq == PY_SSL_CERT_OPTIONAL) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 09:49:22 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 09:49:22 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMi42IC0+IDIuNyk6?= =?utf8?q?_Issue_=2313885=3A_CVE-2011-3389=3A_the_=5Fssl_module_would_alwa?= =?utf8?q?ys_disable_the_CBC_IV?= Message-ID: http://hg.python.org/cpython/rev/8dec547c23d3 changeset: 74646:8dec547c23d3 branch: 2.7 parent: 74637:f18662285248 parent: 74645:9a4131ada792 user: Antoine Pitrou date: Fri Jan 27 09:44:08 2012 +0100 summary: Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. files: Misc/NEWS | 3 +++ Modules/_ssl.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -90,6 +90,9 @@ Library ------- +- Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC + IV attack countermeasure. + - Issue #6631: Disallow relative file paths in urllib urlopen methods. - Issue #13781: Prevent gzip.GzipFile from using the dummy filename provided by diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -369,7 +369,8 @@ } /* ssl compatibility */ - SSL_CTX_set_options(self->ctx, SSL_OP_ALL); + SSL_CTX_set_options(self->ctx, + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); verification_mode = SSL_VERIFY_NONE; if (certreq == PY_SSL_CERT_OPTIONAL) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 09:57:49 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 09:57:49 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4xKTogSXNzdWUgIzEzODg1?= =?utf8?q?=3A_CVE-2011-3389=3A_the_=5Fssl_module_would_always_disable_the_?= =?utf8?q?CBC_IV?= Message-ID: http://hg.python.org/cpython/rev/e7706bdaaa0d changeset: 74647:e7706bdaaa0d branch: 3.1 parent: 74538:73dad4940b88 user: Antoine Pitrou date: Fri Jan 27 09:48:47 2012 +0100 summary: Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. files: Misc/NEWS | 3 +++ Modules/_ssl.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC + IV attack countermeasure. + - Issue #11603: Fix a crash when __str__ is rebound as __repr__. Patch by Andreas St?hrk. diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -365,7 +365,8 @@ } /* ssl compatibility */ - SSL_CTX_set_options(self->ctx, SSL_OP_ALL); + SSL_CTX_set_options(self->ctx, + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); verification_mode = SSL_VERIFY_NONE; if (certreq == PY_SSL_CERT_OPTIONAL) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 09:57:49 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 09:57:49 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAobWVyZ2UgMy4xIC0+IDMuMik6?= =?utf8?q?_Issue_=2313885=3A_CVE-2011-3389=3A_the_=5Fssl_module_would_alwa?= =?utf8?q?ys_disable_the_CBC_IV?= Message-ID: http://hg.python.org/cpython/rev/4386686a035d changeset: 74648:4386686a035d branch: 3.2 parent: 74639:90368391f0f9 parent: 74647:e7706bdaaa0d user: Antoine Pitrou date: Fri Jan 27 09:50:45 2012 +0100 summary: Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. files: Misc/NEWS | 3 +++ Modules/_ssl.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -111,6 +111,9 @@ Library ------- +- Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC + IV attack countermeasure. + - Issue #13772: In os.symlink() under Windows, do not try to guess the link target's type (file or directory). The detection was buggy and made the call non-atomic (therefore prone to race conditions). diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1481,7 +1481,8 @@ self->ctx = ctx; /* Defaults */ SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL); - SSL_CTX_set_options(self->ctx, SSL_OP_ALL); + SSL_CTX_set_options(self->ctx, + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); #define SID_CTX "Python" SSL_CTX_set_session_id_context(self->ctx, (const unsigned char *) SID_CTX, @@ -2143,7 +2144,8 @@ PY_SSL_VERSION_TLS1); /* protocol options */ - PyModule_AddIntConstant(m, "OP_ALL", SSL_OP_ALL); + PyModule_AddIntConstant(m, "OP_ALL", + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); PyModule_AddIntConstant(m, "OP_NO_SSLv2", SSL_OP_NO_SSLv2); PyModule_AddIntConstant(m, "OP_NO_SSLv3", SSL_OP_NO_SSLv3); PyModule_AddIntConstant(m, "OP_NO_TLSv1", SSL_OP_NO_TLSv1); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 09:57:50 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 09:57:50 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313885=3A_CVE-2011-3389=3A_the_=5Fssl_module_would_a?= =?utf8?q?lways_disable_the_CBC_IV?= Message-ID: http://hg.python.org/cpython/rev/d1390175fdc6 changeset: 74649:d1390175fdc6 parent: 74644:082eea3fc9bc parent: 74648:4386686a035d user: Antoine Pitrou date: Fri Jan 27 09:53:29 2012 +0100 summary: Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. files: Misc/NEWS | 3 +++ Modules/_ssl.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC + IV attack countermeasure. + - Issue #13847: time.localtime() and time.gmtime() now raise an OSError instead of ValueError on failure. time.ctime() and time.asctime() now raises an OSError if localtime() failed. time.clock() now raises a RuntimeError if the diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1566,7 +1566,8 @@ self->ctx = ctx; /* Defaults */ SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL); - SSL_CTX_set_options(self->ctx, SSL_OP_ALL); + SSL_CTX_set_options(self->ctx, + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); #define SID_CTX "Python" SSL_CTX_set_session_id_context(self->ctx, (const unsigned char *) SID_CTX, @@ -2533,7 +2534,8 @@ PY_SSL_VERSION_TLS1); /* protocol options */ - PyModule_AddIntConstant(m, "OP_ALL", SSL_OP_ALL); + PyModule_AddIntConstant(m, "OP_ALL", + SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS); PyModule_AddIntConstant(m, "OP_NO_SSLv2", SSL_OP_NO_SSLv2); PyModule_AddIntConstant(m, "OP_NO_SSLv3", SSL_OP_NO_SSLv3); PyModule_AddIntConstant(m, "OP_NO_TLSv1", SSL_OP_NO_TLSv1); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 10:05:42 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 10:05:42 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Clarify_that_ss?= =?utf8?q?l=2EOP=5FALL_can_be_different_from_OpenSSL=27s_SSL=5FOP=5FALL=2E?= Message-ID: http://hg.python.org/cpython/rev/f8f9724e427c changeset: 74650:f8f9724e427c branch: 3.2 parent: 74648:4386686a035d user: Antoine Pitrou date: Fri Jan 27 10:02:55 2012 +0100 summary: Clarify that ssl.OP_ALL can be different from OpenSSL's SSL_OP_ALL. files: Doc/library/ssl.rst | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -316,7 +316,8 @@ .. data:: OP_ALL Enables workarounds for various bugs present in other SSL implementations. - This option is set by default. + This option is set by default. It does not necessarily set the same + flags as OpenSSL's ``SSL_OP_ALL`` constant. .. versionadded:: 3.2 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 10:05:43 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 10:05:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Clarify_that_ssl=2EOP=5FALL_can_be_different_from_OpenSSL=27?= =?utf8?q?s_SSL=5FOP=5FALL=2E?= Message-ID: http://hg.python.org/cpython/rev/849e113ddf83 changeset: 74651:849e113ddf83 parent: 74649:d1390175fdc6 parent: 74650:f8f9724e427c user: Antoine Pitrou date: Fri Jan 27 10:03:23 2012 +0100 summary: Clarify that ssl.OP_ALL can be different from OpenSSL's SSL_OP_ALL. files: Doc/library/ssl.rst | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -392,7 +392,8 @@ .. data:: OP_ALL Enables workarounds for various bugs present in other SSL implementations. - This option is set by default. + This option is set by default. It does not necessarily set the same + flags as OpenSSL's ``SSL_OP_ALL`` constant. .. versionadded:: 3.2 -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 10:58:02 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 10:58:02 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODEy?= =?utf8?q?=3A_When_a_multiprocessing_Process_child_raises_an_exception=2C_?= =?utf8?q?flush?= Message-ID: http://hg.python.org/cpython/rev/2863d9273abd changeset: 74652:2863d9273abd branch: 3.2 parent: 74650:f8f9724e427c user: Antoine Pitrou date: Fri Jan 27 10:52:37 2012 +0100 summary: Issue #13812: When a multiprocessing Process child raises an exception, flush stderr after printing the exception traceback. files: Lib/multiprocessing/forking.py | 2 - Lib/multiprocessing/process.py | 7 +++-- Lib/test/test_multiprocessing.py | 23 ++++++++++++++++++++ Misc/NEWS | 3 ++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -124,8 +124,6 @@ import random random.seed() code = process_obj._bootstrap() - sys.stdout.flush() - sys.stderr.flush() os._exit(code) def poll(self, flag=os.WNOHANG): diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -275,16 +275,17 @@ exitcode = e.args[0] else: sys.stderr.write(e.args[0] + '\n') - sys.stderr.flush() exitcode = 1 except: exitcode = 1 import traceback sys.stderr.write('Process %s:\n' % self.name) + traceback.print_exc() + finally: + util.info('process exiting with exitcode %d' % exitcode) + sys.stdout.flush() sys.stderr.flush() - traceback.print_exc() - util.info('process exiting with exitcode %d' % exitcode) return exitcode # diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -367,6 +367,29 @@ uppercaser.stop() uppercaser.join() + def test_stderr_flush(self): + # sys.stderr is flushed at process shutdown (issue #13812) + if self.TYPE == "threads": + return + + testfn = test.support.TESTFN + self.addCleanup(test.support.unlink, testfn) + proc = self.Process(target=self._test_stderr_flush, args=(testfn,)) + proc.start() + proc.join() + with open(testfn, 'r') as f: + err = f.read() + # The whole traceback was printed + self.assertIn("ZeroDivisionError", err) + self.assertIn("test_multiprocessing.py", err) + self.assertIn("1/0 # MARKER", err) + + @classmethod + def _test_stderr_flush(cls, testfn): + sys.stderr = open(testfn, 'w') + 1/0 # MARKER + + # # # diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -111,6 +111,9 @@ Library ------- +- Issue #13812: When a multiprocessing Process child raises an exception, + flush stderr after printing the exception traceback. + - Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 10:58:03 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 10:58:03 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313812=3A_When_a_multiprocessing_Process_child_raise?= =?utf8?q?s_an_exception=2C_flush?= Message-ID: http://hg.python.org/cpython/rev/96c1de5acbd3 changeset: 74653:96c1de5acbd3 parent: 74651:849e113ddf83 parent: 74652:2863d9273abd user: Antoine Pitrou date: Fri Jan 27 10:53:35 2012 +0100 summary: Issue #13812: When a multiprocessing Process child raises an exception, flush stderr after printing the exception traceback. files: Lib/multiprocessing/forking.py | 2 - Lib/multiprocessing/process.py | 7 +++-- Lib/test/test_multiprocessing.py | 23 ++++++++++++++++++++ Misc/NEWS | 3 ++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -129,8 +129,6 @@ import random random.seed() code = process_obj._bootstrap() - sys.stdout.flush() - sys.stderr.flush() os._exit(code) # `w` will be closed when the child exits, at which point `r` diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -291,16 +291,17 @@ exitcode = e.args[0] else: sys.stderr.write(e.args[0] + '\n') - sys.stderr.flush() exitcode = 1 except: exitcode = 1 import traceback sys.stderr.write('Process %s:\n' % self.name) + traceback.print_exc() + finally: + util.info('process exiting with exitcode %d' % exitcode) + sys.stdout.flush() sys.stderr.flush() - traceback.print_exc() - util.info('process exiting with exitcode %d' % exitcode) return exitcode # diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -417,6 +417,29 @@ uppercaser.stop() uppercaser.join() + def test_stderr_flush(self): + # sys.stderr is flushed at process shutdown (issue #13812) + if self.TYPE == "threads": + return + + testfn = test.support.TESTFN + self.addCleanup(test.support.unlink, testfn) + proc = self.Process(target=self._test_stderr_flush, args=(testfn,)) + proc.start() + proc.join() + with open(testfn, 'r') as f: + err = f.read() + # The whole traceback was printed + self.assertIn("ZeroDivisionError", err) + self.assertIn("test_multiprocessing.py", err) + self.assertIn("1/0 # MARKER", err) + + @classmethod + def _test_stderr_flush(cls, testfn): + sys.stderr = open(testfn, 'w') + 1/0 # MARKER + + # # # diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #13812: When a multiprocessing Process child raises an exception, + flush stderr after printing the exception traceback. + - Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 11:51:01 2012 From: python-checkins at python.org (nick.coghlan) Date: Fri, 27 Jan 2012 11:51:01 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_PEP_408=3A_=5F=5Fpreview?= =?utf8?q?=5F=5F_namespace?= Message-ID: http://hg.python.org/peps/rev/53d5bdd95cf5 changeset: 4017:53d5bdd95cf5 user: Nick Coghlan date: Fri Jan 27 20:50:50 2012 +1000 summary: Add PEP 408: __preview__ namespace files: pep-0408.txt | 291 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 291 insertions(+), 0 deletions(-) diff --git a/pep-0408.txt b/pep-0408.txt new file mode 100644 --- /dev/null +++ b/pep-0408.txt @@ -0,0 +1,291 @@ +PEP: 408 +Title: Standard library __preview__ package +Version: $Revision$ +Last-Modified: $Date$ +Author: Nick Coghlan , + Eli Bendersky +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 2012-01-07 +Python-Version: 3.3 +Post-History: 2012-01-27 + + +Abstract +======== + +The process of including a new module into the Python standard library is +hindered by the API lock-in and promise of backward compatibility implied by +a module being formally part of Python. This PEP proposes a transitional +state for modules - inclusion in a special ``__preview__`` package for the +duration of a minor release (roughly 18 months) prior to full acceptance into +the standard library. On one hand, this state provides the module with the +benefits of being formally part of the Python distribution. On the other hand, +the core development team explicitly states that no promises are made with +regards to the module's eventual full inclusion into the standard library, +or to the stability of its API, which may change for the next release. + + +Proposal - the __preview__ package +================================== + +Whenever the Python core development team decides that a new module should be +included into the standard library, but isn't entirely sure about whether the +module's API is optimal, the module can be placed in a special package named +``__preview__`` for a single minor release. + +In the next minor release, the module may either be "graduated" into the +standard library (and occupy its natural place within its namespace, leaving the +``__preview__`` package), or be rejected and removed entirely from the Python +source tree. If the module ends up graduating into the standard library after +spending a minor release in ``__preview__``, its API may be changed according +to accumulated feedback. The core development team explicitly makes no +guarantees about API stability and backward compatibility of modules in +``__preview__``. + +Entry into the ``__preview__`` package marks the start of a transition of the +module into the standard library. It means that the core development team +assumes responsibility of the module, similarly to any other module in the +standard library. + + +Which modules should go through ``__preview__`` +----------------------------------------------- + +We expect most modules proposed for addition into the Python standard library +to go through a minor release in ``__preview__``. There may, however, be some +exceptions, such as modules that use a pre-defined API (for example ``lzma``, +which generally follows the API of the existing ``bz2`` module), or modules +with an API that has wide acceptance in the Python development community. + +In any case, modules that are proposed to be added to the standard library, +whether via ``__preview__`` or directly, must fulfill the acceptance conditions +set by PEP 2. + +It is important to stress that the aim of of this proposal is not to make the +process of adding new modules to the standard library more difficult. On the +contrary, it tries to provide a means to add *more* useful libraries. Modules +which are obvious candidates for entry can be added as before. Modules which +due to uncertainties about the API could be stalled for a long time now have +a means to still be distributed with Python, via an incubation period in the +``__preview__`` package. + + +Criteria for "graduation" +------------------------- + +In principle, most modules in the ``__preview__`` package should eventually +graduate to the stable standard library. Some reasons for not graduating are: + +* The module may prove to be unstable or fragile, without sufficient developer + support to maintain it. +* A much better alternative module may be found during the preview release + +Essentially, the decision will be made by the core developers on a per-case +basis. The point to emphasize here is that a module's appearance in the +``__preview__`` package in some release does not guarantee it will continue +being part of Python in the next release. + + +Example +------- + +Suppose the ``example`` module is a candidate for inclusion in the standard +library, but some Python developers aren't convinced that it presents the best +API for the problem it intends to solve. The module can then be added to the +``__preview__`` package in release ``3.X``, importable via:: + + from __preview__ import example + +Assuming the module is then promoted to the the standard library proper in +release ``3.X+1``, it will be moved to a permanent location in the library:: + + import example + +And importing it from ``__preview__`` will no longer work. + + +Rationale +========= + +Benefits for the core development team +-------------------------------------- + +Currently, the core developers are really reluctant to add new interfaces to +the standard library. This is because as soon as they're published in a +release, API design mistakes get locked in due to backward compatibility +concerns. + +By gating all major API additions through some kind of a preview mechanism +for a full release, we get one full release cycle of community feedback +before we lock in the APIs with our standard backward compatibility guarantee. + +We can also start integrating preview modules with the rest of the standard +library early, so long as we make it clear to packagers that the preview +modules should not be considered optional. The only difference between preview +APIs and the rest of the standard library is that preview APIs are explicitly +exempted from the usual backward compatibility guarantees. + +Essentially, the ``__preview__`` package is intended to lower the risk of +locking in minor API design mistakes for extended periods of time. Currently, +this concern can block new additions, even when the core development team +consensus is that a particular addition is a good idea in principle. + + +Benefits for end users +---------------------- + +For future end users, the broadest benefit lies in a better "out-of-the-box" +experience - rather than being told "oh, the standard library tools for task X +are horrible, download this 3rd party library instead", those superior tools +are more likely to be just be an import away. + +For environments where developers are required to conduct due diligence on +their upstream dependencies (severely harming the cost-effectiveness of, or +even ruling out entirely, much of the material on PyPI), the key benefit lies +in ensuring that anything in the ``__preview__`` package is clearly under +python-dev's aegis from at least the following perspectives: + +* Licensing: Redistributed by the PSF under a Contributor Licensing Agreement. +* Documentation: The documentation of the module is published and organized via + the standard Python documentation tools (i.e. ReST source, output generated + with Sphinx and published on http://docs.python.org). +* Testing: The module test suites are run on the python.org buildbot fleet + and results published via http://www.python.org/dev/buildbot. +* Issue management: Bugs and feature requests are handled on + http://bugs.python.org +* Source control: The master repository for the software is published + on http://hg.python.org. + + +Candidates for inclusion into __preview__ +========================================= + +For Python 3.3, there are a number of clear current candidates: + +* ``regex`` (http://pypi.python.org/pypi/regex) +* ``daemon`` (PEP 3143) +* ``ipaddr`` (PEP 3144) + +Other possible future use cases include: + +* Improved HTTP modules (e.g. ``requests``) +* HTML 5 parsing support (e.g. ``html5lib``) +* Improved URL/URI/IRI parsing +* A standard image API (PEP 368) +* Encapsulation of the import state (PEP 368) +* Standard event loop API (PEP 3153) +* A binary version of WSGI for Python 3 (e.g. PEP 444) +* Generic function support (e.g. ``simplegeneric``) + + +Relationship with PEP 407 +========================= + +PEP 407 proposes a change to the core Python release cycle to permit interim +releases every 6 months (perhaps limited to standard library updates). If +such a change to the release cycle is made, the following policy for the +``__preview__`` namespace is suggested: + +* For long term support releases, the ``__preview__`` namespace would always + be empty. +* New modules would be accepted into the ``__preview__`` namespace only in + interim releases that immediately follow a long term support release. +* All modules added will either be migrated to their final location in the + standard library or dropped entirely prior to the next long term support + release. + + +Rejected alternatives and variations +==================================== + + +Using ``__future__`` +-------------------- + +Python already has a "forward-looking" namespace in the form of the +``__future__`` module, so it's reasonable to ask why that can't be re-used for +this new purpose. + +There are two reasons why doing so not appropriate: + +1. The ``__future__`` module is actually linked to a separate compiler +directives feature that can actually change the way the Python interpreter +compiles a module. We don't want that for the preview package - we just want +an ordinary Python package. + +2. The ``__future__`` module comes with an express promise that names will be +maintained in perpetuity, long after the associated features have become the +compiler's default behaviour. Again, this is precisely the opposite of what is +intended for the preview package - it is almost certain that all names added to +the preview will be removed at some point, most likely due to their being moved +to a permanent home in the standard library, but also potentially due to their +being reverted to third party package status (if community feedback suggests the +proposed addition is irredeemably broken). + + +Versioning the package +---------------------- + +One proposed alternative [1]_ was to add explicit versioning to the +``__preview__`` package, i.e. ``__preview34__``. We think that it's better to +simply define that a module being in ``__preview__`` in Python 3.X will either +graduate to the normal standard library namespace in Python 3.X+1 or will +disappear from the Python source tree altogether. Versioning the ``_preview__`` +package complicates the process and does not align well with the main intent of +this proposal. + + +Using a package name without leading and trailing underscores +------------------------------------------------------------- + +It was proposed [1]_ to use a package name like ``preview`` or ``exp``, instead +of ``__preview__``. This was rejected in the discussion due to the special +meaning a "dunder" (double-underscore) package name (a name *with* leading and +trailing underscores) conveys in Python. Besides, a non-dunder name indicates +stability, which is not the intention of the ``__preview__`` package. + + +Preserving pickle compatibility +------------------------------- + +A pickled class instance based on a module in ``__preview__`` in release 3.X +won't be unpickle-able in release 3.X+1, where the module won't be in +``__preview__``. Special code may be added to make this work, but this goes +against the intent of this proposal, since it implies backward compatibility. +Therefore, this PEP does not propose to preserve pickle compatibility. + + +Credits +======= + +Dj Gilcrease initially proposed the idea of having a ``__preview__`` package +in Python [2]_. Although his original proposal uses the name +``__experimental__``, we feel that ``__preview__`` conveys the meaning of this +package in a better way. + + +References +========== + +.. [#] Discussed in this thread: + http://mail.python.org/pipermail/python-ideas/2012-January/013246.html + +.. [#] http://mail.python.org/pipermail/python-ideas/2011-August/011278.html + + +Copyright +========= + +This document has been placed in the public domain. + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 11:58:49 2012 From: python-checkins at python.org (nick.coghlan) Date: Fri, 27 Jan 2012 11:58:49 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Combine_the_two_explanations_o?= =?utf8?q?f_the_term_=27dunder=27?= Message-ID: http://hg.python.org/peps/rev/895942e1fab3 changeset: 4018:895942e1fab3 user: Nick Coghlan date: Fri Jan 27 20:58:39 2012 +1000 summary: Combine the two explanations of the term 'dunder' files: pep-0408.txt | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pep-0408.txt b/pep-0408.txt --- a/pep-0408.txt +++ b/pep-0408.txt @@ -242,9 +242,10 @@ It was proposed [1]_ to use a package name like ``preview`` or ``exp``, instead of ``__preview__``. This was rejected in the discussion due to the special -meaning a "dunder" (double-underscore) package name (a name *with* leading and -trailing underscores) conveys in Python. Besides, a non-dunder name indicates -stability, which is not the intention of the ``__preview__`` package. +meaning a "dunder" package name (that is, a name *with* leading and +trailing double-underscores) conveys in Python. Besides, a non-dunder name +would suggest normal standard library API stability guarantees, which is not +the intention of the ``__preview__`` package. Preserving pickle compatibility -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 12:01:57 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 12:01:57 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_an_open_question_about_sec?= =?utf8?q?urity_fixes=2E?= Message-ID: http://hg.python.org/peps/rev/e7172b0a7601 changeset: 4019:e7172b0a7601 user: Antoine Pitrou date: Fri Jan 27 11:59:46 2012 +0100 summary: Add an open question about security fixes. files: pep-0407.txt | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/pep-0407.txt b/pep-0407.txt --- a/pep-0407.txt +++ b/pep-0407.txt @@ -142,6 +142,8 @@ * For given values of X and N, is the no-bugfix-releases policy for non-LTS versions feasible? +* What is the policy for security fixes? + * Restrict new syntax and similar changes (i.e. everything that was prohibited by PEP 3003) to LTS versions? -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 14:10:19 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 14:10:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_error_handl?= =?utf8?q?ing_in_examples_of_C_API_use=2E?= Message-ID: http://hg.python.org/cpython/rev/e21dd3c1ca7e changeset: 74654:e21dd3c1ca7e branch: 3.2 parent: 74652:2863d9273abd user: Antoine Pitrou date: Fri Jan 27 14:07:29 2012 +0100 summary: Fix error handling in examples of C API use. files: Doc/c-api/intro.rst | 36 ++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -246,17 +246,19 @@ int set_all(PyObject *target, PyObject *item) { - int i, n; + Py_ssize_t i, n; n = PyObject_Length(target); if (n < 0) return -1; for (i = 0; i < n; i++) { - PyObject *index = PyLong_FromLong(i); + PyObject *index = PyLong_FromSsize_t(i); if (!index) return -1; - if (PyObject_SetItem(target, index, item) < 0) + if (PyObject_SetItem(target, index, item) < 0) { + Py_DECREF(index); return -1; + } Py_DECREF(index); } return 0; @@ -292,8 +294,8 @@ long sum_list(PyObject *list) { - int i, n; - long total = 0; + Py_ssize_t i, n; + long total = 0, value; PyObject *item; n = PyList_Size(list); @@ -302,7 +304,11 @@ for (i = 0; i < n; i++) { item = PyList_GetItem(list, i); /* Can't fail */ if (!PyLong_Check(item)) continue; /* Skip non-integers */ - total += PyLong_AsLong(item); + value = PyLong_AsLong(item); + if (value == -1 && PyErr_Occurred()) + /* Integer too big to fit in a C long, bail out */ + return -1; + total += value; } return total; } @@ -314,8 +320,8 @@ long sum_sequence(PyObject *sequence) { - int i, n; - long total = 0; + Py_ssize_t i, n; + long total = 0, value; PyObject *item; n = PySequence_Length(sequence); if (n < 0) @@ -324,9 +330,17 @@ item = PySequence_GetItem(sequence, i); if (item == NULL) return -1; /* Not a sequence, or other failure */ - if (PyLong_Check(item)) - total += PyLong_AsLong(item); - Py_DECREF(item); /* Discard reference ownership */ + if (PyLong_Check(item)) { + value = PyLong_AsLong(item); + Py_DECREF(item); + if (value == -1 && PyErr_Occurred()) + /* Integer too big to fit in a C long, bail out */ + return -1; + total += value; + } + else { + Py_DECREF(item); /* Discard reference ownership */ + } } return total; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 14:10:20 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 14:10:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_error_handling_in_examples_of_C_API_use=2E?= Message-ID: http://hg.python.org/cpython/rev/d35a25a25cb3 changeset: 74655:d35a25a25cb3 parent: 74653:96c1de5acbd3 parent: 74654:e21dd3c1ca7e user: Antoine Pitrou date: Fri Jan 27 14:08:04 2012 +0100 summary: Fix error handling in examples of C API use. files: Doc/c-api/intro.rst | 36 ++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -246,17 +246,19 @@ int set_all(PyObject *target, PyObject *item) { - int i, n; + Py_ssize_t i, n; n = PyObject_Length(target); if (n < 0) return -1; for (i = 0; i < n; i++) { - PyObject *index = PyLong_FromLong(i); + PyObject *index = PyLong_FromSsize_t(i); if (!index) return -1; - if (PyObject_SetItem(target, index, item) < 0) + if (PyObject_SetItem(target, index, item) < 0) { + Py_DECREF(index); return -1; + } Py_DECREF(index); } return 0; @@ -292,8 +294,8 @@ long sum_list(PyObject *list) { - int i, n; - long total = 0; + Py_ssize_t i, n; + long total = 0, value; PyObject *item; n = PyList_Size(list); @@ -302,7 +304,11 @@ for (i = 0; i < n; i++) { item = PyList_GetItem(list, i); /* Can't fail */ if (!PyLong_Check(item)) continue; /* Skip non-integers */ - total += PyLong_AsLong(item); + value = PyLong_AsLong(item); + if (value == -1 && PyErr_Occurred()) + /* Integer too big to fit in a C long, bail out */ + return -1; + total += value; } return total; } @@ -314,8 +320,8 @@ long sum_sequence(PyObject *sequence) { - int i, n; - long total = 0; + Py_ssize_t i, n; + long total = 0, value; PyObject *item; n = PySequence_Length(sequence); if (n < 0) @@ -324,9 +330,17 @@ item = PySequence_GetItem(sequence, i); if (item == NULL) return -1; /* Not a sequence, or other failure */ - if (PyLong_Check(item)) - total += PyLong_AsLong(item); - Py_DECREF(item); /* Discard reference ownership */ + if (PyLong_Check(item)) { + value = PyLong_AsLong(item); + Py_DECREF(item); + if (value == -1 && PyErr_Occurred()) + /* Integer too big to fit in a C long, bail out */ + return -1; + total += value; + } + else { + Py_DECREF(item); /* Discard reference ownership */ + } } return total; } -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 15:14:43 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 15:14:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_note_that_get?= =?utf8?q?=28=29_is_not_affected_by_default=5Ffactory_=28closes_=2313887?= =?utf8?q?=29?= Message-ID: http://hg.python.org/cpython/rev/089a086252fc changeset: 74656:089a086252fc branch: 3.2 parent: 74654:e21dd3c1ca7e user: Benjamin Peterson date: Fri Jan 27 09:14:01 2012 -0500 summary: note that get() is not affected by default_factory (closes #13887) files: Doc/library/collections.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -468,6 +468,11 @@ :class:`dict` class when the requested key is not found; whatever it returns or raises is then returned or raised by :meth:`__getitem__`. + Note that :meth:`__missing__` is *not* called for any operations besides + :meth:`__getitem__`. This means that :meth:`get` will, like normal + dictionaries, return ``None`` as a default rather than using + :attr:`default_factory`. + :class:`defaultdict` objects support the following instance variable: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 15:14:44 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 15:14:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_heads_=28=2313887=29?= Message-ID: http://hg.python.org/cpython/rev/26612ad451ad changeset: 74657:26612ad451ad parent: 74655:d35a25a25cb3 parent: 74656:089a086252fc user: Benjamin Peterson date: Fri Jan 27 09:14:29 2012 -0500 summary: merge heads (#13887) files: Doc/library/collections.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -595,6 +595,11 @@ :class:`dict` class when the requested key is not found; whatever it returns or raises is then returned or raised by :meth:`__getitem__`. + Note that :meth:`__missing__` is *not* called for any operations besides + :meth:`__getitem__`. This means that :meth:`get` will, like normal + dictionaries, return ``None`` as a default rather than using + :attr:`default_factory`. + :class:`defaultdict` objects support the following instance variable: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 15:14:44 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 15:14:44 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_note_that_get?= =?utf8?q?=28=29_is_not_affected_by_default=5Ffactory_=28closes_=2313887?= =?utf8?q?=29?= Message-ID: http://hg.python.org/cpython/rev/b2db66bc8e7f changeset: 74658:b2db66bc8e7f branch: 2.7 parent: 74646:8dec547c23d3 user: Benjamin Peterson date: Fri Jan 27 09:14:01 2012 -0500 summary: note that get() is not affected by default_factory (closes #13887) files: Doc/library/collections.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -469,6 +469,11 @@ :class:`dict` class when the requested key is not found; whatever it returns or raises is then returned or raised by :meth:`__getitem__`. + Note that :meth:`__missing__` is *not* called for any operations besides + :meth:`__getitem__`. This means that :meth:`get` will, like normal + dictionaries, return ``None`` as a default rather than using + :attr:`default_factory`. + :class:`defaultdict` objects support the following instance variable: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 16:42:27 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 16:42:27 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_pep_409=3A_syntax_for_supressi?= =?utf8?q?ng_exception_context?= Message-ID: http://hg.python.org/peps/rev/f45f0e0c4319 changeset: 4020:f45f0e0c4319 user: Benjamin Peterson date: Fri Jan 27 10:42:24 2012 -0500 summary: pep 409: syntax for supressing exception context files: pep-0409.txt | 96 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 96 insertions(+), 0 deletions(-) diff --git a/pep-0409.txt b/pep-0409.txt new file mode 100644 --- /dev/null +++ b/pep-0409.txt @@ -0,0 +1,96 @@ +PEP: 409 +Title: Suppressing exception context +Version: $Revision$ +Last-Modified: $Date$ +Author: Ethan Furman +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 26-Jan-2012 +Python-Version: 3.3 +Post-History: + + +Abstract +======== + +One of the open issues from PEP 3134 is suppressing context: currently there is +no way to do it. This PEP proposes one. + +Motivation +========== + +There are two basic ways to generate exceptions: 1) Python does it (buggy code, +missing resources, ending loops, etc.); and, 2) manually (with a raise +statement). + +When writing libraries, or even just custom classes, it can become necessary to +raise exceptions; moreover it can be useful, even necessary, to change from one +exception to another. To take an example from my dbf module: + + try: + value = int(value) + except Exception: + raise DbfError(...) + +Whatever the original exception was (ValueError, TypeError, or something else) +is irrelevant. The exception from this point on is a DbfError, and the original +exception is of no value. However, if this exception is printed, we would +currently see both. + + +Alternatives +============ +Several possibilities have been put forth: + + - raise as NewException() + + Reuses the 'as' keyword; can be confusing since we are not really +reraising the originating exception + + - raise NewException() from None + + Follows existing syntax of explicitly declaring the originating +exception + + - exc = NewException(); exc.__context__ = None; raise exc + + Very verbose way of the previous method + + - raise NewException.no_context(...) + + Make context suppression a class method. + +All of the above options will require changes to the core. + + +Proposal +======== + +I proprose going with the second option: + + raise NewException from None + +It has the advantage of using the existing pattern of explicitly setting +the cause: + + raise KeyError() from NameError() + +but because the 'cause' is None the previous context is discarded. There is a +patch to this effect attached to Issue6210 (http://bugs.python.org/issue6210). + + +Copyright +========= + +This document has been placed in the public domain. + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 16:45:04 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 16:45:04 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_add_post_history?= Message-ID: http://hg.python.org/peps/rev/17afce59bbd8 changeset: 4021:17afce59bbd8 user: Benjamin Peterson date: Fri Jan 27 10:45:00 2012 -0500 summary: add post history files: pep-0407.txt | 2 +- pep-0409.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0407.txt b/pep-0407.txt --- a/pep-0407.txt +++ b/pep-0407.txt @@ -9,7 +9,7 @@ Type: Process Content-Type: text/x-rst Created: 2012-01-12 -Post-History: +Post-History: http://mail.python.org/pipermail/python-dev/2012-January/115838.html Resolution: TBD diff --git a/pep-0409.txt b/pep-0409.txt --- a/pep-0409.txt +++ b/pep-0409.txt @@ -8,7 +8,7 @@ Content-Type: text/x-rst Created: 26-Jan-2012 Python-Version: 3.3 -Post-History: +Post-History: 2012-01-27 Abstract -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 16:47:51 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 16:47:51 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_fix_indentation?= Message-ID: http://hg.python.org/peps/rev/80a76bee5094 changeset: 4022:80a76bee5094 user: Benjamin Peterson date: Fri Jan 27 10:46:02 2012 -0500 summary: fix indentation files: pep-0409.txt | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/pep-0409.txt b/pep-0409.txt --- a/pep-0409.txt +++ b/pep-0409.txt @@ -50,8 +50,7 @@ - raise NewException() from None - Follows existing syntax of explicitly declaring the originating -exception + Follows existing syntax of explicitly declaring the originating exception - exc = NewException(); exc.__context__ = None; raise exc -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 16:47:52 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 16:47:52 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_use_references?= Message-ID: http://hg.python.org/peps/rev/b59ce07dab7b changeset: 4023:b59ce07dab7b user: Benjamin Peterson date: Fri Jan 27 10:47:48 2012 -0500 summary: use references files: pep-0409.txt | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/pep-0409.txt b/pep-0409.txt --- a/pep-0409.txt +++ b/pep-0409.txt @@ -76,8 +76,13 @@ raise KeyError() from NameError() but because the 'cause' is None the previous context is discarded. There is a -patch to this effect attached to Issue6210 (http://bugs.python.org/issue6210). +patch to this effect attached to issue 6210 [#issue6210]_. +References +========== + +.. [#issue6210] + http://bugs.python.org/issue6210 Copyright ========= -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 16:48:20 2012 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 27 Jan 2012 16:48:20 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_fix_more_indentation?= Message-ID: http://hg.python.org/peps/rev/99f4916dcb4c changeset: 4024:99f4916dcb4c user: Benjamin Peterson date: Fri Jan 27 10:48:17 2012 -0500 summary: fix more indentation files: pep-0409.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0409.txt b/pep-0409.txt --- a/pep-0409.txt +++ b/pep-0409.txt @@ -45,8 +45,8 @@ - raise as NewException() - Reuses the 'as' keyword; can be confusing since we are not really -reraising the originating exception + Reuses the 'as' keyword; can be confusing since we are not really reraising + the originating exception - raise NewException() from None -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Fri Jan 27 17:37:36 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 17:37:36 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_intermitten?= =?utf8?q?t_test=5Fssl_failure=2E?= Message-ID: http://hg.python.org/cpython/rev/76d60fcef3db changeset: 74659:76d60fcef3db branch: 3.2 parent: 74656:089a086252fc user: Antoine Pitrou date: Fri Jan 27 17:33:01 2012 +0100 summary: Fix intermittent test_ssl failure. files: Lib/test/test_ssl.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -911,6 +911,7 @@ + repr(connaddr) + '\n') handler = self.ConnectionHandler(self, newconn, connaddr) handler.start() + handler.join() except socket.timeout: pass except KeyboardInterrupt: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 17:37:37 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 17:37:37 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_intermittent_test=5Fssl_failure=2E?= Message-ID: http://hg.python.org/cpython/rev/b99c54acb22d changeset: 74660:b99c54acb22d parent: 74657:26612ad451ad parent: 74659:76d60fcef3db user: Antoine Pitrou date: Fri Jan 27 17:34:56 2012 +0100 summary: Fix intermittent test_ssl failure. files: Lib/test/test_ssl.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1032,6 +1032,7 @@ + repr(connaddr) + '\n') handler = self.ConnectionHandler(self, newconn, connaddr) handler.start() + handler.join() except socket.timeout: pass except KeyboardInterrupt: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 17:39:23 2012 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 27 Jan 2012 17:39:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_Fix_intermitten?= =?utf8?q?t_test=5Fssl_failure=2E?= Message-ID: http://hg.python.org/cpython/rev/f2360aafc450 changeset: 74661:f2360aafc450 branch: 2.7 parent: 74658:b2db66bc8e7f user: Antoine Pitrou date: Fri Jan 27 17:33:01 2012 +0100 summary: Fix intermittent test_ssl failure. files: Lib/test/test_ssl.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -562,6 +562,7 @@ + str(connaddr) + '\n') handler = self.ConnectionHandler(self, newconn) handler.start() + handler.join() except socket.timeout: pass except KeyboardInterrupt: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 22:20:17 2012 From: python-checkins at python.org (mark.dickinson) Date: Fri, 27 Jan 2012 22:20:17 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODg5?= =?utf8?q?=3A_Add_missing_=5FPy=5FSET=5F53BIT=5FPRECISION=5F*_calls_around?= =?utf8?q?_uses_of_dtoa=2Ec?= Message-ID: http://hg.python.org/cpython/rev/5b8800004955 changeset: 74662:5b8800004955 branch: 3.2 parent: 74659:76d60fcef3db user: Mark Dickinson date: Fri Jan 27 21:16:01 2012 +0000 summary: Issue #13889: Add missing _Py_SET_53BIT_PRECISION_* calls around uses of dtoa.c functions in float round. files: Objects/floatobject.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -919,9 +919,12 @@ char *buf, *buf_end, shortbuf[100], *mybuf=shortbuf; int decpt, sign; PyObject *result = NULL; + _Py_SET_53BIT_PRECISION_HEADER; /* round to a decimal string */ + _Py_SET_53BIT_PRECISION_START; buf = _Py_dg_dtoa(x, 3, ndigits, &decpt, &sign, &buf_end); + _Py_SET_53BIT_PRECISION_END; if (buf == NULL) { PyErr_NoMemory(); return NULL; @@ -944,7 +947,9 @@ /* and convert the resulting string back to a double */ errno = 0; + _Py_SET_53BIT_PRECISION_START; rounded = _Py_dg_strtod(mybuf, NULL); + _Py_SET_53BIT_PRECISION_END; if (errno == ERANGE && fabs(rounded) >= 1.) PyErr_SetString(PyExc_OverflowError, "rounded value too large to represent"); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 22:20:18 2012 From: python-checkins at python.org (mark.dickinson) Date: Fri, 27 Jan 2012 22:20:18 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_3=2E2_-=3E_default_=28issue_13889=29?= Message-ID: http://hg.python.org/cpython/rev/265d35e8fe82 changeset: 74663:265d35e8fe82 parent: 74660:b99c54acb22d parent: 74662:5b8800004955 user: Mark Dickinson date: Fri Jan 27 21:17:04 2012 +0000 summary: Merge 3.2 -> default (issue 13889) files: Objects/floatobject.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -902,9 +902,12 @@ char *buf, *buf_end, shortbuf[100], *mybuf=shortbuf; int decpt, sign; PyObject *result = NULL; + _Py_SET_53BIT_PRECISION_HEADER; /* round to a decimal string */ + _Py_SET_53BIT_PRECISION_START; buf = _Py_dg_dtoa(x, 3, ndigits, &decpt, &sign, &buf_end); + _Py_SET_53BIT_PRECISION_END; if (buf == NULL) { PyErr_NoMemory(); return NULL; @@ -927,7 +930,9 @@ /* and convert the resulting string back to a double */ errno = 0; + _Py_SET_53BIT_PRECISION_START; rounded = _Py_dg_strtod(mybuf, NULL); + _Py_SET_53BIT_PRECISION_END; if (errno == ERANGE && fabs(rounded) >= 1.) PyErr_SetString(PyExc_OverflowError, "rounded value too large to represent"); -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Fri Jan 27 22:20:22 2012 From: python-checkins at python.org (mark.dickinson) Date: Fri, 27 Jan 2012 22:20:22 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzODg5?= =?utf8?q?=3A_Add_missing_=5FPy=5FSET=5F53BIT=5FPRECISION=5F*_calls_around?= =?utf8?q?_uses_of_dtoa=2Ec?= Message-ID: http://hg.python.org/cpython/rev/eaf553b063a7 changeset: 74664:eaf553b063a7 branch: 2.7 parent: 74661:f2360aafc450 user: Mark Dickinson date: Fri Jan 27 21:16:01 2012 +0000 summary: Issue #13889: Add missing _Py_SET_53BIT_PRECISION_* calls around uses of dtoa.c functions in float round. files: Objects/floatobject.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1086,6 +1086,7 @@ char *buf, *buf_end, shortbuf[100], *mybuf=shortbuf; int decpt, sign, val, halfway_case; PyObject *result = NULL; + _Py_SET_53BIT_PRECISION_HEADER; /* The basic idea is very simple: convert and round the double to a decimal string using _Py_dg_dtoa, then convert that decimal string @@ -1142,7 +1143,9 @@ halfway_case = 0; /* round to a decimal string; use an extra place for halfway case */ + _Py_SET_53BIT_PRECISION_START; buf = _Py_dg_dtoa(x, 3, ndigits+halfway_case, &decpt, &sign, &buf_end); + _Py_SET_53BIT_PRECISION_END; if (buf == NULL) { PyErr_NoMemory(); return NULL; @@ -1186,7 +1189,9 @@ /* and convert the resulting string back to a double */ errno = 0; + _Py_SET_53BIT_PRECISION_START; rounded = _Py_dg_strtod(mybuf, NULL); + _Py_SET_53BIT_PRECISION_END; if (errno == ERANGE && fabs(rounded) >= 1.) PyErr_SetString(PyExc_OverflowError, "rounded value too large to represent"); -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sat Jan 28 05:32:42 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 28 Jan 2012 05:32:42 +0100 Subject: [Python-checkins] Daily reference leaks (265d35e8fe82): sum=0 Message-ID: results for 265d35e8fe82 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogCOoNy4', '-x'] From python-checkins at python.org Sat Jan 28 11:38:08 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 28 Jan 2012 11:38:08 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODk0?= =?utf8?q?=3A_Skip_test=5Fthreading=2ECRLockTests_if_=5FCRLock_isn=27t_ava?= =?utf8?q?ilable=2E_Patch?= Message-ID: http://hg.python.org/cpython/rev/5cf181df7bea changeset: 74665:5cf181df7bea branch: 3.2 parent: 74662:5b8800004955 user: Charles-Fran?ois Natali date: Sat Jan 28 11:36:04 2012 +0100 summary: Issue #13894: Skip test_threading.CRLockTests if _CRLock isn't available. Patch by Matt Joiner. files: Lib/test/test_threading.py | 1 + Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -726,6 +726,7 @@ class PyRLockTests(lock_tests.RLockTests): locktype = staticmethod(threading._PyRLock) + at unittest.skipIf(threading._CRLock is None, 'RLock not implemented in C') class CRLockTests(lock_tests.RLockTests): locktype = staticmethod(threading._CRLock) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -453,6 +453,7 @@ Fredrik Johansson Gregory K. Johnson Simon Johnston +Matt Joiner Thomas Jollans Nicolas Joly Evan Jones -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 11:38:10 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sat, 28 Jan 2012 11:38:10 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313894=3A_Skip_test=5Fthreading=2ECRLockTests_if_=5F?= =?utf8?q?CRLock_isn=27t_available=2E_Patch?= Message-ID: http://hg.python.org/cpython/rev/279b6d778663 changeset: 74666:279b6d778663 parent: 74663:265d35e8fe82 parent: 74665:5cf181df7bea user: Charles-Fran?ois Natali date: Sat Jan 28 11:37:42 2012 +0100 summary: Issue #13894: Skip test_threading.CRLockTests if _CRLock isn't available. Patch by Matt Joiner. files: Lib/test/test_threading.py | 1 + Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -738,6 +738,7 @@ class PyRLockTests(lock_tests.RLockTests): locktype = staticmethod(threading._PyRLock) + at unittest.skipIf(threading._CRLock is None, 'RLock not implemented in C') class CRLockTests(lock_tests.RLockTests): locktype = staticmethod(threading._CRLock) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -492,6 +492,7 @@ Fredrik Johansson Gregory K. Johnson Simon Johnston +Matt Joiner Thomas Jollans Nicolas Joly Evan Jones -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 16:33:05 2012 From: python-checkins at python.org (nadeem.vawda) Date: Sat, 28 Jan 2012 16:33:05 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_typo_in_comment=2E?= Message-ID: http://hg.python.org/cpython/rev/86452e102929 changeset: 74667:86452e102929 user: Nadeem Vawda date: Sat Jan 28 17:32:47 2012 +0200 summary: Fix typo in comment. files: Lib/test/test_zlib.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -20,7 +20,7 @@ # major version that we were compiled against. We can't guarantee that # the minor versions will match (even on the machine on which the module # was compiled), and the API is stable between minor versions, so - # testing only the major verions avoids spurious failures. + # testing only the major versions avoids spurious failures. self.assertEqual(zlib.ZLIB_RUNTIME_VERSION[0], zlib.ZLIB_VERSION[0]) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 17:42:40 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 28 Jan 2012 17:42:40 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODk1?= =?utf8?q?=3A_fix_test=5Fssl_hanging_under_Ubuntu?= Message-ID: http://hg.python.org/cpython/rev/10c79f29e417 changeset: 74668:10c79f29e417 branch: 3.2 parent: 74665:5cf181df7bea user: Antoine Pitrou date: Sat Jan 28 17:38:34 2012 +0100 summary: Issue #13895: fix test_ssl hanging under Ubuntu files: Lib/test/test_ssl.py | 40 ++++++++++++++++---------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1078,28 +1078,28 @@ chatty=chatty, connectionchatty=False) with server: - s = client_context.wrap_socket(socket.socket()) - s.connect((HOST, server.port)) - for arg in [indata, bytearray(indata), memoryview(indata)]: + with client_context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + for arg in [indata, bytearray(indata), memoryview(indata)]: + if connectionchatty: + if support.verbose: + sys.stdout.write( + " client: sending %r...\n" % indata) + s.write(arg) + outdata = s.read() + if connectionchatty: + if support.verbose: + sys.stdout.write(" client: read %r\n" % outdata) + if outdata != indata.lower(): + raise AssertionError( + "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" + % (outdata[:20], len(outdata), + indata[:20].lower(), len(indata))) + s.write(b"over\n") if connectionchatty: if support.verbose: - sys.stdout.write( - " client: sending %r...\n" % indata) - s.write(arg) - outdata = s.read() - if connectionchatty: - if support.verbose: - sys.stdout.write(" client: read %r\n" % outdata) - if outdata != indata.lower(): - raise AssertionError( - "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" - % (outdata[:20], len(outdata), - indata[:20].lower(), len(indata))) - s.write(b"over\n") - if connectionchatty: - if support.verbose: - sys.stdout.write(" client: closing connection.\n") - s.close() + sys.stdout.write(" client: closing connection.\n") + s.close() def try_protocol_combo(server_protocol, client_protocol, expect_success, certsreqs=None, server_options=0, client_options=0): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 17:42:41 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 28 Jan 2012 17:42:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313895=3A_fix_test=5Fssl_hanging_under_Ubuntu?= Message-ID: http://hg.python.org/cpython/rev/db0c717cbc01 changeset: 74669:db0c717cbc01 parent: 74667:86452e102929 parent: 74668:10c79f29e417 user: Antoine Pitrou date: Sat Jan 28 17:40:23 2012 +0100 summary: Issue #13895: fix test_ssl hanging under Ubuntu files: Lib/test/test_ssl.py | 50 ++++++++++++++++---------------- 1 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1198,33 +1198,33 @@ chatty=chatty, connectionchatty=False) with server: - s = client_context.wrap_socket(socket.socket()) - s.connect((HOST, server.port)) - for arg in [indata, bytearray(indata), memoryview(indata)]: + with client_context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + for arg in [indata, bytearray(indata), memoryview(indata)]: + if connectionchatty: + if support.verbose: + sys.stdout.write( + " client: sending %r...\n" % indata) + s.write(arg) + outdata = s.read() + if connectionchatty: + if support.verbose: + sys.stdout.write(" client: read %r\n" % outdata) + if outdata != indata.lower(): + raise AssertionError( + "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" + % (outdata[:20], len(outdata), + indata[:20].lower(), len(indata))) + s.write(b"over\n") if connectionchatty: if support.verbose: - sys.stdout.write( - " client: sending %r...\n" % indata) - s.write(arg) - outdata = s.read() - if connectionchatty: - if support.verbose: - sys.stdout.write(" client: read %r\n" % outdata) - if outdata != indata.lower(): - raise AssertionError( - "bad data <<%r>> (%d) received; expected <<%r>> (%d)\n" - % (outdata[:20], len(outdata), - indata[:20].lower(), len(indata))) - s.write(b"over\n") - if connectionchatty: - if support.verbose: - sys.stdout.write(" client: closing connection.\n") - stats = { - 'compression': s.compression(), - 'cipher': s.cipher(), - } - s.close() - return stats + sys.stdout.write(" client: closing connection.\n") + stats = { + 'compression': s.compression(), + 'cipher': s.cipher(), + } + s.close() + return stats def try_protocol_combo(server_protocol, client_protocol, expect_success, certsreqs=None, server_options=0, client_options=0): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 22:07:34 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 28 Jan 2012 22:07:34 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODA2?= =?utf8?q?=3A_The_size_check_in_audioop_decompression_functions_was_too_st?= =?utf8?q?rict?= Message-ID: http://hg.python.org/cpython/rev/77188bc37c74 changeset: 74670:77188bc37c74 branch: 3.2 parent: 74668:10c79f29e417 user: Antoine Pitrou date: Sat Jan 28 22:01:59 2012 +0100 summary: Issue #13806: The size check in audioop decompression functions was too strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. files: Lib/test/test_audioop.py | 25 +++++++++++++++++++------ Misc/NEWS | 3 +++ Modules/audioop.c | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py --- a/Lib/test/test_audioop.py +++ b/Lib/test/test_audioop.py @@ -21,9 +21,9 @@ data = [gendata1(), gendata2(), gendata4()] INVALID_DATA = [ - ('abc', 0), - ('abc', 2), - ('abc', 4), + (b'abc', 0), + (b'abc', 2), + (b'abc', 4), ] @@ -94,7 +94,9 @@ def test_adpcm2lin(self): # Very cursory test - self.assertEqual(audioop.adpcm2lin(b'\0\0', 1, None), (b'\0\0\0\0', (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 1, None), (b'\0' * 4, (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 2, None), (b'\0' * 8, (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 4, None), (b'\0' * 16, (0,0))) def test_lin2adpcm(self): # Very cursory test @@ -109,6 +111,9 @@ # Cursory d = audioop.lin2alaw(data[0], 1) self.assertEqual(audioop.alaw2lin(d, 1), data[0]) + self.assertEqual(audioop.alaw2lin(d, 2), b'\x08\x00\x08\x01\x10\x02') + self.assertEqual(audioop.alaw2lin(d, 4), + b'\x00\x00\x08\x00\x00\x00\x08\x01\x00\x00\x10\x02') def test_lin2ulaw(self): self.assertEqual(audioop.lin2ulaw(data[0], 1), b'\xff\xe7\xdb') @@ -119,6 +124,9 @@ # Cursory d = audioop.lin2ulaw(data[0], 1) self.assertEqual(audioop.ulaw2lin(d, 1), data[0]) + self.assertEqual(audioop.ulaw2lin(d, 2), b'\x00\x00\x04\x01\x0c\x02') + self.assertEqual(audioop.ulaw2lin(d, 4), + b'\x00\x00\x00\x00\x00\x00\x04\x01\x00\x00\x0c\x02') def test_mul(self): data2 = [] @@ -195,10 +203,15 @@ self.assertRaises(audioop.error, audioop.lin2lin, data, size, size2) self.assertRaises(audioop.error, audioop.ratecv, data, size, 1, 1, 1, state) self.assertRaises(audioop.error, audioop.lin2ulaw, data, size) + self.assertRaises(audioop.error, audioop.lin2alaw, data, size) + self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state) + + def test_wrongsize(self): + data = b'abc' + state = None + for size in (-1, 3, 5): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) - self.assertRaises(audioop.error, audioop.lin2alaw, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) - self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state) def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -111,6 +111,9 @@ Library ------- +- Issue #13806: The size check in audioop decompression functions was too + strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. + - Issue #13812: When a multiprocessing Process child raises an exception, flush stderr after printing the exception traceback. diff --git a/Modules/audioop.c b/Modules/audioop.c --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1313,7 +1313,7 @@ &cp, &len, &size) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; if (len > PY_SSIZE_T_MAX/size) { @@ -1382,7 +1382,7 @@ &cp, &len, &size) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; if (len > PY_SSIZE_T_MAX/size) { @@ -1527,7 +1527,7 @@ &cp, &len, &size, &state) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; /* Decode state, should have (value, step) */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 22:07:34 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 28 Jan 2012 22:07:34 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313806=3A_The_size_check_in_audioop_decompression_fu?= =?utf8?q?nctions_was_too_strict?= Message-ID: http://hg.python.org/cpython/rev/ce89dcba008f changeset: 74671:ce89dcba008f parent: 74669:db0c717cbc01 parent: 74670:77188bc37c74 user: Antoine Pitrou date: Sat Jan 28 22:02:47 2012 +0100 summary: Issue #13806: The size check in audioop decompression functions was too strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. files: Lib/test/test_audioop.py | 25 +++++++++++++++++++------ Misc/NEWS | 3 +++ Modules/audioop.c | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py --- a/Lib/test/test_audioop.py +++ b/Lib/test/test_audioop.py @@ -21,9 +21,9 @@ data = [gendata1(), gendata2(), gendata4()] INVALID_DATA = [ - ('abc', 0), - ('abc', 2), - ('abc', 4), + (b'abc', 0), + (b'abc', 2), + (b'abc', 4), ] @@ -94,7 +94,9 @@ def test_adpcm2lin(self): # Very cursory test - self.assertEqual(audioop.adpcm2lin(b'\0\0', 1, None), (b'\0\0\0\0', (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 1, None), (b'\0' * 4, (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 2, None), (b'\0' * 8, (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 4, None), (b'\0' * 16, (0,0))) def test_lin2adpcm(self): # Very cursory test @@ -109,6 +111,9 @@ # Cursory d = audioop.lin2alaw(data[0], 1) self.assertEqual(audioop.alaw2lin(d, 1), data[0]) + self.assertEqual(audioop.alaw2lin(d, 2), b'\x08\x00\x08\x01\x10\x02') + self.assertEqual(audioop.alaw2lin(d, 4), + b'\x00\x00\x08\x00\x00\x00\x08\x01\x00\x00\x10\x02') def test_lin2ulaw(self): self.assertEqual(audioop.lin2ulaw(data[0], 1), b'\xff\xe7\xdb') @@ -119,6 +124,9 @@ # Cursory d = audioop.lin2ulaw(data[0], 1) self.assertEqual(audioop.ulaw2lin(d, 1), data[0]) + self.assertEqual(audioop.ulaw2lin(d, 2), b'\x00\x00\x04\x01\x0c\x02') + self.assertEqual(audioop.ulaw2lin(d, 4), + b'\x00\x00\x00\x00\x00\x00\x04\x01\x00\x00\x0c\x02') def test_mul(self): data2 = [] @@ -195,10 +203,15 @@ self.assertRaises(audioop.error, audioop.lin2lin, data, size, size2) self.assertRaises(audioop.error, audioop.ratecv, data, size, 1, 1, 1, state) self.assertRaises(audioop.error, audioop.lin2ulaw, data, size) + self.assertRaises(audioop.error, audioop.lin2alaw, data, size) + self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state) + + def test_wrongsize(self): + data = b'abc' + state = None + for size in (-1, 3, 5): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) - self.assertRaises(audioop.error, audioop.lin2alaw, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) - self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state) def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #13806: The size check in audioop decompression functions was too + strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. + - Issue #13812: When a multiprocessing Process child raises an exception, flush stderr after printing the exception traceback. diff --git a/Modules/audioop.c b/Modules/audioop.c --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1311,7 +1311,7 @@ &cp, &len, &size) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; if (len > PY_SSIZE_T_MAX/size) { @@ -1380,7 +1380,7 @@ &cp, &len, &size) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; if (len > PY_SSIZE_T_MAX/size) { @@ -1524,7 +1524,7 @@ &cp, &len, &size, &state) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; /* Decode state, should have (value, step) */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sat Jan 28 22:07:35 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 28 Jan 2012 22:07:35 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzODA2?= =?utf8?q?=3A_The_size_check_in_audioop_decompression_functions_was_too_st?= =?utf8?q?rict?= Message-ID: http://hg.python.org/cpython/rev/f1ee3bb6ba64 changeset: 74672:f1ee3bb6ba64 branch: 2.7 parent: 74664:eaf553b063a7 user: Antoine Pitrou date: Sat Jan 28 22:01:59 2012 +0100 summary: Issue #13806: The size check in audioop decompression functions was too strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. files: Lib/test/test_audioop.py | 25 +++++++++++++++++++------ Misc/NEWS | 3 +++ Modules/audioop.c | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_audioop.py b/Lib/test/test_audioop.py --- a/Lib/test/test_audioop.py +++ b/Lib/test/test_audioop.py @@ -21,9 +21,9 @@ data = [gendata1(), gendata2(), gendata4()] INVALID_DATA = [ - ('abc', 0), - ('abc', 2), - ('abc', 4), + (b'abc', 0), + (b'abc', 2), + (b'abc', 4), ] @@ -94,7 +94,9 @@ def test_adpcm2lin(self): # Very cursory test - self.assertEqual(audioop.adpcm2lin('\0\0', 1, None), ('\0\0\0\0', (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 1, None), (b'\0' * 4, (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 2, None), (b'\0' * 8, (0,0))) + self.assertEqual(audioop.adpcm2lin(b'\0\0', 4, None), (b'\0' * 16, (0,0))) def test_lin2adpcm(self): # Very cursory test @@ -109,6 +111,9 @@ # Cursory d = audioop.lin2alaw(data[0], 1) self.assertEqual(audioop.alaw2lin(d, 1), data[0]) + self.assertEqual(audioop.alaw2lin(d, 2), b'\x08\x00\x08\x01\x10\x02') + self.assertEqual(audioop.alaw2lin(d, 4), + b'\x00\x00\x08\x00\x00\x00\x08\x01\x00\x00\x10\x02') def test_lin2ulaw(self): self.assertEqual(audioop.lin2ulaw(data[0], 1), '\xff\xe7\xdb') @@ -119,6 +124,9 @@ # Cursory d = audioop.lin2ulaw(data[0], 1) self.assertEqual(audioop.ulaw2lin(d, 1), data[0]) + self.assertEqual(audioop.ulaw2lin(d, 2), b'\x00\x00\x04\x01\x0c\x02') + self.assertEqual(audioop.ulaw2lin(d, 4), + b'\x00\x00\x00\x00\x00\x00\x04\x01\x00\x00\x0c\x02') def test_mul(self): data2 = [] @@ -193,10 +201,15 @@ self.assertRaises(audioop.error, audioop.lin2lin, data, size, size2) self.assertRaises(audioop.error, audioop.ratecv, data, size, 1, 1, 1, state) self.assertRaises(audioop.error, audioop.lin2ulaw, data, size) + self.assertRaises(audioop.error, audioop.lin2alaw, data, size) + self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state) + + def test_wrongsize(self): + data = b'abc' + state = None + for size in (-1, 3, 5): self.assertRaises(audioop.error, audioop.ulaw2lin, data, size) - self.assertRaises(audioop.error, audioop.lin2alaw, data, size) self.assertRaises(audioop.error, audioop.alaw2lin, data, size) - self.assertRaises(audioop.error, audioop.lin2adpcm, data, size, state) self.assertRaises(audioop.error, audioop.adpcm2lin, data, size, state) def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -90,6 +90,9 @@ Library ------- +- Issue #13806: The size check in audioop decompression functions was too + strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. + - Issue #13885: CVE-2011-3389: the _ssl module would always disable the CBC IV attack countermeasure. diff --git a/Modules/audioop.c b/Modules/audioop.c --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1298,7 +1298,7 @@ &cp, &len, &size) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; if (len > INT_MAX/size) { @@ -1367,7 +1367,7 @@ &cp, &len, &size) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; if (len > INT_MAX/size) { @@ -1509,7 +1509,7 @@ &cp, &len, &size, &state) ) return 0; - if (!audioop_check_parameters(len, size)) + if (!audioop_check_size(size)) return NULL; /* Decode state, should have (value, step) */ -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 02:34:19 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jan 2012 02:34:19 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_remove_tests_fr?= =?utf8?q?om_really_old_regex_module?= Message-ID: http://hg.python.org/cpython/rev/4084b2c65dca changeset: 74673:4084b2c65dca branch: 3.2 parent: 74670:77188bc37c74 user: Benjamin Peterson date: Sat Jan 28 20:33:21 2012 -0500 summary: remove tests from really old regex module files: Lib/test/regex_tests.py | 285 ---------------------------- 1 files changed, 0 insertions(+), 285 deletions(-) diff --git a/Lib/test/regex_tests.py b/Lib/test/regex_tests.py deleted file mode 100644 --- a/Lib/test/regex_tests.py +++ /dev/null @@ -1,285 +0,0 @@ -# Regex test suite and benchmark suite v1.5a2 - -# The 3 possible outcomes for each pattern -[SUCCEED, FAIL, SYNTAX_ERROR] = range(3) - -# Benchmark suite (needs expansion) -# -# The benchmark suite does not test correctness, just speed. The -# first element of each tuple is the regex pattern; the second is a -# string to match it against. The benchmarking code will embed the -# second string inside several sizes of padding, to test how regex -# matching performs on large strings. - -benchmarks = [ - ('Python', 'Python'), # Simple text literal - ('.*Python', 'Python'), # Bad text literal - ('.*Python.*', 'Python'), # Worse text literal - ('.*\\(Python\\)', 'Python'), # Bad text literal with grouping - - ('(Python\\|Perl\\|Tcl', 'Perl'), # Alternation - ('\\(Python\\|Perl\\|Tcl\\)', 'Perl'), # Grouped alternation - ('\\(Python\\)\\1', 'PythonPython'), # Backreference -# ('\\([0a-z][a-z]*,\\)+', 'a5,b7,c9,'), # Disable the fastmap optimization - ('\\([a-z][a-z0-9]*,\\)+', 'a5,b7,c9,') # A few sets -] - -# Test suite (for verifying correctness) -# -# The test suite is a list of 5- or 3-tuples. The 5 parts of a -# complete tuple are: -# element 0: a string containing the pattern -# 1: the string to match against the pattern -# 2: the expected result (SUCCEED, FAIL, SYNTAX_ERROR) -# 3: a string that will be eval()'ed to produce a test string. -# This is an arbitrary Python expression; the available -# variables are "found" (the whole match), and "g1", "g2", ... -# up to "g10" contain the contents of each group, or the -# string 'None' if the group wasn't given a value. -# 4: The expected result of evaluating the expression. -# If the two don't match, an error is reported. -# -# If the regex isn't expected to work, the latter two elements can be omitted. - -tests = [ -('abc', 'abc', SUCCEED, - 'found', 'abc'), -('abc', 'xbc', FAIL), -('abc', 'axc', FAIL), -('abc', 'abx', FAIL), -('abc', 'xabcy', SUCCEED, - 'found', 'abc'), -('abc', 'ababc', SUCCEED, - 'found', 'abc'), -('ab*c', 'abc', SUCCEED, - 'found', 'abc'), -('ab*bc', 'abc', SUCCEED, - 'found', 'abc'), -('ab*bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab*bc', 'abbbbc', SUCCEED, - 'found', 'abbbbc'), -('ab+bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab+bc', 'abc', FAIL), -('ab+bc', 'abq', FAIL), -('ab+bc', 'abbbbc', SUCCEED, - 'found', 'abbbbc'), -('ab?bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab?bc', 'abc', SUCCEED, - 'found', 'abc'), -('ab?bc', 'abbbbc', FAIL), -('ab?c', 'abc', SUCCEED, - 'found', 'abc'), -('^abc$', 'abc', SUCCEED, - 'found', 'abc'), -('^abc$', 'abcc', FAIL), -('^abc', 'abcc', SUCCEED, - 'found', 'abc'), -('^abc$', 'aabc', FAIL), -('abc$', 'aabc', SUCCEED, - 'found', 'abc'), -('^', 'abc', SUCCEED, - 'found+"-"', '-'), -('$', 'abc', SUCCEED, - 'found+"-"', '-'), -('a.c', 'abc', SUCCEED, - 'found', 'abc'), -('a.c', 'axc', SUCCEED, - 'found', 'axc'), -('a.*c', 'axyzc', SUCCEED, - 'found', 'axyzc'), -('a.*c', 'axyzd', FAIL), -('a[bc]d', 'abc', FAIL), -('a[bc]d', 'abd', SUCCEED, - 'found', 'abd'), -('a[b-d]e', 'abd', FAIL), -('a[b-d]e', 'ace', SUCCEED, - 'found', 'ace'), -('a[b-d]', 'aac', SUCCEED, - 'found', 'ac'), -('a[-b]', 'a-', SUCCEED, - 'found', 'a-'), -('a[b-]', 'a-', SUCCEED, - 'found', 'a-'), -('a[]b', '-', SYNTAX_ERROR), -('a[', '-', SYNTAX_ERROR), -('a\\', '-', SYNTAX_ERROR), -('abc\\)', '-', SYNTAX_ERROR), -('\\(abc', '-', SYNTAX_ERROR), -('a]', 'a]', SUCCEED, - 'found', 'a]'), -('a[]]b', 'a]b', SUCCEED, - 'found', 'a]b'), -('a[^bc]d', 'aed', SUCCEED, - 'found', 'aed'), -('a[^bc]d', 'abd', FAIL), -('a[^-b]c', 'adc', SUCCEED, - 'found', 'adc'), -('a[^-b]c', 'a-c', FAIL), -('a[^]b]c', 'a]c', FAIL), -('a[^]b]c', 'adc', SUCCEED, - 'found', 'adc'), -('\\ba\\b', 'a-', SUCCEED, - '"-"', '-'), -('\\ba\\b', '-a', SUCCEED, - '"-"', '-'), -('\\ba\\b', '-a-', SUCCEED, - '"-"', '-'), -('\\by\\b', 'xy', FAIL), -('\\by\\b', 'yz', FAIL), -('\\by\\b', 'xyz', FAIL), -('ab\\|cd', 'abc', SUCCEED, - 'found', 'ab'), -('ab\\|cd', 'abcd', SUCCEED, - 'found', 'ab'), -('\\(\\)ef', 'def', SUCCEED, - 'found+"-"+g1', 'ef-'), -('$b', 'b', FAIL), -('a(b', 'a(b', SUCCEED, - 'found+"-"+g1', 'a(b-None'), -('a(*b', 'ab', SUCCEED, - 'found', 'ab'), -('a(*b', 'a((b', SUCCEED, - 'found', 'a((b'), -('a\\\\b', 'a\\b', SUCCEED, - 'found', 'a\\b'), -('\\(\\(a\\)\\)', 'abc', SUCCEED, - 'found+"-"+g1+"-"+g2', 'a-a-a'), -('\\(a\\)b\\(c\\)', 'abc', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abc-a-c'), -('a+b+c', 'aabbabc', SUCCEED, - 'found', 'abc'), -('\\(a+\\|b\\)*', 'ab', SUCCEED, - 'found+"-"+g1', 'ab-b'), -('\\(a+\\|b\\)+', 'ab', SUCCEED, - 'found+"-"+g1', 'ab-b'), -('\\(a+\\|b\\)?', 'ab', SUCCEED, - 'found+"-"+g1', 'a-a'), -('\\)\\(', '-', SYNTAX_ERROR), -('[^ab]*', 'cde', SUCCEED, - 'found', 'cde'), -('abc', '', FAIL), -('a*', '', SUCCEED, - 'found', ''), -('a\\|b\\|c\\|d\\|e', 'e', SUCCEED, - 'found', 'e'), -('\\(a\\|b\\|c\\|d\\|e\\)f', 'ef', SUCCEED, - 'found+"-"+g1', 'ef-e'), -('abcd*efg', 'abcdefg', SUCCEED, - 'found', 'abcdefg'), -('ab*', 'xabyabbbz', SUCCEED, - 'found', 'ab'), -('ab*', 'xayabbbz', SUCCEED, - 'found', 'a'), -('\\(ab\\|cd\\)e', 'abcde', SUCCEED, - 'found+"-"+g1', 'cde-cd'), -('[abhgefdc]ij', 'hij', SUCCEED, - 'found', 'hij'), -('^\\(ab\\|cd\\)e', 'abcde', FAIL, - 'xg1y', 'xy'), -('\\(abc\\|\\)ef', 'abcdef', SUCCEED, - 'found+"-"+g1', 'ef-'), -('\\(a\\|b\\)c*d', 'abcd', SUCCEED, - 'found+"-"+g1', 'bcd-b'), -('\\(ab\\|ab*\\)bc', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-a'), -('a\\([bc]*\\)c*', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-bc'), -('a\\([bc]*\\)\\(c*d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), -('a\\([bc]+\\)\\(c*d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), -('a\\([bc]*\\)\\(c+d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-b-cd'), -('a[bcd]*dcdcde', 'adcdcde', SUCCEED, - 'found', 'adcdcde'), -('a[bcd]+dcdcde', 'adcdcde', FAIL), -('\\(ab\\|a\\)b*c', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-ab'), -('\\(\\(a\\)\\(b\\)c\\)\\(d\\)', 'abcd', SUCCEED, - 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'), -('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, - 'found', 'alpha'), -('^a\\(bc+\\|b[eh]\\)g\\|.h$', 'abh', SUCCEED, - 'found+"-"+g1', 'bh-None'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'effgz', SUCCEED, - 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'ij', SUCCEED, - 'found+"-"+g1+"-"+g2', 'ij-ij-j'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'effg', FAIL), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'bcdd', FAIL), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'reffgz', SUCCEED, - 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), -('\\(\\(\\(\\(\\(\\(\\(\\(\\(a\\)\\)\\)\\)\\)\\)\\)\\)\\)', 'a', SUCCEED, - 'found', 'a'), -('multiple words of text', 'uh-uh', FAIL), -('multiple words', 'multiple words, yeah', SUCCEED, - 'found', 'multiple words'), -('\\(.*\\)c\\(.*\\)', 'abcde', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcde-ab-de'), -('(\\(.*\\), \\(.*\\))', '(a, b)', SUCCEED, - 'g2+"-"+g1', 'b-a'), -('[k]', 'ab', FAIL), -('a[-]?c', 'ac', SUCCEED, - 'found', 'ac'), -('\\(abc\\)\\1', 'abcabc', SUCCEED, - 'g1', 'abc'), -('\\([a-c]*\\)\\1', 'abcabc', SUCCEED, - 'g1', 'abc'), -('^\\(.+\\)?B', 'AB', SUCCEED, - 'g1', 'A'), -('\\(a+\\).\\1$', 'aaaaa', SUCCEED, - 'found+"-"+g1', 'aaaaa-aa'), -('^\\(a+\\).\\1$', 'aaaa', FAIL), -('\\(abc\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\([a-c]+\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\(a\\)\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a+\\)\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a+\\)+\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a\\).+\\1', 'aba', SUCCEED, - 'found+"-"+g1', 'aba-a'), -('\\(a\\)ba*\\1', 'aba', SUCCEED, - 'found+"-"+g1', 'aba-a'), -('\\(aa\\|a\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\(a\\|aa\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\(a+\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\([abc]*\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\(a\\)\\(b\\)c\\|ab', 'ab', SUCCEED, - 'found+"-"+g1+"-"+g2', 'ab-None-None'), -('\\(a\\)+x', 'aaax', SUCCEED, - 'found+"-"+g1', 'aaax-a'), -('\\([ac]\\)+x', 'aacx', SUCCEED, - 'found+"-"+g1', 'aacx-c'), -('\\([^/]*/\\)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED, - 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'), -('\\([^.]*\\)\\.\\([^:]*\\):[T ]+\\(.*\\)', 'track1.title:TBlah blah blah', SUCCEED, - 'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'), -('\\([^N]*N\\)+', 'abNNxyzN', SUCCEED, - 'found+"-"+g1', 'abNNxyzN-xyzN'), -('\\([^N]*N\\)+', 'abNNxyz', SUCCEED, - 'found+"-"+g1', 'abNN-N'), -('\\([abc]*\\)x', 'abcx', SUCCEED, - 'found+"-"+g1', 'abcx-abc'), -('\\([abc]*\\)x', 'abc', FAIL), -('\\([xyz]*\\)x', 'abcx', SUCCEED, - 'found+"-"+g1', 'x-'), -('\\(a\\)+b\\|aac', 'aac', SUCCEED, - 'found+"-"+g1', 'aac-None'), -('\', 'ab', FAIL), -('a\>', 'a!', SUCCEED, 'found', 'a'), -('a\>', 'a', SUCCEED, 'found', 'a'), -] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 02:34:23 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jan 2012 02:34:23 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/aa214fefbdc1 changeset: 74674:aa214fefbdc1 parent: 74671:ce89dcba008f parent: 74673:4084b2c65dca user: Benjamin Peterson date: Sat Jan 28 20:33:52 2012 -0500 summary: merge 3.2 files: Lib/test/regex_tests.py | 285 ---------------------------- 1 files changed, 0 insertions(+), 285 deletions(-) diff --git a/Lib/test/regex_tests.py b/Lib/test/regex_tests.py deleted file mode 100644 --- a/Lib/test/regex_tests.py +++ /dev/null @@ -1,285 +0,0 @@ -# Regex test suite and benchmark suite v1.5a2 - -# The 3 possible outcomes for each pattern -[SUCCEED, FAIL, SYNTAX_ERROR] = range(3) - -# Benchmark suite (needs expansion) -# -# The benchmark suite does not test correctness, just speed. The -# first element of each tuple is the regex pattern; the second is a -# string to match it against. The benchmarking code will embed the -# second string inside several sizes of padding, to test how regex -# matching performs on large strings. - -benchmarks = [ - ('Python', 'Python'), # Simple text literal - ('.*Python', 'Python'), # Bad text literal - ('.*Python.*', 'Python'), # Worse text literal - ('.*\\(Python\\)', 'Python'), # Bad text literal with grouping - - ('(Python\\|Perl\\|Tcl', 'Perl'), # Alternation - ('\\(Python\\|Perl\\|Tcl\\)', 'Perl'), # Grouped alternation - ('\\(Python\\)\\1', 'PythonPython'), # Backreference -# ('\\([0a-z][a-z]*,\\)+', 'a5,b7,c9,'), # Disable the fastmap optimization - ('\\([a-z][a-z0-9]*,\\)+', 'a5,b7,c9,') # A few sets -] - -# Test suite (for verifying correctness) -# -# The test suite is a list of 5- or 3-tuples. The 5 parts of a -# complete tuple are: -# element 0: a string containing the pattern -# 1: the string to match against the pattern -# 2: the expected result (SUCCEED, FAIL, SYNTAX_ERROR) -# 3: a string that will be eval()'ed to produce a test string. -# This is an arbitrary Python expression; the available -# variables are "found" (the whole match), and "g1", "g2", ... -# up to "g10" contain the contents of each group, or the -# string 'None' if the group wasn't given a value. -# 4: The expected result of evaluating the expression. -# If the two don't match, an error is reported. -# -# If the regex isn't expected to work, the latter two elements can be omitted. - -tests = [ -('abc', 'abc', SUCCEED, - 'found', 'abc'), -('abc', 'xbc', FAIL), -('abc', 'axc', FAIL), -('abc', 'abx', FAIL), -('abc', 'xabcy', SUCCEED, - 'found', 'abc'), -('abc', 'ababc', SUCCEED, - 'found', 'abc'), -('ab*c', 'abc', SUCCEED, - 'found', 'abc'), -('ab*bc', 'abc', SUCCEED, - 'found', 'abc'), -('ab*bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab*bc', 'abbbbc', SUCCEED, - 'found', 'abbbbc'), -('ab+bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab+bc', 'abc', FAIL), -('ab+bc', 'abq', FAIL), -('ab+bc', 'abbbbc', SUCCEED, - 'found', 'abbbbc'), -('ab?bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab?bc', 'abc', SUCCEED, - 'found', 'abc'), -('ab?bc', 'abbbbc', FAIL), -('ab?c', 'abc', SUCCEED, - 'found', 'abc'), -('^abc$', 'abc', SUCCEED, - 'found', 'abc'), -('^abc$', 'abcc', FAIL), -('^abc', 'abcc', SUCCEED, - 'found', 'abc'), -('^abc$', 'aabc', FAIL), -('abc$', 'aabc', SUCCEED, - 'found', 'abc'), -('^', 'abc', SUCCEED, - 'found+"-"', '-'), -('$', 'abc', SUCCEED, - 'found+"-"', '-'), -('a.c', 'abc', SUCCEED, - 'found', 'abc'), -('a.c', 'axc', SUCCEED, - 'found', 'axc'), -('a.*c', 'axyzc', SUCCEED, - 'found', 'axyzc'), -('a.*c', 'axyzd', FAIL), -('a[bc]d', 'abc', FAIL), -('a[bc]d', 'abd', SUCCEED, - 'found', 'abd'), -('a[b-d]e', 'abd', FAIL), -('a[b-d]e', 'ace', SUCCEED, - 'found', 'ace'), -('a[b-d]', 'aac', SUCCEED, - 'found', 'ac'), -('a[-b]', 'a-', SUCCEED, - 'found', 'a-'), -('a[b-]', 'a-', SUCCEED, - 'found', 'a-'), -('a[]b', '-', SYNTAX_ERROR), -('a[', '-', SYNTAX_ERROR), -('a\\', '-', SYNTAX_ERROR), -('abc\\)', '-', SYNTAX_ERROR), -('\\(abc', '-', SYNTAX_ERROR), -('a]', 'a]', SUCCEED, - 'found', 'a]'), -('a[]]b', 'a]b', SUCCEED, - 'found', 'a]b'), -('a[^bc]d', 'aed', SUCCEED, - 'found', 'aed'), -('a[^bc]d', 'abd', FAIL), -('a[^-b]c', 'adc', SUCCEED, - 'found', 'adc'), -('a[^-b]c', 'a-c', FAIL), -('a[^]b]c', 'a]c', FAIL), -('a[^]b]c', 'adc', SUCCEED, - 'found', 'adc'), -('\\ba\\b', 'a-', SUCCEED, - '"-"', '-'), -('\\ba\\b', '-a', SUCCEED, - '"-"', '-'), -('\\ba\\b', '-a-', SUCCEED, - '"-"', '-'), -('\\by\\b', 'xy', FAIL), -('\\by\\b', 'yz', FAIL), -('\\by\\b', 'xyz', FAIL), -('ab\\|cd', 'abc', SUCCEED, - 'found', 'ab'), -('ab\\|cd', 'abcd', SUCCEED, - 'found', 'ab'), -('\\(\\)ef', 'def', SUCCEED, - 'found+"-"+g1', 'ef-'), -('$b', 'b', FAIL), -('a(b', 'a(b', SUCCEED, - 'found+"-"+g1', 'a(b-None'), -('a(*b', 'ab', SUCCEED, - 'found', 'ab'), -('a(*b', 'a((b', SUCCEED, - 'found', 'a((b'), -('a\\\\b', 'a\\b', SUCCEED, - 'found', 'a\\b'), -('\\(\\(a\\)\\)', 'abc', SUCCEED, - 'found+"-"+g1+"-"+g2', 'a-a-a'), -('\\(a\\)b\\(c\\)', 'abc', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abc-a-c'), -('a+b+c', 'aabbabc', SUCCEED, - 'found', 'abc'), -('\\(a+\\|b\\)*', 'ab', SUCCEED, - 'found+"-"+g1', 'ab-b'), -('\\(a+\\|b\\)+', 'ab', SUCCEED, - 'found+"-"+g1', 'ab-b'), -('\\(a+\\|b\\)?', 'ab', SUCCEED, - 'found+"-"+g1', 'a-a'), -('\\)\\(', '-', SYNTAX_ERROR), -('[^ab]*', 'cde', SUCCEED, - 'found', 'cde'), -('abc', '', FAIL), -('a*', '', SUCCEED, - 'found', ''), -('a\\|b\\|c\\|d\\|e', 'e', SUCCEED, - 'found', 'e'), -('\\(a\\|b\\|c\\|d\\|e\\)f', 'ef', SUCCEED, - 'found+"-"+g1', 'ef-e'), -('abcd*efg', 'abcdefg', SUCCEED, - 'found', 'abcdefg'), -('ab*', 'xabyabbbz', SUCCEED, - 'found', 'ab'), -('ab*', 'xayabbbz', SUCCEED, - 'found', 'a'), -('\\(ab\\|cd\\)e', 'abcde', SUCCEED, - 'found+"-"+g1', 'cde-cd'), -('[abhgefdc]ij', 'hij', SUCCEED, - 'found', 'hij'), -('^\\(ab\\|cd\\)e', 'abcde', FAIL, - 'xg1y', 'xy'), -('\\(abc\\|\\)ef', 'abcdef', SUCCEED, - 'found+"-"+g1', 'ef-'), -('\\(a\\|b\\)c*d', 'abcd', SUCCEED, - 'found+"-"+g1', 'bcd-b'), -('\\(ab\\|ab*\\)bc', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-a'), -('a\\([bc]*\\)c*', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-bc'), -('a\\([bc]*\\)\\(c*d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), -('a\\([bc]+\\)\\(c*d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), -('a\\([bc]*\\)\\(c+d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-b-cd'), -('a[bcd]*dcdcde', 'adcdcde', SUCCEED, - 'found', 'adcdcde'), -('a[bcd]+dcdcde', 'adcdcde', FAIL), -('\\(ab\\|a\\)b*c', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-ab'), -('\\(\\(a\\)\\(b\\)c\\)\\(d\\)', 'abcd', SUCCEED, - 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'), -('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, - 'found', 'alpha'), -('^a\\(bc+\\|b[eh]\\)g\\|.h$', 'abh', SUCCEED, - 'found+"-"+g1', 'bh-None'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'effgz', SUCCEED, - 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'ij', SUCCEED, - 'found+"-"+g1+"-"+g2', 'ij-ij-j'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'effg', FAIL), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'bcdd', FAIL), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'reffgz', SUCCEED, - 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), -('\\(\\(\\(\\(\\(\\(\\(\\(\\(a\\)\\)\\)\\)\\)\\)\\)\\)\\)', 'a', SUCCEED, - 'found', 'a'), -('multiple words of text', 'uh-uh', FAIL), -('multiple words', 'multiple words, yeah', SUCCEED, - 'found', 'multiple words'), -('\\(.*\\)c\\(.*\\)', 'abcde', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcde-ab-de'), -('(\\(.*\\), \\(.*\\))', '(a, b)', SUCCEED, - 'g2+"-"+g1', 'b-a'), -('[k]', 'ab', FAIL), -('a[-]?c', 'ac', SUCCEED, - 'found', 'ac'), -('\\(abc\\)\\1', 'abcabc', SUCCEED, - 'g1', 'abc'), -('\\([a-c]*\\)\\1', 'abcabc', SUCCEED, - 'g1', 'abc'), -('^\\(.+\\)?B', 'AB', SUCCEED, - 'g1', 'A'), -('\\(a+\\).\\1$', 'aaaaa', SUCCEED, - 'found+"-"+g1', 'aaaaa-aa'), -('^\\(a+\\).\\1$', 'aaaa', FAIL), -('\\(abc\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\([a-c]+\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\(a\\)\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a+\\)\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a+\\)+\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a\\).+\\1', 'aba', SUCCEED, - 'found+"-"+g1', 'aba-a'), -('\\(a\\)ba*\\1', 'aba', SUCCEED, - 'found+"-"+g1', 'aba-a'), -('\\(aa\\|a\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\(a\\|aa\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\(a+\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\([abc]*\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\(a\\)\\(b\\)c\\|ab', 'ab', SUCCEED, - 'found+"-"+g1+"-"+g2', 'ab-None-None'), -('\\(a\\)+x', 'aaax', SUCCEED, - 'found+"-"+g1', 'aaax-a'), -('\\([ac]\\)+x', 'aacx', SUCCEED, - 'found+"-"+g1', 'aacx-c'), -('\\([^/]*/\\)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED, - 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'), -('\\([^.]*\\)\\.\\([^:]*\\):[T ]+\\(.*\\)', 'track1.title:TBlah blah blah', SUCCEED, - 'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'), -('\\([^N]*N\\)+', 'abNNxyzN', SUCCEED, - 'found+"-"+g1', 'abNNxyzN-xyzN'), -('\\([^N]*N\\)+', 'abNNxyz', SUCCEED, - 'found+"-"+g1', 'abNN-N'), -('\\([abc]*\\)x', 'abcx', SUCCEED, - 'found+"-"+g1', 'abcx-abc'), -('\\([abc]*\\)x', 'abc', FAIL), -('\\([xyz]*\\)x', 'abcx', SUCCEED, - 'found+"-"+g1', 'x-'), -('\\(a\\)+b\\|aac', 'aac', SUCCEED, - 'found+"-"+g1', 'aac-None'), -('\', 'ab', FAIL), -('a\>', 'a!', SUCCEED, 'found', 'a'), -('a\>', 'a', SUCCEED, 'found', 'a'), -] -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 02:35:04 2012 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 29 Jan 2012 02:35:04 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_remove_tests_fr?= =?utf8?q?om_really_old_regex_module?= Message-ID: http://hg.python.org/cpython/rev/4c6662090870 changeset: 74675:4c6662090870 branch: 2.7 parent: 74672:f1ee3bb6ba64 user: Benjamin Peterson date: Sat Jan 28 20:33:21 2012 -0500 summary: remove tests from really old regex module files: Lib/test/regex_tests.py | 287 ---------------------------- 1 files changed, 0 insertions(+), 287 deletions(-) diff --git a/Lib/test/regex_tests.py b/Lib/test/regex_tests.py deleted file mode 100644 --- a/Lib/test/regex_tests.py +++ /dev/null @@ -1,287 +0,0 @@ -# Regex test suite and benchmark suite v1.5a2 -# Due to the use of r"aw" strings, this file will -# only work with Python 1.5 or higher. - -# The 3 possible outcomes for each pattern -[SUCCEED, FAIL, SYNTAX_ERROR] = range(3) - -# Benchmark suite (needs expansion) -# -# The benchmark suite does not test correctness, just speed. The -# first element of each tuple is the regex pattern; the second is a -# string to match it against. The benchmarking code will embed the -# second string inside several sizes of padding, to test how regex -# matching performs on large strings. - -benchmarks = [ - ('Python', 'Python'), # Simple text literal - ('.*Python', 'Python'), # Bad text literal - ('.*Python.*', 'Python'), # Worse text literal - ('.*\\(Python\\)', 'Python'), # Bad text literal with grouping - - ('(Python\\|Perl\\|Tcl', 'Perl'), # Alternation - ('\\(Python\\|Perl\\|Tcl\\)', 'Perl'), # Grouped alternation - ('\\(Python\\)\\1', 'PythonPython'), # Backreference -# ('\\([0a-z][a-z]*,\\)+', 'a5,b7,c9,'), # Disable the fastmap optimization - ('\\([a-z][a-z0-9]*,\\)+', 'a5,b7,c9,') # A few sets -] - -# Test suite (for verifying correctness) -# -# The test suite is a list of 5- or 3-tuples. The 5 parts of a -# complete tuple are: -# element 0: a string containing the pattern -# 1: the string to match against the pattern -# 2: the expected result (SUCCEED, FAIL, SYNTAX_ERROR) -# 3: a string that will be eval()'ed to produce a test string. -# This is an arbitrary Python expression; the available -# variables are "found" (the whole match), and "g1", "g2", ... -# up to "g10" contain the contents of each group, or the -# string 'None' if the group wasn't given a value. -# 4: The expected result of evaluating the expression. -# If the two don't match, an error is reported. -# -# If the regex isn't expected to work, the latter two elements can be omitted. - -tests = [ -('abc', 'abc', SUCCEED, - 'found', 'abc'), -('abc', 'xbc', FAIL), -('abc', 'axc', FAIL), -('abc', 'abx', FAIL), -('abc', 'xabcy', SUCCEED, - 'found', 'abc'), -('abc', 'ababc', SUCCEED, - 'found', 'abc'), -('ab*c', 'abc', SUCCEED, - 'found', 'abc'), -('ab*bc', 'abc', SUCCEED, - 'found', 'abc'), -('ab*bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab*bc', 'abbbbc', SUCCEED, - 'found', 'abbbbc'), -('ab+bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab+bc', 'abc', FAIL), -('ab+bc', 'abq', FAIL), -('ab+bc', 'abbbbc', SUCCEED, - 'found', 'abbbbc'), -('ab?bc', 'abbc', SUCCEED, - 'found', 'abbc'), -('ab?bc', 'abc', SUCCEED, - 'found', 'abc'), -('ab?bc', 'abbbbc', FAIL), -('ab?c', 'abc', SUCCEED, - 'found', 'abc'), -('^abc$', 'abc', SUCCEED, - 'found', 'abc'), -('^abc$', 'abcc', FAIL), -('^abc', 'abcc', SUCCEED, - 'found', 'abc'), -('^abc$', 'aabc', FAIL), -('abc$', 'aabc', SUCCEED, - 'found', 'abc'), -('^', 'abc', SUCCEED, - 'found+"-"', '-'), -('$', 'abc', SUCCEED, - 'found+"-"', '-'), -('a.c', 'abc', SUCCEED, - 'found', 'abc'), -('a.c', 'axc', SUCCEED, - 'found', 'axc'), -('a.*c', 'axyzc', SUCCEED, - 'found', 'axyzc'), -('a.*c', 'axyzd', FAIL), -('a[bc]d', 'abc', FAIL), -('a[bc]d', 'abd', SUCCEED, - 'found', 'abd'), -('a[b-d]e', 'abd', FAIL), -('a[b-d]e', 'ace', SUCCEED, - 'found', 'ace'), -('a[b-d]', 'aac', SUCCEED, - 'found', 'ac'), -('a[-b]', 'a-', SUCCEED, - 'found', 'a-'), -('a[b-]', 'a-', SUCCEED, - 'found', 'a-'), -('a[]b', '-', SYNTAX_ERROR), -('a[', '-', SYNTAX_ERROR), -('a\\', '-', SYNTAX_ERROR), -('abc\\)', '-', SYNTAX_ERROR), -('\\(abc', '-', SYNTAX_ERROR), -('a]', 'a]', SUCCEED, - 'found', 'a]'), -('a[]]b', 'a]b', SUCCEED, - 'found', 'a]b'), -('a[^bc]d', 'aed', SUCCEED, - 'found', 'aed'), -('a[^bc]d', 'abd', FAIL), -('a[^-b]c', 'adc', SUCCEED, - 'found', 'adc'), -('a[^-b]c', 'a-c', FAIL), -('a[^]b]c', 'a]c', FAIL), -('a[^]b]c', 'adc', SUCCEED, - 'found', 'adc'), -('\\ba\\b', 'a-', SUCCEED, - '"-"', '-'), -('\\ba\\b', '-a', SUCCEED, - '"-"', '-'), -('\\ba\\b', '-a-', SUCCEED, - '"-"', '-'), -('\\by\\b', 'xy', FAIL), -('\\by\\b', 'yz', FAIL), -('\\by\\b', 'xyz', FAIL), -('ab\\|cd', 'abc', SUCCEED, - 'found', 'ab'), -('ab\\|cd', 'abcd', SUCCEED, - 'found', 'ab'), -('\\(\\)ef', 'def', SUCCEED, - 'found+"-"+g1', 'ef-'), -('$b', 'b', FAIL), -('a(b', 'a(b', SUCCEED, - 'found+"-"+g1', 'a(b-None'), -('a(*b', 'ab', SUCCEED, - 'found', 'ab'), -('a(*b', 'a((b', SUCCEED, - 'found', 'a((b'), -('a\\\\b', 'a\\b', SUCCEED, - 'found', 'a\\b'), -('\\(\\(a\\)\\)', 'abc', SUCCEED, - 'found+"-"+g1+"-"+g2', 'a-a-a'), -('\\(a\\)b\\(c\\)', 'abc', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abc-a-c'), -('a+b+c', 'aabbabc', SUCCEED, - 'found', 'abc'), -('\\(a+\\|b\\)*', 'ab', SUCCEED, - 'found+"-"+g1', 'ab-b'), -('\\(a+\\|b\\)+', 'ab', SUCCEED, - 'found+"-"+g1', 'ab-b'), -('\\(a+\\|b\\)?', 'ab', SUCCEED, - 'found+"-"+g1', 'a-a'), -('\\)\\(', '-', SYNTAX_ERROR), -('[^ab]*', 'cde', SUCCEED, - 'found', 'cde'), -('abc', '', FAIL), -('a*', '', SUCCEED, - 'found', ''), -('a\\|b\\|c\\|d\\|e', 'e', SUCCEED, - 'found', 'e'), -('\\(a\\|b\\|c\\|d\\|e\\)f', 'ef', SUCCEED, - 'found+"-"+g1', 'ef-e'), -('abcd*efg', 'abcdefg', SUCCEED, - 'found', 'abcdefg'), -('ab*', 'xabyabbbz', SUCCEED, - 'found', 'ab'), -('ab*', 'xayabbbz', SUCCEED, - 'found', 'a'), -('\\(ab\\|cd\\)e', 'abcde', SUCCEED, - 'found+"-"+g1', 'cde-cd'), -('[abhgefdc]ij', 'hij', SUCCEED, - 'found', 'hij'), -('^\\(ab\\|cd\\)e', 'abcde', FAIL, - 'xg1y', 'xy'), -('\\(abc\\|\\)ef', 'abcdef', SUCCEED, - 'found+"-"+g1', 'ef-'), -('\\(a\\|b\\)c*d', 'abcd', SUCCEED, - 'found+"-"+g1', 'bcd-b'), -('\\(ab\\|ab*\\)bc', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-a'), -('a\\([bc]*\\)c*', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-bc'), -('a\\([bc]*\\)\\(c*d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), -('a\\([bc]+\\)\\(c*d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-bc-d'), -('a\\([bc]*\\)\\(c+d\\)', 'abcd', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcd-b-cd'), -('a[bcd]*dcdcde', 'adcdcde', SUCCEED, - 'found', 'adcdcde'), -('a[bcd]+dcdcde', 'adcdcde', FAIL), -('\\(ab\\|a\\)b*c', 'abc', SUCCEED, - 'found+"-"+g1', 'abc-ab'), -('\\(\\(a\\)\\(b\\)c\\)\\(d\\)', 'abcd', SUCCEED, - 'g1+"-"+g2+"-"+g3+"-"+g4', 'abc-a-b-d'), -('[a-zA-Z_][a-zA-Z0-9_]*', 'alpha', SUCCEED, - 'found', 'alpha'), -('^a\\(bc+\\|b[eh]\\)g\\|.h$', 'abh', SUCCEED, - 'found+"-"+g1', 'bh-None'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'effgz', SUCCEED, - 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'ij', SUCCEED, - 'found+"-"+g1+"-"+g2', 'ij-ij-j'), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'effg', FAIL), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'bcdd', FAIL), -('\\(bc+d$\\|ef*g.\\|h?i\\(j\\|k\\)\\)', 'reffgz', SUCCEED, - 'found+"-"+g1+"-"+g2', 'effgz-effgz-None'), -('\\(\\(\\(\\(\\(\\(\\(\\(\\(a\\)\\)\\)\\)\\)\\)\\)\\)\\)', 'a', SUCCEED, - 'found', 'a'), -('multiple words of text', 'uh-uh', FAIL), -('multiple words', 'multiple words, yeah', SUCCEED, - 'found', 'multiple words'), -('\\(.*\\)c\\(.*\\)', 'abcde', SUCCEED, - 'found+"-"+g1+"-"+g2', 'abcde-ab-de'), -('(\\(.*\\), \\(.*\\))', '(a, b)', SUCCEED, - 'g2+"-"+g1', 'b-a'), -('[k]', 'ab', FAIL), -('a[-]?c', 'ac', SUCCEED, - 'found', 'ac'), -('\\(abc\\)\\1', 'abcabc', SUCCEED, - 'g1', 'abc'), -('\\([a-c]*\\)\\1', 'abcabc', SUCCEED, - 'g1', 'abc'), -('^\\(.+\\)?B', 'AB', SUCCEED, - 'g1', 'A'), -('\\(a+\\).\\1$', 'aaaaa', SUCCEED, - 'found+"-"+g1', 'aaaaa-aa'), -('^\\(a+\\).\\1$', 'aaaa', FAIL), -('\\(abc\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\([a-c]+\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\(a\\)\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a+\\)\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a+\\)+\\1', 'aa', SUCCEED, - 'found+"-"+g1', 'aa-a'), -('\\(a\\).+\\1', 'aba', SUCCEED, - 'found+"-"+g1', 'aba-a'), -('\\(a\\)ba*\\1', 'aba', SUCCEED, - 'found+"-"+g1', 'aba-a'), -('\\(aa\\|a\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\(a\\|aa\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\(a+\\)a\\1$', 'aaa', SUCCEED, - 'found+"-"+g1', 'aaa-a'), -('\\([abc]*\\)\\1', 'abcabc', SUCCEED, - 'found+"-"+g1', 'abcabc-abc'), -('\\(a\\)\\(b\\)c\\|ab', 'ab', SUCCEED, - 'found+"-"+g1+"-"+g2', 'ab-None-None'), -('\\(a\\)+x', 'aaax', SUCCEED, - 'found+"-"+g1', 'aaax-a'), -('\\([ac]\\)+x', 'aacx', SUCCEED, - 'found+"-"+g1', 'aacx-c'), -('\\([^/]*/\\)*sub1/', 'd:msgs/tdir/sub1/trial/away.cpp', SUCCEED, - 'found+"-"+g1', 'd:msgs/tdir/sub1/-tdir/'), -('\\([^.]*\\)\\.\\([^:]*\\):[T ]+\\(.*\\)', 'track1.title:TBlah blah blah', SUCCEED, - 'found+"-"+g1+"-"+g2+"-"+g3', 'track1.title:TBlah blah blah-track1-title-Blah blah blah'), -('\\([^N]*N\\)+', 'abNNxyzN', SUCCEED, - 'found+"-"+g1', 'abNNxyzN-xyzN'), -('\\([^N]*N\\)+', 'abNNxyz', SUCCEED, - 'found+"-"+g1', 'abNN-N'), -('\\([abc]*\\)x', 'abcx', SUCCEED, - 'found+"-"+g1', 'abcx-abc'), -('\\([abc]*\\)x', 'abc', FAIL), -('\\([xyz]*\\)x', 'abcx', SUCCEED, - 'found+"-"+g1', 'x-'), -('\\(a\\)+b\\|aac', 'aac', SUCCEED, - 'found+"-"+g1', 'aac-None'), -('\', 'ab', FAIL), -('a\>', 'a!', SUCCEED, 'found', 'a'), -('a\>', 'a', SUCCEED, 'found', 'a'), -] -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Sun Jan 29 05:32:29 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 29 Jan 2012 05:32:29 +0100 Subject: [Python-checkins] Daily reference leaks (aa214fefbdc1): sum=0 Message-ID: results for aa214fefbdc1 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogG0VRKe', '-x'] From python-checkins at python.org Sun Jan 29 07:22:40 2012 From: python-checkins at python.org (nick.coghlan) Date: Sun, 29 Jan 2012 07:22:40 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Guido_has_rejected_PEP_408?= Message-ID: http://hg.python.org/peps/rev/fcf8ecbcf953 changeset: 4025:fcf8ecbcf953 user: Nick Coghlan date: Sun Jan 29 16:22:32 2012 +1000 summary: Guido has rejected PEP 408 files: pep-0408.txt | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/pep-0408.txt b/pep-0408.txt --- a/pep-0408.txt +++ b/pep-0408.txt @@ -4,12 +4,13 @@ Last-Modified: $Date$ Author: Nick Coghlan , Eli Bendersky -Status: Draft +Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 2012-01-07 Python-Version: 3.3 Post-History: 2012-01-27 +Resolution: http://mail.python.org/pipermail/python-dev/2012-January/115962.html Abstract @@ -27,6 +28,25 @@ or to the stability of its API, which may change for the next release. +PEP Rejection +============= + +Based on his experience with a similar "labs" namespace in Google App Engine, +Guido has rejected this PEP [3] in favour of the simpler alternative of +explicitly marking provisional modules as such in their documentation. + +If a module is otherwise considered suitable for standard library inclusion, +but some concerns remain regarding maintainability or certain API details, +then the module can be accepted on a provisional basis. While it is considered +an unlikely outcome, such modules *may* be removed from the standard library +without a deprecation period if the lingering concerns prove well-founded. + +As part of the same announcement, Guido explicitly accepted Matthew +Barnett's 'regex' module [4] as a provisional addition to the standard +library for Python 3.3 (using the 'regex' name, rather than as a drop-in +replacement for the existing 're' module). + + Proposal - the __preview__ package ================================== @@ -275,6 +295,11 @@ .. [#] http://mail.python.org/pipermail/python-ideas/2011-August/011278.html +.. [#] Guido's decision: + http://mail.python.org/pipermail/python-dev/2012-January/115962.html + +.. [#] Proposal for inclusion of regex: http://bugs.python.org/issue2636 + Copyright ========= -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Jan 29 07:32:03 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 07:32:03 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_regex=2E?= Message-ID: http://hg.python.org/peps/rev/773efb84a269 changeset: 4026:773efb84a269 user: Georg Brandl date: Sun Jan 29 07:32:04 2012 +0100 summary: Add regex. files: pep-0398.txt | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -67,8 +67,8 @@ Other final large-scale changes: * Addition of the "packaging" module, deprecating "distutils" -* Addition of the faulthandler module -* Addition of the lzma module, and lzma/xz support in tarfile +* Addition of the "faulthandler" module +* Addition of the "lzma" module, and lzma/xz support in tarfile Candidate PEPs: @@ -88,6 +88,7 @@ * A standard event-loop interface (PEP by Jim Fulton pending) * Breaking out standard library and docs in separate repos? * A PEP on supplementing C modules with equivalent Python modules? +* Addition of the "regex" module Copyright -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Jan 29 07:39:38 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 07:39:38 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_PEP_399_is_already_there_and_f?= =?utf8?q?inal=2E?= Message-ID: http://hg.python.org/peps/rev/7c0e1d694bfe changeset: 4027:7c0e1d694bfe user: Georg Brandl date: Sun Jan 29 07:39:39 2012 +0100 summary: PEP 399 is already there and final. files: pep-0398.txt | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -57,10 +57,11 @@ Features for 3.3 ================ -Implemented PEPs: +Implemented / Final PEPs: * PEP 380: Syntax for Delegating to a Subgenerator * PEP 393: Flexible String Representation +* PEP 399: Pure Python/C Accelerator Module Compatibility Requirements * PEP 3151: Reworking the OS and IO exception hierarchy * PEP 3155: Qualified name for classes and functions @@ -83,12 +84,11 @@ Other planned large-scale changes: +* Addition of the "regex" module +* Email version 6 * Implementing ``__import__`` using importlib -* Email version 6 * A standard event-loop interface (PEP by Jim Fulton pending) * Breaking out standard library and docs in separate repos? -* A PEP on supplementing C modules with equivalent Python modules? -* Addition of the "regex" module Copyright -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Jan 29 09:41:12 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 09:41:12 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Style_updates_to_PEP_409=2E?= Message-ID: http://hg.python.org/peps/rev/c1ed6327769a changeset: 4028:c1ed6327769a user: Georg Brandl date: Sun Jan 29 09:41:13 2012 +0100 summary: Style updates to PEP 409. files: pep-0409.txt | 78 +++++++++++++++++++++------------------ 1 files changed, 42 insertions(+), 36 deletions(-) diff --git a/pep-0409.txt b/pep-0409.txt --- a/pep-0409.txt +++ b/pep-0409.txt @@ -14,51 +14,54 @@ Abstract ======== -One of the open issues from PEP 3134 is suppressing context: currently there is -no way to do it. This PEP proposes one. +One of the open issues from PEP 3134 is suppressing context: currently +there is no way to do it. This PEP proposes one. + Motivation ========== -There are two basic ways to generate exceptions: 1) Python does it (buggy code, -missing resources, ending loops, etc.); and, 2) manually (with a raise -statement). +There are two basic ways to generate exceptions: 1) Python does it +(buggy code, missing resources, ending loops, etc.); and, 2) manually +(with a raise statement). -When writing libraries, or even just custom classes, it can become necessary to -raise exceptions; moreover it can be useful, even necessary, to change from one -exception to another. To take an example from my dbf module: +When writing libraries, or even just custom classes, it can become +necessary to raise exceptions; moreover it can be useful, even +necessary, to change from one exception to another. To take an +example from my dbf module:: try: value = int(value) except Exception: raise DbfError(...) -Whatever the original exception was (ValueError, TypeError, or something else) -is irrelevant. The exception from this point on is a DbfError, and the original -exception is of no value. However, if this exception is printed, we would -currently see both. +Whatever the original exception was (ValueError, TypeError, or +something else) is irrelevant. The exception from this point on is a +DbfError, and the original exception is of no value. However, if this +exception is printed, we would currently see both. Alternatives ============ + Several possibilities have been put forth: - - raise as NewException() +- ``raise as NewException()`` - Reuses the 'as' keyword; can be confusing since we are not really reraising - the originating exception + Reuses the 'as' keyword; can be confusing since we are not really reraising + the originating exception - - raise NewException() from None +- ``raise NewException() from None`` - Follows existing syntax of explicitly declaring the originating exception + Follows existing syntax of explicitly declaring the originating exception - - exc = NewException(); exc.__context__ = None; raise exc +- ``exc = NewException(); exc.__context__ = None; raise exc`` - Very verbose way of the previous method + Very verbose way of the previous method - - raise NewException.no_context(...) +- ``raise NewException.no_context(...)`` - Make context suppression a class method. + Make context suppression a class method. All of the above options will require changes to the core. @@ -66,17 +69,18 @@ Proposal ======== -I proprose going with the second option: +I proprose going with the second option:: - raise NewException from None + raise NewException from None -It has the advantage of using the existing pattern of explicitly setting -the cause: +It has the advantage of using the existing pattern of explicitly +setting the cause:: - raise KeyError() from NameError() + raise KeyError() from NameError() -but because the 'cause' is None the previous context is discarded. There is a -patch to this effect attached to issue 6210 [#issue6210]_. +but because the 'cause' is None the previous context is discarded. +There is a patch to this effect attached to issue 6210 [#issue6210]_. + References ========== @@ -84,17 +88,19 @@ .. [#issue6210] http://bugs.python.org/issue6210 + Copyright ========= This document has been placed in the public domain. - + + .. - Local Variables: - mode: indented-text - indent-tabs-mode: nil - sentence-end-double-space: t - fill-column: 70 - coding: utf-8 - End: + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Jan 29 09:44:18 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 09:44:18 +0100 Subject: [Python-checkins] =?utf8?q?peps=3A_Add_PEP_409=2E?= Message-ID: http://hg.python.org/peps/rev/caa64c650757 changeset: 4029:caa64c650757 user: Georg Brandl date: Sun Jan 29 09:44:19 2012 +0100 summary: Add PEP 409. files: pep-0398.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/pep-0398.txt b/pep-0398.txt --- a/pep-0398.txt +++ b/pep-0398.txt @@ -77,6 +77,7 @@ * PEP 382: Namespace Packages * PEP 395: Module Aliasing * PEP 397: Python launcher for Windows +* PEP 409: Suppressing exception context * PEP 3143: Standard daemon process library (Note that these are not accepted yet and even if they are, they might -- Repository URL: http://hg.python.org/peps From python-checkins at python.org Sun Jan 29 15:38:57 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 15:38:57 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogRml4ICMxMzkwMDog?= =?utf8?q?resolve_self-referential_description_of_a_parameter=2E?= Message-ID: http://hg.python.org/cpython/rev/0d5667171356 changeset: 74676:0d5667171356 branch: 3.2 parent: 74673:4084b2c65dca user: Georg Brandl date: Sun Jan 29 15:38:47 2012 +0100 summary: Fix #13900: resolve self-referential description of a parameter. files: Doc/library/email.parser.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/email.parser.rst b/Doc/library/email.parser.rst --- a/Doc/library/email.parser.rst +++ b/Doc/library/email.parser.rst @@ -133,7 +133,9 @@ data or by a blank line. Following the header block is the body of the message (which may contain MIME-encoded subparts). - Optional *headersonly* is as with the :meth:`parse` method. + Optional *headersonly* is a flag specifying whether to stop parsing after + reading the headers or not. The default is ``False``, meaning it parses + the entire contents of the file. .. method:: parsestr(text, headersonly=False) @@ -142,9 +144,7 @@ equivalent to wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:`parse`. - Optional *headersonly* is a flag specifying whether to stop parsing after - reading the headers or not. The default is ``False``, meaning it parses - the entire contents of the file. + Optional *headersonly* is as with the :meth:`parse` method. .. class:: BytesParser(_class=email.message.Message, strict=None) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 15:38:58 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 15:38:58 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_merge_with_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/a273f6e101c6 changeset: 74677:a273f6e101c6 parent: 74674:aa214fefbdc1 parent: 74676:0d5667171356 user: Georg Brandl date: Sun Jan 29 15:38:55 2012 +0100 summary: merge with 3.2 files: Doc/library/email.parser.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/email.parser.rst b/Doc/library/email.parser.rst --- a/Doc/library/email.parser.rst +++ b/Doc/library/email.parser.rst @@ -141,7 +141,9 @@ data or by a blank line. Following the header block is the body of the message (which may contain MIME-encoded subparts). - Optional *headersonly* is as with the :meth:`parse` method. + Optional *headersonly* is a flag specifying whether to stop parsing after + reading the headers or not. The default is ``False``, meaning it parses + the entire contents of the file. .. method:: parsestr(text, headersonly=False) @@ -150,9 +152,7 @@ equivalent to wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:`parse`. - Optional *headersonly* is a flag specifying whether to stop parsing after - reading the headers or not. The default is ``False``, meaning it parses - the entire contents of the file. + Optional *headersonly* is as with the :meth:`parse` method. .. class:: BytesParser(_class=email.message.Message, *, policy=policy.default) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 15:39:37 2012 From: python-checkins at python.org (georg.brandl) Date: Sun, 29 Jan 2012 15:39:37 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogRml4ICMxMzkwMDog?= =?utf8?q?resolve_self-referential_description_of_a_parameter=2E?= Message-ID: http://hg.python.org/cpython/rev/690d5978bd21 changeset: 74678:690d5978bd21 branch: 2.7 parent: 74675:4c6662090870 user: Georg Brandl date: Sun Jan 29 15:38:47 2012 +0100 summary: Fix #13900: resolve self-referential description of a parameter. files: Doc/library/email.parser.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/email.parser.rst b/Doc/library/email.parser.rst --- a/Doc/library/email.parser.rst +++ b/Doc/library/email.parser.rst @@ -135,7 +135,9 @@ data or by a blank line. Following the header block is the body of the message (which may contain MIME-encoded subparts). - Optional *headersonly* is as with the :meth:`parse` method. + Optional *headersonly* is a flag specifying whether to stop parsing after + reading the headers or not. The default is ``False``, meaning it parses + the entire contents of the file. .. versionchanged:: 2.2.2 The *headersonly* flag was added. @@ -148,9 +150,7 @@ equivalent to wrapping *text* in a :class:`StringIO` instance first and calling :meth:`parse`. - Optional *headersonly* is a flag specifying whether to stop parsing after - reading the headers or not. The default is ``False``, meaning it parses - the entire contents of the file. + Optional *headersonly* is as with the :meth:`parse` method. .. versionchanged:: 2.2.2 The *headersonly* flag was added. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 16:43:51 2012 From: python-checkins at python.org (charles-francois.natali) Date: Sun, 29 Jan 2012 16:43:51 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=236774=3A_Back_out_c?= =?utf8?q?8b77efe8b56=2C_which_only_brings_confusion=2E?= Message-ID: http://hg.python.org/cpython/rev/9be82f458b79 changeset: 74679:9be82f458b79 parent: 74677:a273f6e101c6 user: Charles-Fran?ois Natali date: Sun Jan 29 16:42:54 2012 +0100 summary: Issue #6774: Back out c8b77efe8b56, which only brings confusion. files: Doc/library/socket.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1071,9 +1071,7 @@ Shut down one or both halves of the connection. If *how* is :const:`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends and receives are - disallowed. Depending on the platform, shutting down one half of the connection - can also close the opposite half (e.g. on Mac OS X, ``shutdown(SHUT_WR)`` does - not allow further reads on the other end of the connection). + disallowed. Note that there are no methods :meth:`read` or :meth:`write`; use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 18:47:27 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 29 Jan 2012 18:47:27 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogSXNzdWUgIzEzODQ4?= =?utf8?q?=3A_open=28=29_and_the_FileIO_constructor_now_check_for_NUL_char?= =?utf8?q?acters_in?= Message-ID: http://hg.python.org/cpython/rev/572bb8c265c0 changeset: 74680:572bb8c265c0 branch: 3.2 parent: 74676:0d5667171356 user: Antoine Pitrou date: Sun Jan 29 18:36:34 2012 +0100 summary: Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name. Patch by Hynek Schlawack. files: Include/unicodeobject.h | 6 +++++ Lib/test/test_fileio.py | 5 ++++ Lib/test/test_io.py | 5 ++++ Misc/ACKS | 1 + Misc/NEWS | 3 ++ Modules/_io/fileio.c | 33 +++++++++------------------- Objects/unicodeobject.c | 13 +++++++++++ 7 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -1501,6 +1501,12 @@ PyObject *element /* Element string */ ); +/* Checks whether the string contains any NUL characters. */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyUnicode_HasNULChars(PyObject *); +#endif + /* Checks whether argument is a valid identifier. */ PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s); diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -305,6 +305,11 @@ finally: os.unlink(TESTFN) + def testConstructorHandlesNULChars(self): + fn_with_NUL = 'foo\0bar' + self.assertRaises(TypeError, _FileIO, fn_with_NUL, 'w') + self.assertRaises(TypeError, _FileIO, bytes(fn_with_NUL, 'ascii'), 'w') + def testInvalidFd(self): self.assertRaises(ValueError, _FileIO, -10) self.assertRaises(OSError, _FileIO, make_bad_fd()) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -363,6 +363,11 @@ self.assertRaises(exc, fp.seek, 1, self.SEEK_CUR) self.assertRaises(exc, fp.seek, -1, self.SEEK_END) + def test_open_handles_NUL_chars(self): + fn_with_NUL = 'foo\0bar' + self.assertRaises(TypeError, self.open, fn_with_NUL, 'w') + self.assertRaises(TypeError, self.open, bytes(fn_with_NUL, 'ascii'), 'w') + def test_raw_file_io(self): with self.open(support.TESTFN, "wb", buffering=0) as f: self.assertEqual(f.readable(), False) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -811,6 +811,7 @@ Andreas Schawo Neil Schemenauer David Scherer +Hynek Schlawack Bob Schmertz Gregor Schmid Ralf Schmitt diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -111,6 +111,9 @@ Library ------- +- Issue #13848: open() and the FileIO constructor now check for NUL + characters in the file name. Patch by Hynek Schlawack. + - Issue #13806: The size check in audioop decompression functions was too strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -253,34 +253,23 @@ } #ifdef MS_WINDOWS - if (PyUnicode_Check(nameobj)) + if (PyUnicode_Check(nameobj)) { + int rv = _PyUnicode_HasNULChars(nameobj); + if (rv) { + if (rv != -1) + PyErr_SetString(PyExc_TypeError, "embedded NUL character"); + return -1; + } widename = PyUnicode_AS_UNICODE(nameobj); + } if (widename == NULL) #endif if (fd < 0) { - if (PyBytes_Check(nameobj) || PyByteArray_Check(nameobj)) { - Py_ssize_t namelen; - if (PyObject_AsCharBuffer(nameobj, &name, &namelen) < 0) - return -1; + if (!PyUnicode_FSConverter(nameobj, &stringobj)) { + return -1; } - else { - PyObject *u = PyUnicode_FromObject(nameobj); - - if (u == NULL) - return -1; - - stringobj = PyUnicode_EncodeFSDefault(u); - Py_DECREF(u); - if (stringobj == NULL) - return -1; - if (!PyBytes_Check(stringobj)) { - PyErr_SetString(PyExc_TypeError, - "encoder failed to return bytes"); - goto error; - } - name = PyBytes_AS_STRING(stringobj); - } + name = PyBytes_AS_STRING(stringobj); } s = mode; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1867,6 +1867,19 @@ int +_PyUnicode_HasNULChars(PyObject* s) +{ + static PyObject *nul = NULL; + + if (nul == NULL) + nul = PyUnicode_FromStringAndSize("\0", 1); + if (nul == NULL) + return -1; + return PyUnicode_Contains(s, nul); +} + + +int PyUnicode_FSConverter(PyObject* arg, void* addr) { PyObject *output = NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Sun Jan 29 18:47:28 2012 From: python-checkins at python.org (antoine.pitrou) Date: Sun, 29 Jan 2012 18:47:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Issue_=2313848=3A_open=28=29_and_the_FileIO_constructor_now_?= =?utf8?q?check_for_NUL_characters_in?= Message-ID: http://hg.python.org/cpython/rev/6bb05ce1cd1f changeset: 74681:6bb05ce1cd1f parent: 74679:9be82f458b79 parent: 74680:572bb8c265c0 user: Antoine Pitrou date: Sun Jan 29 18:43:36 2012 +0100 summary: Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name. Patch by Hynek Schlawack. files: Include/unicodeobject.h | 6 +++++ Lib/test/test_fileio.py | 5 ++++ Lib/test/test_io.py | 5 ++++ Misc/NEWS | 3 ++ Modules/_io/fileio.c | 30 ++++++++-------------------- Objects/unicodeobject.c | 13 ++++++++++++ 6 files changed, 41 insertions(+), 21 deletions(-) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -1914,6 +1914,12 @@ PyObject *element /* Element string */ ); +/* Checks whether the string contains any NUL characters. */ + +#ifndef Py_LIMITED_API +PyAPI_FUNC(int) _PyUnicode_HasNULChars(PyObject *); +#endif + /* Checks whether argument is a valid identifier. */ PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s); diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -306,6 +306,11 @@ finally: os.unlink(TESTFN) + def testConstructorHandlesNULChars(self): + fn_with_NUL = 'foo\0bar' + self.assertRaises(TypeError, _FileIO, fn_with_NUL, 'w') + self.assertRaises(TypeError, _FileIO, bytes(fn_with_NUL, 'ascii'), 'w') + def testInvalidFd(self): self.assertRaises(ValueError, _FileIO, -10) self.assertRaises(OSError, _FileIO, make_bad_fd()) diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -363,6 +363,11 @@ self.assertRaises(exc, fp.seek, 1, self.SEEK_CUR) self.assertRaises(exc, fp.seek, -1, self.SEEK_END) + def test_open_handles_NUL_chars(self): + fn_with_NUL = 'foo\0bar' + self.assertRaises(TypeError, self.open, fn_with_NUL, 'w') + self.assertRaises(TypeError, self.open, bytes(fn_with_NUL, 'ascii'), 'w') + def test_raw_file_io(self): with self.open(support.TESTFN, "wb", buffering=0) as f: self.assertEqual(f.readable(), False) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -461,6 +461,9 @@ Library ------- +- Issue #13848: open() and the FileIO constructor now check for NUL + characters in the file name. Patch by Hynek Schlawack. + - Issue #13806: The size check in audioop decompression functions was too strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -258,6 +258,12 @@ #ifdef MS_WINDOWS if (PyUnicode_Check(nameobj)) { + int rv = _PyUnicode_HasNULChars(nameobj); + if (rv) { + if (rv != -1) + PyErr_SetString(PyExc_TypeError, "embedded NUL character"); + return -1; + } widename = PyUnicode_AsUnicode(nameobj); if (widename == NULL) return -1; @@ -265,28 +271,10 @@ #endif if (fd < 0) { - if (PyBytes_Check(nameobj) || PyByteArray_Check(nameobj)) { - Py_ssize_t namelen; - if (PyObject_AsCharBuffer(nameobj, &name, &namelen) < 0) - return -1; + if (!PyUnicode_FSConverter(nameobj, &stringobj)) { + return -1; } - else { - PyObject *u = PyUnicode_FromObject(nameobj); - - if (u == NULL) - return -1; - - stringobj = PyUnicode_EncodeFSDefault(u); - Py_DECREF(u); - if (stringobj == NULL) - return -1; - if (!PyBytes_Check(stringobj)) { - PyErr_SetString(PyExc_TypeError, - "encoder failed to return bytes"); - goto error; - } - name = PyBytes_AS_STRING(stringobj); - } + name = PyBytes_AS_STRING(stringobj); } s = mode; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3575,6 +3575,19 @@ int +_PyUnicode_HasNULChars(PyObject* s) +{ + static PyObject *nul = NULL; + + if (nul == NULL) + nul = PyUnicode_FromStringAndSize("\0", 1); + if (nul == NULL) + return -1; + return PyUnicode_Contains(s, nul); +} + + +int PyUnicode_FSConverter(PyObject* arg, void* addr) { PyObject *output = NULL; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 00:07:33 2012 From: python-checkins at python.org (victor.stinner) Date: Mon, 30 Jan 2012 00:07:33 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313874=3A_read=5Fnu?= =?utf8?q?ll=28=29_of_faulthandler_uses_volatile_to_avoid_optimisation?= Message-ID: http://hg.python.org/cpython/rev/f71249d785d6 changeset: 74682:f71249d785d6 user: Victor Stinner date: Mon Jan 30 00:07:43 2012 +0100 summary: Issue #13874: read_null() of faulthandler uses volatile to avoid optimisation Clang 3.0 removes "y = *x;" instruction if the optimisation level is 3. files: Modules/faulthandler.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -943,10 +943,13 @@ static PyObject * faulthandler_read_null(PyObject *self, PyObject *args) { - int *x = NULL, y; + volatile int *x; + volatile int y; int release_gil = 0; if (!PyArg_ParseTuple(args, "|i:_read_null", &release_gil)) return NULL; + + x = NULL; if (release_gil) { Py_BEGIN_ALLOW_THREADS y = *x; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 00:23:32 2012 From: python-checkins at python.org (victor.stinner) Date: Mon, 30 Jan 2012 00:23:32 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313847=3A_Fix_test?= =?utf8?q?=5Ftime=2C_time=2Egmtime=28=29_doesn=27t_use_localtime=28=29?= Message-ID: http://hg.python.org/cpython/rev/5b42aefb8969 changeset: 74683:5b42aefb8969 user: Victor Stinner date: Mon Jan 30 00:23:32 2012 +0100 summary: Issue #13847: Fix test_time, time.gmtime() doesn't use localtime() On Windows, localtime(-1) fails, but not gmtime(1). files: Lib/test/test_time.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -361,7 +361,6 @@ self.skipTest("unable to find an invalid time_t value") self.assertRaises(OSError, time.localtime, invalid_time_t) - self.assertRaises(OSError, time.gmtime, invalid_time_t) self.assertRaises(OSError, time.ctime, invalid_time_t) class TestLocale(unittest.TestCase): -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 02:17:15 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 30 Jan 2012 02:17:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_ready_types_ret?= =?utf8?q?urned_from_PyType=5FFromSpec?= Message-ID: http://hg.python.org/cpython/rev/e858bb04f7e7 changeset: 74685:e858bb04f7e7 branch: 3.2 user: Benjamin Peterson date: Sun Jan 29 20:16:37 2012 -0500 summary: ready types returned from PyType_FromSpec files: Misc/NEWS | 2 ++ Objects/typeobject.c | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #13908: Ready types returned from PyType_FromSpec. + - Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2386,6 +2386,9 @@ } } + if (PyType_Ready(&res->ht_type) < 0) + goto fail; + return (PyObject*)res; fail: -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 02:17:14 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 30 Jan 2012 02:17:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_adjust_declarat?= =?utf8?q?ion?= Message-ID: http://hg.python.org/cpython/rev/32816454ba30 changeset: 74684:32816454ba30 branch: 3.2 parent: 74680:572bb8c265c0 user: Benjamin Peterson date: Sun Jan 29 20:13:18 2012 -0500 summary: adjust declaration files: Objects/typeobject.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2347,7 +2347,8 @@ #include "typeslots.inc" }; -PyObject* PyType_FromSpec(PyType_Spec *spec) +PyObject * +PyType_FromSpec(PyType_Spec *spec) { PyHeapTypeObject *res = (PyHeapTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); char *res_start = (char*)res; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 02:17:16 2012 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 30 Jan 2012 02:17:16 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?b?OiBtZXJnZSAzLjIgKGNsb3NlcyAjMTM5MDgp?= Message-ID: http://hg.python.org/cpython/rev/53b8f55e08bd changeset: 74686:53b8f55e08bd parent: 74683:5b42aefb8969 parent: 74685:e858bb04f7e7 user: Benjamin Peterson date: Sun Jan 29 20:17:07 2012 -0500 summary: merge 3.2 (closes #13908) files: Misc/NEWS | 2 ++ Objects/typeobject.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #13908: Ready types returned from PyType_FromSpec. + - Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2394,7 +2394,8 @@ #include "typeslots.inc" }; -PyObject* PyType_FromSpec(PyType_Spec *spec) +PyObject * +PyType_FromSpec(PyType_Spec *spec) { PyHeapTypeObject *res = (PyHeapTypeObject*)PyType_GenericAlloc(&PyType_Type, 0); char *res_start = (char*)res; @@ -2434,6 +2435,9 @@ } } + if (PyType_Ready(&res->ht_type) < 0) + goto fail; + return (PyObject*)res; fail: -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Mon Jan 30 05:32:51 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 30 Jan 2012 05:32:51 +0100 Subject: [Python-checkins] Daily reference leaks (53b8f55e08bd): sum=0 Message-ID: results for 53b8f55e08bd on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogxBn2kZ', '-x'] From python-checkins at python.org Mon Jan 30 18:49:43 2012 From: python-checkins at python.org (brett.cannon) Date: Mon, 30 Jan 2012 18:49:43 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313890=3A_Fix_impor?= =?utf8?q?tlib_case-sensitivity_tests_to_not_run_on_Windows=2E?= Message-ID: http://hg.python.org/cpython/rev/54d7823ec488 changeset: 74687:54d7823ec488 user: Brett Cannon date: Mon Jan 30 12:48:16 2012 -0500 summary: Issue #13890: Fix importlib case-sensitivity tests to not run on Windows. Thanks to os.environ under Windows only updating the dict and not the environment itself (as exposed by nt.environ), tests using PYTHONCASEOK always fail. Now the tests are skipped when os.environ does not do what is expected. files: Lib/importlib/test/source/test_case_sensitivity.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/importlib/test/source/test_case_sensitivity.py b/Lib/importlib/test/source/test_case_sensitivity.py --- a/Lib/importlib/test/source/test_case_sensitivity.py +++ b/Lib/importlib/test/source/test_case_sensitivity.py @@ -37,6 +37,9 @@ def test_sensitive(self): with test_support.EnvironmentVarGuard() as env: env.unset('PYTHONCASEOK') + if b'PYTHONCASEOK' in _bootstrap._os.environ: + self.skipTest('os.environ changes not reflected in ' + '_os.environ') sensitive, insensitive = self.sensitivity_test() self.assertTrue(hasattr(sensitive, 'load_module')) self.assertIn(self.name, sensitive.get_filename(self.name)) @@ -45,6 +48,9 @@ def test_insensitive(self): with test_support.EnvironmentVarGuard() as env: env.set('PYTHONCASEOK', '1') + if b'PYTHONCASEOK' not in _bootstrap._os.environ: + self.skipTest('os.environ changes not reflected in ' + '_os.environ') sensitive, insensitive = self.sensitivity_test() self.assertTrue(hasattr(sensitive, 'load_module')) self.assertIn(self.name, sensitive.get_filename(self.name)) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 18:51:57 2012 From: python-checkins at python.org (brett.cannon) Date: Mon, 30 Jan 2012 18:51:57 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=2313890=3A_Also_fix_?= =?utf8?q?for_extension_module_tests_for_case-insensitivity=2E?= Message-ID: http://hg.python.org/cpython/rev/2914ce82bf89 changeset: 74688:2914ce82bf89 user: Brett Cannon date: Mon Jan 30 12:51:49 2012 -0500 summary: Issue #13890: Also fix for extension module tests for case-insensitivity. files: Lib/importlib/test/extension/test_case_sensitivity.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/importlib/test/extension/test_case_sensitivity.py b/Lib/importlib/test/extension/test_case_sensitivity.py --- a/Lib/importlib/test/extension/test_case_sensitivity.py +++ b/Lib/importlib/test/extension/test_case_sensitivity.py @@ -20,12 +20,18 @@ def test_case_sensitive(self): with support.EnvironmentVarGuard() as env: env.unset('PYTHONCASEOK') + if b'PYTHONCASEOK' in _bootstrap._os.environ: + self.skipTest('os.environ changes not reflected in ' + '_os.environ') loader = self.find_module() self.assertIsNone(loader) def test_case_insensitivity(self): with support.EnvironmentVarGuard() as env: env.set('PYTHONCASEOK', '1') + if b'PYTHONCASEOK' not in _bootstrap._os.environ: + self.skipTest('os.environ changes not reflected in ' + '_os.environ') loader = self.find_module() self.assertTrue(hasattr(loader, 'load_module')) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Mon Jan 30 22:11:20 2012 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 30 Jan 2012 22:11:20 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Issue_=238828=3A_Add_new_fu?= =?utf8?q?nction_os=2Ereplace=28=29=2C_for_cross-platform_renaming_with?= Message-ID: http://hg.python.org/cpython/rev/80ddbd822227 changeset: 74689:80ddbd822227 user: Antoine Pitrou date: Mon Jan 30 22:08:52 2012 +0100 summary: Issue #8828: Add new function os.replace(), for cross-platform renaming with overwriting. files: Doc/library/os.rst | 18 +++++++++- Lib/test/test_os.py | 12 ++++++ Misc/NEWS | 3 + Modules/posixmodule.c | 55 +++++++++++++++++++++--------- 4 files changed, 69 insertions(+), 19 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1889,8 +1889,9 @@ Unix flavors if *src* and *dst* are on different filesystems. If successful, the renaming will be an atomic operation (this is a POSIX requirement). On Windows, if *dst* already exists, :exc:`OSError` will be raised even if it is a - file; there may be no way to implement an atomic rename when *dst* names an - existing file. + file. + + If you want cross-platform overwriting of the destination, use :func:`replace`. Availability: Unix, Windows. @@ -1908,6 +1909,19 @@ permissions needed to remove the leaf directory or file. +.. function:: replace(src, dst) + + Rename the file or directory *src* to *dst*. If *dst* is a directory, + :exc:`OSError` will be raised. If *dst* exists and is a file, it will + be replaced silently if the user has permission. The operation may fail + if *src* and *dst* are on different filesystems. If successful, + the renaming will be an atomic operation (this is a POSIX requirement). + + Availability: Unix, Windows + + .. versionadded:: 3.3 + + .. function:: rmdir(path) Remove (delete) the directory *path*. Only works when the directory is diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -129,6 +129,18 @@ self.fdopen_helper('r') self.fdopen_helper('r', 100) + def test_replace(self): + TESTFN2 = support.TESTFN + ".2" + with open(support.TESTFN, 'w') as f: + f.write("1") + with open(TESTFN2, 'w') as f: + f.write("2") + self.addCleanup(os.unlink, TESTFN2) + os.replace(support.TESTFN, TESTFN2) + self.assertRaises(FileNotFoundError, os.stat, support.TESTFN) + with open(TESTFN2, 'r') as f: + self.assertEqual(f.read(), "1") + # Test attributes on return values from os.*stat* family. class StatAttributeTests(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -463,6 +463,9 @@ Library ------- +- Issue #8828: Add new function os.replace(), for cross-platform renaming + with overwriting. + - Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name. Patch by Hynek Schlawack. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3280,17 +3280,16 @@ #endif /* HAVE_SETPRIORITY */ -PyDoc_STRVAR(posix_rename__doc__, -"rename(old, new)\n\n\ -Rename a file or directory."); - -static PyObject * -posix_rename(PyObject *self, PyObject *args) +static PyObject * +internal_rename(PyObject *self, PyObject *args, int is_replace) { #ifdef MS_WINDOWS PyObject *src, *dst; BOOL result; - if (PyArg_ParseTuple(args, "UU:rename", &src, &dst)) + int flags = is_replace ? MOVEFILE_REPLACE_EXISTING : 0; + if (PyArg_ParseTuple(args, + is_replace ? "UU:replace" : "UU:rename", + &src, &dst)) { wchar_t *wsrc, *wdst; @@ -3301,16 +3300,17 @@ if (wdst == NULL) return NULL; Py_BEGIN_ALLOW_THREADS - result = MoveFileW(wsrc, wdst); + result = MoveFileExW(wsrc, wdst, flags); Py_END_ALLOW_THREADS if (!result) - return win32_error("rename", NULL); + return win32_error(is_replace ? "replace" : "rename", NULL); Py_INCREF(Py_None); return Py_None; } else { PyErr_Clear(); - if (!PyArg_ParseTuple(args, "O&O&:rename", + if (!PyArg_ParseTuple(args, + is_replace ? "O&O&:replace" : "O&O&:rename", PyUnicode_FSConverter, &src, PyUnicode_FSConverter, &dst)) return NULL; @@ -3319,15 +3319,15 @@ goto error; Py_BEGIN_ALLOW_THREADS - result = MoveFileA(PyBytes_AS_STRING(src), - PyBytes_AS_STRING(dst)); + result = MoveFileExA(PyBytes_AS_STRING(src), + PyBytes_AS_STRING(dst), flags); Py_END_ALLOW_THREADS Py_XDECREF(src); Py_XDECREF(dst); if (!result) - return win32_error("rename", NULL); + return win32_error(is_replace ? "replace" : "rename", NULL); Py_INCREF(Py_None); return Py_None; @@ -3337,10 +3337,30 @@ return NULL; } #else - return posix_2str(args, "O&O&:rename", rename); -#endif -} - + return posix_2str(args, + is_replace ? "O&O&:replace" : "O&O&:rename", rename); +#endif +} + +PyDoc_STRVAR(posix_rename__doc__, +"rename(old, new)\n\n\ +Rename a file or directory."); + +static PyObject * +posix_rename(PyObject *self, PyObject *args) +{ + return internal_rename(self, args, 0); +} + +PyDoc_STRVAR(posix_replace__doc__, +"replace(old, new)\n\n\ +Rename a file or directory, overwriting the destination."); + +static PyObject * +posix_replace(PyObject *self, PyObject *args) +{ + return internal_rename(self, args, 1); +} PyDoc_STRVAR(posix_rmdir__doc__, "rmdir(path)\n\n\ @@ -10555,6 +10575,7 @@ {"readlink", win_readlink, METH_VARARGS, win_readlink__doc__}, #endif /* !defined(HAVE_READLINK) && defined(MS_WINDOWS) */ {"rename", posix_rename, METH_VARARGS, posix_rename__doc__}, + {"replace", posix_replace, METH_VARARGS, posix_replace__doc__}, {"rmdir", posix_rmdir, METH_VARARGS, posix_rmdir__doc__}, {"stat", posix_stat, METH_VARARGS, posix_stat__doc__}, {"stat_float_times", stat_float_times, METH_VARARGS, stat_float_times__doc__}, -- Repository URL: http://hg.python.org/cpython From brett at python.org Mon Jan 30 22:26:30 2012 From: brett at python.org (Brett Cannon) Date: Mon, 30 Jan 2012 16:26:30 -0500 Subject: [Python-checkins] cpython: Issue #8828: Add new function os.replace(), for cross-platform renaming with In-Reply-To: References: Message-ID: Should this end up being used in importlib through _os? On Mon, Jan 30, 2012 at 16:11, antoine.pitrou wrote: > http://hg.python.org/cpython/rev/80ddbd822227 > changeset: 74689:80ddbd822227 > user: Antoine Pitrou > date: Mon Jan 30 22:08:52 2012 +0100 > summary: > Issue #8828: Add new function os.replace(), for cross-platform renaming > with overwriting. > > files: > Doc/library/os.rst | 18 +++++++++- > Lib/test/test_os.py | 12 ++++++ > Misc/NEWS | 3 + > Modules/posixmodule.c | 55 +++++++++++++++++++++--------- > 4 files changed, 69 insertions(+), 19 deletions(-) > > > diff --git a/Doc/library/os.rst b/Doc/library/os.rst > --- a/Doc/library/os.rst > +++ b/Doc/library/os.rst > @@ -1889,8 +1889,9 @@ > Unix flavors if *src* and *dst* are on different filesystems. If > successful, > the renaming will be an atomic operation (this is a POSIX requirement). > On > Windows, if *dst* already exists, :exc:`OSError` will be raised even if > it is a > - file; there may be no way to implement an atomic rename when *dst* > names an > - existing file. > + file. > + > + If you want cross-platform overwriting of the destination, use > :func:`replace`. > > Availability: Unix, Windows. > > @@ -1908,6 +1909,19 @@ > permissions needed to remove the leaf directory or file. > > > +.. function:: replace(src, dst) > + > + Rename the file or directory *src* to *dst*. If *dst* is a directory, > + :exc:`OSError` will be raised. If *dst* exists and is a file, it will > + be replaced silently if the user has permission. The operation may > fail > + if *src* and *dst* are on different filesystems. If successful, > + the renaming will be an atomic operation (this is a POSIX requirement). > + > + Availability: Unix, Windows > + > + .. versionadded:: 3.3 > + > + > .. function:: rmdir(path) > > Remove (delete) the directory *path*. Only works when the directory is > diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py > --- a/Lib/test/test_os.py > +++ b/Lib/test/test_os.py > @@ -129,6 +129,18 @@ > self.fdopen_helper('r') > self.fdopen_helper('r', 100) > > + def test_replace(self): > + TESTFN2 = support.TESTFN + ".2" > + with open(support.TESTFN, 'w') as f: > + f.write("1") > + with open(TESTFN2, 'w') as f: > + f.write("2") > + self.addCleanup(os.unlink, TESTFN2) > + os.replace(support.TESTFN, TESTFN2) > + self.assertRaises(FileNotFoundError, os.stat, support.TESTFN) > + with open(TESTFN2, 'r') as f: > + self.assertEqual(f.read(), "1") > + > > # Test attributes on return values from os.*stat* family. > class StatAttributeTests(unittest.TestCase): > diff --git a/Misc/NEWS b/Misc/NEWS > --- a/Misc/NEWS > +++ b/Misc/NEWS > @@ -463,6 +463,9 @@ > Library > ------- > > +- Issue #8828: Add new function os.replace(), for cross-platform renaming > + with overwriting. > + > - Issue #13848: open() and the FileIO constructor now check for NUL > characters in the file name. Patch by Hynek Schlawack. > > diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c > --- a/Modules/posixmodule.c > +++ b/Modules/posixmodule.c > @@ -3280,17 +3280,16 @@ > #endif /* HAVE_SETPRIORITY */ > > > -PyDoc_STRVAR(posix_rename__doc__, > -"rename(old, new)\n\n\ > -Rename a file or directory."); > - > -static PyObject * > -posix_rename(PyObject *self, PyObject *args) > +static PyObject * > +internal_rename(PyObject *self, PyObject *args, int is_replace) > { > #ifdef MS_WINDOWS > PyObject *src, *dst; > BOOL result; > - if (PyArg_ParseTuple(args, "UU:rename", &src, &dst)) > + int flags = is_replace ? MOVEFILE_REPLACE_EXISTING : 0; > + if (PyArg_ParseTuple(args, > + is_replace ? "UU:replace" : "UU:rename", > + &src, &dst)) > { > wchar_t *wsrc, *wdst; > > @@ -3301,16 +3300,17 @@ > if (wdst == NULL) > return NULL; > Py_BEGIN_ALLOW_THREADS > - result = MoveFileW(wsrc, wdst); > + result = MoveFileExW(wsrc, wdst, flags); > Py_END_ALLOW_THREADS > if (!result) > - return win32_error("rename", NULL); > + return win32_error(is_replace ? "replace" : "rename", NULL); > Py_INCREF(Py_None); > return Py_None; > } > else { > PyErr_Clear(); > - if (!PyArg_ParseTuple(args, "O&O&:rename", > + if (!PyArg_ParseTuple(args, > + is_replace ? "O&O&:replace" : "O&O&:rename", > PyUnicode_FSConverter, &src, > PyUnicode_FSConverter, &dst)) > return NULL; > @@ -3319,15 +3319,15 @@ > goto error; > > Py_BEGIN_ALLOW_THREADS > - result = MoveFileA(PyBytes_AS_STRING(src), > - PyBytes_AS_STRING(dst)); > + result = MoveFileExA(PyBytes_AS_STRING(src), > + PyBytes_AS_STRING(dst), flags); > Py_END_ALLOW_THREADS > > Py_XDECREF(src); > Py_XDECREF(dst); > > if (!result) > - return win32_error("rename", NULL); > + return win32_error(is_replace ? "replace" : "rename", NULL); > Py_INCREF(Py_None); > return Py_None; > > @@ -3337,10 +3337,30 @@ > return NULL; > } > #else > - return posix_2str(args, "O&O&:rename", rename); > -#endif > -} > - > + return posix_2str(args, > + is_replace ? "O&O&:replace" : "O&O&:rename", > rename); > +#endif > +} > + > +PyDoc_STRVAR(posix_rename__doc__, > +"rename(old, new)\n\n\ > +Rename a file or directory."); > + > +static PyObject * > +posix_rename(PyObject *self, PyObject *args) > +{ > + return internal_rename(self, args, 0); > +} > + > +PyDoc_STRVAR(posix_replace__doc__, > +"replace(old, new)\n\n\ > +Rename a file or directory, overwriting the destination."); > + > +static PyObject * > +posix_replace(PyObject *self, PyObject *args) > +{ > + return internal_rename(self, args, 1); > +} > > PyDoc_STRVAR(posix_rmdir__doc__, > "rmdir(path)\n\n\ > @@ -10555,6 +10575,7 @@ > {"readlink", win_readlink, METH_VARARGS, win_readlink__doc__}, > #endif /* !defined(HAVE_READLINK) && defined(MS_WINDOWS) */ > {"rename", posix_rename, METH_VARARGS, posix_rename__doc__}, > + {"replace", posix_replace, METH_VARARGS, > posix_replace__doc__}, > {"rmdir", posix_rmdir, METH_VARARGS, posix_rmdir__doc__}, > {"stat", posix_stat, METH_VARARGS, posix_stat__doc__}, > {"stat_float_times", stat_float_times, METH_VARARGS, > stat_float_times__doc__}, > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Jan 31 00:55:40 2012 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 31 Jan 2012 00:55:40 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_Fix_zip=5Fimpor?= =?utf8?q?t=2Ec=27s_read=5Fdirectory=28=29_to_use_appropriate_types_for_th?= =?utf8?q?e_values?= Message-ID: http://hg.python.org/cpython/rev/c5a09a96f533 changeset: 74690:c5a09a96f533 branch: 3.2 parent: 74685:e858bb04f7e7 user: Gregory P. Smith date: Mon Jan 30 15:17:33 2012 -0800 summary: Fix zip_import.c's read_directory() to use appropriate types for the values being read from the header vs the values being used by fseek and ftell (Py_ssize_t for those) and how they are computed. Py_ssize_t is used for actual file offsets so that files greater than 2gigs could be supported. Updates the Py_BuildValue format string to match (including several existing wrong 'i's that should have been 'l's). files: Modules/zipimport.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/zipimport.c b/Modules/zipimport.c --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -714,15 +714,16 @@ PyObject *files = NULL; FILE *fp; unsigned short flags; - long compress, crc, data_size, file_size, file_offset, date, time; - long header_offset, name_size, header_size, header_position; + short compress, time, date, name_size; + long crc, data_size, file_size, header_size; + Py_ssize_t file_offset, header_position, header_offset; long i, l, count; size_t length; Py_UNICODE path[MAXPATHLEN + 5]; char name[MAXPATHLEN + 5]; PyObject *nameobj = NULL; char *p, endof_central_dir[22]; - long arc_offset; /* offset from beginning of file to start of zip-archive */ + Py_ssize_t arc_offset; /* Absolute offset to start of the zip-archive. */ PyObject *pathobj; const char *charset; int bootstrap; @@ -832,7 +833,7 @@ pathobj = PyUnicode_FromUnicode(path, Py_UNICODE_strlen(path)); if (pathobj == NULL) goto error; - t = Py_BuildValue("Niiiiiii", pathobj, compress, data_size, + t = Py_BuildValue("Nhllnhhl", pathobj, compress, data_size, file_size, file_offset, time, date, crc); if (t == NULL) goto error; -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 00:55:41 2012 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 31 Jan 2012 00:55:41 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Fix_zipimport=2Ec=27s_read=5Fdirectory=28=29_to_use_appropri?= =?utf8?q?ate_types_for_the_values?= Message-ID: http://hg.python.org/cpython/rev/2db416b953e8 changeset: 74691:2db416b953e8 parent: 74689:80ddbd822227 parent: 74690:c5a09a96f533 user: Gregory P. Smith date: Mon Jan 30 15:55:29 2012 -0800 summary: Fix zipimport.c's read_directory() to use appropriate types for the values being read from the header vs the values being used by fseek and ftell (Py_ssize_t for those). Updates the Py_BuildValue format string to match (including several existing wrong 'i's that should have been 'l's). files: Modules/zipimport.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/zipimport.c b/Modules/zipimport.c --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -728,14 +728,15 @@ PyObject *files = NULL; FILE *fp; unsigned short flags; - long compress, crc, data_size, file_size, file_offset, date, time; - long header_offset, name_size, header_size, header_position; + short compress, time, date, name_size; + long crc, data_size, file_size, header_size; + Py_ssize_t file_offset, header_position, header_offset; long l, count; Py_ssize_t i; char name[MAXPATHLEN + 5]; PyObject *nameobj = NULL; char *p, endof_central_dir[22]; - long arc_offset; /* offset from beginning of file to start of zip-archive */ + Py_ssize_t arc_offset; /* Absolute offset to start of the zip-archive. */ PyObject *path; const char *charset; int bootstrap; @@ -835,7 +836,7 @@ path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj); if (path == NULL) goto error; - t = Py_BuildValue("Niiiiiii", path, compress, data_size, + t = Py_BuildValue("Nhllnhhl", path, compress, data_size, file_size, file_offset, time, date, crc); if (t == NULL) goto error; -- Repository URL: http://hg.python.org/cpython From solipsis at pitrou.net Tue Jan 31 05:32:56 2012 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 31 Jan 2012 05:32:56 +0100 Subject: [Python-checkins] Daily reference leaks (2db416b953e8): sum=0 Message-ID: results for 2db416b953e8 on branch "default" -------------------------------------------- Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/antoine/cpython/refleaks/reflogJzCAwg', '-x'] From python-checkins at python.org Tue Jan 31 08:59:26 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 31 Jan 2012 08:59:26 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMi43KTogIzEzNTA2IEFkZCAn?= =?utf8?q?=27_to_path_for_interactive_interpreter_by_adding_with=5Fcwd_par?= =?utf8?q?ameter?= Message-ID: http://hg.python.org/cpython/rev/1b5abba0c808 changeset: 74692:1b5abba0c808 branch: 2.7 parent: 74678:690d5978bd21 user: Terry Jan Reedy date: Tue Jan 31 02:09:25 2012 -0500 summary: #13506 Add '' to path for interactive interpreter by adding with_cwd parameter to PyShell.PyShell.transfer_path() and changing elsewhere as needed. Original patches by Marco Scataglini and Roger Serwy. files: Lib/idlelib/PyShell.py | 19 +++++++++++++------ Lib/idlelib/ScriptBinding.py | 5 ++--- Misc/ACKS | 2 ++ Misc/NEWS | 3 +++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -423,11 +423,11 @@ self.rpcclt.register("flist", self.tkconsole.flist) self.rpcclt.register("linecache", linecache) self.rpcclt.register("interp", self) - self.transfer_path() + self.transfer_path(with_cwd=True) self.poll_subprocess() return self.rpcclt - def restart_subprocess(self): + def restart_subprocess(self, with_cwd=False): if self.restarting: return self.rpcclt self.restarting = True @@ -451,7 +451,7 @@ except socket.timeout, err: self.display_no_subprocess_error() return None - self.transfer_path() + self.transfer_path(with_cwd=with_cwd) # annotate restart in shell window and mark it console.text.delete("iomark", "end-1c") if was_executing: @@ -501,12 +501,18 @@ except OSError: return - def transfer_path(self): + def transfer_path(self, with_cwd=False): + if with_cwd: # Issue 13506 + path = [''] # include Current Working Directory + path.extend(sys.path) + else: + path = sys.path + self.runcommand("""if 1: import sys as _sys _sys.path = %r del _sys - \n""" % (sys.path,)) + \n""" % (path,)) active_seq = None @@ -1209,7 +1215,8 @@ self.text.see("restart") def restart_shell(self, event=None): - self.interp.restart_subprocess() + "Callback for Run/Restart Shell Cntl-F6" + self.interp.restart_subprocess(with_cwd=True) def showprompt(self): self.resetoutput() diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -146,10 +146,9 @@ return 'break' if not self.tabnanny(filename): return 'break' - shell = self.shell - interp = shell.interp + interp = self.shell.interp if PyShell.use_subprocess: - shell.restart_shell() + interp.restart_subprocess(with_cwd=False) dirname = os.path.dirname(filename) # XXX Too often this discards arguments the user just set... interp.runcommand("""if 1: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -740,6 +740,7 @@ Ty Sarna Ben Sayer sbt +Marco Scataglini Michael Scharf Neil Schemenauer David Scherer @@ -759,6 +760,7 @@ ?iga Seilnach Fred Sells Jiwon Seo +Roger Serwy Jerry Seutter Denis Severson Ian Seyer diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -90,6 +90,9 @@ Library ------- +- Issue #13506: Add '' to path for IDLE Shell when started and restarted with Restart Shell. + Original patches by Marco Scataglini and Roger Serwy. + - Issue #13806: The size check in audioop decompression functions was too strict and could reject valid compressed data. Patch by Oleg Plakhotnyuk. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 08:59:26 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 31 Jan 2012 08:59:26 +0100 Subject: [Python-checkins] =?utf8?b?Y3B5dGhvbiAoMy4yKTogIzEzNTA2IEFkZCAn?= =?utf8?q?=27_to_path_for_interactive_interpreter_by_adding_with=5Fcwd_par?= =?utf8?q?ameter?= Message-ID: http://hg.python.org/cpython/rev/1993aa091d89 changeset: 74693:1993aa091d89 branch: 3.2 parent: 74690:c5a09a96f533 user: Terry Jan Reedy date: Tue Jan 31 02:26:32 2012 -0500 summary: #13506 Add '' to path for interactive interpreter by adding with_cwd parameter to PyShell.PyShell.transfer_path() and changing elsewhere as needed. Original patches by Marco Scataglini and Roger Serwy. files: Lib/idlelib/PyShell.py | 19 +++++++++++++------ Lib/idlelib/ScriptBinding.py | 5 ++--- Misc/ACKS | 3 ++- Misc/NEWS | 3 +++ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -411,11 +411,11 @@ self.rpcclt.register("flist", self.tkconsole.flist) self.rpcclt.register("linecache", linecache) self.rpcclt.register("interp", self) - self.transfer_path() + self.transfer_path(with_cwd=True) self.poll_subprocess() return self.rpcclt - def restart_subprocess(self): + def restart_subprocess(self, with_cwd=False): if self.restarting: return self.rpcclt self.restarting = True @@ -439,7 +439,7 @@ except socket.timeout as err: self.display_no_subprocess_error() return None - self.transfer_path() + self.transfer_path(with_cwd=with_cwd) # annotate restart in shell window and mark it console.text.delete("iomark", "end-1c") if was_executing: @@ -488,12 +488,18 @@ except OSError: return - def transfer_path(self): + def transfer_path(self, with_cwd=False): + if with_cwd: # Issue 13506 + path = [''] # include Current Working Directory + path.extend(sys.path) + else: + path = sys.path + self.runcommand("""if 1: import sys as _sys _sys.path = %r del _sys - \n""" % (sys.path,)) + \n""" % (path,)) active_seq = None @@ -1187,7 +1193,8 @@ self.text.see("restart") def restart_shell(self, event=None): - self.interp.restart_subprocess() + "Callback for Run/Restart Shell Cntl-F6" + self.interp.restart_subprocess(with_cwd=True) def showprompt(self): self.resetoutput() diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -144,10 +144,9 @@ return 'break' if not self.tabnanny(filename): return 'break' - shell = self.shell - interp = shell.interp + interp = self.shell.interp if PyShell.use_subprocess: - shell.restart_shell() + interp.restart_subprocess(with_cwd=False) dirname = os.path.dirname(filename) # XXX Too often this discards arguments the user just set... interp.runcommand("""if 1: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -806,6 +806,7 @@ Ty Sarna Ben Sayer sbt +Marco Scataglini Andrew Schaaf Michael Scharf Andreas Schawo @@ -830,7 +831,7 @@ Yury Selivanov Fred Sells Jiwon Seo -Roger D. Serwy +Roger Serwy Jerry Seutter Denis Severson Ian Seyer diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -113,6 +113,9 @@ Library ------- +- Issue #13506: Add '' to path for IDLE Shell when started and restarted with Restart Shell. + Original patches by Marco Scataglini and Roger Serwy. + - Issue #13848: open() and the FileIO constructor now check for NUL characters in the file name. Patch by Hynek Schlawack. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 08:59:28 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 31 Jan 2012 08:59:28 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_3=2E2?= Message-ID: http://hg.python.org/cpython/rev/acedd92086c5 changeset: 74694:acedd92086c5 parent: 74691:2db416b953e8 parent: 74693:1993aa091d89 user: Terry Jan Reedy date: Tue Jan 31 02:42:19 2012 -0500 summary: Merge 3.2 - Issue #13506: Add '' to path for IDLE Shell when started and restarted with Restart Shell. Original patches by Marco Scataglini and Roger Serwy. Merge 3.2 #13506 Add '' to path for interactive interpreter by adding with_cwd parameter to PyShell.PyShell.transfer_path() and changing elsewhere as needed. Original patches by Marco Scataglini and Roger Serwy. files: Lib/idlelib/PyShell.py | 19 +++++++++++++------ Lib/idlelib/ScriptBinding.py | 5 ++--- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -411,11 +411,11 @@ self.rpcclt.register("flist", self.tkconsole.flist) self.rpcclt.register("linecache", linecache) self.rpcclt.register("interp", self) - self.transfer_path() + self.transfer_path(with_cwd=True) self.poll_subprocess() return self.rpcclt - def restart_subprocess(self): + def restart_subprocess(self, with_cwd=False): if self.restarting: return self.rpcclt self.restarting = True @@ -439,7 +439,7 @@ except socket.timeout as err: self.display_no_subprocess_error() return None - self.transfer_path() + self.transfer_path(with_cwd=with_cwd) # annotate restart in shell window and mark it console.text.delete("iomark", "end-1c") if was_executing: @@ -492,12 +492,18 @@ except OSError: return - def transfer_path(self): + def transfer_path(self, with_cwd=False): + if with_cwd: # Issue 13506 + path = [''] # include Current Working Directory + path.extend(sys.path) + else: + path = sys.path + self.runcommand("""if 1: import sys as _sys _sys.path = %r del _sys - \n""" % (sys.path,)) + \n""" % (path,)) active_seq = None @@ -1191,7 +1197,8 @@ self.text.see("restart") def restart_shell(self, event=None): - self.interp.restart_subprocess() + "Callback for Run/Restart Shell Cntl-F6" + self.interp.restart_subprocess(with_cwd=True) def showprompt(self): self.resetoutput() diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -144,10 +144,9 @@ return 'break' if not self.tabnanny(filename): return 'break' - shell = self.shell - interp = shell.interp + interp = self.shell.interp if PyShell.use_subprocess: - shell.restart_shell() + interp.restart_subprocess(with_cwd=False) dirname = os.path.dirname(filename) # XXX Too often this discards arguments the user just set... interp.runcommand("""if 1: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -880,6 +880,7 @@ Ty Sarna Ben Sayer sbt +Marco Scataglini Andrew Schaaf Michael Scharf Andreas Schawo diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -463,6 +463,9 @@ Library ------- +- Issue #13506: Add '' to path for IDLE Shell when started and restarted with Restart Shell. + Original patches by Marco Scataglini and Roger Serwy. + - Issue #8828: Add new function os.replace(), for cross-platform renaming with overwriting. -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 08:59:29 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 31 Jan 2012 08:59:29 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=282=2E7=29=3A_whitespace3?= Message-ID: http://hg.python.org/cpython/rev/822d7a1f8885 changeset: 74695:822d7a1f8885 branch: 2.7 parent: 74692:1b5abba0c808 user: Terry Jan Reedy date: Tue Jan 31 02:55:32 2012 -0500 summary: whitespace3 files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -507,7 +507,7 @@ path.extend(sys.path) else: path = sys.path - + self.runcommand("""if 1: import sys as _sys _sys.path = %r -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 08:59:30 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 31 Jan 2012 08:59:30 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=283=2E2=29=3A_whitespace?= Message-ID: http://hg.python.org/cpython/rev/89b699e68fa2 changeset: 74696:89b699e68fa2 branch: 3.2 parent: 74693:1993aa091d89 user: Terry Jan Reedy date: Tue Jan 31 02:57:29 2012 -0500 summary: whitespace files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -494,7 +494,7 @@ path.extend(sys.path) else: path = sys.path - + self.runcommand("""if 1: import sys as _sys _sys.path = %r -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 08:59:30 2012 From: python-checkins at python.org (terry.reedy) Date: Tue, 31 Jan 2012 08:59:30 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_3=2E2_-=3E_default=29?= =?utf8?q?=3A_Merge_with_3=2E2_whitespace?= Message-ID: http://hg.python.org/cpython/rev/bf31815548c9 changeset: 74697:bf31815548c9 parent: 74694:acedd92086c5 parent: 74696:89b699e68fa2 user: Terry Jan Reedy date: Tue Jan 31 02:58:39 2012 -0500 summary: Merge with 3.2 whitespace files: Lib/idlelib/PyShell.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -498,7 +498,7 @@ path.extend(sys.path) else: path = sys.path - + self.runcommand("""if 1: import sys as _sys _sys.path = %r -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 20:58:12 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 31 Jan 2012 20:58:12 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Allow_for_the_specification?= =?utf8?q?_of_a_file_to_dump_importlib_benchmark?= Message-ID: http://hg.python.org/cpython/rev/fc007eef3c0b changeset: 74698:fc007eef3c0b parent: 74689:80ddbd822227 user: Brett Cannon date: Mon Jan 30 19:12:29 2012 -0500 summary: Allow for the specification of a file to dump importlib benchmark results to (and to compare against previous runs). * * * Move importlib.test.benchmark to argparse. files: Lib/importlib/test/benchmark.py | 46 ++++++++++++++++---- 1 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Lib/importlib/test/benchmark.py b/Lib/importlib/test/benchmark.py --- a/Lib/importlib/test/benchmark.py +++ b/Lib/importlib/test/benchmark.py @@ -9,6 +9,7 @@ import decimal import imp import importlib +import json import os import py_compile import sys @@ -132,7 +133,12 @@ yield result -def main(import_): +def main(import_, filename=None): + if filename and os.path.exists(filename): + with open(filename, 'r') as file: + prev_results = json.load(file) + else: + prev_results = {} __builtins__.__import__ = import_ benchmarks = (from_cache, builtin_mod, source_using_bytecode, source_wo_bytecode, @@ -142,8 +148,11 @@ seconds = 1 seconds_plural = 's' if seconds > 1 else '' repeat = 3 - header = "Measuring imports/second over {} second{}, best out of {}\n" - print(header.format(seconds, seconds_plural, repeat)) + header = ('Measuring imports/second over {} second{}, best out of {}\n' + 'Entire benchmark run should take about {} seconds\n') + print(header.format(seconds, seconds_plural, repeat, + len(benchmarks) * seconds * repeat)) + new_results = {} for benchmark in benchmarks: print(benchmark.__doc__, "[", end=' ') sys.stdout.flush() @@ -154,19 +163,36 @@ sys.stdout.flush() assert not sys.dont_write_bytecode print("]", "best is", format(max(results), ',d')) + new_results[benchmark.__doc__] = results + prev_results[import_.__module__] = new_results + if 'importlib._bootstrap' in prev_results and 'builtins' in prev_results: + print('\n\nComparing importlib vs. __import__\n') + importlib_results = prev_results['importlib._bootstrap'] + builtins_results = prev_results['builtins'] + for benchmark in benchmarks: + benchmark_name = benchmark.__doc__ + importlib_result = max(importlib_results[benchmark_name]) + builtins_result = max(builtins_results[benchmark_name]) + result = '{:,d} vs. {:,d} ({:%})'.format(importlib_result, + builtins_result, + importlib_result/builtins_result) + print(benchmark_name, ':', result) + if filename: + with open(filename, 'w') as file: + json.dump(prev_results, file, indent=2) if __name__ == '__main__': - import optparse + import argparse - parser = optparse.OptionParser() - parser.add_option('-b', '--builtin', dest='builtin', action='store_true', + parser = argparse.ArgumentParser() + parser.add_argument('-b', '--builtin', dest='builtin', action='store_true', default=False, help="use the built-in __import__") - options, args = parser.parse_args() - if args: - raise RuntimeError("unrecognized args: {}".format(args)) + parser.add_argument('-f', '--file', dest='filename', default=None, + help='file to read/write results from/to') + options = parser.parse_args() import_ = __import__ if not options.builtin: import_ = importlib.__import__ - main(import_) + main(import_, options.filename) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 20:58:13 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 31 Jan 2012 20:58:13 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Let_importlib=2Etest=2Ebenc?= =?utf8?q?hmark_take_a_specific_benchmark_name_to_run=2E?= Message-ID: http://hg.python.org/cpython/rev/2d0ff4d82b14 changeset: 74699:2d0ff4d82b14 user: Brett Cannon date: Mon Jan 30 19:27:51 2012 -0500 summary: Let importlib.test.benchmark take a specific benchmark name to run. files: Lib/importlib/test/benchmark.py | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Lib/importlib/test/benchmark.py b/Lib/importlib/test/benchmark.py --- a/Lib/importlib/test/benchmark.py +++ b/Lib/importlib/test/benchmark.py @@ -133,7 +133,7 @@ yield result -def main(import_, filename=None): +def main(import_, filename=None, benchmark=None): if filename and os.path.exists(filename): with open(filename, 'r') as file: prev_results = json.load(file) @@ -145,6 +145,14 @@ source_writing_bytecode, decimal_using_bytecode, decimal_writing_bytecode, decimal_wo_bytecode,) + if benchmark: + for b in benchmarks: + if b.__doc__ == benchmark: + benchmarks = [b] + break + else: + print('Unknown benchmark: {!r}'.format(benchmark, file=sys.stderr)) + sys.exit(1) seconds = 1 seconds_plural = 's' if seconds > 1 else '' repeat = 3 @@ -189,10 +197,17 @@ parser.add_argument('-b', '--builtin', dest='builtin', action='store_true', default=False, help="use the built-in __import__") parser.add_argument('-f', '--file', dest='filename', default=None, - help='file to read/write results from/to') + help='file to read/write results from/to' + '(incompatible w/ --benchmark)') + parser.add_argument('--benchmark', dest='benchmark', + help='specific benchmark to run ' + '(incompatible w/ --file') options = parser.parse_args() + if options.filename and options.benchmark: + print('Cannot specify a benchmark *and* read/write results') + sys.exit(1) import_ = __import__ if not options.builtin: import_ = importlib.__import__ - main(import_, options.filename) + main(import_, options.filename, options.benchmark) -- Repository URL: http://hg.python.org/cpython From python-checkins at python.org Tue Jan 31 20:58:14 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 31 Jan 2012 20:58:14 +0100 Subject: [Python-checkins] =?utf8?q?cpython_=28merge_default_-=3E_default?= =?utf8?q?=29=3A_Merge?= Message-ID: http://hg.python.org/cpython/rev/06d47538af89 changeset: 74700:06d47538af89 parent: 74699:2d0ff4d82b14 parent: 74697:bf31815548c9 user: Brett Cannon date: Tue Jan 31 14:58:07 2012 -0500 summary: Merge files: Lib/idlelib/PyShell.py | 19 +++++++++++++------ Lib/idlelib/ScriptBinding.py | 5 ++--- Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/zipimport.c | 9 +++++---- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -411,11 +411,11 @@ self.rpcclt.register("flist", self.tkconsole.flist) self.rpcclt.register("linecache", linecache) self.rpcclt.register("interp", self) - self.transfer_path() + self.transfer_path(with_cwd=True) self.poll_subprocess() return self.rpcclt - def restart_subprocess(self): + def restart_subprocess(self, with_cwd=False): if self.restarting: return self.rpcclt self.restarting = True @@ -439,7 +439,7 @@ except socket.timeout as err: self.display_no_subprocess_error() return None - self.transfer_path() + self.transfer_path(with_cwd=with_cwd) # annotate restart in shell window and mark it console.text.delete("iomark", "end-1c") if was_executing: @@ -492,12 +492,18 @@ except OSError: return - def transfer_path(self): + def transfer_path(self, with_cwd=False): + if with_cwd: # Issue 13506 + path = [''] # include Current Working Directory + path.extend(sys.path) + else: + path = sys.path + self.runcommand("""if 1: import sys as _sys _sys.path = %r del _sys - \n""" % (sys.path,)) + \n""" % (path,)) active_seq = None @@ -1191,7 +1197,8 @@ self.text.see("restart") def restart_shell(self, event=None): - self.interp.restart_subprocess() + "Callback for Run/Restart Shell Cntl-F6" + self.interp.restart_subprocess(with_cwd=True) def showprompt(self): self.resetoutput() diff --git a/Lib/idlelib/ScriptBinding.py b/Lib/idlelib/ScriptBinding.py --- a/Lib/idlelib/ScriptBinding.py +++ b/Lib/idlelib/ScriptBinding.py @@ -144,10 +144,9 @@ return 'break' if not self.tabnanny(filename): return 'break' - shell = self.shell - interp = shell.interp + interp = self.shell.interp if PyShell.use_subprocess: - shell.restart_shell() + interp.restart_subprocess(with_cwd=False) dirname = os.path.dirname(filename) # XXX Too often this discards arguments the user just set... interp.runcommand("""if 1: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -880,6 +880,7 @@ Ty Sarna Ben Sayer sbt +Marco Scataglini Andrew Schaaf Michael Scharf Andreas Schawo diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -463,6 +463,9 @@ Library ------- +- Issue #13506: Add '' to path for IDLE Shell when started and restarted with Restart Shell. + Original patches by Marco Scataglini and Roger Serwy. + - Issue #8828: Add new function os.replace(), for cross-platform renaming with overwriting. diff --git a/Modules/zipimport.c b/Modules/zipimport.c --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -728,14 +728,15 @@ PyObject *files = NULL; FILE *fp; unsigned short flags; - long compress, crc, data_size, file_size, file_offset, date, time; - long header_offset, name_size, header_size, header_position; + short compress, time, date, name_size; + long crc, data_size, file_size, header_size; + Py_ssize_t file_offset, header_position, header_offset; long l, count; Py_ssize_t i; char name[MAXPATHLEN + 5]; PyObject *nameobj = NULL; char *p, endof_central_dir[22]; - long arc_offset; /* offset from beginning of file to start of zip-archive */ + Py_ssize_t arc_offset; /* Absolute offset to start of the zip-archive. */ PyObject *path; const char *charset; int bootstrap; @@ -835,7 +836,7 @@ path = PyUnicode_FromFormat("%U%c%U", archive, SEP, nameobj); if (path == NULL) goto error; - t = Py_BuildValue("Niiiiiii", path, compress, data_size, + t = Py_BuildValue("Nhllnhhl", path, compress, data_size, file_size, file_offset, time, date, crc); if (t == NULL) goto error; -- Repository URL: http://hg.python.org/cpython From tjreedy at udel.edu Tue Jan 31 22:54:58 2012 From: tjreedy at udel.edu (Terry Reedy) Date: Tue, 31 Jan 2012 16:54:58 -0500 Subject: [Python-checkins] cpython: Let importlib.test.benchmark take a specific benchmark name to run. In-Reply-To: References: Message-ID: <4F286332.2010509@udel.edu> On 1/31/2012 2:58 PM, brett.cannon wrote: > + parser.add_argument('--benchmark', dest='benchmark', > + help='specific benchmark to run ' > + '(incompatible w/ --file') I believe you want ) before the last ' also, whenever you edit this again. From python-checkins at python.org Tue Jan 31 23:02:15 2012 From: python-checkins at python.org (brett.cannon) Date: Tue, 31 Jan 2012 23:02:15 +0100 Subject: [Python-checkins] =?utf8?q?cpython=3A_Fix_a_minor_output_typo_as_?= =?utf8?q?found_by_Terry_Reedy=2E?= Message-ID: http://hg.python.org/cpython/rev/b74a77fee744 changeset: 74701:b74a77fee744 user: Brett Cannon date: Tue Jan 31 17:02:10 2012 -0500 summary: Fix a minor output typo as found by Terry Reedy. files: Lib/importlib/test/benchmark.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/importlib/test/benchmark.py b/Lib/importlib/test/benchmark.py --- a/Lib/importlib/test/benchmark.py +++ b/Lib/importlib/test/benchmark.py @@ -201,7 +201,7 @@ '(incompatible w/ --benchmark)') parser.add_argument('--benchmark', dest='benchmark', help='specific benchmark to run ' - '(incompatible w/ --file') + '(incompatible w/ --file)') options = parser.parse_args() if options.filename and options.benchmark: print('Cannot specify a benchmark *and* read/write results') -- Repository URL: http://hg.python.org/cpython From neologix at free.fr Mon Jan 9 09:23:33 2012 From: neologix at free.fr (=?ISO-8859-1?Q?Charles=2DFran=E7ois_Natali?=) Date: Mon, 09 Jan 2012 08:23:33 -0000 Subject: [Python-checkins] [Python-Dev] cpython: Backed out changeset 36f2e236c601: For some reason, rewinddir() doesn't work as In-Reply-To: References: Message-ID: >> Can rewinddir() end up touching the filesystem to retrieve data? I >> noticed that your previous change (the one this checkin reverted) >> moved it outside the GIL release macros. > > It just resets a position count. (in glibc). Actually, it also calls lseek() on the directory FD: http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/rewinddir.c;hb=HEAD But lseek() doesn't (normally) perform I/O, it just sets an offset in the kernel file structure: http://lxr.free-electrons.com/source/fs/read_write.c#L38 For example, it's not documented to return EINTR. Now, one could imagine that the kernel could do some read-ahead or some other magic things when passed SEEK_DATA or SEEK_HOLE, but seeking at the beginning of a directory FD should be fast. Anyway, I ended up reverting this change, because for some reason this broke OpenIndiana buildbots (maybe rewinddir() is a no-op before readdir() has been called?). Cheers, cf